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
sequencelengths 1
8
|
---|---|---|---|---|---|
[[howto.build]]
== Build
Spring Boot includes build plugins for Maven and Gradle.
This section answers common questions about these plugins.
[[howto.build.generate-info]]
=== Generate Build Information
Both the Maven plugin and the Gradle plugin allow generating build information containing the coordinates, name, and version of the project.
The plugins can also be configured to add additional properties through configuration.
When such a file is present, Spring Boot auto-configures a `BuildProperties` bean.
To generate build information with Maven, add an execution for the `build-info` goal, as shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>{spring-boot-version}</version>
<executions>
<execution>
<goals>
<goal>build-info</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
----
TIP: See the {spring-boot-maven-plugin-docs}#goals-build-info[Spring Boot Maven Plugin documentation] for more details.
The following example does the same with Gradle:
[source,gradle,indent=0,subs="verbatim"]
----
springBoot {
buildInfo()
}
----
TIP: See the {spring-boot-gradle-plugin-docs}#integrating-with-actuator-build-info[Spring Boot Gradle Plugin documentation] for more details.
[[howto.build.generate-git-info]]
=== Generate Git Information
Both Maven and Gradle allow generating a `git.properties` file containing information about the state of your `git` source code repository when the project was built.
For Maven users, the `spring-boot-starter-parent` POM includes a pre-configured plugin to generate a `git.properties` file.
To use it, add the following declaration for the https://github.com/git-commit-id/git-commit-id-maven-plugin[`Git Commit Id Plugin`] to your POM:
[source,xml,indent=0,subs="verbatim"]
----
<build>
<plugins>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
</plugin>
</plugins>
</build>
----
Gradle users can achieve the same result by using the https://plugins.gradle.org/plugin/com.gorylenko.gradle-git-properties[`gradle-git-properties`] plugin, as shown in the following example:
[source,gradle,indent=0,subs="verbatim"]
----
plugins {
id "com.gorylenko.gradle-git-properties" version "2.2.4"
}
----
Both the Maven and Gradle plugins allow the properties that are included in `git.properties` to be configured.
TIP: The commit time in `git.properties` is expected to match the following format: `yyyy-MM-dd'T'HH:mm:ssZ`.
This is the default format for both plugins listed above.
Using this format lets the time be parsed into a `Date` and its format, when serialized to JSON, to be controlled by Jackson's date serialization configuration settings.
[[howto.build.customize-dependency-versions]]
=== Customize Dependency Versions
The `spring-boot-dependencies` POM manages the versions of common dependencies.
The Spring Boot plugins for Maven and Gradle allow these managed dependency versions to be customized using build properties.
WARNING: Each Spring Boot release is designed and tested against this specific set of third-party dependencies.
Overriding versions may cause compatibility issues.
To override dependency versions with Maven, see {spring-boot-maven-plugin-docs}#using[this section] of the Maven plugin's documentation.
To override dependency versions in Gradle, see {spring-boot-gradle-plugin-docs}#managing-dependencies-dependency-management-plugin-customizing[this section] of the Gradle plugin's documentation.
[[howto.build.create-an-executable-jar-with-maven]]
=== Create an Executable JAR with Maven
The `spring-boot-maven-plugin` can be used to create an executable "`fat`" JAR.
If you use the `spring-boot-starter-parent` POM, you can declare the plugin and your jars are repackaged as follows:
[source,xml,indent=0,subs="verbatim"]
----
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
----
If you do not use the parent POM, you can still use the plugin.
However, you must additionally add an `<executions>` section, as follows:
[source,xml,indent=0,subs="verbatim"]
----
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>{spring-boot-version}</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
----
See the {spring-boot-maven-plugin-docs}#repackage[plugin documentation] for full usage details.
[[howto.build.use-a-spring-boot-application-as-dependency]]
=== Use a Spring Boot Application as a Dependency
Like a war file, a Spring Boot application is not intended to be used as a dependency.
If your application contains classes that you want to share with other projects, the recommended approach is to move that code into a separate module.
The separate module can then be depended upon by your application and other projects.
If you cannot rearrange your code as recommended above, Spring Boot's Maven and Gradle plugins must be configured to produce a separate artifact that is suitable for use as a dependency.
The executable archive cannot be used as a dependency as the <<executable-jar#executable-jar.nested-jars.jar-structure,executable jar format>> packages application classes in `BOOT-INF/classes`.
This means that they cannot be found when the executable jar is used as a dependency.
To produce the two artifacts, one that can be used as a dependency and one that is executable, a classifier must be specified.
This classifier is applied to the name of the executable archive, leaving the default archive for use as a dependency.
To configure a classifier of `exec` in Maven, you can use the following configuration:
[source,xml,indent=0,subs="verbatim"]
----
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<classifier>exec</classifier>
</configuration>
</plugin>
</plugins>
</build>
----
[[howto.build.extract-specific-libraries-when-an-executable-jar-runs]]
=== Extract Specific Libraries When an Executable Jar Runs
Most nested libraries in an executable jar do not need to be unpacked in order to run.
However, certain libraries can have problems.
For example, JRuby includes its own nested jar support, which assumes that the `jruby-complete.jar` is always directly available as a file in its own right.
To deal with any problematic libraries, you can flag that specific nested jars should be automatically unpacked when the executable jar first runs.
Such nested jars are written beneath the temporary directory identified by the `java.io.tmpdir` system property.
WARNING: Care should be taken to ensure that your operating system is configured so that it will not delete the jars that have been unpacked to the temporary directory while the application is still running.
For example, to indicate that JRuby should be flagged for unpacking by using the Maven Plugin, you would add the following configuration:
[source,xml,indent=0,subs="verbatim"]
----
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<requiresUnpack>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-complete</artifactId>
</dependency>
</requiresUnpack>
</configuration>
</plugin>
</plugins>
</build>
----
[[howto.build.create-a-nonexecutable-jar]]
=== Create a Non-executable JAR with Exclusions
Often, if you have an executable and a non-executable jar as two separate build products, the executable version has additional configuration files that are not needed in a library jar.
For example, the `application.yml` configuration file might be excluded from the non-executable JAR.
In Maven, the executable jar must be the main artifact and you can add a classified jar for the library, as follows:
[source,xml,indent=0,subs="verbatim"]
----
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>lib</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>lib</classifier>
<excludes>
<exclude>application.yml</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
----
[[howto.build.remote-debug-maven]]
=== Remote Debug a Spring Boot Application Started with Maven
To attach a remote debugger to a Spring Boot application that was started with Maven, you can use the `jvmArguments` property of the {spring-boot-maven-plugin-docs}[maven plugin].
See {spring-boot-maven-plugin-docs}#run-example-debug[this example] for more details.
[[howto.build.build-an-executable-archive-with-ant-without-using-spring-boot-antlib]]
=== Build an Executable Archive from Ant without Using spring-boot-antlib
To build with Ant, you need to grab dependencies, compile, and then create a jar or war archive.
To make it executable, you can either use the `spring-boot-antlib` module or you can follow these instructions:
. If you are building a jar, package the application's classes and resources in a nested `BOOT-INF/classes` directory.
If you are building a war, package the application's classes in a nested `WEB-INF/classes` directory as usual.
. Add the runtime dependencies in a nested `BOOT-INF/lib` directory for a jar or `WEB-INF/lib` for a war.
Remember *not* to compress the entries in the archive.
. Add the `provided` (embedded container) dependencies in a nested `BOOT-INF/lib` directory for a jar or `WEB-INF/lib-provided` for a war.
Remember *not* to compress the entries in the archive.
. Add the `spring-boot-loader` classes at the root of the archive (so that the `Main-Class` is available).
. Use the appropriate launcher (such as `JarLauncher` for a jar file) as a `Main-Class` attribute in the manifest and specify the other properties it needs as manifest entries -- principally, by setting a `Start-Class` property.
The following example shows how to build an executable archive with Ant:
[source,xml,indent=0,subs="verbatim"]
----
<target name="build" depends="compile">
<jar destfile="target/${ant.project.name}-${spring-boot.version}.jar" compress="false">
<mappedresources>
<fileset dir="target/classes" />
<globmapper from="*" to="BOOT-INF/classes/*"/>
</mappedresources>
<mappedresources>
<fileset dir="src/main/resources" erroronmissingdir="false"/>
<globmapper from="*" to="BOOT-INF/classes/*"/>
</mappedresources>
<mappedresources>
<fileset dir="${lib.dir}/runtime" />
<globmapper from="*" to="BOOT-INF/lib/*"/>
</mappedresources>
<zipfileset src="${lib.dir}/loader/spring-boot-loader-jar-${spring-boot.version}.jar" />
<manifest>
<attribute name="Main-Class" value="org.springframework.boot.loader.JarLauncher" />
<attribute name="Start-Class" value="${start-class}" />
</manifest>
</jar>
</target>
----
| AsciiDoc | 5 | Cuiqingqiang/spring-boot | spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/build.adoc | [
"Apache-2.0"
] |
(:~
: Normalize AST, reducing EBNF to use just two operators, g:choice and
: g:oneOrMore. This serves both for simplifying factorization rules, and
: for a uniform appearance of the railroad graphics regardless of the
: original formulation of grammar rules. Also some flattening of g:choice
: and g:charClass operators is done here.
:
: The reverse operation, here called denormalization, attempts to reinstall
: the other operators for better readability of EBNF grammars.
:)
module namespace n="de/bottlecaps/railroad/xq/normalize-ast.xq";
import module namespace b="de/bottlecaps/railroad/xq/ast-to-ebnf.xq" at "ast-to-ebnf.xq";
declare namespace g="http://www.w3.org/2001/03/XPath/grammar";
(:~
: Whether empty cases should be shown as the last alternative
:)
declare variable $n:empty-last := false();
(:~
: Remove any g:sequence wrappers from a grammar fragment.
:
: @param $nodes the grammar fragment.
: @return the grammar fragment, freed from any g:sequence wrappers.
:)
declare function n:unwrap-sequence($nodes as node()*) as node()*
{
for $node in $nodes
return
if ($node/self::g:sequence) then
for $c in n:children($node) return n:unwrap-sequence($c)
else
$node
};
(:~
: Wrap a node sequence into a g:sequence, unless it is a
: singleton sequence.
:
: @param $nodes the node sequence.
: @return the wrapped node sequence, or single node.
:)
declare function n:wrap-sequence($nodes as node()*) as node()
{
if (count($nodes) eq 1) then
$nodes
else
element g:sequence {$nodes}
};
(:~
: Identify cases for creating a g:choice operator from a single candidate
: node. Unwrap any g:sequence, and recursively identify cases, if there
: is exactly one node. Otherwise re-wrap as a g:sequence.
:
: @param $node the candidate node.
: @return the sequence of cases.
:)
declare function n:case($node as element()) as element()+
{
let $non-sequence := n:unwrap-sequence($node)
return
if (count($non-sequence) eq 1) then
n:cases($non-sequence)
else
n:wrap-sequence($non-sequence)
};
(:~
: Identify cases for normalizing an arbitrary parent operator into a g:choice
: operator. The cases of a g:choice or g:charClass operator are the
: alternatives of that operator. A g:optional operator has an empty case and
: one comprising the child sequence. A g:zeroOrMore operator has an empty case
: and a g:oneOrMore, that represents the child sequence. Any other operator
: remains unchanged, i.e. it is a case in itself.
:
: @param $node the parent operator of the cases to be identified.
: @return the sequence of cases.
:)
declare function n:cases($node as element()) as element()*
{
let $children := n:children($node)
return
typeswitch ($node)
case element(g:choice) return
for $c in $children return n:case($c)
case element(g:charClass) return
for $c in $children return n:case($c)
case element(g:optional) return
(
n:case(n:wrap-sequence($children)),
n:wrap-sequence(())
)
case element(g:zeroOrMore) return
(
element g:oneOrMore {$children},
n:wrap-sequence(())
)
default return
$node
};
(:~
: Rewrite grammar such that there is not more than one production per
: nonterminal. Multiple productions for the same nonterminal are
: replaced by a single production containing a choice.
:
: @param $grammar the grammar.
: @return the grammar with distinct production names.
:)
declare function n:group-productions-by-nonterminal(
$grammar as element(g:grammar)) as element(g:grammar)
{
element g:grammar
{
let $end := n:syntax-end($grammar)
return
(
$grammar/@*,
n:children($grammar)[not(self::g:production or . is $end or . >> $end)],
for $parser in (true(), false())
return
(
let $production-group := $grammar/g:production[$parser != boolean(. >> $end)]
for $qualified-name in distinct-values($production-group/string-join((@name, @context), "^"))
let $name := tokenize($qualified-name, "\^")
let $productions := $production-group[@name = $name[1] and string(@context) = string($name[2])]
order by n:index-of-node($production-group, $productions[1])
return
if (count($productions) = 1) then
$productions
else
element g:production
{
for $n in distinct-values($productions/@*/node-name(.))
return
attribute {$n}
{
distinct-values($productions/@*[node-name(.) = $n])
},
element g:choice
{
for $p in $productions
return
if ($p/*[last() = 1]/self::g:choice) then
$p/*/*
else
n:wrap-sequence($p/*)
}
},
$end[$parser]
),
n:children($grammar)[not(self::g:production or . is $end or . << $end)]
)
}
};
(:~
: Normalize a grammar or fragment of a grammar, such that it becomes suitable
: for factorization, or railroad diagram creation. A normalized grammar has
: the g:optional and g:zeroOrMore operators replaced by equivalent combinations
: of the g:choice and g:oneOrMore operators. Empty branches of g:choice operators
: are ordered last.
:
: @param $nodes the grammar fragment to be normalized.
: @return the normalized grammar fragment.
:)
declare function n:normalize($nodes as node()*) as node()*
{
for $node in $nodes
let $children := n:children($node)
return
if ($node/self::g:grammar) then
element g:grammar
{
let $grammar := n:group-productions-by-nonterminal($node)
return
(
$grammar/@*,
n:normalize(n:children($grammar))
)
}
else if ($node/self::g:choice
or $node/self::g:optional
or $node/self::g:zeroOrMore
or $node/self::g:charClass) then
n:choice
((
for $c in n:cases($node)
return n:wrap-sequence(n:normalize(n:unwrap-sequence($c)))
))
else if ($node/self::g:oneOrMore) then
element g:oneOrMore {n:normalize($children)}
else if ($node/self::g:charRange) then
$node
else if (empty($children)) then
$node
else if (n:is-sequence-item($children)) then
element {node-name($node)}
{
$node/@*,
n:normalize($children)
}
else
element {node-name($node)}
{
for $c in $children
return n:wrap-sequence(n:normalize($c))
}
};
(:~
: Introduce g:oneOrMoreWithSeparator operators with non-empty separators. First
: convert g:oneOrMore to g:oneOrMoreWithSeparator with empty separator, then match
: content of g:oneOrMoreWithSeparator with preceding nodes. This corresponds to
: identifying 'B C' as the separator in 'A (B C A)*' and replacing accordingly.
:
: @param $nodes the grammar fragment to be normalized.
: @return the normalized grammar fragment.
:)
declare function n:introduce-separators($nodes as node()*) as node()*
{
let $nodes := n:rewrite-oneOrMore($nodes)
let $nodes := n:introduce-trivial-repeater($nodes)
return $nodes
};
declare function n:rewrite-oneOrMore($nodes as node()*) as node()*
{
let $normalized-nodes :=
element g:sequence
{
for $node in $nodes
return
typeswitch ($node)
case element(g:oneOrMore) return
element g:oneOrMoreWithSeparator
{
$node/@*,
n:wrap-sequence(n:rewrite-oneOrMore($node/*)),
n:wrap-sequence(())
}
case element() return
if (n:is-sequence-item($node/node())) then
element {node-name($node)} {$node/@*, n:rewrite-oneOrMore($node/node())}
else
element {node-name($node)}
{
$node/@*,
for $child in $node/*
return n:wrap-sequence(n:rewrite-oneOrMore($child))
}
default return
$node
}/node()
return
if (not(n:is-sequence-item($nodes))) then
$normalized-nodes
else
let $head :=
(
for $choice in $normalized-nodes/self::g:choice
let $cases := n:children($choice)
let $oneOrMoreCase := $cases/self::g:oneOrMoreWithSeparator
let $emptyCase := $cases/self::g:sequence[empty(n:children(.))]
let $args := n:children($oneOrMoreCase)
where count($cases) eq 2
and exists($oneOrMoreCase)
and exists($emptyCase)
and $args[2]/self::g:sequence[empty(n:children(.))]
return
for $head in n:unwrap-sequence($args[1])
let $candidate := ($head, $head[parent::g:sequence]/following-sibling::*)
where deep-equal($candidate, ($choice/preceding-sibling::*)[position() > last() - count($candidate)])
return $head
)
let $head := $head[1]
return
if (empty($head)) then
$normalized-nodes
else
let $separator := $head[parent::g:sequence]/preceding-sibling::*
let $orMore := ($head, $head[parent::g:sequence]/following-sibling::*)
let $choice := $head/ancestor::g:choice[1]
let $content :=
element g:sequence
{
($choice/preceding-sibling::*)[position() <= last() - count($orMore)],
element g:oneOrMoreWithSeparator
{
if (count($orMore) ne 1 or empty($orMore/self::g:oneOrMoreWithSeparator)) then
(
n:wrap-sequence($orMore),
n:wrap-sequence($separator)
)
else
(
n:wrap-sequence($orMore/*[1]),
n:choice
((
if ($orMore/*[2]/self::g:choice) then $orMore/*[2]/* else $orMore/*[2],
if (count($separator) eq 1 and $separator/self::g:choice) then $separator/* else $separator
))
)
},
$choice/following-sibling::*
}
return n:rewrite-oneOrMore($content/node())
};
declare function n:introduce-trivial-repeater($nodes)
{
element g:sequence
{
for $node in $nodes
let $oom := $node/g:oneOrMoreWithSeparator
return
if ($node/self::g:choice
and count($oom) eq 1
and $node/g:sequence[empty(*)]
and n:no-sequence($oom/*[1])
and $oom/*[2]/self::g:sequence[empty(*)]
) then
n:choice
((
for $case in $node/*[not(self::g:sequence[empty(*)])]
return
if (not($case/self::g:oneOrMoreWithSeparator)) then
$case
else
element g:oneOrMoreWithSeparator
{
$case/*[2],
$case/*[1]
}
))
else if (not($node/self::element())) then
$node
else
element {node-name($node)}
{
$node/@*,
if (n:is-sequence-item($node/node())) then
n:introduce-trivial-repeater($node/node())
else
for $child in $node/*
return n:wrap-sequence(n:introduce-trivial-repeater($child))
}
}/node()
};
declare function n:no-sequence($node as node())
{
$node[self::g:ref or
self::g:char or
self::g:charRange or
self::g:charCode or
self::g:charCodeRange or
self::g:string or
self::g:subtract] or
$node/self::g:choice and (every $case in $node/* satisfies n:no-sequence($case)) or
$node/self::g:oneOrMoreWithSeparator and (every $arg in $node/* satisfies n:no-sequence($arg))
};
(:~
: Denormalize a single g:oneOrMoreWithSeparator.
:
: If the separator is empty, construct a g:oneOrMore with the same
: body. Otherwise, return the body, followed by a g:zeroOrMore
: containing the separator and the body.
:
: @param $node the g:oneOrMoreWithSeparator node to be denormalized.
: @return the denormalized equivalent of $node.
:)
declare function n:denormalize-oneOrMoreWithSeparator(
$node as element(g:oneOrMoreWithSeparator)) as element()*
{
let $children := n:children($node)
let $denormalized-body := n:unwrap-sequence(n:denormalize($children[1]))
return
if ($children[2]/self::g:sequence[empty(n:children(.))]) then
element g:oneOrMore {$denormalized-body}
else
let $replacement :=
(
$denormalized-body,
element g:zeroOrMore
{
n:unwrap-sequence(n:denormalize($children[2])),
$denormalized-body
}
)
return $replacement
};
(:~
: Denormalize a single g:oneOrMore.
:
: Construct a g:oneOrMore with the same body.
:
: @param $node the g:oneOrMore node to be denormalized.
: @return the denormalized equivalent of $node.
:)
declare function n:denormalize-oneOrMore(
$node as element(g:oneOrMore)) as element()*
{
element g:oneOrMore {n:denormalize(n:children($node))}
};
(:~
: Denormalize a single g:choice. Separate charClass components
: from other components. Reinstall any outer g:optional or
: g:zeroOrMore operators, if appropriate.
:
: @param $node the g:choice node to be denormalized.
: @return the denormalized equivalent of $node.
:)
declare function n:denormalize-choice($node as element(g:choice)) as element()*
{
let $cases := n:children($node)
let $empty-cases := $cases[self::g:sequence[empty(n:children(.))]]
let $charclass-cases := $cases[self::g:char or
self::g:charRange or
self::g:charCode or
self::g:charCodeRange or
self::g:string[string-length() eq 1]]
let $charclass-cases :=
if (exists($charclass-cases[not(self::g:string)])
and (count($charclass-cases) gt 1
or $charclass-cases/self::g:charRange
or $charclass-cases/self::g:charCodeRange)) then
$charclass-cases
else
()
let $denormalized-cases :=
(
for $case in $cases
where empty($empty-cases[. is $case])
return
if ($charclass-cases[1] is $case) then
element g:charClass
{
let $ordered-groups :=
for $c in $charclass-cases
order by exists(($c/@value, $c/@minValue))
return
if ($c/self::g:string) then
element g:char{data($c)}
else
$c
return
for $g at $i in $ordered-groups
where not(deep-equal($ordered-groups[$i - 1], $ordered-groups[$i]))
return $g
}
else if (exists($charclass-cases[. is $case])) then
()
else
n:wrap-sequence(n:denormalize($case))
)
let $denormalized-result :=
if (count($denormalized-cases) != 1) then
element g:choice {$denormalized-cases}
else
$denormalized-cases
return
if (empty($empty-cases)) then
n:unwrap-sequence($denormalized-result)
else if ($denormalized-result/self::g:oneOrMore) then
element g:zeroOrMore {n:children($denormalized-result)}
else if (empty($denormalized-cases/self::g:oneOrMore)) then
element g:optional {n:unwrap-sequence($denormalized-result)}
else
let $oneOrMore-case :=
(
for $c at $i in $denormalized-cases
where $c/self::g:oneOrMore
return $i
)[1]
return
element g:choice
{
$denormalized-cases[position() < $oneOrMore-case],
element g:zeroOrMore {$denormalized-cases[$oneOrMore-case]/node()},
$denormalized-cases[position() > $oneOrMore-case]
}
};
(:~
: Denormalize a single g:subtract operator. Rewrite operator
: with recursively denormalized operand nodes.
:
: @param $node the g:subtract to be denormalized.
: @return the denormalized equivalent.
:)
declare function n:denormalize-subtract($node as element(g:subtract)) as element(g:subtract)
{
element g:subtract
{
for $child in n:children($node)
return n:wrap-sequence(n:denormalize($child))
}
};
(:~
: Denormalize a grammar or fragment of a grammar. This serves for
: reversing the effect of prior normalization for railroad diagram
: creation. The denormalized grammar or fragment makes use of more
: operators and is thus better suitable for rendereing as ebnf.
:
: @param $nodes the grammar fragment to be denormalized.
: @return the denormalized grammar fragment.
:)
declare function n:denormalize($nodes as node()*) as node()*
{
for $node in $nodes
return
typeswitch ($node)
case element(g:oneOrMoreWithSeparator) return
n:denormalize-oneOrMoreWithSeparator($node)
case element(g:oneOrMore) return
n:denormalize-oneOrMore($node)
case element(g:choice) return
n:denormalize-choice($node)
case element(g:char) return
if ($node/parent::g:complement) then element g:charClass {$node} else $node
case element(g:charCode) return
if ($node/parent::g:complement) then element g:charClass {$node} else $node
case element(g:charRange) return
element g:charClass {$node}
case element(g:charCodeRange) return
element g:charClass {$node}
case element(g:subtract) return
n:denormalize-subtract($node)
case element(g:equivalence) return
$node
case element() return
element {node-name($node)}
{
$node/@*,
if (empty(n:children($node))) then
$node/node()
else
n:denormalize(n:children($node))
}
default return
$node
};
(:~
: Return child nodes as far as relevant for grammar processing,
: i.e. child elements and processing instructions.
:
: @param $e the parent node.
: @return the child nodes.
:)
declare function n:children($e as node()?) as node()*
{
for $child in $e/node()
where $child/self::element()
or $child/self::processing-instruction()
return $child
};
(:~
: Node sequence based index-of. As shown in sample code of the
: XQuery recommendation.
:
: @param $sequence the node sequence.
: @return $srch the node to be searched.
:)
declare function n:index-of-node($sequence as node()*, $srch as node()) as xs:integer*
{
for $n at $i in $sequence where $n is $srch return $i
};
(:~
: Find the processing instruction (if any) that marks the end of
: the parser rules.
:
: @param $grammar the grammar.
: @return the processing instruction marking the end of parser rules,
: or empty sequence, if the grammar does not contain one.
:)
declare function n:syntax-end($grammar as element(g:grammar)) as processing-instruction()?
{
$grammar/processing-instruction()[local-name(.) = ("TOKENS", "ENCORE") and string(.) eq ""][1]
};
(:~
: Normalize a g:choice operator by extracting any "empty" case.
:
: @param $cases the individual cases, wrapped in a g:sequence,
: if necessary.
: @return the normalized node sequence.
:)
declare function n:choice($cases as element()*) as element()*
{
let $cases :=
for $case in $cases
return
if ($case/self::element(g:choice)) then
n:children($case)
else
$case
let $empty := $cases[exists(self::g:sequence[empty(n:children(.))])]
(::)
let $cases := $cases[empty (self::g:sequence[empty(n:children(.))])]
where exists($cases)
return
let $cases :=
if ($n:empty-last or exists($cases/descendant-or-self::g:oneOrMore)) then
($cases, $empty[1])
else
($empty[1], $cases)
(::)
(:?
let $non-empty := $cases[empty (self::g:sequence[empty(n:children(.))])]
return
let $cases :=
for $case in $cases
where ($non-empty, $empty[1])[. is $case]
return $case
?:)
return
if (empty($cases[2])) then
n:unwrap-sequence($cases)
else
element g:choice {$cases}
};
(:~
: Verify given nodes are in a sequence context, by checking that
: none of them occur in a non-sequence context.
:
: @param $nodes the set of nodes.
: @return true, if none has a non-sequence context.
:)
declare function n:is-sequence-item($nodes as node()*) as xs:boolean
{
not
(
$nodes/parent::g:choice
or $nodes/parent::g:orderedChoice
or $nodes/parent::g:oneOrMoreWithSeparator
or $nodes/parent::g:subtract
)
};
(:~
: Reverse the order of node sequences in a grammar fragment.
:
: @param $nodes the grammar fragment to be reversed.
: @return the reversed grammar fragment.
:)
declare function n:reverse($nodes as node()*) as node()*
{
let $reordered :=
if ($nodes/parent::g:grammar) then
$nodes
else if (n:is-sequence-item($nodes)) then
reverse($nodes)
else
$nodes
for $n in $reordered
return
let $children := n:children($n)
return
if (empty($children)) then
$n
else
element {node-name($n)} {$n/@*, n:reverse($children)}
};
(:~
: Strip processing instructions from grammar fragment.
:
: @param $nodes the grammar fragment
:)
declare function n:strip-pi($nodes)
{
for $node in $nodes
return
typeswitch ($node)
case document-node() return
document
{
n:strip-pi($node/node())
}
case element() return
element {node-name($node)}
{
$node/@*,
if ($node/self::g:choice or
$node/self::g:orderedChoice or
$node/self::g:subtractor or
$node/self::g:context or
$node/self::g:delimiter or
$node/self::g:preference) then
(
for $child in $node/(* | processing-instruction())
let $stripped :=
if ($child/self::g:sequence) then
n:strip-pi($child/*)
else
n:strip-pi($child)
return
if (count($stripped) eq 1) then
$stripped
else
element g:sequence {$stripped}
)
else
n:strip-pi($node/node())
}
case comment() return
$node[starts-with(., "*")]
case processing-instruction() return
if (local-name($node) = "TOKENS" and normalize-space($node) eq "") then
<?TOKENS?>
else
()
default return
$node
};
| XQuery | 5 | bannmann/rr | src/main/resources/de/bottlecaps/railroad/xq/normalize-ast.xq | [
"Apache-2.0"
] |
// run-pass
#![allow(dead_code)]
// check that we handle recursive arrays correctly in `type_of`
struct Loopy {
ptr: *mut [Loopy; 1]
}
fn main() {
let _t = Loopy { ptr: core::ptr::null_mut() };
}
| Rust | 3 | Eric-Arellano/rust | src/test/ui/issues/issue-19001.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; GNU GENERAL PUBLIC LICENSE ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ----------------------------------------------------------------TÍTULO
;; ----------------------------------------------------------------"TÍTULO" is an agent-based model designed to
;; study cooperative calls for beached whales.
;; Copyright (C) 2015
;; -----------------------------------------------------------------AUTORES
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
;;;;;;;;;;;;;;
;;; BREEDS ;;;
;;;;;;;;;;;;;;
breed [people person]
;;;;;;;;;;;;;;;;;
;;; VARIABLES ;;;
;;;;;;;;;;;;;;;;;
globals [
;; to stress the system
;prob-resource ;; probability of obtaining a unit of resource
;min-energy ;; minimun energy a person requires to survive
energy ;; energy of a unit of resource
;n-people ;; number of people
generation ;; current generation
n-rounds
;rounds-per-generation ;; number of rounds per generation
]
people-own [
; strategy
given-energy ;; percentage of energy the person donates to others
correlation ;; [-1,1] whicht type of person this agent donates to (+1 the most cooperative; 0 equally distributed; -1 the least cooperative)
get-resource? ;; Boolean: 1 implies the agent got resource, 0 the opposite
energy-consumed ;; own consumption each tick
n-get-resource ;; # times the agent get resource by its own
fitness ;; # times the agent fulfilled energy requirements (energy-consumed > min-energy)
]
;;;;;;;;;;;;;;;;;;;
;;; MODEL SETUP ;;;
;;;;;;;;;;;;;;;;;;;
to startup [interactive?]
clear-all
set-default-shape people "person"
reset-ticks
create-agents
set n-rounds 0
set generation 0
set energy 1
end
to create-agents
create-people n-people [
set given-energy random-float 1
set correlation -1 + random-float 2 ;; [-1,1]
set energy-consumed 0
set n-get-resource 0
set fitness 0
set get-resource? false
set color scale-color orange given-energy 0 1
set size 1
setxy random-xcor random-ycor
]
end
;;;;;;;;;;;;;;;;;;;;;;
;;; MAIN PROCEDURE ;;;
;;;;;;;;;;;;;;;;;;;;;;
to go
get-resources
share
update-fitness
; people select best strategies
ifelse (n-rounds >= rounds-per-generation)
[
; compute-statistics
select-strategies
set n-rounds 0
set generation generation + 1
]
[ set n-rounds n-rounds + 1]
tick
end
to go-generation
repeat rounds-per-generation [go]
select-strategies
set n-rounds 0
set generation generation + 1
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; OBSERVER'S PROCEDURES ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to get-resources
ask people [
if random-float 1 < prob-resource [
set get-resource? true
;; initially the agent get the full resource, and later maybe she shares if there is someone to share with
set energy-consumed energy
set n-get-resource n-get-resource + 1
]
]
end
to update-fitness
ask people [
if energy-consumed > min-energy [set fitness fitness + 1]
;; initialize set energy-consumed to zero
set energy-consumed 0
]
end
to select-strategies
ask people[
let competitors n-of round ( strategy-tournament-size * n-people) people
;; if there is a tie, "max-one-of" chooses randomly
let the-one max-one-of competitors [fitness]
if [fitness] of the-one > fitness [
;; copy strategy
set given-energy [given-energy] of the-one
set correlation [correlation] of the-one]
;; mutation
if random-float 1.0 < prob-mutation [
set given-energy random-float 1
set correlation -1 + random-float 2
]
]
;; update people colour just for fun
ask people [
;; initialize fitness
set fitness 0
;; update colour just for fun
set color scale-color orange given-energy 0 1
]
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; PEOPLE'S PROCEDURES ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to share
;; the maximum number of receivers is the maximum number of people without resource
let n-sharing min list round (sharing-tournament-size * n-people) (count people with [get-resource? = false])
ask people with [get-resource? = true]
[
ifelse any? people with [get-resource? = false] [
let receivers n-of (min list (n-sharing) (count people with [get-resource? = false])) people with [get-resource? = false]
let my-receiver one-of receivers ;; correlation 0
ifelse (correlation > 0)
;; correlation > 0
[ if random-float 1 < correlation [set my-receiver max-one-of receivers [given-energy]]]
;; correlation < 0
[ if random-float 1 < -1 * correlation [set my-receiver min-one-of receivers [given-energy]]]
if my-receiver != nobody
[ let donated-energy (given-energy * energy)
set energy-consumed energy-consumed - donated-energy ;; antes hay que añadir energy siempre que se obtenga recurso (M) Ok, estaba :)
ask my-receiver [
set energy-consumed energy-consumed + donated-energy
if (energy-consumed > min-energy) [set get-resource? true]
]
]
]
[ stop ]
]
;; initialization for next tick
ask people [
set get-resource? false
]
end
to-report max-items [the-list]
report max map [ ?1 -> count-items ?1 the-list ] remove-duplicates the-list
end
to-report count-items [i the-list]
report length filter [ ?1 -> ?1 = i ] the-list
end
to-report stop-cond
report ticks > 5000
end
@#$#@#$#@
GRAPHICS-WINDOW
319
10
756
448
-1
-1
13.0
1
10
1
1
1
0
1
1
1
-16
16
-16
16
1
1
1
ticks
30.0
BUTTON
16
10
90
43
setup
startup true
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
BUTTON
93
10
202
43
go one generation
go-generation
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
BUTTON
204
10
299
43
go
go-generation
T
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
TEXTBOX
23
125
281
143
-- Stressing parameters --
15
0.0
1
SLIDER
17
147
307
180
prob-resource
prob-resource
0
1
0.8
0.01
1
NIL
HORIZONTAL
SLIDER
17
181
308
214
min-energy
min-energy
0
1
0.8
0.01
1
NIL
HORIZONTAL
SLIDER
16
76
306
109
n-people
n-people
0
1000
300.0
1
1
NIL
HORIZONTAL
TEXTBOX
21
223
171
242
-- Sharing strategy --
15
0.0
1
SLIDER
18
242
309
275
sharing-tournament-size
sharing-tournament-size
0
1
0.01
0.1
1
NIL
HORIZONTAL
TEXTBOX
19
299
248
317
-- Evolutionary dynamics --
15
0.0
1
SLIDER
17
318
308
351
strategy-tournament-size
strategy-tournament-size
0
1
0.01
0.1
1
NIL
HORIZONTAL
TEXTBOX
21
55
171
74
-- Population --
15
0.0
1
SLIDER
17
353
308
386
prob-mutation
prob-mutation
0
1
0.01
0.01
1
NIL
HORIZONTAL
SLIDER
17
387
308
420
rounds-per-generation
rounds-per-generation
0
100
10.0
1
1
NIL
HORIZONTAL
PLOT
759
10
960
130
Given energy of people
NIL
NIL
0.0
10.0
0.0
300.0
true
false
"" ""
PENS
"default" 1.0 1 -8053223 true "" "histogram sort [10 * precision given-energy 1] of people"
MONITOR
760
131
859
176
generation
generation
0
1
11
@#$#@#$#@
## WHAT IS IT?
(a general understanding of what the model is trying to show or explain)
## HOW IT WORKS
(what rules the agents use to create the overall behavior of the model)
## HOW TO USE IT
(how to use the model, including a description of each of the items in the Interface tab)
## THINGS TO NOTICE
(suggested things for the user to notice while running the model)
## THINGS TO TRY
(suggested things for the user to try to do (move sliders, switches, etc.) with the model)
## EXTENDING THE MODEL
(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)
## NETLOGO FEATURES
(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)
## RELATED MODELS
(models in the NetLogo Models Library and elsewhere which are of related interest)
## CREDITS AND REFERENCES
(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)
@#$#@#$#@
default
true
0
Polygon -7500403 true true 150 5 40 250 150 205 260 250
airplane
true
0
Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15
arrow
true
0
Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150
box
false
0
Polygon -7500403 true true 150 285 285 225 285 75 150 135
Polygon -7500403 true true 150 135 15 75 150 15 285 75
Polygon -7500403 true true 15 75 15 225 150 285 150 135
Line -16777216 false 150 285 150 135
Line -16777216 false 150 135 15 75
Line -16777216 false 150 135 285 75
bug
true
0
Circle -7500403 true true 96 182 108
Circle -7500403 true true 110 127 80
Circle -7500403 true true 110 75 80
Line -7500403 true 150 100 80 30
Line -7500403 true 150 100 220 30
butterfly
true
0
Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240
Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240
Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163
Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165
Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225
Circle -16777216 true false 135 90 30
Line -16777216 false 150 105 195 60
Line -16777216 false 150 105 105 60
car
false
0
Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180
Circle -16777216 true false 180 180 90
Circle -16777216 true false 30 180 90
Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89
Circle -7500403 true true 47 195 58
Circle -7500403 true true 195 195 58
circle
false
0
Circle -7500403 true true 0 0 300
circle 2
false
0
Circle -7500403 true true 0 0 300
Circle -16777216 true false 30 30 240
cow
false
0
Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167
Polygon -7500403 true true 73 210 86 251 62 249 48 208
Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123
cylinder
false
0
Circle -7500403 true true 0 0 300
dot
false
0
Circle -7500403 true true 90 90 120
face happy
false
0
Circle -7500403 true true 8 8 285
Circle -16777216 true false 60 75 60
Circle -16777216 true false 180 75 60
Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240
face neutral
false
0
Circle -7500403 true true 8 7 285
Circle -16777216 true false 60 75 60
Circle -16777216 true false 180 75 60
Rectangle -16777216 true false 60 195 240 225
face sad
false
0
Circle -7500403 true true 8 8 285
Circle -16777216 true false 60 75 60
Circle -16777216 true false 180 75 60
Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183
fish
false
0
Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166
Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165
Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60
Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166
Circle -16777216 true false 215 106 30
flag
false
0
Rectangle -7500403 true true 60 15 75 300
Polygon -7500403 true true 90 150 270 90 90 30
Line -7500403 true 75 135 90 135
Line -7500403 true 75 45 90 45
flower
false
0
Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135
Circle -7500403 true true 85 132 38
Circle -7500403 true true 130 147 38
Circle -7500403 true true 192 85 38
Circle -7500403 true true 85 40 38
Circle -7500403 true true 177 40 38
Circle -7500403 true true 177 132 38
Circle -7500403 true true 70 85 38
Circle -7500403 true true 130 25 38
Circle -7500403 true true 96 51 108
Circle -16777216 true false 113 68 74
Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218
Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240
house
false
0
Rectangle -7500403 true true 45 120 255 285
Rectangle -16777216 true false 120 210 180 285
Polygon -7500403 true true 15 120 150 15 285 120
Line -16777216 false 30 120 270 120
leaf
false
0
Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195
Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195
line
true
0
Line -7500403 true 150 0 150 300
line half
true
0
Line -7500403 true 150 0 150 150
pentagon
false
0
Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120
person
false
0
Circle -7500403 true true 110 5 80
Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
Rectangle -7500403 true true 127 79 172 94
Polygon -7500403 true true 195 90 240 150 225 180 165 105
Polygon -7500403 true true 105 90 60 150 75 180 135 105
plant
false
0
Rectangle -7500403 true true 135 90 165 300
Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285
Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285
Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210
Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135
Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135
Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60
Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90
sheep
false
15
Circle -1 true true 203 65 88
Circle -1 true true 70 65 162
Circle -1 true true 150 105 120
Polygon -7500403 true false 218 120 240 165 255 165 278 120
Circle -7500403 true false 214 72 67
Rectangle -1 true true 164 223 179 298
Polygon -1 true true 45 285 30 285 30 240 15 195 45 210
Circle -1 true true 3 83 150
Rectangle -1 true true 65 221 80 296
Polygon -1 true true 195 285 210 285 210 240 240 210 195 210
Polygon -7500403 true false 276 85 285 105 302 99 294 83
Polygon -7500403 true false 219 85 210 105 193 99 201 83
square
false
0
Rectangle -7500403 true true 30 30 270 270
square 2
false
0
Rectangle -7500403 true true 30 30 270 270
Rectangle -16777216 true false 60 60 240 240
star
false
0
Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108
target
false
0
Circle -7500403 true true 0 0 300
Circle -16777216 true false 30 30 240
Circle -7500403 true true 60 60 180
Circle -16777216 true false 90 90 120
Circle -7500403 true true 120 120 60
tree
false
0
Circle -7500403 true true 118 3 94
Rectangle -6459832 true false 120 195 180 300
Circle -7500403 true true 65 21 108
Circle -7500403 true true 116 41 127
Circle -7500403 true true 45 90 120
Circle -7500403 true true 104 74 152
triangle
false
0
Polygon -7500403 true true 150 30 15 255 285 255
triangle 2
false
0
Polygon -7500403 true true 150 30 15 255 285 255
Polygon -16777216 true false 151 99 225 223 75 224
truck
false
0
Rectangle -7500403 true true 4 45 195 187
Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194
Rectangle -1 true false 195 60 195 105
Polygon -16777216 true false 238 112 252 141 219 141 218 112
Circle -16777216 true false 234 174 42
Rectangle -7500403 true true 181 185 214 194
Circle -16777216 true false 144 174 42
Circle -16777216 true false 24 174 42
Circle -7500403 false true 24 174 42
Circle -7500403 false true 144 174 42
Circle -7500403 false true 234 174 42
turtle
true
0
Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210
Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105
Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105
Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87
Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210
Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99
wheel
false
0
Circle -7500403 true true 3 3 294
Circle -16777216 true false 30 30 240
Line -7500403 true 150 285 150 15
Line -7500403 true 15 150 285 150
Circle -7500403 true true 120 120 60
Line -7500403 true 216 40 79 269
Line -7500403 true 40 84 269 221
Line -7500403 true 40 216 269 79
Line -7500403 true 84 40 221 269
wolf
false
0
Polygon -16777216 true false 253 133 245 131 245 133
Polygon -7500403 true true 2 194 13 197 30 191 38 193 38 205 20 226 20 257 27 265 38 266 40 260 31 253 31 230 60 206 68 198 75 209 66 228 65 243 82 261 84 268 100 267 103 261 77 239 79 231 100 207 98 196 119 201 143 202 160 195 166 210 172 213 173 238 167 251 160 248 154 265 169 264 178 247 186 240 198 260 200 271 217 271 219 262 207 258 195 230 192 198 210 184 227 164 242 144 259 145 284 151 277 141 293 140 299 134 297 127 273 119 270 105
Polygon -7500403 true true -1 195 14 180 36 166 40 153 53 140 82 131 134 133 159 126 188 115 227 108 236 102 238 98 268 86 269 92 281 87 269 103 269 113
x
false
0
Polygon -7500403 true true 270 75 225 30 30 225 75 270
Polygon -7500403 true true 30 75 75 30 270 225 225 270
@#$#@#$#@
NetLogo 6.2.0
@#$#@#$#@
@#$#@#$#@
@#$#@#$#@
<experiments>
<experiment name="4 escenarios 30 rep" repetitions="30" runMetricsEveryStep="false">
<setup>startup true</setup>
<go>go</go>
<timeLimit steps="50000"/>
<exitCondition>stop-cond</exitCondition>
<metric>ticks</metric>
<metric>[given-energy] of people</metric>
<metric>[correlation] of people</metric>
<metric>distribution-given-energy</metric>
<metric>max variation</metric>
<metric>variation</metric>
<metric>avgFitness</metric>
<metric>sdFitness</metric>
<metric>avgGivenEnergy</metric>
<metric>sdGivenEnergy</metric>
<enumeratedValueSet variable="prob-mutation">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="prob-resource">
<value value="0.2"/>
<value value="0.8"/>
</enumeratedValueSet>
<enumeratedValueSet variable="min-energy">
<value value="0.2"/>
<value value="0.8"/>
</enumeratedValueSet>
<enumeratedValueSet variable="n-people">
<value value="300"/>
</enumeratedValueSet>
<enumeratedValueSet variable="sharing-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="strategy-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="rounds-per-generation">
<value value="10"/>
</enumeratedValueSet>
</experiment>
<experiment name="4 escenarios 30 rep NoSTOP" repetitions="30" runMetricsEveryStep="false">
<setup>startup true</setup>
<go>go</go>
<timeLimit steps="35000"/>
<metric>distribution-given-energy</metric>
<metric>max variation</metric>
<metric>variation</metric>
<metric>avgFitness</metric>
<metric>sdFitness</metric>
<metric>avgGivenEnergy</metric>
<metric>sdGivenEnergy</metric>
<enumeratedValueSet variable="prob-mutation">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="prob-resource">
<value value="0.2"/>
<value value="0.8"/>
</enumeratedValueSet>
<enumeratedValueSet variable="min-energy">
<value value="0.2"/>
<value value="0.8"/>
</enumeratedValueSet>
<enumeratedValueSet variable="n-people">
<value value="300"/>
</enumeratedValueSet>
<enumeratedValueSet variable="sharing-tournament-size">
<value value="0.5"/>
</enumeratedValueSet>
<enumeratedValueSet variable="strategy-tournament-size">
<value value="0.5"/>
</enumeratedValueSet>
<enumeratedValueSet variable="rounds-per-generation">
<value value="10"/>
</enumeratedValueSet>
</experiment>
<experiment name="1 escenarios 10 rep" repetitions="1" runMetricsEveryStep="false">
<setup>startup true</setup>
<go>go</go>
<timeLimit steps="50000"/>
<exitCondition>stop-cond</exitCondition>
<metric>ticks</metric>
<metric>[given-energy] of people</metric>
<metric>[correlation] of people</metric>
<metric>distribution-given-energy</metric>
<metric>max variation</metric>
<metric>variation</metric>
<metric>avgFitness</metric>
<metric>sdFitness</metric>
<metric>avgGivenEnergy</metric>
<metric>sdGivenEnergy</metric>
<enumeratedValueSet variable="prob-mutation">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="prob-resource">
<value value="0.2"/>
</enumeratedValueSet>
<enumeratedValueSet variable="min-energy">
<value value="0.8"/>
</enumeratedValueSet>
<enumeratedValueSet variable="n-people">
<value value="300"/>
</enumeratedValueSet>
<enumeratedValueSet variable="sharing-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="strategy-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="rounds-per-generation">
<value value="10"/>
</enumeratedValueSet>
</experiment>
<experiment name="Gradient" repetitions="5" runMetricsEveryStep="true">
<setup>startup true</setup>
<go>go</go>
<timeLimit steps="50000"/>
<metric>mean [given-energy] of people</metric>
<metric>mean [correlation] of people</metric>
<metric>standard-deviation [given-energy] of people</metric>
<metric>standard-deviation [correlation] of people</metric>
<steppedValueSet variable="prob-resource" first="0.2" step="0.1" last="0.8"/>
<steppedValueSet variable="min-energy" first="0.2" step="0.1" last="0.8"/>
<enumeratedValueSet variable="prob-mutation">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="n-people">
<value value="300"/>
</enumeratedValueSet>
<enumeratedValueSet variable="sharing-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="rounds-per-generation">
<value value="10"/>
</enumeratedValueSet>
<enumeratedValueSet variable="strategy-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
</experiment>
<experiment name="tss1" repetitions="30" runMetricsEveryStep="true">
<setup>startup true</setup>
<go>repeat 500 [go]</go>
<timeLimit steps="100"/>
<metric>ticks</metric>
<metric>mean [given-energy] of people</metric>
<metric>mean [correlation] of people</metric>
<metric>standard-deviation [given-energy] of people</metric>
<metric>standard-deviation [correlation] of people</metric>
<metric>mean [fitness] of people</metric>
<metric>standard-deviation [fitness] of people</metric>
<enumeratedValueSet variable="prob-resource">
<value value="0.7"/>
<value value="0.3"/>
</enumeratedValueSet>
<steppedValueSet variable="min-energy" first="0.3" step="0.1" last="0.7"/>
<enumeratedValueSet variable="prob-mutation">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="n-people">
<value value="300"/>
</enumeratedValueSet>
<enumeratedValueSet variable="sharing-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="rounds-per-generation">
<value value="10"/>
</enumeratedValueSet>
<enumeratedValueSet variable="strategy-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
</experiment>
<experiment name="tss2" repetitions="30" runMetricsEveryStep="true">
<setup>startup true</setup>
<go>repeat 500 [go]</go>
<timeLimit steps="100"/>
<metric>ticks</metric>
<metric>mean [given-energy] of people</metric>
<metric>mean [correlation] of people</metric>
<metric>standard-deviation [given-energy] of people</metric>
<metric>standard-deviation [correlation] of people</metric>
<metric>mean [fitness] of people</metric>
<metric>standard-deviation [fitness] of people</metric>
<steppedValueSet variable="prob-resource" first="0.3" step="0.1" last="0.7"/>
<enumeratedValueSet variable="min-energy">
<value value="0.7"/>
<value value="0.3"/>
</enumeratedValueSet>
<enumeratedValueSet variable="prob-mutation">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="n-people">
<value value="300"/>
</enumeratedValueSet>
<enumeratedValueSet variable="sharing-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="rounds-per-generation">
<value value="10"/>
</enumeratedValueSet>
<enumeratedValueSet variable="strategy-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
</experiment>
<experiment name="Gradient-02-30" repetitions="30" runMetricsEveryStep="true">
<setup>startup true</setup>
<go>go-generation</go>
<exitCondition>ticks = 50000</exitCondition>
<metric>ticks</metric>
<metric>mean [given-energy] of people</metric>
<metric>mean [correlation] of people</metric>
<enumeratedValueSet variable="prob-resource">
<value value="0.2"/>
</enumeratedValueSet>
<steppedValueSet variable="min-energy" first="0.2" step="0.1" last="0.8"/>
<enumeratedValueSet variable="prob-mutation">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="n-people">
<value value="300"/>
</enumeratedValueSet>
<enumeratedValueSet variable="sharing-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="rounds-per-generation">
<value value="10"/>
</enumeratedValueSet>
<enumeratedValueSet variable="strategy-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
</experiment>
<experiment name="Gradient-03-30" repetitions="30" runMetricsEveryStep="true">
<setup>startup true</setup>
<go>go-generation</go>
<exitCondition>ticks = 50000</exitCondition>
<metric>ticks</metric>
<metric>mean [given-energy] of people</metric>
<metric>mean [correlation] of people</metric>
<enumeratedValueSet variable="prob-resource">
<value value="0.3"/>
</enumeratedValueSet>
<steppedValueSet variable="min-energy" first="0.2" step="0.1" last="0.8"/>
<enumeratedValueSet variable="prob-mutation">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="n-people">
<value value="300"/>
</enumeratedValueSet>
<enumeratedValueSet variable="sharing-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="rounds-per-generation">
<value value="10"/>
</enumeratedValueSet>
<enumeratedValueSet variable="strategy-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
</experiment>
<experiment name="Gradient-04-30" repetitions="30" runMetricsEveryStep="true">
<setup>startup true</setup>
<go>go-generation</go>
<exitCondition>ticks = 50000</exitCondition>
<metric>ticks</metric>
<metric>mean [given-energy] of people</metric>
<metric>mean [correlation] of people</metric>
<enumeratedValueSet variable="prob-resource">
<value value="0.4"/>
</enumeratedValueSet>
<steppedValueSet variable="min-energy" first="0.2" step="0.1" last="0.8"/>
<enumeratedValueSet variable="prob-mutation">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="n-people">
<value value="300"/>
</enumeratedValueSet>
<enumeratedValueSet variable="sharing-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="rounds-per-generation">
<value value="10"/>
</enumeratedValueSet>
<enumeratedValueSet variable="strategy-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
</experiment>
<experiment name="Gradient-05-30" repetitions="30" runMetricsEveryStep="true">
<setup>startup true</setup>
<go>go-generation</go>
<exitCondition>ticks = 50000</exitCondition>
<metric>ticks</metric>
<metric>mean [given-energy] of people</metric>
<metric>mean [correlation] of people</metric>
<enumeratedValueSet variable="prob-resource">
<value value="0.5"/>
</enumeratedValueSet>
<steppedValueSet variable="min-energy" first="0.2" step="0.1" last="0.8"/>
<enumeratedValueSet variable="prob-mutation">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="n-people">
<value value="300"/>
</enumeratedValueSet>
<enumeratedValueSet variable="sharing-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="rounds-per-generation">
<value value="10"/>
</enumeratedValueSet>
<enumeratedValueSet variable="strategy-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
</experiment>
<experiment name="Gradient-06-30" repetitions="30" runMetricsEveryStep="true">
<setup>startup true</setup>
<go>go-generation</go>
<exitCondition>ticks = 50000</exitCondition>
<metric>ticks</metric>
<metric>mean [given-energy] of people</metric>
<metric>mean [correlation] of people</metric>
<enumeratedValueSet variable="prob-resource">
<value value="0.6"/>
</enumeratedValueSet>
<steppedValueSet variable="min-energy" first="0.2" step="0.1" last="0.8"/>
<enumeratedValueSet variable="prob-mutation">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="n-people">
<value value="300"/>
</enumeratedValueSet>
<enumeratedValueSet variable="sharing-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="rounds-per-generation">
<value value="10"/>
</enumeratedValueSet>
<enumeratedValueSet variable="strategy-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
</experiment>
<experiment name="Gradient-07-30" repetitions="30" runMetricsEveryStep="true">
<setup>startup true</setup>
<go>go-generation</go>
<exitCondition>ticks = 50000</exitCondition>
<metric>ticks</metric>
<metric>mean [given-energy] of people</metric>
<metric>mean [correlation] of people</metric>
<enumeratedValueSet variable="prob-resource">
<value value="0.7"/>
</enumeratedValueSet>
<steppedValueSet variable="min-energy" first="0.2" step="0.1" last="0.8"/>
<enumeratedValueSet variable="prob-mutation">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="n-people">
<value value="300"/>
</enumeratedValueSet>
<enumeratedValueSet variable="sharing-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="rounds-per-generation">
<value value="10"/>
</enumeratedValueSet>
<enumeratedValueSet variable="strategy-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
</experiment>
<experiment name="Gradient-08-30" repetitions="30" runMetricsEveryStep="true">
<setup>startup true</setup>
<go>go-generation</go>
<exitCondition>ticks = 50000</exitCondition>
<metric>ticks</metric>
<metric>mean [given-energy] of people</metric>
<metric>mean [correlation] of people</metric>
<enumeratedValueSet variable="prob-resource">
<value value="0.8"/>
</enumeratedValueSet>
<steppedValueSet variable="min-energy" first="0.2" step="0.1" last="0.8"/>
<enumeratedValueSet variable="prob-mutation">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="n-people">
<value value="300"/>
</enumeratedValueSet>
<enumeratedValueSet variable="sharing-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="rounds-per-generation">
<value value="10"/>
</enumeratedValueSet>
<enumeratedValueSet variable="strategy-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
</experiment>
<experiment name="LHS" repetitions="1" runMetricsEveryStep="true">
<setup>startup true</setup>
<go>go-generation</go>
<timeLimit steps="5000"/>
<metric>ticks</metric>
<metric>mean [given-energy] of people</metric>
<metric>mean [correlation] of people</metric>
<steppedValueSet variable="exp-number" first="1" step="1" last="25"/>
</experiment>
<experiment name="論文の再現" repetitions="30" runMetricsEveryStep="false">
<setup>startup true</setup>
<go>go</go>
<timeLimit steps="50000"/>
<exitCondition>stop-cond</exitCondition>
<metric>ticks</metric>
<metric>[given-energy] of people</metric>
<metric>[correlation] of people</metric>
<enumeratedValueSet variable="prob-mutation">
<value value="0.01"/>
</enumeratedValueSet>
<steppedValueSet variable="prob-resource" first="0.2" step="0.1" last="0.8"/>
<steppedValueSet variable="min-energy" first="0.2" step="0.1" last="0.8"/>
<enumeratedValueSet variable="n-people">
<value value="300"/>
</enumeratedValueSet>
<enumeratedValueSet variable="sharing-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="strategy-tournament-size">
<value value="0.01"/>
</enumeratedValueSet>
<enumeratedValueSet variable="rounds-per-generation">
<value value="10"/>
</enumeratedValueSet>
</experiment>
</experiments>
@#$#@#$#@
@#$#@#$#@
default
0.0
-0.2 0 0.0 1.0
0.0 1 1.0 0.0
0.2 0 0.0 1.0
link direction
true
0
Line -7500403 true 150 150 90 180
Line -7500403 true 150 150 210 180
@#$#@#$#@
0
@#$#@#$#@
| NetLogo | 5 | mas178/reproduction-of-papers | Emergence and Evolution of Cooperation Under Resource Pressure/CURP.nlogo | [
"MIT"
] |
React = require \react
{svg} = require \react-dom-factories
{find-DOM-node} = require \react-dom
# set the focusable attribute to false, this prevents having to press the tab key multiple times in IE
module.exports = class SvgWrapper extends React.PureComponent
# render :: () -> ReactElement
render: -> svg @props
# component-did-mount :: () -> Void
component-did-mount: !->
find-DOM-node @ .set-attribute \focusable, false | LiveScript | 4 | rodcope1/react-selectize-rodcope1 | src/SvgWrapper.ls | [
"Apache-2.0"
] |
module org-openroadm-service {
namespace "http://org/openroadm/service";
prefix org-openroadm-service;
import ietf-yang-types {
prefix yang;
}
import org-openroadm-routing-constraints {
prefix org-openroadm-routing-constraints;
}
import org-openroadm-common-types {
prefix org-openroadm-common-types;
}
import org-openroadm-resource-types {
prefix org-openroadm-resource-types;
}
import org-openroadm-common-service-types {
prefix org-openroadm-common-service-types;
}
organization
"Open ROADM MSA";
contact
"OpenROADM.org";
description
"YANG definitions of services.
Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016,
AT&T Intellectual Property. All other rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
* Neither the Members of the Open ROADM MSA Agreement nor the names of its
contributors may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE";
revision 2016-10-14 {
description
"Version 1.2";
}
rpc service-create {
input {
leaf service-name {
type string;
description
"Identifier for the service to be created in
the ROADM network, e.g., CLFI, CLCI, etc. This is reported against the service, but may not get reflected in the service in the network.";
mandatory true;
}
leaf common-id {
type string;
description
"To be used by the ROADM controller to identify the routing constraints received from planning application (PED).";
}
uses org-openroadm-common-service-types:sdnc-request-header;
leaf connection-type {
type org-openroadm-common-service-types:connection-type;
mandatory true;
}
container service-a-end {
uses org-openroadm-common-service-types:service-endpoint;
}
container service-z-end {
uses org-openroadm-common-service-types:service-endpoint;
}
uses org-openroadm-routing-constraints:routing-constraints;
uses org-openroadm-common-service-types:service-information;
}
output {
uses org-openroadm-common-service-types:configuration-response-common;
uses org-openroadm-common-service-types:response-parameters;
}
description
"Whether this request passed initial validation and was accepted for processing. Once the request completes processing, a
service-rpc-result Notification shall be sent.";
}
rpc service-feasibility-check {
input {
leaf common-id {
type string;
mandatory true;
description
"To be used by the ROADM controller to identify the routing
constraints received from planning application (PED).";
}
uses org-openroadm-common-service-types:sdnc-request-header;
leaf connection-type {
type org-openroadm-common-service-types:connection-type;
}
container service-a-end {
uses org-openroadm-common-service-types:service-endpoint;
}
container service-z-end {
uses org-openroadm-common-service-types:service-endpoint;
}
uses org-openroadm-routing-constraints:routing-constraints;
uses org-openroadm-common-service-types:service-information;
}
output {
uses org-openroadm-common-service-types:configuration-response-common;
uses org-openroadm-common-service-types:response-parameters;
container service-a-end {
uses org-openroadm-common-service-types:service-endpoint;
list equipment-required {
description
"List of required equipment, including equipment type and quantity";
key "eqipment-identifier";
leaf eqipment-identifier {
type string;
}
leaf equipment-type {
type string;
}
leaf equipment-quantity {
type uint32;
}
}
}
container service-z-end {
uses org-openroadm-common-service-types:service-endpoint;
list equipment-required {
description
"List of required equipment, including equipment type and quantity";
key "eqipment-identifier";
leaf eqipment-identifier {
type string;
}
leaf equipment-type {
type string;
}
leaf equipment-quantity {
type uint32;
}
}
}
list intermediate-sites {
key "clli";
uses org-openroadm-common-service-types:service-endpoint;
list equipment-required {
description
"List of required equipment, including equipment type and quantity";
key "eqipment-identifier";
leaf eqipment-identifier {
type string;
}
leaf equipment-type {
type string;
}
leaf equipment-quantity {
type uint32;
}
}
}
}
description
"Whether a service was possible to be created, and if so
the routing constraints match and the a and z end connection that have
to match";
}
rpc service-delete {
input {
uses org-openroadm-common-service-types:sdnc-request-header;
container service-delete-req-info {
leaf service-name {
type string;
description
"Identifier for the service to be deleted in
the ROADM network, e.g., CLFI, CLCI, etc.";
mandatory true;
}
leaf due-date {
type yang:date-and-time;
description
"date and time service to be turned down. If missing, now.";
}
leaf tail-retention {
type enumeration {
enum "yes" {
value 1;
description
"tails are left intact ";
}
enum "no" {
value 2;
description
"tails are deleted";
}
}
mandatory true;
}
}
}
output {
uses org-openroadm-common-service-types:configuration-response-common;
}
description
"Whether this request passed initial validation and was accepted for processing. Once the request completes processing, a
service-rpc-result Notification shall be sent. Once the service has been deleted, it no longer will appear in the service list";
}
rpc equipment-notification {
input {
uses org-openroadm-common-service-types:sdnc-request-header;
leaf equiptment-id {
type string;
mandatory true;
}
leaf equipment-name {
type string;
}
leaf equipemt-type {
type string;
mandatory true;
}
leaf equipment-vendor {
type string;
mandatory true;
}
leaf equipment-customer {
type string;
}
leaf equipment-clli {
type string;
mandatory true;
}
leaf equipment-ip {
type string;
}
leaf controller-id {
type string;
mandatory true;
}
}
output {
uses org-openroadm-common-service-types:configuration-response-common;
}
}
rpc temp-service-create {
input {
leaf common-id {
type string;
description
"To be used by the ROADM controller to identify the routing constraints received from planning application (PED).";
mandatory true;
}
uses org-openroadm-common-service-types:sdnc-request-header;
leaf connection-type {
type org-openroadm-common-service-types:connection-type;
mandatory true;
}
container service-a-end {
uses org-openroadm-common-service-types:service-endpoint;
}
container service-z-end {
uses org-openroadm-common-service-types:service-endpoint;
}
uses org-openroadm-routing-constraints:routing-constraints;
uses org-openroadm-common-service-types:service-information;
}
output {
uses org-openroadm-common-service-types:configuration-response-common;
uses org-openroadm-common-service-types:response-parameters;
}
}
rpc temp-service-delete {
input {
leaf common-id {
type string;
mandatory true;
}
}
output {
uses org-openroadm-common-service-types:configuration-response-common;
}
}
rpc service-roll {
input {
leaf service-name {
type string;
mandatory true;
description
"Identifier for the service to be rolled in
the ROADM network, e.g., CLFI, CLCI, etc.";
}
leaf due-date {
type yang:date-and-time;
description
"date and time service to be rolled";
}
}
output {
uses org-openroadm-common-types:rpc-response-status;
}
}
rpc service-reconfigure {
input {
leaf service-name {
type string;
mandatory true;
description
"Existing identifier for the service to be
reconfigured in the ROADM network, e.g., CLFI, CLCI, etc.";
}
leaf new-service-name {
type string;
description
"New identifier for the service to be
reconfigured in the ROADM network, e.g., CLFI, CLCI, etc.";
}
leaf common-id {
type string;
description
"To be used by the ROADM controller to identify the routing
constraints received from planning application (PED).";
}
leaf connection-type {
type org-openroadm-common-service-types:connection-type;
}
container service-a-end {
uses org-openroadm-common-service-types:service-endpoint;
}
container service-z-end {
uses org-openroadm-common-service-types:service-endpoint;
}
uses org-openroadm-routing-constraints:routing-constraints;
uses org-openroadm-common-service-types:service-information;
}
output {
uses org-openroadm-common-types:rpc-response-status;
}
description
"Whether this request passed initial validation and was accepted for processing. Once the request completes processing, a
service-rpc-result Notification shall be sent.";
}
rpc service-restoration {
input {
leaf service-name {
type string;
mandatory true;
description
"Identifier for the service to be restored in
the ROADM network, e.g., CLFI, CLCI, etc.";
}
leaf option {
type enumeration {
enum "permanent" {
value 1;
description
"A spare regen can be used to restore the
service permanently without reverting back to the
original regen";
}
enum "temporary" {
value 2;
description
"a spare regen can be used to restore the
service temporarily. The service needs to be reverted
back to the original regen transponder";
}
}
mandatory true;
}
}
output {
uses org-openroadm-common-types:rpc-response-status;
}
description
"Whether this request passed initial validation and was accepted for processing. Once the request completes processing, a
service-rpc-result Notification shall be sent.";
}
rpc service-reversion {
input {
leaf service-name {
type string;
mandatory true;
description
"Identifier for the service to be reverted
in the ROADM network, e.g., CLFI, CLCI, etc. ";
}
leaf due-date {
type yang:date-and-time;
description
"date and time service to be reverted";
}
}
output {
uses org-openroadm-common-types:rpc-response-status;
}
description
"Whether this request passed initial validation and was accepted for processing. Once the request completes processing, a
service-rpc-result Notification shall be sent.";
}
rpc service-reroute {
input {
leaf service-name {
type string;
mandatory true;
description
"Identifier for the service to be re-routed in
the ROADM network, e.g., CLFI, CLCI, etc.";
}
}
output {
uses org-openroadm-common-types:rpc-response-status;
uses org-openroadm-routing-constraints:routing-constraints;
}
description
"Whether this request was validated and processed correct. If sucessful, it return the proposed new route.
If acceptable, this request should be followed by a service-reroute-confirm to complete the reroute operation.";
}
rpc service-reroute-confirm {
input {
leaf service-name {
type string;
mandatory true;
description
"Identifier for the service to be re-routed in
the ROADM network, e.g., CLFI, CLCI, etc.";
}
uses org-openroadm-routing-constraints:routing-constraints;
}
output {
uses org-openroadm-common-types:rpc-response-status;
}
description
"Whether this request passed initial validation and was accepted for processing. Once the request completes processing, a
service-rpc-result Notification shall be sent.";
}
rpc network-re-optimization {
input {
leaf service-name {
type string;
description
"Identifier for the service in the ROADM network,
e.g., CLFI, CLCI, etc. whose path is to be checked by the RNC
for re-optimization";
}
leaf a-end {
type string;
description
"Services whose A-ends are terminated at the
specified office location are to be checked by the RNC for
re-optimization";
}
leaf z-end {
type string;
description
"Services whose Z-ends are terminated at the
specified office location are to be checked by the RNC for
re-optimization ";
}
leaf pass-through {
type string;
description
"Services that are pass-through (either via
regen or express) at the specified office location are to
be checked by the RNC for re-optimization";
}
leaf customer-code {
type string;
description
"Services that belong to the specified customer
are to be checked by the RNC for re-optimization ";
}
}
output {
uses org-openroadm-common-types:rpc-response-status;
leaf optimization-candidate {
type string;
}
}
}
container service-list {
description
"List of service. Can only be created, deleted, modified, etc. using special RPCs.";
list services {
key "service-name";
uses org-openroadm-common-service-types:service;
}
}
container temp-service-list {
description
"List of temporary services Can only be created, deleted, modified, etc. using special RPCs.";
list services {
key "common-id";
uses org-openroadm-common-service-types:service {
refine "service-name" {
mandatory false;
}
}
}
}
notification service-rpc-result {
description
"This Notification indicates result of service RPC";
leaf notification-type {
type org-openroadm-common-service-types:service-notification-types;
}
uses org-openroadm-common-types:rpc-response-status;
uses org-openroadm-common-service-types:service-notification-result;
}
notification service-traffic-flow {
description
"This Notification indicates that traffic is flowing again on the service after an administrative action has completed";
leaf service-name {
type string;
description
"Identifier for the service being reported on";
mandatory true;
}
leaf actual-date {
type yang:date-and-time;
description
"Actual date and time traffic started flowing";
}
}
notification service-notification {
description
"This Notification that a service has been added, modified or removed.
A resourceCreation notification shall contain the created service in its entirety.
A resourceMofified notification shall contain just the modified field, plus the service identifier
A resourceDeleted notification shall just contain the service identifier";
leaf notificationType {
type org-openroadm-resource-types:resource-notification-type;
description
"Whether this notification indicates a service creation, service modification or service deletion.";
}
uses org-openroadm-common-service-types:service;
}
}
| YANG | 5 | meodaiduoi/onos | models/openroadm/src/main/yang/[email protected] | [
"Apache-2.0"
] |
@inproceedings{Cordts2016Cityscapes,
title={The Cityscapes Dataset for Semantic Urban Scene Understanding},
author={Cordts, Marius and Omran, Mohamed and Ramos, Sebastian and Rehfeld, Timo and Enzweiler, Markus and Benenson, Rodrigo and Franke, Uwe and Roth, Stefan and Schiele, Bernt},
booktitle={Proc. of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
year={2016}
}
| TeX | 0 | chuxiuhong/ganilla | datasets/bibtex/cityscapes.tex | [
"BSD-3-Clause"
] |
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: opam.eclass
# @MAINTAINER:
# Gentoo ML Project <[email protected]>
# @AUTHOR:
# Alexis Ballier <[email protected]>
# @SUPPORTED_EAPIS: 5 6 7
# @BLURB: Provides functions for installing opam packages.
# @DESCRIPTION:
# Provides dependencies on opam and ocaml, opam-install and a default
# src_install for opam-based packages.
case ${EAPI:-0} in
0|1|2|3|4) die "You need at least EAPI-5 to use opam.eclass";;
*) ;;
esac
RDEPEND=">=dev-lang/ocaml-4:="
DEPEND="${RDEPEND}
dev-ml/opam"
# @FUNCTION: opam-install
# @USAGE: <list of packages>
# @DESCRIPTION:
# Installs the opam packages given as arguments. For each "${pkg}" element in
# that list, "${pkg}.install" must be readable from current working directory.
opam-install() {
local pkg
for pkg ; do
opam-installer -i \
--prefix="${ED}usr" \
--libdir="${D}$(ocamlc -where)" \
--docdir="${ED}usr/share/doc/${PF}" \
--mandir="${ED}usr/share/man" \
"${pkg}.install" || die
done
}
opam_src_install() {
local pkg="${1:-${PN}}"
opam-install "${pkg}"
# Handle opam putting doc in a subdir
if [ -d "${ED}usr/share/doc/${PF}/${pkg}" ] ; then
mv "${ED}usr/share/doc/${PF}/${pkg}/"* "${ED}usr/share/doc/${PF}/" || die
rmdir "${ED}usr/share/doc/${PF}/${pkg}" || die
fi
}
EXPORT_FUNCTIONS src_install
| Gentoo Eclass | 5 | NighttimeDriver50000/Sabayon-Packages | local_overlay/eclass/opam.eclass | [
"MIT"
] |
#!/usr/bin/env bash
(
cd $(dirname $0)
echo "digraph {"
echo "rankdir=RL; splines=ortho; node [shape=box];"
jq -f org_chart.jq --raw-output < ../../content/marketing/contributors.json
echo "}"
) | dot -Tpng > org.png | Shell | 3 | coreyscherbing/angular | aio/scripts/contributors/generate_org_chart.sh | [
"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.
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.Editor.UnitTests;
using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions;
using Microsoft.CodeAnalysis.Editor.UnitTests.Extensions;
using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
using Microsoft.CodeAnalysis.ExternalAccess.IntelliCode.Api;
using Microsoft.CodeAnalysis.Features.Intents;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.Text.Shared.Extensions;
using Microsoft.VisualStudio.Text;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Intents
{
[UseExportProvider]
public class AddConstructorParameterIntentTests : IntentTestsBase
{
[Fact]
public async Task AddConstructorParameterWithField()
{
var initialText =
@"class C
{
private readonly int _someInt;{|priorSelection:|}
public C({|typed:int som|})
{
}
}";
var expectedText =
@"class C
{
private readonly int _someInt;
public C(int someInt)
{
_someInt = someInt;
}
}";
await VerifyExpectedTextAsync(WellKnownIntents.AddConstructorParameter, initialText, expectedText).ConfigureAwait(false);
}
[Fact]
public async Task AddConstructorParameterWithProperty()
{
var initialText =
@"class C
{
public int SomeInt { get; }{|priorSelection:|}
public C({|typed:int som|})
{
}
}";
var expectedText =
@"class C
{
public int SomeInt { get; }
public C(int someInt)
{
SomeInt = someInt;
}
}";
await VerifyExpectedTextAsync(WellKnownIntents.AddConstructorParameter, initialText, expectedText).ConfigureAwait(false);
}
[Fact]
public async Task AddMultipleConstructorParameters()
{
var initialText =
@"class C
{
{|priorSelection:private readonly int _someInt;
private readonly string _someString;|}
public C({|typed:int som|})
{
}
}";
var expectedText =
@"class C
{
private readonly int _someInt;
private readonly string _someString;
public C(int someInt, string someString)
{
_someInt = someInt;
_someString = someString;
}
}";
await VerifyExpectedTextAsync(WellKnownIntents.AddConstructorParameter, initialText, expectedText).ConfigureAwait(false);
}
[Fact]
public async Task AddConstructorParameterOnlyAddsSelected()
{
var initialText =
@"class C
{
private readonly int _someInt;{|priorSelection:|}
private readonly string _someString;
public C({|typed:int som|})
{
}
}";
var expectedText =
@"class C
{
private readonly int _someInt;
private readonly string _someString;
public C(int someInt)
{
_someInt = someInt;
}
}";
await VerifyExpectedTextAsync(WellKnownIntents.AddConstructorParameter, initialText, expectedText).ConfigureAwait(false);
}
[Fact]
public async Task AddConstructorParameterUsesCodeStyleOption()
{
var initialText =
@"class C
{
private readonly int _someInt;{|priorSelection:|}
public C({|typed:int som|})
{
}
}";
var expectedText =
@"class C
{
private readonly int _someInt;
public C(int someInt)
{
this._someInt = someInt;
}
}";
await VerifyExpectedTextAsync(WellKnownIntents.AddConstructorParameter, initialText, expectedText,
options: new OptionsCollection(LanguageNames.CSharp)
{
{ CodeStyleOptions2.QualifyFieldAccess, true }
}).ConfigureAwait(false);
}
}
}
| C# | 4 | frandesc/roslyn | src/EditorFeatures/CSharpTest/Intents/AddConstructorParameterIntentTests.cs | [
"MIT"
] |
const { shell } = require('electron')
const os = require('os')
const exLinksBtn = document.getElementById('open-ex-links')
const fileManagerBtn = document.getElementById('open-file-manager')
fileManagerBtn.addEventListener('click', (event) => {
shell.showItemInFolder(os.homedir())
})
exLinksBtn.addEventListener('click', (event) => {
shell.openExternal('https://electronjs.org')
})
| JavaScript | 4 | lingxiao-Zhu/electron | docs/fiddles/native-ui/external-links-file-manager/renderer.js | [
"MIT"
] |
html,
body {
padding: 0;
margin: 0;
}
a {
color: inherit;
text-decoration: none;
}
* {
box-sizing: border-box;
font-family: IBM Plex Sans, 'sans-serif';
}
p {
color: #19303d;
font-size: 18px;
line-height: 25px;
margin: 0;
}
strong {
color: black;
font-weight: 500;
}
h2 {
font-size: 30px;
line-height: 40px;
margin: 0;
}
input {
border: 1px solid #adbcc5;
box-sizing: border-box;
border-radius: 3px;
color: #19303d;
font-size: 18px;
height: 45px;
line-height: 25px;
padding: 10px;
}
input:disabled {
background-color: white;
color: #19303d;
}
input:focus {
outline: 0;
}
input::placeholder {
color: #adbcc5;
}
button,
input[type='submit'] {
border: none;
border-radius: 3px;
color: white;
font-size: 18px;
font-weight: 600;
height: 45px;
width: 100%;
}
button:hover,
input[type='submit']:hover {
opacity: 0.8;
}
| CSS | 3 | blomqma/next.js | examples/auth-with-stytch/styles/globals.css | [
"MIT"
] |
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h3>Download CSV</h3>
<a data-cy="download-csv" href="records.csv" download>records.csv</a>
<h3>Download XLSX</h3>
<a data-cy="download-xlsx" href="people.xlsx" download>people.xlsx</a>
<h3>Download ZIP file</h3>
<a data-cy="download-zip" href="files.zip" download>files.zip</a>
</body>
</html>
| HTML | 3 | bkucera2/cypress | packages/server/test/support/fixtures/projects/downloads/cypress/fixtures/downloads.html | [
"MIT"
] |
--TEST--
Test typed properties type must precede first declaration in group
--FILE--
<?php
class Foo {
public $bar,
int $qux;
}
?>
--EXPECTF--
Parse error: syntax error, unexpected identifier "int", expecting variable in %s on line %d
| PHP | 2 | NathanFreeman/php-src | Zend/tests/type_declarations/typed_properties_025.phpt | [
"PHP-3.01"
] |
/*
* Copyright (c) 2021, Luke Wilde <[email protected]>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/DOM/LiveNodeList.h>
#include <LibWeb/DOM/Node.h>
namespace Web::DOM {
LiveNodeList::LiveNodeList(Node& root, Function<bool(Node const&)> filter)
: m_root(root)
, m_filter(move(filter))
{
}
NonnullRefPtrVector<Node> LiveNodeList::collection() const
{
NonnullRefPtrVector<Node> nodes;
m_root->for_each_in_inclusive_subtree_of_type<Node>([&](auto& node) {
if (m_filter(node))
nodes.append(node);
return IterationDecision::Continue;
});
return nodes;
}
// https://dom.spec.whatwg.org/#dom-nodelist-length
u32 LiveNodeList::length() const
{
return collection().size();
}
// https://dom.spec.whatwg.org/#dom-nodelist-item
Node const* LiveNodeList::item(u32 index) const
{
// The item(index) method must return the indexth node in the collection. If there is no indexth node in the collection, then the method must return null.
auto nodes = collection();
if (index >= nodes.size())
return nullptr;
return &nodes[index];
}
// https://dom.spec.whatwg.org/#ref-for-dfn-supported-property-indices
bool LiveNodeList::is_supported_property_index(u32 index) const
{
// The object’s supported property indices are the numbers in the range zero to one less than the number of nodes represented by the collection.
// If there are no such elements, then there are no supported property indices.
return index < length();
}
}
| C++ | 5 | r00ster91/serenity | Userland/Libraries/LibWeb/DOM/LiveNodeList.cpp | [
"BSD-2-Clause"
] |
a { width: +.10; } | CSS | 0 | mengxy/swc | crates/swc_css_parser/tests/fixture/esbuild/misc/-JoxoRcnA-zaaEC7RjXKvQ/input.css | [
"Apache-2.0"
] |
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/libplatform/default-platform.h"
#include "src/base/platform/semaphore.h"
#include "src/base/platform/time.h"
#include "testing/gmock/include/gmock/gmock.h"
using testing::InSequence;
using testing::StrictMock;
namespace v8 {
namespace platform {
namespace default_platform_unittest {
namespace {
struct MockTask : public Task {
// See issue v8:8185
~MockTask() /* override */ { Die(); }
MOCK_METHOD(void, Run, (), (override));
MOCK_METHOD(void, Die, ());
};
struct MockIdleTask : public IdleTask {
// See issue v8:8185
~MockIdleTask() /* override */ { Die(); }
MOCK_METHOD(void, Run, (double deadline_in_seconds), (override));
MOCK_METHOD(void, Die, ());
};
class DefaultPlatformWithMockTime : public DefaultPlatform {
public:
explicit DefaultPlatformWithMockTime(int thread_pool_size = 0)
: DefaultPlatform(thread_pool_size, IdleTaskSupport::kEnabled, nullptr) {
mock_time_ = 0.0;
SetTimeFunctionForTesting([]() { return mock_time_; });
}
void IncreaseTime(double seconds) { mock_time_ += seconds; }
private:
static double mock_time_;
};
double DefaultPlatformWithMockTime::mock_time_ = 0.0;
template <typename Platform>
class PlatformTest : public ::testing::Test {
public:
Isolate* isolate() { return reinterpret_cast<Isolate*>(dummy_); }
Platform* platform() { return &platform_; }
std::shared_ptr<TaskRunner> task_runner() {
if (!task_runner_) {
task_runner_ = platform_.GetForegroundTaskRunner(isolate());
}
DCHECK_NOT_NULL(task_runner_);
return task_runner_;
}
// These methods take ownership of the task. Tests might still reference them,
// if the tasks are expected to still exist.
void CallOnForegroundThread(Task* task) {
task_runner()->PostTask(std::unique_ptr<Task>(task));
}
void CallNonNestableOnForegroundThread(Task* task) {
task_runner()->PostNonNestableTask(std::unique_ptr<Task>(task));
}
void CallDelayedOnForegroundThread(Task* task, double delay_in_seconds) {
task_runner()->PostDelayedTask(std::unique_ptr<Task>(task),
delay_in_seconds);
}
void CallIdleOnForegroundThread(IdleTask* task) {
task_runner()->PostIdleTask(std::unique_ptr<IdleTask>(task));
}
bool PumpMessageLoop() { return platform_.PumpMessageLoop(isolate()); }
private:
Platform platform_;
InSequence in_sequence_;
std::shared_ptr<TaskRunner> task_runner_;
int dummy_ = 0;
};
class DefaultPlatformTest : public PlatformTest<DefaultPlatform> {};
class DefaultPlatformTestWithMockTime
: public PlatformTest<DefaultPlatformWithMockTime> {};
} // namespace
TEST_F(DefaultPlatformTest, PumpMessageLoop) {
EXPECT_FALSE(platform()->PumpMessageLoop(isolate()));
StrictMock<MockTask>* task = new StrictMock<MockTask>;
CallOnForegroundThread(task);
EXPECT_CALL(*task, Run());
EXPECT_CALL(*task, Die());
EXPECT_TRUE(PumpMessageLoop());
EXPECT_FALSE(PumpMessageLoop());
}
TEST_F(DefaultPlatformTest, PumpMessageLoopWithTaskRunner) {
std::shared_ptr<TaskRunner> taskrunner =
platform()->GetForegroundTaskRunner(isolate());
EXPECT_FALSE(PumpMessageLoop());
StrictMock<MockTask>* task = new StrictMock<MockTask>;
taskrunner->PostTask(std::unique_ptr<Task>(task));
EXPECT_CALL(*task, Run());
EXPECT_CALL(*task, Die());
EXPECT_TRUE(PumpMessageLoop());
EXPECT_FALSE(PumpMessageLoop());
}
TEST_F(DefaultPlatformTest, PumpMessageLoopNested) {
EXPECT_FALSE(PumpMessageLoop());
StrictMock<MockTask>* nestable_task1 = new StrictMock<MockTask>;
StrictMock<MockTask>* non_nestable_task2 = new StrictMock<MockTask>;
StrictMock<MockTask>* nestable_task3 = new StrictMock<MockTask>;
StrictMock<MockTask>* non_nestable_task4 = new StrictMock<MockTask>;
CallOnForegroundThread(nestable_task1);
CallNonNestableOnForegroundThread(non_nestable_task2);
CallOnForegroundThread(nestable_task3);
CallNonNestableOnForegroundThread(non_nestable_task4);
// Nestable tasks are FIFO; non-nestable tasks are FIFO. A task being
// non-nestable may cause it to be executed later, but not earlier.
EXPECT_CALL(*nestable_task1, Run).WillOnce([this]() {
EXPECT_TRUE(PumpMessageLoop());
});
EXPECT_CALL(*nestable_task3, Run());
EXPECT_CALL(*nestable_task3, Die());
EXPECT_CALL(*nestable_task1, Die());
EXPECT_TRUE(PumpMessageLoop());
EXPECT_CALL(*non_nestable_task2, Run());
EXPECT_CALL(*non_nestable_task2, Die());
EXPECT_TRUE(PumpMessageLoop());
EXPECT_CALL(*non_nestable_task4, Run());
EXPECT_CALL(*non_nestable_task4, Die());
EXPECT_TRUE(PumpMessageLoop());
EXPECT_FALSE(PumpMessageLoop());
}
TEST_F(DefaultPlatformTestWithMockTime, PumpMessageLoopDelayed) {
EXPECT_FALSE(PumpMessageLoop());
StrictMock<MockTask>* task1 = new StrictMock<MockTask>;
StrictMock<MockTask>* task2 = new StrictMock<MockTask>;
CallDelayedOnForegroundThread(task2, 100);
CallDelayedOnForegroundThread(task1, 10);
EXPECT_FALSE(PumpMessageLoop());
platform()->IncreaseTime(11);
EXPECT_CALL(*task1, Run());
EXPECT_CALL(*task1, Die());
EXPECT_TRUE(PumpMessageLoop());
EXPECT_FALSE(PumpMessageLoop());
platform()->IncreaseTime(90);
EXPECT_CALL(*task2, Run());
EXPECT_CALL(*task2, Die());
EXPECT_TRUE(PumpMessageLoop());
}
TEST_F(DefaultPlatformTestWithMockTime, PumpMessageLoopNoStarvation) {
EXPECT_FALSE(PumpMessageLoop());
StrictMock<MockTask>* task1 = new StrictMock<MockTask>;
StrictMock<MockTask>* task2 = new StrictMock<MockTask>;
StrictMock<MockTask>* task3 = new StrictMock<MockTask>;
CallOnForegroundThread(task1);
CallDelayedOnForegroundThread(task2, 10);
platform()->IncreaseTime(11);
EXPECT_CALL(*task1, Run());
EXPECT_CALL(*task1, Die());
EXPECT_TRUE(PumpMessageLoop());
CallOnForegroundThread(task3);
EXPECT_CALL(*task2, Run());
EXPECT_CALL(*task2, Die());
EXPECT_TRUE(PumpMessageLoop());
EXPECT_CALL(*task3, Run());
EXPECT_CALL(*task3, Die());
EXPECT_TRUE(PumpMessageLoop());
}
TEST_F(DefaultPlatformTestWithMockTime,
PendingDelayedTasksAreDestroyedOnShutdown) {
StrictMock<MockTask>* task = new StrictMock<MockTask>;
CallDelayedOnForegroundThread(task, 10);
EXPECT_CALL(*task, Die());
}
TEST_F(DefaultPlatformTestWithMockTime, RunIdleTasks) {
StrictMock<MockIdleTask>* task = new StrictMock<MockIdleTask>;
CallIdleOnForegroundThread(task);
EXPECT_CALL(*task, Run(42.0 + 23.0));
EXPECT_CALL(*task, Die());
platform()->IncreaseTime(23.0);
platform()->RunIdleTasks(isolate(), 42.0);
}
TEST_F(DefaultPlatformTestWithMockTime,
PendingIdleTasksAreDestroyedOnShutdown) {
StrictMock<MockIdleTask>* task = new StrictMock<MockIdleTask>;
CallIdleOnForegroundThread(task);
EXPECT_CALL(*task, Die());
}
namespace {
class TestBackgroundTask : public Task {
public:
explicit TestBackgroundTask(base::Semaphore* sem, bool* executed)
: sem_(sem), executed_(executed) {}
~TestBackgroundTask() override { Die(); }
MOCK_METHOD(void, Die, ());
void Run() override {
*executed_ = true;
sem_->Signal();
}
private:
base::Semaphore* sem_;
bool* executed_;
};
} // namespace
TEST(CustomDefaultPlatformTest, RunBackgroundTask) {
DefaultPlatform platform(1);
base::Semaphore sem(0);
bool task_executed = false;
StrictMock<TestBackgroundTask>* task =
new StrictMock<TestBackgroundTask>(&sem, &task_executed);
EXPECT_CALL(*task, Die());
platform.CallOnWorkerThread(std::unique_ptr<Task>(task));
EXPECT_TRUE(sem.WaitFor(base::TimeDelta::FromSeconds(1)));
EXPECT_TRUE(task_executed);
}
TEST(CustomDefaultPlatformTest, PostForegroundTaskAfterPlatformTermination) {
std::shared_ptr<TaskRunner> foreground_taskrunner;
{
DefaultPlatformWithMockTime platform(1);
int dummy;
Isolate* isolate = reinterpret_cast<Isolate*>(&dummy);
foreground_taskrunner = platform.GetForegroundTaskRunner(isolate);
}
// It should still be possible to post foreground tasks, even when the
// platform does not exist anymore.
StrictMock<MockTask>* task1 = new StrictMock<MockTask>;
EXPECT_CALL(*task1, Die());
foreground_taskrunner->PostTask(std::unique_ptr<Task>(task1));
StrictMock<MockTask>* task2 = new StrictMock<MockTask>;
EXPECT_CALL(*task2, Die());
foreground_taskrunner->PostDelayedTask(std::unique_ptr<Task>(task2), 10);
StrictMock<MockIdleTask>* task3 = new StrictMock<MockIdleTask>;
EXPECT_CALL(*task3, Die());
foreground_taskrunner->PostIdleTask(std::unique_ptr<IdleTask>(task3));
}
} // namespace default_platform_unittest
} // namespace platform
} // namespace v8
| C++ | 5 | EXHades/v8 | test/unittests/libplatform/default-platform-unittest.cc | [
"BSD-3-Clause"
] |
SmalltalkCISpec {
#loading : [
SCIMetacelloLoadSpec {
#baseline : 'Tode',
#load : [ 'GemStone', 'Rewrite' ],
#directory : 'repository',
#onWarningLog : true,
#platforms : [ #gemstone ]
},
SCIMetacelloLoadSpec {
#baseline : 'Tode',
#load : [ 'CI' ],
#directory : 'repository',
#onWarningLog : true,
#platforms : [ #pharo ]
}
],
#testing : {
#exclude : {
#categories : [ 'Tode-Server-*', 'Topez-Server-*', 'Tode-GemStone-Server-*' ]
},
#failOnSCIDeprecationWarnings : false
}
}
| STON | 3 | dassi/tode | .client.smalltalk.ston | [
"MIT"
] |
#*****************************************************************************
# *
# Make file for VMS *
# Author : J.Jansen ([email protected]) *
# Date : 10 November 1999 *
# *
#*****************************************************************************
.first
define wx [---.include.wx]
.ifdef __WXMOTIF__
CXX_DEFINE = /define=(__WXMOTIF__=1)/name=(as_is,short)\
/assume=(nostdnew,noglobal_array_new)
.else
.ifdef __WXGTK__
CXX_DEFINE = /define=(__WXGTK__=1)/float=ieee/name=(as_is,short)/ieee=denorm\
/assume=(nostdnew,noglobal_array_new)
.else
CXX_DEFINE =
.endif
.endif
.suffixes : .cpp
.cpp.obj :
cxx $(CXXFLAGS)$(CXX_DEFINE) $(MMS$TARGET_NAME).cpp
all :
.ifdef __WXMOTIF__
$(MMS)$(MMSQUALIFIERS) dialoged.exe
.else
.ifdef __WXGTK__
$(MMS)$(MMSQUALIFIERS) dialoged_gtk.exe
.endif
.endif
OBJECTS=dialoged.obj,reseditr.obj,dlghndlr.obj,reswrite.obj,winprop.obj,\
edtree.obj,edlist.obj,symbtabl.obj,winstyle.obj
.ifdef __WXMOTIF__
dialoged.exe : $(OBJECTS)
cxxlink $(OBJECTS),[---.lib]vms/opt
.else
.ifdef __WXGTK__
dialoged_gtk.exe : $(OBJECTS)
cxxlink/exec=dialoged_gtk.exe $(OBJECTS),[---.lib]vms_gtk/opt
.endif
.endif
dialoged.obj : dialoged.cpp
reseditr.obj : reseditr.cpp
dlghndlr.obj : dlghndlr.cpp
reswrite.obj : reswrite.cpp
winprop.obj : winprop.cpp
edtree.obj : edtree.cpp
edlist.obj : edlist.cpp
symbtabl.obj : symbtabl.cpp
winstyle.obj : winstyle.cpp
| Module Management System | 2 | addstone/unrealengine3 | Development/External/wxWindows_2.4.0/utils/dialoged/src/descrip.mms | [
"FSFAP"
] |
% a bakedFDA c -def
stdout:"0:a 1:backedFDA 2:c 3:-def"
exit:0
| Io | 0 | Refusal-Type-Bamboo/virgil | test/system/Params01.io | [
"Apache-2.0"
] |
## Description
A similar approach to psexec but executing commands through DCOM.
You can select different objects to be used to execute the commands.
Currently supported objects are:
1. MMC20.Application (`49B2791A-B1AE-4C90-9B8E-E860BA07F889`)
- Tested Windows 7, Windows 10, Server 2012R2
1. ShellWindows (`9BA05972-F6A8-11CF-A442-00A0C90A8F39`)
- Tested Windows 7, Windows 10, Server 2012R2
1. ShellBrowserWindow (`C08AFD90-F2A1-11D1-8455-00A0C91F3880`)
- Tested Windows 10, Server 2012R2
## Verification Steps
1. Install [Impacket][1] v0.9.17 from GitHub. The `impacket` package must be in
Python's module path, so `import impacket` works from any directory.
1. Install [pycrypto][2] v2.7 (the experimental release). Impacket requires this
specific version.
1. Start msfconsole
1. Do: `use auxiliary/scanner/smb/impacket/dcomexec`
1. Set: `COMMAND`, `RHOSTS`, `SMBUser`, `SMBPass`
1. Do: `run`, see the command result (if `OUTPUT` is enabled)
## Options
**OUTPUT**
When the `OUTPUT` option is enabled, the result of the command will be written
to a temporary file on the remote host and then retrieved. This allows the
module user to view the output but also causes it to be written to disk before
it is retrieved and deleted.
## Scenarios
```
metasploit-framework (S:0 J:1) auxiliary(scanner/smb/impacket/dcomexec) > show options
Module options (auxiliary/scanner/smb/impacket/dcomexec):
Name Current Setting Required Description
---- --------------- -------- -----------
COMMAND ipconfig yes The command to execute
OBJECT MMC20 yes The DCOM object to use for execution (Accepted: ShellWindows, ShellBrowserWindow, MMC20)
OUTPUT true yes Get the output of the executed command
RHOSTS 192.168.90.11 yes The target address range or CIDR identifier
SMBDomain . no The Windows domain to use for authentication
SMBPass wakawaka yes The password for the specified username
SMBUser spencer yes The username to authenticate as
THREADS 1 yes The number of concurrent threads
metasploit-framework (S:0 J:1) auxiliary(scanner/smb/impacket/dcomexec) > run
[*] [2018.04.04-17:07:51] Running for 192.168.90.11...
[*] [2018.04.04-17:07:51] 192.168.90.11 - SMBv3.0 dialect used
[*] [2018.04.04-17:07:51] 192.168.90.11 - Target system is 192.168.90.11 and isFDQN is False
[*] [2018.04.04-17:07:51] 192.168.90.11 - StringBinding: Windows8VM[55339]
[*] [2018.04.04-17:07:51] 192.168.90.11 - StringBinding: 10.0.3.15[55339]
[*] [2018.04.04-17:07:51] 192.168.90.11 - StringBinding: 192.168.90.11[55339]
[*] [2018.04.04-17:07:51] 192.168.90.11 - StringBinding chosen: ncacn_ip_tcp:192.168.90.11[55339]
[*] [2018.04.04-17:07:52]
Windows IP Configuration
Ethernet adapter Ethernet 5:
Connection-specific DNS Suffix . : foo.lan
Link-local IPv6 Address . . . . . : fe80::9ceb:820e:7c6b:def9%17
IPv4 Address. . . . . . . . . . . : 10.0.3.15
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 10.0.3.2
Ethernet adapter Local Area Connection:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Ethernet adapter Ethernet 3:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Ethernet adapter Ethernet 4:
Connection-specific DNS Suffix . :
IPv4 Address. . . . . . . . . . . : 192.168.90.11
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
Tunnel adapter isatap.foo.lan:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . : foo.lan
Tunnel adapter isatap.{70FE2ED7-E141-40A9-9CAF-E8556F6A4E80}:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
[*] [2018.04.04-17:07:52] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
```
[1]: https://github.com/CoreSecurity/impacket
[2]: https://www.dlitz.net/software/pycrypto/
| Markdown | 3 | OsmanDere/metasploit-framework | documentation/modules/auxiliary/scanner/smb/impacket/dcomexec.md | [
"BSD-2-Clause",
"BSD-3-Clause"
] |
// build-fail
#![feature(repr_simd)]
struct E;
// error-pattern:monomorphising SIMD type `S<E>` with a non-primitive-scalar (integer/float/pointer) element type `E`
#[repr(simd)]
struct S<T>([T; 4]);
fn main() {
let _v: Option<S<E>> = None;
}
| Rust | 2 | mbc-git/rust | src/test/ui/simd/simd-type-generic-monomorphisation-non-primitive.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
# this is sample property file for PropertiesLoaderTest configuration needs
! this is also a comment
sampleConfEntry = sample String value
colonSeparatedEntry : colon separated entry value
| INI | 3 | zeesh49/tutorials | core-java/src/test/resources/configuration.properties | [
"MIT"
] |
At: "inv-01.hac":6:
parse error: syntax error
parser stacks:
state value
#STATE# (null)
#STATE# (null)
#STATE# keyword: defproc [3:1..7]
#STATE# identifier: inv [3:9..11]
#STATE# list<(port-formal-decl)>: (port-formal-decl) ... [3:12..22]
#STATE# { [3:24]
#STATE# keyword: prs [4:1..3]
#STATE# { [4:5]
#STATE# (unknown)
#STATE# } [6:1]
in state #STATE#, possible rules are:
prs_literal_base: prs_internal_optional . relative_member_index_expr (#RULE#)
acceptable tokens are:
ID (shift)
| Bison | 0 | broken-wheel/hacktist | hackt_docker/hackt/test/parser/prs/inv-01.stderr.bison | [
"MIT"
] |
#N canvas 642 81 520 354 12;
#X obj 150 207 metro 100;
#X obj 150 235 snapshot~;
#X floatatom 98 125 5 0 0 0 - - - 0;
#X floatatom 150 261 7 0 0 0 - - - 0;
#X text 215 315 updated for Pd version 0.42.;
#X obj 98 180 abs~;
#X obj 51 18 abs~;
#X text 63 68 Passes nonnegative values unchanged \, but replaces negative
ones with their (positive) inverses., f 49;
#X obj 110 316 abs;
#X text 38 316 see also:;
#X text 90 17 - absolute value for signals;
#X obj 141 316 expr~;
#X obj 150 180 loadbang;
#X obj 251 182 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000
#000000 0 1;
#X msg 251 208 \; pd dsp \$1;
#X obj 98 150 sig~ -10;
#X text 274 181 DSP on/off;
#X connect 0 0 1 0;
#X connect 1 0 3 0;
#X connect 2 0 15 0;
#X connect 5 0 1 0;
#X connect 12 0 0 0;
#X connect 13 0 14 0;
#X connect 15 0 5 0;
| Pure Data | 4 | myQwil/pure-data | doc/5.reference/abs~-help.pd | [
"TCL"
] |
<h1>{{.Title}</h1>
| HTML | 2 | itsursujit/fiber | .github/testdata/template-invalid.html | [
"MIT"
] |
// [full] check-pass
// revisions: full min
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
struct Bar<T>(T);
impl<T> Bar<T> {
const fn value() -> usize {
42
}
}
struct Foo<const N: [u8; Bar::<u32>::value()]>;
//[min]~^ ERROR `[u8; _]` is forbidden as the type of a const generic parameter
fn main() {}
| Rust | 3 | mbc-git/rust | src/test/ui/const-generics/issues/issue-75047.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
// Umbilical Torus generator, by Bruce Mueller 2013/03/30 CC-BY-SA
// inc = incremental segments
inc=5;
// r = radius of circle
// t = 'radius' of triangle -distance from center to vertex
// a = angle of rotation of triangle
// b = angle rotation around center of circle
function tri(r,t,a,b) = [(r + t*sin(a))*cos(b), (r+ t*sin(a))*sin(b), t*cos(a)];
// module to generate a rotated triangle slice, inc degrees wide
// (could not implement this in the for loop below)
module wedge(r,t,i,inc) {
a1 = tri(r,t,i/3,i);
b1 = tri(r,t,120+i/3,i);
c1 = tri(r,t,240+i/3,i);
j=i+inc;
a2 = tri(r,t,j/3,j);
b2 = tri(r,t,120+j/3,j);
c2 = tri(r,t,240+j/3,j);
polyhedron(
points=[a1,b1,c1,a2,b2,c2],
triangles=[ [0,1,2], [5,4,3],
[3,4,0], [1,0,4],
[3,0,2], [3,2,5],
[5,2,4], [4,2,1] ] );
}
// created a conjoined set of triangular wedges around the circle
for (i=[0:inc:360-inc]) {
wedge(2,1,i,inc);
}
| OpenSCAD | 4 | samiwa/test | examples/umbilical_torus.scad | [
"MIT"
] |
// test of Scape Chubgraph
//
// This example uses the caps library
// from http://quitte.de/dsp/caps.html
// installed in /usr/local/lib/ladspa/caps.so
// (If it's in another location, change the path
// in Scape.ck)
//
// Run with: chuck Scape.ck scape-test.ck
adc => Scape scape => dac;
scape.ladspa.info();
120 => scape.bpm;
minute => now; | ChucK | 4 | mariobuoninfante/chugins | Ladspa/scape-test.ck | [
"MIT"
] |
---
title: "Regular polygons and ellipses in grid graphics"
author: "Baptiste Auguie"
date: '`r Sys.Date()`'
vignette: >
%\VignetteEngine{knitr::rmarkdown}
%\VignetteIndexEntry{ngonGrob: regular polygons and ellipses in grid graphics}
output:
knitr:::html_vignette:
toc: yes
---
```{r setup, echo=FALSE, results='hide'}
library(knitr)
opts_chunk$set(message=FALSE, fig.width=4, fig.height=3)
```
The `gridExtra` package provides a basic implementation of regular polygons, `ngonGrob()/grid.ngon`, and a convenience function to draw ellipses, `ellipseGrob()/grid.ellipse()`. We illustrate below the basic usage of these vectorised functions.
## Basic usage
```{r basic}
library(gridExtra)
library(grid)
library(grid)
N <- 5
xy <- polygon_regular(N)*2
# draw multiple polygons
g <- ngonGrob(unit(xy[,1],"cm") + unit(0.5,"npc"),
unit(xy[,2],"cm") + unit(0.5,"npc"),
n=seq_len(N)+2, gp=gpar(fill=1:N))
grid.newpage()
grid.draw(g)
```
## Rotated and stretched polygons
```{r rotated}
g2 <- ngonGrob(unit(xy[,1],"cm") + unit(0.5,"npc"),
unit(xy[,2],"cm") + unit(0.5,"npc"),
n=seq_len(N)+2, ar=seq_len(N),
phase=0, angle=pi/(seq_len(N)+2),
size=1:N+5, gp=gpar(fill=1:N))
grid.newpage()
grid.draw(g2)
```
## Ellipses
```{r ellipse}
g3 <- ellipseGrob(unit(xy[,1],"cm") + unit(0.5,"npc"),
unit(xy[,2],"cm") + unit(0.5,"npc"),
angle=-2*seq(0,N-1)*pi/N+pi/2,
size=5, ar=3, gp=gpar(fill=1:N))
grid.newpage()
grid.draw(g3)
```
| RMarkdown | 4 | Chicago-R-User-Group/2017-n3-Meetup-RStudio | packrat/lib/x86_64-pc-linux-gnu/3.2.5/gridExtra/doc/ngonGrob.rmd | [
"MIT"
] |
{default $class = NULL, $namespace = NULL, $top = TRUE}
<!DOCTYPE html>
<head>
<title>{block title|stripHtml|upper}My website{/block}</title>
</head>
<body>
<div id="sidebar">
{block sidebar}
<ul>
<li><a href="/">Homepage</a></li>
</ul>
{/block}
</div>
<div id="content">
{include content}
{include content|stripHtml|upper}
</div>
</body>
</html>
Parent: {basename($this->getReferringTemplate()->getName())}/{$this->getReferenceType()}
| Latte | 4 | TheDigitalOrchard/latte | tests/Latte/templates/BlockMacros.parent.latte | [
"BSD-3-Clause"
] |
// More complex version of hello world
>++++++++[<+++++++++>-]<.>>+>+>++>[-]+<[>[->+<<++++>]<<]>.+++++++..+++.>
>+++++++.<<<[[-]<[-]>]<+++++++++++++++.>>.+++.------.--------.>>+.>++++. | Brainfuck | 2 | JavascriptID/sourcerer-app | src/test/resources/samples/langs/Brainfuck/hello.bf | [
"MIT"
] |
OBTW
This is a FizzBuzz solution in the
esoteric programming LOLCODE! :)
Author: @NLDev
TLDR
HAI 1.2
I HAS A VAR ITZ 1
IM IN YR LOOP UPPIN YR VAR TIL BOTH SAEM VAR AN 101
I HAS A FIFTEN ITZ MOD OF VAR AN 15
I HAS A FIVE ITZ MOD OF VAR AN 5
I HAS A THREE ITZ MOD OF VAR AN 3
BOTH SAEM FIFTEN AN 0, O RLY?
YA RLY
VISIBLE "FizzBuzz"
MEBBE BOTH SAEM FIVE AN 0
VISIBLE "Buzz"
MEBBE BOTH SAEM THREE AN 0
VISIBLE "Fizz"
NO WAI
VISIBLE VAR
OIC
IM OUTTA YR LOOP
KTHXBYE
| LOLCODE | 4 | veotani/Hacktoberfest-2020-FizzBuzz | LOLCODE/FizzBuzz-lolcode.lol | [
"Unlicense"
] |
Clean | 0 | bo3b/iZ3D | TestsPack/DX10ShaderAnalyzingTest/Shaders/shader9_0x1C6711EA.dcl | [
"MIT"
] |
|
/*
* This is a L3 version of tester. Port 0 and 1 are expected to be attached to the
* two interface of your DUT.
* Port 0 will only generate packets while port 1 expects to receive packets back.
* Both ports will respond to ARP queries.
*
* Author: Tom Barbette <[email protected]>, Lida Liu <[email protected]>
*/
define($L 60, $N 100, $S 100000);
define($block true);
define($ring_size 0); //virtio needs a direct assignation of 512, use 0 for automatic
define($dstmac 52:54:00:1e:4f:f3);
define($srcmac 52:54:00:ef:81:e0);
AddressInfo(
lan_interface 192.168.100.166 52:54:00:ef:81:e0,
wan_interface 192.168.200.219 52:54:00:50:07:4b
);
DPDKInfo(65536);
replay0 :: ReplayUnqueue(STOP $S, QUICK_CLONE 0);
td0 :: ToDPDKDevice(0, NDESC $ring_size, BLOCKING $block);
td1 :: ToDPDKDevice(1, NDESC $ring_size, BLOCKING $block);
class_left :: Classifier(12/0806 20/0001, -);
class_right :: Classifier(12/0806 20/0001, -);
is0 :: FastUDPFlows(RATE 0, LIMIT $N, LENGTH $L, SRCETH 52:54:00:ef:81:e0, DSTETH $dstmac, SRCIP 192.168.100.166, DSTIP 192.168.200.219, FLOWS 1, FLOWSIZE $N);
StaticThreadSched(replay0 0);
is0 -> MarkMACHeader
-> EnsureDPDKBuffer
-> replay0
-> ic0 :: AverageCounter()
-> td0;
fd0 :: FromDPDKDevice(0, NDESC 512) -> class_left;
fd1 :: FromDPDKDevice(1, NDESC 512) -> class_right;
class_left[0] -> ARPResponder(lan_interface) -> td0; //ARP Requests
class_left[1] -> oc0 :: AverageCounter() -> Discard; // Others Counting
class_right[0] -> ARPResponder(wan_interface) -> td1; //ARP Requests
class_right[1] -> oc1 :: AverageCounter() -> Discard; // Others Counting
DriverManager(wait, wait 10ms, print $(ic0.count), print $(oc1.count), print $(ic0.link_rate), print $(oc1.link_rate));
| Click | 4 | BorisPis/asplos22-nicmem-fastclick | conf/pktgen/tester-l3.click | [
"BSD-3-Clause-Clear"
] |
// Daniel Shiffman
// http://codingtra.in
// http://patreon.com/codingtrain
// Pong
// https://youtu.be/IIrC5Qcb2G4
class Paddle {
float x;
float y = height/2;
float w = 20;
float h = 100;
float ychange = 0;
Paddle(boolean left) {
if (left) {
x = w;
} else {
x = width - w;
}
}
void update() {
y += ychange;
y = constrain(y, h/2, height-h/2);
}
void move(float steps) {
ychange = steps;
}
void show() {
fill(255);
rectMode(CENTER);
rect(x, y, w, h);
}
}
| Processing | 4 | aerinkayne/website | CodingChallenges/CC_067_Pong/Processing/CC_067_Pong/Paddle.pde | [
"MIT"
] |
\require "g@>=0.2.2" | LilyPond | 0 | HolgerPeters/lyp | spec/package_setups/big/[email protected]/package.ly | [
"MIT"
] |
# N3 paths
@prefix : <http://www.w3.org/2013/TurtleTests/> .
@prefix ns: <http://www.w3.org/2013/TurtleTests/p#> .
:x^ns:p :p :z .
| Turtle | 2 | joshrose/audacity | lib-src/lv2/serd/tests/TurtleTests/turtle-syntax-bad-n3-extras-04.ttl | [
"CC-BY-3.0"
] |
// (c) Copyright 1995-2018 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a license and does not grant any
// rights to the materials distributed herewith. Except as
// otherwise provided in a valid license issued to you by
// Xilinx, and to the maximum extent permitted by applicable
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
// (2) Xilinx shall not be liable (whether in contract or tort,
// including negligence, or under any other theory of
// liability) for any loss or damage of any kind or nature
// related to, arising under or in connection with these
// materials, including for any direct, or any indirect,
// special, incidental, or consequential loss or damage
// (including loss of data, profits, goodwill, or any type of
// loss or damage suffered as a result of any action brought
// by a third party) even if such damage or loss was
// reasonably foreseeable or Xilinx had been advised of the
// possibility of the same.
//
// CRITICAL APPLICATIONS
// Xilinx products are not designed or intended to be fail-
// safe, or for use in any application requiring fail-safe
// performance, such as life-support or safety devices or
// systems, Class III medical devices, nuclear facilities,
// applications related to the deployment of airbags, or any
// other applications that could lead to death, personal
// injury, or severe property or environmental damage
// (individually and collectively, "Critical
// Applications"). Customer assumes the sole risk and
// liability of any use of Xilinx products in Critical
// Applications, subject only to applicable laws and
// regulations governing limitations on product liability.
//
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
// PART OF THIS FILE AT ALL TIMES.
//
// DO NOT MODIFY THIS FILE.
// IP VLNV: xilinx.com:ip:xadc_wiz:3.3
// IP Revision: 5
// The following must be inserted into your Verilog file for this
// core to be instantiated. Change the instance name and port connections
// (in parentheses) to your own signal names.
//----------- Begin Cut here for INSTANTIATION Template ---// INST_TAG
xadc_wiz_0 your_instance_name (
.di_in(di_in), // input wire [15 : 0] di_in
.daddr_in(daddr_in), // input wire [6 : 0] daddr_in
.den_in(den_in), // input wire den_in
.dwe_in(dwe_in), // input wire dwe_in
.drdy_out(drdy_out), // output wire drdy_out
.do_out(do_out), // output wire [15 : 0] do_out
.dclk_in(dclk_in), // input wire dclk_in
.reset_in(reset_in), // input wire reset_in
.vp_in(vp_in), // input wire vp_in
.vn_in(vn_in), // input wire vn_in
.vauxp6(vauxp6), // input wire vauxp6
.vauxn6(vauxn6), // input wire vauxn6
.vauxp7(vauxp7), // input wire vauxp7
.vauxn7(vauxn7), // input wire vauxn7
.user_temp_alarm_out(user_temp_alarm_out), // output wire user_temp_alarm_out
.vccint_alarm_out(vccint_alarm_out), // output wire vccint_alarm_out
.vccaux_alarm_out(vccaux_alarm_out), // output wire vccaux_alarm_out
.ot_out(ot_out), // output wire ot_out
.channel_out(channel_out), // output wire [4 : 0] channel_out
.eoc_out(eoc_out), // output wire eoc_out
.alarm_out(alarm_out), // output wire alarm_out
.eos_out(eos_out), // output wire eos_out
.busy_out(busy_out) // output wire busy_out
);
// INST_TAG_END ------ End INSTANTIATION Template ---------
// You must compile the wrapper file xadc_wiz_0.v when simulating
// the core, xadc_wiz_0. When compiling the wrapper file, be sure to
// reference the Verilog simulation library.
| Verilog | 4 | MJurczak-PMarchut/uec2_DeathRace | vivado/DeathRace.srcs/sources_1/ip/xadc_wiz_0/xadc_wiz_0.veo | [
"MIT"
] |
insert into a values
(268435456, '268435456'),
(1, 'adgagdadgagag'),
(262144, 'gadgagaha'),
(32, '32'),
(4, 'hahaha'),
(65536, 'luck dog'),
(8388608, 'heyhey'),
(0, '999');
| SQL | 2 | cuishuang/tidb | br/tests/lightning_partitioned-table/data/partitioned.a.sql | [
"Apache-2.0"
] |
HTTP/1.1 200 OK
Content-Type: application/json
{
"asset": {
"data": {
"msg": "Hello BigchainDB!"
}
},
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [
{
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUCy4BR6gKaYT-tdyAGPPpknIqI4JYQQ-p2nCg3_9BfOI-15vzldhyz-j_LZVpqAlRmbTzKS-Q5gs7ZIFaZCA_UD",
"fulfills": null,
"owners_before": [
"4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD"
]
}
],
"metadata": {
"sequence": 0
},
"operation": "CREATE",
"outputs": [
{
"amount": "1",
"condition": {
"details": {
"public_key": "4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD",
"type": "ed25519-sha-256"
},
"uri": "ni:///sha-256;PNYwdxaRaNw60N6LDFzOWO97b8tJeragczakL8PrAPc?fpt=ed25519-sha-256&cost=131072"
},
"public_keys": [
"4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD"
]
}
],
"version": "2.0"
}
| HTTP | 3 | jaromil/bigchaindb | docs/root/source/installation/api/http-samples/get-tx-id-response.http | [
"Apache-2.0"
] |
.style {
grid-template-columns: minmax(1fr, 200px);
}
| CSS | 3 | mengxy/swc | crates/swc_css_parser/tests/errors/rome/invalid/grid/minmax/.incorrect-flex/input.css | [
"Apache-2.0"
] |
'Ok, little example of converting objects to/from JSON using reflection
'
'Also handles built in list, stack and map classes.
'
'CAN'T HANDLE CYCLES!!!!!
#REFLECTION_FILTER="jsonstream*|monkey.list|monkey.stack|monkey.map"
Import reflection
Class JsonStream
Method New()
End
Method New( json$ )
WriteJson json
End
Method New( obj:Object )
WriteObject obj
End
Method ReadJson$()
ValidateJson
Local t:=json[pos..]
peeked=""
json=""
pos=0
Return t
End
Method ReadObject:Object()
Local t:=Read()
If Not t JsonErr
If IsDigit( t[0] )
If t.Contains( "e" ) Or t.Contains( "." ) Return BoxFloat( Float(t) )
Return BoxInt( Int(t) )
Else If t[0]="~q"[0]
Return BoxString( t[1..-1] )
Else If t="null"
Return Null
Endif
If t<>"{" JsonErr
Local name:=Read()
If name.StartsWith( "~q" ) And name.EndsWith( "~q" ) name=name[1..-1]
Local clas:=GetClass( name )
If Not clas JsonErr
If Read()<>":" JsonErr
Local obj:Object
If Peek()="["
Read
Local elems:=New Stack<Object>
While Peek()<>"]"
If Not elems.IsEmpty() And Read()<>"," JsonErr
elems.Push ReadObject()
Wend
Read
Local n:=elems.Length
'get monkey base class
Local mclas:=clas
While mclas And Not mclas.Name.StartsWith( "monkey." )
mclas=mclas.SuperClass
Wend
Local mname:=mclas.Name
If mname.StartsWith( "monkey.list." ) Or mname.StartsWith( "monkey.stack." )
Local elemty:=clas.GetMethod( "ToArray",[] ).ReturnType.ElementType
Local add:=clas.GetMethod( "AddLast",[elemty] )
If Not add add=clas.GetMethod( "Push",[elemty] )
obj=clas.NewInstance()
For Local i=0 Until n
add.Invoke( obj,[elems.Get(i)] )
Next
Else If mname.StartsWith( "monkey.map." )
Local objenumer:=clas.GetMethod( "ObjectEnumerator",[] )
Local nextobj:=objenumer.ReturnType.GetMethod( "NextObject",[] )
Local getkey:=nextobj.ReturnType.GetMethod( "Key",[] )
Local getval:=nextobj.ReturnType.GetMethod( "Value",[] )
Local set:=clas.GetMethod( "Set",[getkey.ReturnType,getval.ReturnType] )
obj=clas.NewInstance()
For Local i=0 Until n Step 2
set.Invoke( obj,[elems.Get(i),elems.Get(i+1)] )
Next
Else
obj=clas.NewArray( n )
For Local i=0 Until n
clas.SetElement( obj,i,elems.Get(i) )
Next
Endif
Else If Peek()="{"
Read
obj=clas.NewInstance
Local i:=0
While Peek()<>"}"
If i And Read()<>"," JsonErr
Local id:=Read()
If id.StartsWith("~q") And id.EndsWith("~q") id=id[1..-1]
Local f:=clas.GetField( id )
If Not f Error "Field '"+id+"' not found"
If Read()<>":" JsonErr
f.SetValue( obj,ReadObject() )
i+=1
Wend
Read
Else
JsonErr
Endif
If Read()<>"}" JsonErr
Return obj
End
Method WriteJson:Void( json$ )
Write json
End
Method WriteObject:Void( obj:Object )
If Not obj
Write "null"
Return
Endif
Local clas:=GetClass( obj )
If clas=IntClass()
Local t:=String( UnboxInt( obj ) ).ToLower()
If t.Contains( "." ) t=t[..t.Find(".")]
If t.Contains( "e" ) t=t[..t.Find("e")]
Write t
Return
Else If clas=FloatClass()
Local t:=String( UnboxFloat( obj ) ).ToLower()
If Not t.Contains( "." ) And Not t.Contains( "e" ) t+=".0"
Write t
Return
Else If clas=StringClass()
Local t:=String( UnboxString( obj ) )
t=t.Replace( "~q","~~q" )
t="~q"+t+"~q"
Write t
Return
Endif
Local name:=clas.Name
'write class..
Write "{"
Write "~q"+name+"~q"
Write ":"
'array?
Local elemty:=clas.ElementType
If elemty
Write "["
For Local i=0 Until clas.ArrayLength( obj )
If i Write ","
WriteObject clas.GetElement( obj,i )
Next
Write "]"
Write "}"
Return
Endif
'Get base monkey name/class
Local mclas:=clas
While mclas And Not mclas.Name.StartsWith( "monkey." )
mclas=mclas.SuperClass
Wend
Local mname:=mclas.Name
'list or stack?
If mname.StartsWith( "monkey.list." ) Or mname.StartsWith( "monkey.stack." )
Write "["
Local toarr:=clas.GetMethod( "ToArray",[] )
Local arrty:=toarr.ReturnType
Local arr:=toarr.Invoke( obj,[] )
Local len:=arrty.ArrayLength( arr )
For Local i=0 Until len
If i Write ","
WriteObject arrty.GetElement( arr,i )
Next
Write "]"
'map?
Else If mname.StartsWith( "monkey.map." )
Write "["
Local objenumer:=clas.GetMethod( "ObjectEnumerator",[] )
Local hasnext:=objenumer.ReturnType.GetMethod( "HasNext",[] )
Local nextobj:=objenumer.ReturnType.GetMethod( "NextObject",[] )
Local getkey:=nextobj.ReturnType.GetMethod( "Key",[] )
Local getval:=nextobj.ReturnType.GetMethod( "Value",[] )
Local enumer:=objenumer.Invoke( obj,[] ),n:=0
While UnboxBool( hasnext.Invoke( enumer,[] ) )
Local node:=nextobj.Invoke( enumer,[] )
Local key:=getkey.Invoke( node,[] )
Local val:=getval.Invoke( node,[] )
If n Write ","
WriteObject key
Write ","
WriteObject val
n+=2
Wend
Write "]"
'user object?
Else
'better not be cyclic..!
Write "{"
Local n:=0
For Local f:=Eachin clas.GetFields( True )
If n Write ","
Write "~q"+f.Name+"~q"
Write ":"
WriteObject f.GetValue( obj )
n+=1
Next
Write "}"
Endif
Write "}"
End
Private
Field indent$
Field json$,pos,peeked$
Field buf:=New StringStack
Method JsonErr()
Error "Bad JSON!"
End
Method ValidateJson()
If buf.Length
json+=buf.Join("")
buf.Clear
Endif
End
Method IsDigit?( ch )
Return ch>=48 And ch<=57
End
Method IsAlpha?( ch )
Return (ch>=65 And ch<=90) Or (ch>=97 And ch<=122) Or (ch=95)
End
Method Peek$()
If Not peeked peeked=Read()
Return peeked
End
Method Read$()
If peeked
Local t:=peeked
peeked=""
Return t
Endif
ValidateJson
While pos<json.Length And json[pos]<=32
pos+=1
Wend
Local c:=Chr()
If Not c Return
Local st:=pos
pos+=1
If IsAlpha( c )
While IsAlpha( Chr() ) Or IsDigit( Chr() )
pos+=1
Wend
Else If IsDigit( c )
SkipDigits
If Chr()="."[0]
pos+=1
SkipDigits
Endif
If Chr()="e"[0]
pos+=1
If Chr()="+"[0] Or Chr()="-"[0]
pos+=1
Endif
SkipDigits
Endif
Else If c="~q"[0]
While Chr() And Chr()<>"~q"[0]
pos+=1
Wend
If Chr()="~q"[0] pos+=1
Endif
Return json[st..pos]
End
Method Write( t$ )
Select t
Case "{","["
indent+=" "
t+="~n"+indent
Case "}","]"
indent=indent[1..]
t="~n"+indent+t
Case ","
t+="~n"+indent
End
buf.Push t
End
Private
Method Chr()
If pos<json.Length Return json[pos]
Return 0
End
Method SkipDigits()
While IsDigit( Chr() )
pos+=1
Wend
End
End
'***** Demo of using stream *****
Class Vec3
Field x#,y#,z#
Method New( x#,y#,z# )
Self.x=x
Self.y=y
Self.z=z
End
End
Class Vec4 Extends Vec3
Field w#
Method New( x#,y#,z#,w# )
Self.x=x
Self.y=y
Self.z=z
Self.w=w
End
End
Class Test
Field x=100
Field y#=200
Field z$=300
Field xs[]=[1,2]
Field ys#[]=[1.0,2.0]
Field zs$[]=["1","2"]
Field intlist:=New IntList
Field vecstack:=New Stack<Vec3>
Field vecarray:=New Vec3[10]
Field mapofvecs:=New StringMap<Vec3>
Method New()
End
Method Init()
intlist.AddLast 10
intlist.AddLast 20
intlist.AddLast 30
vecstack.Push New Vec4(1,2,3,4)
vecstack.Push Null
vecstack.Push New Vec3(7,8,9)
For Local i=0 Until 10 Step 2
vecarray[i]=New Vec3( i,i*2,i*3 )
Next
mapofvecs.Set "A",New Vec3(1,2,3)
mapofvecs.Set "B",New Vec4(4,5,6,7)
End
End
Function Main()
Local test:=New Test
test.Init
Local stream:=New JsonStream
stream.WriteObject test
Local json:=stream.ReadJson()
stream.WriteJson json
Local obj:=stream.ReadObject()
stream.WriteObject obj
Local json2:=stream.ReadJson()
If json=json2
Print json
Print "SUCCESS!"
Else
Print json
Print json2
Print "ERROR!!!!!"
Endif
End
| Monkey | 5 | blitz-research/monkey | bananas/mak/jsonstream/jsonstream.monkey | [
"Zlib"
] |
// This is a ragel file for generating a paser for MTL files
// Note that some MTL files are whitespace sensitive
// Mainly with unquoted string names with spaces
// ala
//
// newmtl material name with spaces and no quotes
//
// or
//
// map_Kd my texture file.png
//
%%{
machine simple_lexer;
default = ^0;
lineend = ('\n' | '\r\n');
greyspace = [\t\v\f ];
comment = '#'[^\r\n]* . lineend;
action appendString { recentString += *p; }
action storeString
{
Token tok;
tok.StringValue = recentString;
tok.Type = Token::String;
tokens.push_back(tok);
recentString.clear();
currentNum.clear();
recentSpace.clear();
}
string = ([^\t\v\f\r\n ]+ @appendString);
action appendSpace { recentSpace += *p; }
action storeSpace
{
Token tok;
tok.StringValue = recentSpace;
tok.Type = Token::Space;
tokens.push_back(tok);
recentSpace.clear();
currentNum.clear();
recentString.clear();
}
spacestring = ([\t\v\f ]+ @appendSpace);
action appendNum { currentNum += *p; }
action storeNum
{
currentNum += '\0';
Token tok;
tok.StringValue = currentNum;
tok.NumberValue = std::atof(currentNum.c_str());
tok.Type = Token::Number;
tokens.push_back(tok);
currentNum.clear();
recentString.clear();
recentSpace.clear();
}
number = ('+'|'-')? @appendNum [0-9]+ @appendNum ('.' @appendNum [0-9]+ @appendNum)?;
main := |*
comment => { currentNum.clear(); recentString.clear(); recentSpace.clear(); };
number => storeNum;
string => storeString;
spacestring => storeSpace;
lineend =>
{
Token tok;
tok.Type = Token::LineEnd;
tokens.push_back(tok);
currentNum.clear(); recentString.clear(); recentSpace.clear();
};
default => { std::string value = "Error unknown text: "; value += std::string(ts, te-ts); cerr << value << "\n"; };
*|;
}%%
%% write data;
int parseMTL(
const char *start,
std::vector<Token> &tokens
)
{
int act, cs, res = 0;
const char *p = start;
const char *pe = p + strlen(start) + 1;
const char *eof = pe;
const char *ts = nullptr;
const char *te = nullptr;
std::string recentString;
std::string recentSpace;
std::string currentNum;
%% write init;
%% write exec;
return res;
}
| Ragel in Ruby Host | 4 | forestGzh/VTK | IO/Import/mtlsyntax.rl | [
"BSD-3-Clause"
] |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
//This contract is purely here to make sure that
//internal sources are generated, to make sure that the decoder
//doesn't choke on them
contract SliceTest {
function slice(uint[] calldata arr) public pure returns (uint[] calldata) {
return arr[1:arr.length - 1];
}
}
| Solidity | 3 | santanaluiz/truffle | packages/decoder/test/current/contracts/SliceTest.sol | [
"MIT"
] |
# Copyright (c) 2018-2021, Carnegie Mellon University
# See LICENSE for details
#F _IPCodeSums(<sums-spl>, <x-input-output-var>)
#F
#F Generates unoptimize inplace loop code for <sums-spl>
#F if we know how (i.e. 'ipcode' methods exist for <sums-spl>)
#F
_IPCodeSums := function(sums, x)
local code;
code := sums.ipcode(x);
code.dimensions := sums.dimensions;
code.root := sums;
return code;
end;
Inplace.ipcode := (self, x) >> _IPCodeSums(self.child(1), x);
Inplace.code := (self, y, x) >> self.child(1).code(y,x);
#let(i := Ind(),
# chain(self.child(1).ipcode(x),
# loop(i, Rows(self), assign(nth(y,i), nth(x,i)))));
#
LStep.ipcode := (self, x) >> _CodeSumsAcc(self.child(1), x, x);
Compose.ipcode := (self, x) >> chain(
List(Reversed(self.children()), c->_IPCodeSums(c, x)));
SUM.ipcode := (self, x) >> chain(
List(self.children(), c->_IPCodeSums(c, x)));
#2x2 inplace blockmat (one entry must be 0)
#A B
#0 C
#Inplace(A%G0 + S0''*B*G1 + C%G1);
BB.ipcode := (self, x) >> MarkForUnrolling(_CodeSums(self.child(1), x, x));
Blk.ipcode := (self, x) >> MarkForUnrolling(_CodeSums(self, x, x));
ISum.ipcode := (self, x) >> _CodeSums(self,x,x);
| GAP | 4 | sr7cb/spiral-software | namespaces/spiral/compiler/sums2ipcode.gi | [
"BSD-2-Clause-FreeBSD"
] |
@import Foundation;
@interface Foo: NSObject
- (BOOL)foo:(int)x error:(NSError**)error;
- (BOOL)foothrows:(int)x error:(NSError**)error;
@end
| C | 3 | lwhsu/swift | test/stdlib/Inputs/ErrorBridgedStaticImpl.h | [
"Apache-2.0"
] |
# Copyright (c) 2018-2021, Carnegie Mellon University
# See LICENSE for details
#---------------------------------------------------------------------------------------
# SPU vector instructions
#---------------------------------------------------------------------------------------
Class(vbinop_8x16i_spu, vbinop_spu, rec( v := self >> 8));
Class(vbinop_4x32f_spu, vbinop_spu, rec( v := self >> 4));
Class(vbinop_2x64f_spu, vbinop_spu, rec( v := self >> 2));
Class(exp_8x16i, rec(v := 8, computeType := self >> TVect(TInt, 8)));
Class(exp_4x32f, rec(v := 4, computeType := self >> TVect(TDouble, 4)));
Class(exp_2x64f, rec(v := 2, computeType := self >> TVect(TDouble, 2)));
Class(cmd_8x16i, rec(v := 8, computeType := self >> TVect(TInt, 8)));
Class(cmd_4x32f, rec(v := 4, computeType := self >> TVect(TDouble, 4)));
Class(cmd_2x64f, rec(v := 2, computeType := self >> TVect(TDouble, 2)));
# Load -----------------------------
Class(vloadu8_spu8x16i, vloadop_new, exp_8x16i, rec(numargs := 1));
Class(vloadu4_spu4x32f, vloadop_new, exp_4x32f, rec(numargs := 1));
# Store ----------------------------
# Zero -----------------------------
Class(vzero_8x16i, vop_new, exp_8x16i, rec(numargs := 0));
Class(vzero_4x32f, vop_new, exp_4x32f, rec(numargs := 0));
Class(vzero_2x64f, vop_new, exp_2x64f, rec(numargs := 0));
# Subvec ---------------------------
Class(promote_spu8x16i, vbinop_new, exp_8x16i);
Class(promote_spu4x32f, vbinop_new, exp_4x32f);
Class(promote_spu2x64f, vbinop_new, exp_2x64f);
Class(extract_spu8x16i, vbinop_new, exp_8x16i, rec(computeType := self >> TInt));
Class(extract_spu4x32f, vbinop_new, exp_4x32f, rec(computeType := self >> TReal));
Class(extract_spu2x64f, vbinop_new, exp_2x64f, rec(computeType := self >> TReal));
Class(insert_spu8x16i, vop_new, exp_8x16i, rec(numargs := 3));
Class(insert_spu4x32f, vop_new, exp_4x32f, rec(numargs := 3));
Class(insert_spu2x64f, vop_new, exp_2x64f, rec(numargs := 3));
Class(vsplat_8x16i, vloadop_new, exp_8x16i, rec(numargs := 1));
Class(vsplat_4x32f, vloadop_new, exp_4x32f, rec(numargs := 1));
Class(vsplat_2x64f, vloadop_new, exp_2x64f, rec(numargs := 1));
# Binary ---------------------------
# VA: This breaks bin_or, looks like something unfinished so commented out.
# Class(bin_or, vbinop_new, exp_8x16i);
# Class(bin_or, vbinop_new, exp_4x32f);
# Class(bin_or, vbinop_new, exp_2x64f);
# Rotates ---------------------------
Class(slqwbyte_spu4x32f, vop_new, exp_4x32f, rec(numargs := 1));
Class(rlmaskqwbyte_spu4x32f, vop_new, exp_4x32f, rec(numargs := 1));
# Binary shuffle -------------------
#NOTE: What are sparams, params, semantic, and permparams?
#NOTE: Can we combine all these perms into the same thing somehow?
Class(vperm_8x16i_spu, vbinop_8x16i_spu, rec(
semantic := (in1, in2, p) -> vpermop(in1, in2, p, 8),
params := self >> sparams(8, 16),
from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), [rch[1], rch[2], rch[3].p]),
permparams := aperm
));
Class(vperm_4x32f_spu, vbinop_4x32f_spu, rec(
semantic := (in1, in2, p) -> vpermop(in1, in2, p, 4),
params := self >> sparams(4, 8),
#HACK: small hack: it'd be nice to not define from_rChildren explicitly
#here. We have to do it though, because the last param is a perm
#(vparam_spu) type, but the object must be created with a List, and not a
#vparam_spu.
from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), [rch[1], rch[2], rch[3].p]),
permparams := aperm
));
Class(vperm_2x64f_spu, vbinop_2x64f_spu, rec(
semantic := (in1, in2, p) -> vpermop(in1, in2, p, 2),
params := self >> sparams(2, 4),
from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), [rch[1], rch[2], rch[3].p]),
permparams := aperm
));
# Unary shuffle --------------------
Class(vuperm_8x16i_spu, vunbinop_spu,
rec(binop := vperm_8x16i_spu,
from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), [rch[1], rch[2].p])
));
Class(vuperm_4x32f_spu, vunbinop_spu,
rec(binop := vperm_8x16i_spu,
from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), [rch[1], rch[2].p])
));
Class(vuperm_2x64f_spu, vunbinop_spu,
rec(binop := vperm_8x16i_spu,
from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), [rch[1], rch[2].p])
));
| GAP | 3 | sr7cb/spiral-software | namespaces/spiral/platforms/cellSPU/code.gi | [
"BSD-2-Clause-FreeBSD"
] |
<?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"
xmlns:p= "http://www.w3.org/ns/xproc"
xmlns:c= "http://www.w3.org/ns/xproc-step"
xmlns:l ="http://xproc.org/library"
xmlns:xhtml ="http://www.w3.org/1999/xhtml"
xmlns:calli ="http://callimachusproject.org/rdf/2009/framework#">
<p:serialization port="result" media-type="text/html" method="html" doctype-system="about:legacy-compat" />
<p:option name="target" select="resolve-uri('/')" />
<p:option name="query" select="''" />
<p:import href="page-layout-html.xpl" />
<p:choose>
<p:when test="/c:data[starts-with(@content-type,'text/html')]">
<p:unescape-markup content-type="text/html" />
<p:unwrap match="/c:data" />
</p:when>
<p:otherwise>
<p:identity />
</p:otherwise>
</p:choose>
<p:identity name="page" />
<p:identity>
<p:input port="source">
<p:inline>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div class="container">
<h1></h1>
<pre></pre>
</div>
</body>
</html>
</p:inline>
</p:input>
</p:identity>
<p:choose>
<p:xpath-context>
<p:pipe step="page" port="result" />
</p:xpath-context>
<p:when test="//xhtml:pre and //xhtml:h1 and //xhtml:title">
<p:replace match="xhtml:title">
<p:input port="replacement" select="//xhtml:title">
<p:pipe step="page" port="result" />
</p:input>
</p:replace>
<p:replace match="xhtml:h1">
<p:input port="replacement" select="//xhtml:h1">
<p:pipe step="page" port="result" />
</p:input>
</p:replace>
<p:replace match="xhtml:pre">
<p:input port="replacement" select="//xhtml:pre">
<p:pipe step="page" port="result" />
</p:input>
</p:replace>
</p:when>
<p:when test="//xhtml:h1 and //xhtml:title">
<p:replace match="xhtml:title">
<p:input port="replacement" select="//xhtml:title">
<p:pipe step="page" port="result" />
</p:input>
</p:replace>
<p:replace match="xhtml:h1">
<p:input port="replacement" select="//xhtml:h1">
<p:pipe step="page" port="result" />
</p:input>
</p:replace>
<p:delete match="xhtml:pre" />
</p:when>
<p:when test="//xhtml:title">
<p:replace match="xhtml:title">
<p:input port="replacement" select="//xhtml:title">
<p:pipe step="page" port="result" />
</p:input>
</p:replace>
<p:replace match="xhtml:h1">
<p:input port="replacement" select="//xhtml:title">
<p:pipe step="page" port="result" />
</p:input>
</p:replace>
<p:delete match="xhtml:pre" />
</p:when>
<p:otherwise>
<p:identity>
<p:input port="source">
<p:pipe step="page" port="result" />
</p:input>
</p:identity>
</p:otherwise>
</p:choose>
<calli:page-layout-html>
<p:with-option name="target" select="$target" />
<p:with-option name="query" select="$query" />
</calli:page-layout-html>
</p:pipeline>
| XProc | 3 | 3-Round-Stones/callimachus | webapp/pipelines/error.xpl | [
"ECL-2.0",
"Apache-2.0",
"BSD-3-Clause"
] |
[
(function_definition)
(while_statement)
(for_statement)
(if_statement)
(begin_statement)
(switch_statement)
] @indent
[
(else_if_clause)
(else_clause)
"end"
] @branch
(comment) @ignore
| Scheme | 3 | hmac/nvim-treesitter | queries/fish/indents.scm | [
"Apache-2.0"
] |
<%= form_tag Routes.person_path(@conn, :subscribe), id: "subscribe", class: "signup-form" do %>
<input name="to" type="hidden" value="<%= SharedHelpers.get_assigns_or_param(assigns, "to", "weekly") %>">
<input name="email" class="signup-form-input" placeholder="[email protected]" aria-label="[email protected]" required/>
<div class="signup-form-submit">
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<input class="signup-form-submit-button g-recaptcha" data-sitekey="6Lda3LoaAAAAAMoUFKUgxnxX91FQKzy9pY8t435v" data-callback="subscribeCaptcha" type="submit" value="Subscribe">
<script>function subscribeCaptcha() { document.getElementById("subscribe").submit(); }</script>
</div>
<% end %>
| HTML+EEX | 4 | snyk-omar/changelog.com | lib/changelog_web/templates/shared/_subscribe_form.html.eex | [
"MIT"
] |
"""Support for tracking a Volvo."""
from __future__ import annotations
from collections.abc import Awaitable, Callable
from homeassistant.components.device_tracker import SOURCE_TYPE_GPS
from homeassistant.core import HomeAssistant
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from homeassistant.util import slugify
from . import DATA_KEY, SIGNAL_STATE_UPDATED
async def async_setup_scanner(
hass: HomeAssistant,
config: ConfigType,
async_see: Callable[..., Awaitable[None]],
discovery_info: DiscoveryInfoType | None = None,
) -> bool:
"""Set up the Volvo tracker."""
if discovery_info is None:
return False
vin, component, attr, slug_attr = discovery_info
data = hass.data[DATA_KEY]
instrument = data.instrument(vin, component, attr, slug_attr)
async def see_vehicle():
"""Handle the reporting of the vehicle position."""
host_name = instrument.vehicle_name
dev_id = f"volvo_{slugify(host_name)}"
await async_see(
dev_id=dev_id,
host_name=host_name,
source_type=SOURCE_TYPE_GPS,
gps=instrument.state,
icon="mdi:car",
)
async_dispatcher_connect(hass, SIGNAL_STATE_UPDATED, see_vehicle)
return True
| Python | 5 | MrDelik/core | homeassistant/components/volvooncall/device_tracker.py | [
"Apache-2.0"
] |
/*
Copyright © 2011, 2012 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 David Rajchenbach-Teller
*/
import stdlib.core.{map, date}
/**
* {1 Types defined in this module}
*/
type Cache.options('key, 'value, 'order) =
{
size_limit: option(int) /**If set, determine the maximal number of items to store in the cache. Otherwise, no limit.*/
age_limit: option(Duration.duration) /**If set, items older than a given duration are discarded from the cache.*/
storage: {default} /**Store to local RAM, using default strategy to differentiate ['key]*/
/ {ordering: order('key, 'order)} /**Store to local RAM, using custom strategy to differentiate ['key] */
strategy: {minimize_overhead} /**Optimistic concurrency: optimize assuming little concurrency.
If several requests are placed to the cache concurrently, some results will not be stored
into the cache.
In the current version of OPA, this is always the best strategy on the client*/
/ {balance_transactions} //Ignored for the moment -- mutexes around [get] and [set]
/ {minimize_transactions} //Ignored for the moment -- serialize all requests, might cause deadlocks
/ {default} /**Choose a reasonable strategy for the platform.*/
//In the future: additional options (e.g. handling disconnect, strategy for asynchronicity)?
}
/**
* @param 'a The type of keys
* @param 'b The type of return values
* @param 'signature The type of signatures, e.g. elements which may be used to decide whether a value needs to be recomputed (typically, expiration date, hash, etc.)
*/
type Cache.sync('a, 'b, 'signature) =
{
get: 'a -> 'b /**Get a cached response if available -- compute one otherwise.*/
invalidate: 'a -> void /**Remove a response from the cache.*/
reset: -> void /**Reset all response from the cache.*/
put: 'a,'b,'signature -> void /**Artificially put a new response in the cache.*/
read: 'a -> option('b) /**Read the current contents of the cache, without any side-effect.*/
fetch: list('a) -> void /**Ask the cache to fetch several values in one request*/
}
/**
* @param 'a The type of keys
* @param 'b The type of return values
* @param 'signature The type of signatures, e.g. elements which may be used to decide whether a value needs to be recomputed (typically, expiration date, hash, etc.)
*/
type Cache.async('a, 'b, 'signature) =
{
get: 'a, ('b -> void) -> void /**Get a cached response if available -- compute one otherwise.*/
invalidate: 'a -> void /**Remove a response from the cache.*/
reset: -> void /**Reset all response from the cache.*/
put: 'a,'b,'signature -> void /**Artificially put a new response in the cache.*/
read: 'a -> option('b) /**Read the current contents of the cache, without any side-effect.*/
fetch: list('a) -> void /**Ask the cache to fetch several values in one request*/
}
/**
* An object used to determine if a result has indeed changed.
*
* Example: accessing a resource on a distant web server (with dates)
*
* The typical behavior of a web client using a cache is to keep track of the latest date at which
* a given information was downloaded. Whenever the user asks the client to access the information
* from the server, the client sends to the server the latest modification date, and the server
* may decide to either return the complete data or to reply that the data hasn't changed in the
* meantime. This may be implemented as a [Cache.negotiator(url, WebClient.result(string), Date.date)],
* where the [Date.date] is the last date at which the information was downloaded.
*
* Example: accessing a resource on a distant web server (with etags)
*
* Another possible behavior for web clients using a cache is to keep a signature for the resource
* downloaded (typically, as a MD5, but in fact, any data provided by the server fits). Whenever
* the user asks the client to access the information from the server, the client sends the signature
* to the server, and the server may decide to either return the complete data (e.g. if the signature
* doesn't fit) or to reply that the data hasn't changed in the meantime. This may be implemented as a
* [Cache.negotiator(url, WebClient.result(string), string)].
*
* Other examples include accessing a database, in which case the signature can be a revision number.
*/
@abstract type Cache.negotiator('a, 'b, 'signature, 'diff) = ({
get_always: 'a -> ('signature, 'b) //Note: typically, located on the server
get_diff: 'signature, 'a -> ('signature, 'diff) //Note: typically, located on the server
get_many: list((option('signature), 'a)) -> list(('signature, 'a, {init:'b} / {diff: 'diff}))//Note: typically, located on the server
decode_diff: ('b,'diff) -> 'b //Note: typically, located on the client
})
/**
* {1 Interface}
*/
/**
* General-purpose caching of function results.
*
* {1 What is this module for?}
*
* This module provides a general-purpose cache for functions, also known as a memoizer. You can use it whenever
* you have a function whose evaluation is long or memory consuming, and you wish to store the result of the function
* in memory.
*
* This is an extremely useful optimization tool in numerous cases:
* - if you are writing an application that needs to access a distant web server to read information, where the information
* changes rather slowly (e.g. today's weather conditions in Paris, today's exchange rate for Pesos, a map of Antakya, ...)
* - if you are writing an application that needs to perform heavy computations but can reuse the results for a time
* (e.g. a usage statistics graph, the high scores of a game, ...)
* - if you are writing an application in which the browser needs to frequently read information from the server (e.g. schedule
* manager for many users, a turn-by-turn game, ...)
* - ...
*
*
* {1 Where should I start?}
*
* A good way to determine whether caching a function can be useful is to use function [Cache.simple].
*
*
* {1 What if I need more?}
*
* Module {!Cache.Negotiator} and function {!Cache.make} are designed to give you fine control upon the cache. Use these to
* set a maximal size for the cache, or to determine how long results should be kept in the cache, or how they should be
* stored, or how new results should be added to the cache, or to set the concurrency level, or if you wish to invalidate
* cache results manually, or to add results to the cache manually.
*
*
* @author David Rajchenbach-Teller, 2011
* @stability Experimental
*/
@both Cache =
{{
Negotiator =
{{
/**
* Produce a 'dumb' negotiator, that always negotiates to perform the computation
*/
always_necessary(f: 'a -> 'b): Cache.negotiator('a, 'b, void, 'b) =
{
get_always(x) = (void, f(x))
get_diff(_,x) = (void, f(x))
get_many(l) = List.map(((maybe_sig, key) ->
match maybe_sig with | {none} -> (void, key, {init = f(key)})
| {some = _}-> (void, key, {diff = f(key)})
), l)
decode_diff((_x,diff) : ('b,'b) ) : 'b = diff
}
/**
* Deprecated
*/
make(~{get_always: 'a -> ('signature, 'b)
get_maybe: 'signature, 'a -> ('signature, option('b))}): Cache.negotiator('a, 'b, 'signature, option('b)) =
(
get_many = make_default_get_many(get_always, get_maybe)
decode_diff((x,diff)) = match diff with
| ~{some} -> some
| {none} -> x
x = {~get_always get_diff=get_maybe ~decode_diff ~get_many}
x
)
/**
* Produce a negotiator interested only in signatures, not in decoding replies
*/
make_sig(~{get_always: 'a -> ('signature, 'b)
get_diff: 'signature, 'a -> ('signature, option('b))}): Cache.negotiator('a, 'b, 'signature, option('b)) =
get_many = make_default_get_many(get_always, get_diff)
decode_diff((x,diff)) = match diff with
| ~{some} -> some
| {none} -> x
x = {~get_always ~get_diff ~decode_diff ~get_many}
x
make_no_diff(~{get_always: 'a -> ('signature, 'b)
get_maybe: 'signature, 'a -> ('signature, option('b))
get_many: list((option('signature), 'a)) -> list(('signature, 'a, {init:'b} / {diff: 'diff}))
}) : Cache.negotiator('a, 'b, 'signature, option('b)) =
decode_diff((x,diff)) = match diff with
| ~{some} -> some
| {none} -> x
x = {~get_always get_diff=get_maybe ~decode_diff ~get_many}
x
@private make_default_get_many(get_always, get_diff) =
l -> List.map(((maybe_sig, key) ->
match maybe_sig with | {none} -> (sig, value) = get_always(key)
(sig, key, {init = value})
| ~{some} -> (sig, diff) = get_diff(some, key)
(sig, key, ~{diff})
), l)
}}
/**
* Perform simple caching for a function.
*
* @param f A function
* @return A new function, with the same behavior as [f], but where results are cached forever, without any size
* or age limit, using the default strategy.
*/
simple(f: 'a -> 'b): 'a -> 'b =
make(Negotiator.always_necessary(f), default_options).get
/**
* A default set of options. You may customize it for finer control on your caches.
*/
default_options: Cache.options('key, 'value, 'order) =
{
size_limit= {none}
age_limit= {none}
storage= {default}
strategy= {default}
}
/**
* Create a cache for a function
*/
make(get_manager:Cache.negotiator('a/*string*/, 'b/*float*/, 'signature/*void*/, 'diff/*dom*/),
options: Cache.options('a/*string*/, 'b/*float*/, 'order)): Cache.sync('a/*string*/, 'b/*float*/, 'signature/*void*/) =
(
Storage : Map('a/*string*/, _) = match options.storage with
| {default} -> Map
|~{ordering} -> Map_make(ordering)
init = {
storage = Storage.empty:ordered_map('a/*string*/, Cache.private.storage.entry('b/*float*/, 'signature/*void*/), 'order)
lru = IntMap.empty: Cache.private.lr('a/*string*/)
generation = 0
size = 0
}
{get = getter set = setter} = Mutable.make(init:Cache.private.content('a/*string*/, 'b/*float*/, 'order, 'signature/*void*/))
/**
* {3 Adapting to option [size_limit]}
*/
/**
* Update the age of an information in the [lru] O(ln(n))
*
* (noop when [size_limit] is not set)
*/
touch_lr = match options.size_limit with
| {none} -> (x, _, _, _ -> x)
| {some = _} ->
action(lru:Cache.private.lr('a/*string*/), old_generation:int, new_generation:int, key:'a/*string*/):Cache.private.lr('a/*string*/) =
lru = IntMap.remove(old_generation, lru)
lru = IntMap.add(new_generation, {index=new_generation ~key}, lru)
lru
action
/**
* Find and remove oldest element from lru
*
* Assume lru is not empty
*/
extract_oldest(lru: Cache.private.lr('a/*string*/)): (Cache.private.lr('a/*string*/), 'a/*string*/) =
(lru, binding) = IntMap.extract_min_binding(lru)
match binding with
| {none} -> error("Internal error: attempting to remove oldest elements of an already empty cache")
|~{some} -> (lru, some.f2.key)
trim_to_size = match options.size_limit with
| {none} -> (x -> x)
| {some = max_size} ->
max_size = max(1, max_size) //If [max_size <= 0], well, round up to 1
(data:Cache.private.content('a/*string*/, 'b/*float*/, 'order, 'signature/*void*/)) ->
~{storage lru generation size} = data
//do jlog("[trim_to_size] starting -- size is {size}, max_size is {max_size}")
if size <= max_size then
//do jlog("[trim_to_size] no need to remove")
data
else
//do jlog("[trim_to_size] removing one element")
(lru, key) = extract_oldest(lru)
storage = Storage.remove(key, storage)
~{storage lru generation size=(size-1)}
/**
* {3 Adapting to option [age_limit]}
*/
/**
* Determine whether some information is stale, based on [options.age_limit]
*
* (noop when [age_limit] is not set)
*/
is_still_valid = match options.age_limit with
| {none} -> (_ -> {true})
| ~{some} ->
(birth ->
now = Date.now()
Order.is_smallereq(Date.between(birth, now), some, Duration.order))
get_date = match options.age_limit with
| {none} -> -> Date.epoch
| {some = _} -> Date.now
/**
* {3 Handle [invalidate]}
*/
/**
* Remove a value from the cache
*/
invalidate_in(key:'a/*string*/, cache:Cache.private.content('a, 'b, 'order, 'signature/*void*/)): option(Cache.private.content('a, 'b, 'order, 'signature/*void*/)) =
(
//do jlog("invalidating")
~{storage lru generation size} = cache
match Storage.get(key, storage) with
| {none} -> {none}
| ~{some} ->
lru = IntMap.remove(some.index, lru)
storage = Storage.remove(key, storage)
{some = ~{storage lru generation size=(size-1)}}
)
/**
* Perform invalidation (public API).
*/
do_invalidate(key:'a/*string*/):void =
(
match invalidate_in(key, getter()) with
| {none} -> void //No need to update, the value wasn't there in the first place
|~{some} -> setter(some) //Perform update, possibly erasing result of concurrent computations
)
/**
* {3 Handle [reset]}
*/
/**
* Perform reset (public API).
*/
do_reset():void =
(
setter(init)
)
/**
* {3 Handling [put]}
*/
/**
* Insert a value in the cache. Do not update size. Do not increment generation.
*/
insert_in(key, value, storage, lru, size, generation, signature) =
(
//do jlog("[cache] inserting")
now = get_date()
lru = IntMap.add(generation, {index=generation ~key}, lru)
storage = Storage.add(key, {index=generation ~value updated = now ~signature}, storage)
~{value data = ~{storage lru generation size}}
)
/**
* Compute a new version of the value of [f(key)] and insert it in the cache
* If the [if_necessary] determines that the value doesn't need to be inserted in the cache, reuse the previous value
*/
put_newer_version_in(key:'a/*string*/, previous_value:'b/*float*/, storage, lru, size, generation:int, signature:'signature/*void*/) =
(
get_diff = get_manager.get_diff//TODO: => share dereference
decode_diff=get_manager.decode_diff//TODO: => share dereference
(signature, diff_value) = get_diff(signature, key)
//message = match maybe_value with {none} -> "old value is still valud" | {some = _} -> "replacing with new value"
//do jlog("[put_newer_version_in] {message}")
value = decode_diff((previous_value,diff_value))
insert_in(key, value, storage, lru, size + 1, generation, signature)
)
/**
* Compute for the first time a version of the value of [f(key)] and insert it in the cache
*/
put_first_version_in(key:'a/*string*/, storage, lru, size, generation:int) =
(
get_always = get_manager.get_always
(signature, value) = get_always(key)
insert_in(key, value, storage, lru, size + 1, generation, signature)
)
/**
* Manual insertion in the cache
*/
do_put(key:'a/*string*/, value:'b/*float*/, signature:'signature/*void*/): void =
(
cache = getter()
cache = match invalidate_in(key, cache) with
| {none} -> cache
| ~{some}-> some
~{storage lru generation size} = cache
cache = insert_in(key, value, storage, lru, size + 1, generation + 1, signature).data
cache = trim_to_size(cache)
do setter(cache)
void
)
/**
* {3 Handle [get]}
*/
do_get(key:'a/*string*/):'b/*float*/ =
(
//do jlog("[do_get] starting")
content = getter()
~{storage lru generation size} = content
generation = generation + 1
//do jlog("[do_get] ready to search")
match Storage.get(key, storage) with //Search for [key] in current storage O(ln(n))
| {some = ~{index value updated signature}} -> //If [key] was found
//do jlog("[do_get] found key")
if is_still_valid(updated) then // and if the data is not too old O(1)
//do jlog("[do_get] data is still valid")
stored = {index=generation ~value ~updated ~signature} // Mark value as having been seen recently O(ln(n))
storage = Storage.add(key, stored, storage)
lru = touch_lr(lru, index, generation, key)
do setter(~{storage lru generation size}) // Update cache (possibly erasing result of competing threads) O(1)
value // Return value
else // otherwise, data may be obsolete, we need to renegotiate
//do jlog("[do_get] data is old, need to check whether it's obsolete")
~{storage lru generation size} = Option.get(invalidate_in(key, content))
// Invalidate value, decreasing size O(ln(n))
~{value data} = put_newer_version_in(key, value, storage, lru, size, generation, signature)
// Refresh value, reincreasing size O(ln(n))
data = trim_to_size(data)
do setter(data) // Update cache (possibly erasing result of competing threads) O(1)
value // Return value
| {none} ->
//do jlog("[do_get] key not found")
~{value data} = put_first_version_in(key, storage, lru, size, generation)
data = trim_to_size(data)
do setter(data)
value
)
do_fetch(keys:list('a)/*string*/): void =
(
//do jlog("[do_get] starting")
content = getter()
//do jlog("[do_get] ready to search")
(to_update, content) = List.fold((key, (acc_to_update, content) ->
~{storage lru generation size} = content
match Storage.get(key, storage) with //Search for [key] in current storage O(ln(n))
| ~{some} -> //If [key] was found
~{index value updated signature} = some
//do jlog("[do_get] found key")
if is_still_valid(updated) then // and if the data is not too old O(1)
//do jlog("[do_get] data is still valid")
generation = generation + 1
stored = {index=generation ~value ~updated ~signature} // Mark value as having been seen recently O(ln(n))
storage = Storage.add(key, stored, storage)
lru = touch_lr(lru, index, generation, key)
(acc_to_update, ~{storage lru generation size})
else // otherwise, data may be obsolete, we need to renegotiate
//do jlog("[do_get] data is old, need to check whether it's obsolete")
content = Option.get(invalidate_in(key, content))
// Invalidate value, decreasing size O(ln(n))
([ ({renegotiate=signature previous=value}, key) | acc_to_update ], content) // Ask for renegotiation
| {none} ->
([ ({none}, key) | acc_to_update ], content) // Ask for initial negotiation
), keys, ([], content))
instructions_to_transmit = List.map(((detail, key) ->
match detail with
| {none} -> ({none}, key)
| {renegotiate=signature previous=_} -> ({some = signature}, key)
), to_update)//TODO: Should be an array
updates = get_manager.get_many(instructions_to_transmit)
decoder = get_manager.decode_diff
content = List.fold2(((signature, key, reply), instruction, content ->
~{storage lru generation size} = content
generation = generation+1
{data=content value=_} = match reply with
| ~{diff} ->
previous_value =
match instruction.f1 with
| {renegotiate=_ ~previous} -> previous
| {none} -> error("Internal error in cache: renegotiation indicated that previous version was still valid, but there is no previous version")
end
new_value = decoder((previous_value,diff))
insert_in(key, new_value, storage, lru, size + 1, generation, signature)
| ~{init} ->
insert_in(key, init, storage, lru, size + 1, generation, signature)
content
), updates, to_update, content)
setter(content) // Store result, possibly erasing result of competing threads O(1)
)
/**
* {3 Handle [do_read]}
*/
do_read(key:'a/*string*/):option('b/*float*/) =
(
//do jlog("[do_read] starting")
storage = getter().storage
//do jlog("[do_read] ready to search")
match Storage.get(key, storage) with //Search for [key] in current storage O(ln(n))
| ~{some} -> /*do jlog("[do_read] found")*/ {some = some.value}
| {none} -> /*do jlog("[do_read] not found")*/ {none}
)
{get=do_get invalidate=do_invalidate reset=do_reset put=do_put read=do_read fetch=do_fetch}
)
//TODO: make_async(...) = ...
}}
/**
* {1 Private section}
*/
type Cache.private.lr.entry('a) =
{
index: int
key: 'a
}
type Cache.private.lr('a) = intmap(Cache.private.lr.entry('a))
type Cache.private.storage.entry('b, 'signature) =
{
index: int
value: 'b
updated: Date.date
signature: 'signature
}
type Cache.private.content('a, 'b, 'order, 'signature) =
{
storage: ordered_map('a, Cache.private.storage.entry('b, 'signature), 'order)
lru : Cache.private.lr('a)
generation: int
size: int
}
| Opa | 5 | Machiaweliczny/oppailang | lib/stdlib/core/cache/cache.opa | [
"MIT"
] |
#import "Foo.h"
#import "Decls.h"
| C | 0 | lwhsu/swift | test/SourceKit/InterfaceGen/Inputs/mock-sdk/APINotesTests.framework/Headers/APINotesTests.h | [
"Apache-2.0"
] |
"Android IF" by Simon Christiansen
[This is Simon's original AndroidIF story file. Big Cat source available on request! ~ Demitrius]
The story genre is "Mystery". The release number is 1. The story creation year is 2015.
Use full-length room descriptions, American dialect, no scoring, and the serial comma.
Include Android IF by Jimmy Maher.
[The Android IF extension will use "50.pic" as the background image.]
The background image is 50.
When play begins:
say "Welcome to the Android IF demo."
The Demo Room is a room. "A nice room. There is a painting on the wall."
In the Demo Room is a painting. The description of the painting is "A painting of two ducks." The painting is scenery.
After examining the painting:
["Android image n" corresponds to n.pic in the "assets" folder.]
show Android image 1.
Requesting information is an action out of world. Understand "about" as requesting information.
Carry out requesting information:
say "This game demonstrates how to use the Android IF extension. When examining the painting, a picture of two ducks should be displayed on the screen."
Requesting hints is an action out of world. Understand "hint" as requesting hints.
Carry out requesting hints:
say "Examine the painting." | Inform 7 | 4 | SimonChris/AndroidIF | Inform Source/story.ni | [
"MIT"
] |
#! /bin/sh -e
# DP: Add gcc/ada/system-linux-ppc64.ads and use it in gcc/ada/Makefile.in
# DP:
dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
pdir="-d $3"
dir="$3/"
elif [ $# -ne 1 ]; then
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
fi
case "$1" in
-patch)
patch $pdir -f --no-backup-if-mismatch -p1 < $0
;;
-unpatch)
patch $pdir -f --no-backup-if-mismatch -R -p1 < $0
;;
*)
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
esac
exit 0
diff -urN src.orig/gcc/ada/Makefile.in src/gcc/ada/Makefile.in
--- src.orig/gcc/ada/Makefile.in 2005-05-02 16:39:32.000000000 +0200
+++ src/gcc/ada/Makefile.in 2005-05-02 16:36:37.000000000 +0200
@@ -1346,6 +1346,31 @@
LIBRARY_VERSION := $(LIB_VERSION)
endif
+ifeq ($(strip $(filter-out powerpc64% linux%,$(arch) $(osys))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-linux.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-osinte.adb<s-osinte-posix.adb \
+ s-osinte.ads<s-osinte-linux.ads \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-taprop.adb<s-taprop-linux.adb \
+ s-taspri.ads<s-taspri-linux.ads \
+ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
+ s-parame.adb<s-parame-linux.adb \
+ system.ads<system-linux-ppc64.ads
+
+ TOOLS_TARGET_PAIRS = \
+ mlib-tgt.adb<mlib-tgt-linux.adb \
+ indepsw.adb<indepsw-linux.adb
+
+ THREADSLIB = -lpthread
+ GNATLIB_SHARED = gnatlib-shared-dual
+ GMEM_LIB = gmemlib
+ PREFIX_OBJS = $(PREFIX_REAL_OBJS)
+ LIBRARY_VERSION := $(LIB_VERSION)
+endif
+
ifeq ($(strip $(filter-out sparc% linux%,$(arch) $(osys))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-linux.ads \
diff -urN src.orig/gcc/ada/system-linux-ppc64.ads src/gcc/ada/system-linux-ppc64.ads
--- src.orig/gcc/ada/system-linux-ppc64.ads 1970-01-01 01:00:00.000000000 +0100
+++ src/gcc/ada/system-linux-ppc64.ads 2005-05-02 16:33:38.000000000 +0200
@@ -0,0 +1,151 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M --
+-- --
+-- S p e c --
+-- (GNU-Linux/PPC64 Version) --
+-- --
+-- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
+-- --
+-- This specification is derived from the Ada Reference Manual for use with --
+-- GNAT. The copyright notice above, and the license provisions that follow --
+-- apply solely to the contents of the part following the private keyword. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
+-- MA 02111-1307, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+package System is
+pragma Pure (System);
+-- Note that we take advantage of the implementation permission to
+-- make this unit Pure instead of Preelaborable, see RM 13.7(36)
+
+ type Name is (SYSTEM_NAME_GNAT);
+ System_Name : constant Name := SYSTEM_NAME_GNAT;
+
+ -- System-Dependent Named Numbers
+
+ Min_Int : constant := Long_Long_Integer'First;
+ Max_Int : constant := Long_Long_Integer'Last;
+
+ Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Nonbinary_Modulus : constant := Integer'Last;
+
+ Max_Base_Digits : constant := Long_Long_Float'Digits;
+ Max_Digits : constant := Long_Long_Float'Digits;
+
+ Max_Mantissa : constant := 63;
+ Fine_Delta : constant := 2.0 ** (-Max_Mantissa);
+
+ Tick : constant := 0.000_001;
+
+ -- Storage-related Declarations
+
+ type Address is private;
+ Null_Address : constant Address;
+
+ Storage_Unit : constant := 8;
+ Word_Size : constant := 64;
+ Memory_Size : constant := 2 ** 64;
+
+ -- Address comparison
+
+ function "<" (Left, Right : Address) return Boolean;
+ function "<=" (Left, Right : Address) return Boolean;
+ function ">" (Left, Right : Address) return Boolean;
+ function ">=" (Left, Right : Address) return Boolean;
+ function "=" (Left, Right : Address) return Boolean;
+
+ pragma Import (Intrinsic, "<");
+ pragma Import (Intrinsic, "<=");
+ pragma Import (Intrinsic, ">");
+ pragma Import (Intrinsic, ">=");
+ pragma Import (Intrinsic, "=");
+
+ -- Other System-Dependent Declarations
+
+ type Bit_Order is (High_Order_First, Low_Order_First);
+ Default_Bit_Order : constant Bit_Order := High_Order_First;
+
+ -- Priority-related Declarations (RM D.1)
+
+ Max_Priority : constant Positive := 30;
+ Max_Interrupt_Priority : constant Positive := 31;
+
+ subtype Any_Priority is Integer range 0 .. 31;
+ subtype Priority is Any_Priority range 0 .. 30;
+ subtype Interrupt_Priority is Any_Priority range 31 .. 31;
+
+ Default_Priority : constant Priority := 15;
+
+private
+
+ type Address is mod Memory_Size;
+ Null_Address : constant Address := 0;
+
+ --------------------------------------
+ -- System Implementation Parameters --
+ --------------------------------------
+
+ -- These parameters provide information about the target that is used
+ -- by the compiler. They are in the private part of System, where they
+ -- can be accessed using the special circuitry in the Targparm unit
+ -- whose source should be consulted for more detailed descriptions
+ -- of the individual switch values.
+
+ AAMP : constant Boolean := False;
+ Backend_Divide_Checks : constant Boolean := False;
+ Backend_Overflow_Checks : constant Boolean := False;
+ Command_Line_Args : constant Boolean := True;
+ Configurable_Run_Time : constant Boolean := False;
+ Denorm : constant Boolean := True;
+ Duration_32_Bits : constant Boolean := False;
+ Exit_Status_Supported : constant Boolean := True;
+ Fractional_Fixed_Ops : constant Boolean := False;
+ Frontend_Layout : constant Boolean := False;
+ Functions_Return_By_DSP : constant Boolean := False;
+ Machine_Overflows : constant Boolean := False;
+ Machine_Rounds : constant Boolean := True;
+ OpenVMS : constant Boolean := False;
+ Preallocated_Stacks : constant Boolean := False;
+ Signed_Zeros : constant Boolean := True;
+ Stack_Check_Default : constant Boolean := False;
+ Stack_Check_Probes : constant Boolean := False;
+ Support_64_Bit_Divides : constant Boolean := True;
+ Support_Aggregates : constant Boolean := True;
+ Support_Composite_Assign : constant Boolean := True;
+ Support_Composite_Compare : constant Boolean := True;
+ Support_Long_Shifts : constant Boolean := True;
+ Suppress_Standard_Library : constant Boolean := False;
+ Use_Ada_Main_Program_Name : constant Boolean := False;
+ ZCX_By_Default : constant Boolean := True;
+ GCC_ZCX_Support : constant Boolean := True;
+ Front_End_ZCX_Support : constant Boolean := False;
+
+ -- Obsolete entries, to be removed eventually (bootstrap issues!)
+
+ High_Integrity_Mode : constant Boolean := False;
+ Long_Shifts_Inlined : constant Boolean := True;
+
+end System;
diff -urN tmp/gcc/ada/s-auxdec.ads src/gcc/ada/s-auxdec.ads
--- tmp/gcc/ada/s-auxdec.ads 2004-06-11 12:47:36.000000000 +0200
+++ src/gcc/ada/s-auxdec.ads 2005-05-03 11:34:17.000000000 +0200
@@ -108,13 +108,13 @@
pragma Warnings (Off);
type F_Float is digits 6;
- pragma Float_Representation (VAX_Float, F_Float);
+-- pragma Float_Representation (VAX_Float, F_Float);
type D_Float is digits 9;
- pragma Float_Representation (Vax_Float, D_Float);
+-- pragma Float_Representation (Vax_Float, D_Float);
type G_Float is digits 15;
- pragma Float_Representation (Vax_Float, G_Float);
+-- pragma Float_Representation (Vax_Float, G_Float);
-- Floating point type declarations for IEEE floating point data types
--- tmp/gcc/ada/s-vaflop.ads 2003-10-21 15:42:18.000000000 +0200
+++ src/gcc/ada/s-vaflop.ads 2005-05-03 15:24:24.000000000 +0200
@@ -40,15 +40,15 @@
-- Suppress warnings if not on Alpha/VAX
type D is digits 9;
- pragma Float_Representation (VAX_Float, D);
+-- pragma Float_Representation (VAX_Float, D);
-- D Float type on Vax
type G is digits 15;
- pragma Float_Representation (VAX_Float, G);
+-- pragma Float_Representation (VAX_Float, G);
-- G Float type on Vax
type F is digits 6;
- pragma Float_Representation (VAX_Float, F);
+-- pragma Float_Representation (VAX_Float, F);
-- F Float type on Vax
type S is digits 6;
| Darcs Patch | 4 | JrCs/opendreambox | recipes/gcc/gcc-4.3.4/debian/ppc64-ada.dpatch | [
"MIT"
] |
--TEST--
Bug #28386 (wordwrap() wraps text 1 character too soon)
--FILE--
<?php
$text = "Some text";
$string = "$text $text $text $text";
echo wordwrap($string, 9);
?>
--EXPECT--
Some text
Some text
Some text
Some text
| PHP | 3 | guomoumou123/php5.5.10 | ext/standard/tests/strings/bug28386.phpt | [
"PHP-3.01"
] |
module Test_FAI_DiskConfig =
(* Test disk_config *)
let disk_config_test = "disk_config hda preserve_always:6,7 disklabel:msdos bootable:3
"
test FAI_DiskConfig.disk_config get disk_config_test =
{ "disk_config" = "hda"
{ "preserve_always"
{ "1" = "6" }
{ "2" = "7" }
}
{ "disklabel" = "msdos" }
{ "bootable" = "3" }
}
(* Test volume *)
let volume_test1 = "primary /boot 20-100 ext3 rw\n"
test FAI_DiskConfig.volume get volume_test1 =
{ "primary"
{ "mountpoint" = "/boot" }
{ "size" = "20-100" }
{ "filesystem" = "ext3" }
{ "mount_options"
{ "1" = "rw" }
}
}
let volume_test2 = "primary swap 1000 swap sw\n"
test FAI_DiskConfig.volume get volume_test2 =
{ "primary"
{ "mountpoint" = "swap" }
{ "size" = "1000" }
{ "filesystem" = "swap" }
{ "mount_options"
{ "1" = "sw" }
}
}
let volume_test3 = "primary / 12000 ext3 rw createopts=\"-b 2048\"\n"
test FAI_DiskConfig.volume get volume_test3 =
{ "primary"
{ "mountpoint" = "/" }
{ "size" = "12000" }
{ "filesystem" = "ext3" }
{ "mount_options"
{ "1" = "rw" }
}
{ "fs_options"
{ "createopts" = "-b 2048" }
}
}
let volume_test4 = "logical /tmp 1000 ext3 rw,nosuid\n"
test FAI_DiskConfig.volume get volume_test4 =
{ "logical"
{ "mountpoint" = "/tmp" }
{ "size" = "1000" }
{ "filesystem" = "ext3" }
{ "mount_options"
{ "1" = "rw" }
{ "2" = "nosuid" }
}
}
let volume_test5 = "logical /var 10%- ext3 rw\n"
test FAI_DiskConfig.volume get volume_test5 =
{ "logical"
{ "mountpoint" = "/var" }
{ "size" = "10%-" }
{ "filesystem" = "ext3" }
{ "mount_options"
{ "1" = "rw" }
}
}
let volume_test6 = "logical /nobackup 0- xfs rw\n"
test FAI_DiskConfig.volume get volume_test6 =
{ "logical"
{ "mountpoint" = "/nobackup" }
{ "size" = "0-" }
{ "filesystem" = "xfs" }
{ "mount_options"
{ "1" = "rw" }
}
}
let simple_config = "# A comment
disk_config disk2
raw-disk - 0 - -
disk_config lvm
vg my_pv sda2
vg test disk1.9
my_pv-_swap swap 2048 swap sw
my_pv-_root / 2048 ext3 rw,errors=remount-ro
disk_config raid
raid1 /boot disk1.1,disk2.1,disk3.1,disk4.1,disk5.1,disk6.1 ext3 rw
raid1 swap disk1.2,disk2.2,disk3.2,disk4.2,disk5.2,disk6.2 swap sw
raid5 /srv/data disk1.11,disk2.11,disk3.11,disk4.11,disk5.11,disk6.11 ext3 ro createopts=\"-m 0\"
raid0 - disk2.2,sdc1,sde1:spare:missing ext2 default
disk_config tmpfs
tmpfs /var/opt/hosting/tmp 500 defaults
"
test FAI_DiskConfig.lns get simple_config =
{ "#comment" = "A comment" }
{ "disk_config" = "disk2"
{ "raw-disk"
{ "mountpoint" = "-" }
{ "size" = "0" }
{ "filesystem" = "-" }
{ "mount_options"
{ "1" = "-" }
}
}
}
{ }
{ "disk_config" = "lvm"
{ "vg"
{ "name" = "my_pv" }
{ "disk" = "sda2" }
}
{ "vg"
{ "name" = "test" }
{ "disk" = "disk1"
{ "partition" = "9" }
}
}
{ "lv"
{ "vg" = "my_pv" }
{ "name" = "_swap" }
{ "mountpoint" = "swap" }
{ "size" = "2048" }
{ "filesystem" = "swap" }
{ "mount_options"
{ "1" = "sw" }
}
}
{ "lv"
{ "vg" = "my_pv" }
{ "name" = "_root" }
{ "mountpoint" = "/" }
{ "size" = "2048" }
{ "filesystem" = "ext3" }
{ "mount_options"
{ "1" = "rw" }
{ "2" = "errors"
{ "value" = "remount-ro" }
}
}
}
}
{ }
{ "disk_config" = "raid"
{ "raid1"
{ "mountpoint" = "/boot" }
{ "disk" = "disk1"
{ "partition" = "1" }
}
{ "disk" = "disk2"
{ "partition" = "1" }
}
{ "disk" = "disk3"
{ "partition" = "1" }
}
{ "disk" = "disk4"
{ "partition" = "1" }
}
{ "disk" = "disk5"
{ "partition" = "1" }
}
{ "disk" = "disk6"
{ "partition" = "1" }
}
{ "filesystem" = "ext3" }
{ "mount_options"
{ "1" = "rw" }
}
}
{ "raid1"
{ "mountpoint" = "swap" }
{ "disk" = "disk1"
{ "partition" = "2" }
}
{ "disk" = "disk2"
{ "partition" = "2" }
}
{ "disk" = "disk3"
{ "partition" = "2" }
}
{ "disk" = "disk4"
{ "partition" = "2" }
}
{ "disk" = "disk5"
{ "partition" = "2" }
}
{ "disk" = "disk6"
{ "partition" = "2" }
}
{ "filesystem" = "swap" }
{ "mount_options"
{ "1" = "sw" }
}
}
{ "raid5"
{ "mountpoint" = "/srv/data" }
{ "disk" = "disk1"
{ "partition" = "11" }
}
{ "disk" = "disk2"
{ "partition" = "11" }
}
{ "disk" = "disk3"
{ "partition" = "11" }
}
{ "disk" = "disk4"
{ "partition" = "11" }
}
{ "disk" = "disk5"
{ "partition" = "11" }
}
{ "disk" = "disk6"
{ "partition" = "11" }
}
{ "filesystem" = "ext3" }
{ "mount_options"
{ "1" = "ro" }
}
{ "fs_options"
{ "createopts" = "-m 0" }
}
}
{ "raid0"
{ "mountpoint" = "-" }
{ "disk" = "disk2"
{ "partition" = "2" }
}
{ "disk" = "sdc1" }
{ "disk" = "sde1"
{ "spare" }
{ "missing" }
}
{ "filesystem" = "ext2" }
{ "mount_options"
{ "1" = "default" }
}
}
}
{ }
{ "disk_config" = "tmpfs"
{ "tmpfs"
{ "mountpoint" = "/var/opt/hosting/tmp" }
{ "size" = "500" }
{ "mount_options"
{ "1" = "defaults" }
}
}
}
let config1 = "disk_config disk1 bootable:1 preserve_always:all always_format:5,6,7,8,9,10,11
primary - 0 - -
primary - 0 - -
logical / 0 ext3 rw,relatime,errors=remount-ro createopts=\"-c -j\"
logical swap 0 swap sw
logical /var 0 ext3 rw,relatime createopts=\"-m 5 -j\"
logical /tmp 0 ext3 rw createopts=\"-m 0 -j\"
logical /usr 0 ext3 rw,relatime createopts=\"-j\"
logical /home 0 ext3 rw,relatime,nosuid,nodev createopts=\"-m 1 -j\"
logical /wrk 0 ext3 rw,relatime,nosuid,nodev createopts=\"-m 1 -j\"
logical /transfer 0 vfat rw
"
test FAI_DiskConfig.lns get config1 =
{ "disk_config" = "disk1"
{ "bootable" = "1" }
{ "preserve_always"
{ "1" = "all" }
}
{ "always_format"
{ "1" = "5" }
{ "2" = "6" }
{ "3" = "7" }
{ "4" = "8" }
{ "5" = "9" }
{ "6" = "10" }
{ "7" = "11" }
}
{ "primary"
{ "mountpoint" = "-" }
{ "size" = "0" }
{ "filesystem" = "-" }
{ "mount_options"
{ "1" = "-" }
}
}
{ "primary"
{ "mountpoint" = "-" }
{ "size" = "0" }
{ "filesystem" = "-" }
{ "mount_options"
{ "1" = "-" }
}
}
{ "logical"
{ "mountpoint" = "/" }
{ "size" = "0" }
{ "filesystem" = "ext3" }
{ "mount_options"
{ "1" = "rw" }
{ "2" = "relatime" }
{ "3" = "errors"
{ "value" = "remount-ro" }
}
}
{ "fs_options"
{ "createopts" = "-c -j" }
}
}
{ "logical"
{ "mountpoint" = "swap" }
{ "size" = "0" }
{ "filesystem" = "swap" }
{ "mount_options"
{ "1" = "sw" }
}
}
{ "logical"
{ "mountpoint" = "/var" }
{ "size" = "0" }
{ "filesystem" = "ext3" }
{ "mount_options"
{ "1" = "rw" }
{ "2" = "relatime" }
}
{ "fs_options"
{ "createopts" = "-m 5 -j" }
}
}
{ "logical"
{ "mountpoint" = "/tmp" }
{ "size" = "0" }
{ "filesystem" = "ext3" }
{ "mount_options"
{ "1" = "rw" }
}
{ "fs_options"
{ "createopts" = "-m 0 -j" }
}
}
{ "logical"
{ "mountpoint" = "/usr" }
{ "size" = "0" }
{ "filesystem" = "ext3" }
{ "mount_options"
{ "1" = "rw" }
{ "2" = "relatime" }
}
{ "fs_options"
{ "createopts" = "-j" }
}
}
{ "logical"
{ "mountpoint" = "/home" }
{ "size" = "0" }
{ "filesystem" = "ext3" }
{ "mount_options"
{ "1" = "rw" }
{ "2" = "relatime" }
{ "3" = "nosuid" }
{ "4" = "nodev" }
}
{ "fs_options"
{ "createopts" = "-m 1 -j" }
}
}
{ "logical"
{ "mountpoint" = "/wrk" }
{ "size" = "0" }
{ "filesystem" = "ext3" }
{ "mount_options"
{ "1" = "rw" }
{ "2" = "relatime" }
{ "3" = "nosuid" }
{ "4" = "nodev" }
}
{ "fs_options"
{ "createopts" = "-m 1 -j" }
}
}
{ "logical"
{ "mountpoint" = "/transfer" }
{ "size" = "0" }
{ "filesystem" = "vfat" }
{ "mount_options"
{ "1" = "rw" }
}
}
}
let config2 = "disk_config /dev/sda
primary - 250M - -
primary - 20G - -
logical - 8G - -
logical - 4G - -
logical - 5G - -
disk_config /dev/sdb sameas:/dev/sda
disk_config raid
raid1 /boot sda1,sdb1 ext3 defaults
raid1 / sda2,sdb2 ext3 defaults,errors=remount-ro
raid1 swap sda5,sdb5 swap defaults
raid1 /tmp sda6,sdb6 ext3 defaults createopts=\"-m 1\"
raid1 /var sda7,sdb7 ext3 defaults
"
test FAI_DiskConfig.lns get config2 =
{ "disk_config" = "/dev/sda"
{ "primary"
{ "mountpoint" = "-" }
{ "size" = "250M" }
{ "filesystem" = "-" }
{ "mount_options"
{ "1" = "-" }
}
}
{ "primary"
{ "mountpoint" = "-" }
{ "size" = "20G" }
{ "filesystem" = "-" }
{ "mount_options"
{ "1" = "-" }
}
}
{ "logical"
{ "mountpoint" = "-" }
{ "size" = "8G" }
{ "filesystem" = "-" }
{ "mount_options"
{ "1" = "-" }
}
}
{ "logical"
{ "mountpoint" = "-" }
{ "size" = "4G" }
{ "filesystem" = "-" }
{ "mount_options"
{ "1" = "-" }
}
}
{ "logical"
{ "mountpoint" = "-" }
{ "size" = "5G" }
{ "filesystem" = "-" }
{ "mount_options"
{ "1" = "-" }
}
}
}
{ }
{ "disk_config" = "/dev/sdb"
{ "sameas" = "/dev/sda" }
}
{ }
{ "disk_config" = "raid"
{ "raid1"
{ "mountpoint" = "/boot" }
{ "disk" = "sda1" }
{ "disk" = "sdb1" }
{ "filesystem" = "ext3" }
{ "mount_options"
{ "1" = "defaults" }
}
}
{ "raid1"
{ "mountpoint" = "/" }
{ "disk" = "sda2" }
{ "disk" = "sdb2" }
{ "filesystem" = "ext3" }
{ "mount_options"
{ "1" = "defaults" }
{ "2" = "errors"
{ "value" = "remount-ro" }
}
}
}
{ "raid1"
{ "mountpoint" = "swap" }
{ "disk" = "sda5" }
{ "disk" = "sdb5" }
{ "filesystem" = "swap" }
{ "mount_options"
{ "1" = "defaults" }
}
}
{ "raid1"
{ "mountpoint" = "/tmp" }
{ "disk" = "sda6" }
{ "disk" = "sdb6" }
{ "filesystem" = "ext3" }
{ "mount_options"
{ "1" = "defaults" }
}
{ "fs_options"
{ "createopts" = "-m 1" }
}
}
{ "raid1"
{ "mountpoint" = "/var" }
{ "disk" = "sda7" }
{ "disk" = "sdb7" }
{ "filesystem" = "ext3" }
{ "mount_options"
{ "1" = "defaults" }
}
}
}
let config3 = "disk_config /dev/sdb
primary / 21750 ext3 defaults,errors=remount-ro
primary /boot 250 ext3 defaults
logical - 4000 - -
logical - 2000 - -
logical - 10- - -
disk_config cryptsetup randinit
swap swap /dev/sdb5 swap defaults
tmp /tmp /dev/sdb6 ext2 defaults
luks /local00 /dev/sdb7 ext3 defaults,errors=remount-ro createopts=\"-m 0\"
"
test FAI_DiskConfig.lns get config3 =
{ "disk_config" = "/dev/sdb"
{ "primary"
{ "mountpoint" = "/" }
{ "size" = "21750" }
{ "filesystem" = "ext3" }
{ "mount_options"
{ "1" = "defaults" }
{ "2" = "errors"
{ "value" = "remount-ro" }
}
}
}
{ "primary"
{ "mountpoint" = "/boot" }
{ "size" = "250" }
{ "filesystem" = "ext3" }
{ "mount_options"
{ "1" = "defaults" }
}
}
{ "logical"
{ "mountpoint" = "-" }
{ "size" = "4000" }
{ "filesystem" = "-" }
{ "mount_options"
{ "1" = "-" }
}
}
{ "logical"
{ "mountpoint" = "-" }
{ "size" = "2000" }
{ "filesystem" = "-" }
{ "mount_options"
{ "1" = "-" }
}
}
{ "logical"
{ "mountpoint" = "-" }
{ "size" = "10-" }
{ "filesystem" = "-" }
{ "mount_options"
{ "1" = "-" }
}
}
}
{ }
{ "disk_config" = "cryptsetup"
{ "randinit" }
{ "swap"
{ "mountpoint" = "swap" }
{ "device" = "/dev/sdb5" }
{ "filesystem" = "swap" }
{ "mount_options"
{ "1" = "defaults" }
}
}
{ "tmp"
{ "mountpoint" = "/tmp" }
{ "device" = "/dev/sdb6" }
{ "filesystem" = "ext2" }
{ "mount_options"
{ "1" = "defaults" }
}
}
{ "luks"
{ "mountpoint" = "/local00" }
{ "device" = "/dev/sdb7" }
{ "filesystem" = "ext3" }
{ "mount_options"
{ "1" = "defaults" }
{ "2" = "errors"
{ "value" = "remount-ro" }
}
}
{ "fs_options"
{ "createopts" = "-m 0" }
}
}
}
| Augeas | 5 | ajnavarro/language-dataset | data/github.com/raphink/config-augeas-validator/ee8aeffb9753fcb260e6227b2ef6b785bdca77c8/lenses/tests/test_fai_diskconfig.aug | [
"MIT"
] |
SELECT number % 2 ? ['Hello', 'World'] : ['abc'] FROM system.numbers LIMIT 10;
SELECT number % 2 ? materialize(['Hello', 'World']) : ['abc'] FROM system.numbers LIMIT 10;
SELECT number % 2 ? ['Hello', 'World'] : materialize(['abc']) FROM system.numbers LIMIT 10;
SELECT number % 2 ? materialize(['Hello', 'World']) : materialize(['abc']) FROM system.numbers LIMIT 10;
SELECT number % 2 ? ['Hello', '', 'World!'] : emptyArrayString() FROM system.numbers LIMIT 10;
SELECT number % 2 ? materialize(['Hello', '', 'World!']) : emptyArrayString() FROM system.numbers LIMIT 10;
SELECT number % 2 ? [''] : ['', ''] FROM system.numbers LIMIT 10;
SELECT number % 2 ? materialize(['']) : ['', ''] FROM system.numbers LIMIT 10;
SELECT number % 2 ? [''] : materialize(['', '']) FROM system.numbers LIMIT 10;
SELECT number % 2 ? materialize(['']) : materialize(['', '']) FROM system.numbers LIMIT 10;
| SQL | 3 | pdv-ru/ClickHouse | tests/queries/0_stateless/00176_if_string_arrays.sql | [
"Apache-2.0"
] |
"""Binary Sensor platform for Garages Amsterdam."""
from __future__ import annotations
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import (
CoordinatorEntity,
DataUpdateCoordinator,
)
from . import get_coordinator
from .const import ATTRIBUTION
BINARY_SENSORS = {
"state",
}
async def async_setup_entry(
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Defer sensor setup to the shared sensor module."""
coordinator = await get_coordinator(hass)
async_add_entities(
GaragesamsterdamBinarySensor(
coordinator, config_entry.data["garage_name"], info_type
)
for info_type in BINARY_SENSORS
)
class GaragesamsterdamBinarySensor(CoordinatorEntity, BinarySensorEntity):
"""Binary Sensor representing garages amsterdam data."""
_attr_attribution = ATTRIBUTION
_attr_device_class = BinarySensorDeviceClass.PROBLEM
def __init__(
self, coordinator: DataUpdateCoordinator, garage_name: str, info_type: str
) -> None:
"""Initialize garages amsterdam binary sensor."""
super().__init__(coordinator)
self._attr_unique_id = f"{garage_name}-{info_type}"
self._garage_name = garage_name
self._info_type = info_type
self._attr_name = garage_name
@property
def is_on(self) -> bool:
"""If the binary sensor is currently on or off."""
return (
getattr(self.coordinator.data[self._garage_name], self._info_type) != "ok"
)
| Python | 4 | MrDelik/core | homeassistant/components/garages_amsterdam/binary_sensor.py | [
"Apache-2.0"
] |
package com.baeldung.reactive.cors.global.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.config.CorsRegistry;
import org.springframework.web.reactive.config.EnableWebFlux;
import org.springframework.web.reactive.config.WebFluxConfigurer;
@Configuration
@EnableWebFlux
public class CorsGlobalConfiguration implements WebFluxConfigurer {
@Override
public void addCorsMappings(CorsRegistry corsRegistry) {
corsRegistry.addMapping("/**")
.allowedOrigins("http://allowed-origin.com")
.allowedMethods("PUT")
.allowedHeaders("Baeldung-Allowed", "Baledung-Another-Allowed")
.exposedHeaders("Baeldung-Allowed", "Baeldung-Exposed")
.maxAge(3600);
}
}
| Java | 4 | scharanreddy/tutorials | spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/config/CorsGlobalConfiguration.java | [
"MIT"
] |
wttr:
apikey: insert-api-key-here-and-make-this-pillar-available-to-salt
| SaltStack | 0 | harunpehlivan/wttr.in | share/salt/pillar.sls | [
"Apache-2.0"
] |
#!/bin/bash
##############################################################################
# Example command to build Caffe2 on Tegra X1.
##############################################################################
#
# This script shows how one can build a Caffe2 binary for NVidia's TX1.
# The build script assumes that you have the most recent libraries installed
# via the JetPack toolkit available at
# https://developer.nvidia.com/embedded/jetpack
# and it assumes that we are starting from a fresh system after the jetpack
# installation. If you have already installed some of the dependencies, you
# may be able to skip quite a few of the apt-get installs.
CAFFE2_ROOT="$( cd "$(dirname -- "$0")"/.. ; pwd -P)"
echo "Caffe2 codebase root is: $CAFFE2_ROOT"
BUILD_ROOT=${BUILD_ROOT:-"$CAFFE2_ROOT/build"}
mkdir -p $BUILD_ROOT
echo "Build Caffe2 raspbian into: $BUILD_ROOT"
# obtain necessary dependencies
echo "Installing dependencies."
sudo apt-get install \
cmake \
libgflags-dev \
libgoogle-glog-dev \
libprotobuf-dev \
protobuf-compiler
# obtain optional dependencies that are usually useful to have.
echo "Installing optional dependencies."
sudo apt-get install \
libleveldb-dev \
liblmdb-dev \
libpython-dev \
libsnappy-dev \
python-numpy \
python-pip \
python-protobuf
# Obtain python hypothesis, which Caffe2 uses for unit testing. Note that
# the one provided by apt-get is quite old so we install it via pip
sudo pip install hypothesis
# Install the six module, which includes Python 2 and 3 compatibility utilities,
# and is required for Caffe2
sudo pip install six
# Now, actually build the android target.
echo "Building caffe2"
cd $BUILD_ROOT
# CUDA_USE_STATIC_CUDA_RUNTIME needs to be set to off so that opencv can be
# properly used. Otherwise, opencv will complain that opencv_dep_cudart cannot
# be found.
cmake "$CAFFE2_ROOT" -DCUDA_USE_STATIC_CUDA_RUNTIME=OFF \
|| exit 1
make -j 4 || exit 1
| Shell | 4 | Hacky-DH/pytorch | scripts/build_tegra_x1.sh | [
"Intel"
] |
#include <Wire.h>
#include "DHT.h"
#define DEBUG_MODE 0
// Address Pins
#define AD0 11
#define AD1 12
// I2C Defaults
#define I2C_DEFAULT_ADDRESS 0x0A
#define I2C_BUFFER_SIZE 4
//
// 0 H LSB
// 1 H MSB
// 2 T LSB
// 3 T MSB
//
byte buffer[I2C_BUFFER_SIZE];
int addressPins[] = { AD0, AD1 };
int address = I2C_DEFAULT_ADDRESS;
int dhtPin = -1;
int dhtType = -1;
void resetState() {
digitalWrite(dhtPin, LOW);
pinMode(dhtPin, INPUT);
}
void setup() {
int offset = 0;
for (int i = 0; i < 2; i++) {
pinMode(addressPins[i], INPUT);
if (digitalRead(addressPins[i])) {
offset |= 1 << i;
}
}
address += offset;
#if DEBUG_MODE
Serial.begin(9600);
#endif
resetState();
Wire.begin(address);
Wire.onRequest(onRequest);
Wire.onReceive(onReceive);
}
void loop() {
if (dhtPin != -1 && dhtType != -1) {
DHT dht(dhtPin, dhtType);
dht.begin();
int h = (int)((float)dht.readHumidity() * 100);
int c = (int)((float)dht.readTemperature() * 100);
buffer[0] = h >> 8;
buffer[1] = h & 0xFF;
buffer[2] = c >> 8;
buffer[3] = c & 0xFF;
#if DEBUG_MODE
Serial.print("h: ");
Serial.println(h);
Serial.print("c: ");
Serial.println(c);
#endif
delay(250);
#if DEBUG_MODE
Serial.print("free ram: ");
Serial.println(freeRam());
#endif
}
}
#if DEBUG_MODE
int freeRam() {
extern int __heap_start, *__brkval;
int v;
return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
}
#endif
void onRequest() {
Wire.write(buffer, I2C_BUFFER_SIZE);
}
void onReceive(int howMany) {
// Order: [ pin, type ]
// Default: [ 2, 11 ]
dhtPin = (byte)Wire.read();
dhtType = (byte)Wire.read();
#if DEBUG_MODE
Serial.print("dhtPin: ");
Serial.println(dhtPin);
Serial.print("dhtType: ");
Serial.println(dhtType);
#endif
}
| Arduino | 4 | mattp94/johnny-five | firmwares/dht_i2c_nano_backpack.ino | [
"MIT"
] |
textarea {
width: 100%;
margin-top: 1rem;
font-size: 1.2rem;
box-sizing: border-box;
}
| CSS | 2 | John-Cassidy/angular | aio/content/examples/router/src/app/compose-message/compose-message.component.css | [
"MIT"
] |
//@declaration: true
class C1 {
method(a = 0, b) { }
} | TypeScript | 1 | nilamjadhav/TypeScript | tests/cases/compiler/requiredInitializedParameter4.ts | [
"Apache-2.0"
] |
function fish_title
# Customize terminal window title
end
| fish | 1 | d-dorazio/theme-sashimi | fish_title.fish | [
"MIT"
] |
package com.baeldung.daos;
import com.baeldung.models.User;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;
import org.omg.PortableInterceptor.LOCATION_FORWARD;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import java.util.logging.Logger;
@RequestScoped
public class UserDao {
SessionFactory sessionFactory;
public UserDao() {
this(null);
}
@Inject
public UserDao(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
public Object add(User user) {
Session session = sessionFactory.openSession();
session.beginTransaction();
Object Id = session.save(user);
session.getTransaction().commit();
return Id;
}
public User findByEmail(String email) {
Session session = sessionFactory.openSession();
session.beginTransaction();
Criteria criteria = session.createCriteria(User.class);
criteria.add(Restrictions.eq("email", email));
criteria.setMaxResults(1);
User u = (User) criteria.uniqueResult();
session.getTransaction().commit();
session.close();
return u;
}
}
| Java | 4 | zeesh49/tutorials | vraptor/src/main/java/com/baeldung/daos/UserDao.java | [
"MIT"
] |
// Copyright 2010-2015 RethinkDB, all rights reserved.
#include "clustering/administration/auth/permissions.hpp"
#include "errors.hpp"
#include <boost/algorithm/string/join.hpp>
#include "clustering/administration/admin_op_exc.hpp"
#include "containers/archive/optional.hpp"
#include "containers/archive/versioned.hpp"
namespace auth {
permissions_t::permissions_t()
: m_read(tribool::Indeterminate),
m_write(tribool::Indeterminate),
m_config(tribool::Indeterminate),
m_connect(r_nullopt) { }
permissions_t::permissions_t(
tribool read,
tribool write,
tribool config)
: m_read(read),
m_write(write),
m_config(config),
m_connect(r_nullopt) {
}
permissions_t::permissions_t(
tribool read,
tribool write,
tribool config,
tribool connect)
: m_read(read),
m_write(write),
m_config(config),
m_connect(connect) {
}
permissions_t::permissions_t(ql::datum_t const &datum, bool global)
: m_read(tribool::Indeterminate),
m_write(tribool::Indeterminate),
m_config(tribool::Indeterminate),
m_connect(
global
? make_optional(tribool::Indeterminate)
: r_nullopt) {
merge(datum);
}
tribool datum_to_tribool(ql::datum_t const &datum, std::string const &field) {
if (datum.get_type() == ql::datum_t::R_BOOL) {
return datum.as_bool() ? tribool::True : tribool::False;
} else if (datum.get_type() == ql::datum_t::R_NULL) {
return tribool::Indeterminate;
} else {
throw admin_op_exc_t(
"Expected a boolean or null for `" + field + "`, got " + datum.print() + ".",
query_state_t::FAILED);
}
}
void permissions_t::merge(ql::datum_t const &datum) {
if (datum.get_type() != ql::datum_t::R_OBJECT) {
throw admin_op_exc_t(
"Expected an object, got " + datum.print() + ".", query_state_t::FAILED);
}
std::set<std::string> keys;
for (size_t i = 0; i < datum.obj_size(); ++i) {
keys.insert(datum.get_pair(i).first.to_std());
}
ql::datum_t read = datum.get_field("read", ql::NOTHROW);
if (read.has()) {
keys.erase("read");
set_read(datum_to_tribool(read, "read"));
}
ql::datum_t write = datum.get_field("write", ql::NOTHROW);
if (write.has()) {
keys.erase("write");
set_write(datum_to_tribool(write, "write"));
}
ql::datum_t config = datum.get_field("config", ql::NOTHROW);
if (config.has()) {
keys.erase("config");
set_config(datum_to_tribool(config, "config"));
}
ql::datum_t connect = datum.get_field("connect", ql::NOTHROW);
if (connect.has()) {
if (m_connect.has_value()) {
keys.erase("connect");
set_connect(datum_to_tribool(connect, "connect"));
} else {
throw admin_op_exc_t(
"The `connect` permission is only valid at the global scope.",
query_state_t::FAILED);
}
}
if (!keys.empty()) {
throw admin_op_exc_t(
"Unexpected key(s) `" + boost::algorithm::join(keys, "`, `") + "`.",
query_state_t::FAILED);
}
}
tribool permissions_t::get_read() const {
return m_read;
}
tribool permissions_t::get_write() const {
return m_write;
}
tribool permissions_t::get_config() const {
return m_config;
}
tribool permissions_t::get_connect() const {
return m_connect.value_or(tribool::Indeterminate);
}
bool permissions_t::is_indeterminate() const {
return
m_read == tribool::Indeterminate &&
m_write == tribool::Indeterminate &&
m_config == tribool::Indeterminate && (
!m_connect.has_value() || *m_connect == tribool::Indeterminate);
}
void permissions_t::set_read(tribool read) {
m_read = read;
}
void permissions_t::set_write(tribool write) {
m_write = write;
}
void permissions_t::set_config(tribool config) {
m_config = config;
}
void permissions_t::set_connect(tribool connect) {
guarantee(m_connect == make_optional(tribool::True));
m_connect.set(connect);
}
ql::datum_t permissions_t::to_datum() const {
ql::datum_object_builder_t datum_object_builder;
if (m_read != tribool::Indeterminate) {
datum_object_builder.overwrite(
"read", ql::datum_t::boolean(m_read == tribool::True));
}
if (m_write != tribool::Indeterminate) {
datum_object_builder.overwrite(
"write", ql::datum_t::boolean(m_write == tribool::True));
}
if (m_config != tribool::Indeterminate) {
datum_object_builder.overwrite(
"config", ql::datum_t::boolean(m_config == tribool::True));
}
if (m_connect.has_value() && m_connect.get() != tribool::Indeterminate) {
datum_object_builder.overwrite(
"connect", ql::datum_t::boolean(m_connect.get() == tribool::True));
}
if (datum_object_builder.empty()) {
return ql::datum_t::null();
} else {
return std::move(datum_object_builder).to_datum();
}
}
std::tuple<int8_t, int8_t, int8_t, optional<int8_t>>
permissions_t::to_tuple() const {
return std::make_tuple(
static_cast<int8_t>(m_read),
static_cast<int8_t>(m_write),
static_cast<int8_t>(m_config),
m_connect.has_value()
? make_optional(static_cast<int8_t>(m_connect.get()))
: r_nullopt);
}
bool permissions_t::operator<(permissions_t const &rhs) const {
return to_tuple() < rhs.to_tuple();
}
bool permissions_t::operator==(permissions_t const &rhs) const {
return to_tuple() == rhs.to_tuple();
}
RDB_IMPL_SERIALIZABLE_4(permissions_t, m_read, m_write, m_config, m_connect);
INSTANTIATE_SERIALIZABLE_SINCE_v2_3(permissions_t);
} // namespace auth
| C++ | 4 | zadcha/rethinkdb | src/clustering/administration/auth/permissions.cc | [
"Apache-2.0"
] |
import * as React from 'react';
import { unstable_useControlled as useControlled, unstable_useId as useId } from '@mui/utils';
export interface UseTabsProps {
/**
* The value of the currently selected `Tab`.
* If you don't want any selected `Tab`, you can set this prop to `false`.
*/
value?: string | number | false;
/**
* The default value. Use when the component is not controlled.
*/
defaultValue?: string | number | false;
/**
* The component orientation (layout flow direction).
* @default 'horizontal'
*/
orientation?: 'horizontal' | 'vertical';
/**
* The direction of the text.
* @default 'ltr'
*/
direction?: 'ltr' | 'rtl';
/**
* Callback invoked when new value is being set.
*/
onChange?: (event: React.SyntheticEvent, value: number | string) => void;
/**
* If `true` the selected tab changes on focus. Otherwise it only
* changes on activation.
*/
selectionFollowsFocus?: boolean;
}
const useTabs = (props: UseTabsProps) => {
const {
value: valueProp,
defaultValue,
onChange,
orientation,
direction,
selectionFollowsFocus,
} = props;
const [value, setValue] = useControlled({
controlled: valueProp,
default: defaultValue,
name: 'Tabs',
state: 'value',
});
const idPrefix = useId();
const onSelected = React.useCallback(
(e, newValue) => {
setValue(newValue);
if (onChange) {
onChange(e, newValue);
}
},
[onChange, setValue],
);
const getRootProps = () => {
return {};
};
const tabsContextValue = React.useMemo(() => {
return { idPrefix, value, onSelected, orientation, direction, selectionFollowsFocus };
}, [idPrefix, value, onSelected, orientation, direction, selectionFollowsFocus]);
return {
getRootProps,
tabsContextValue,
};
};
export default useTabs;
| TypeScript | 5 | dany-freeman/material-ui | packages/mui-base/src/TabsUnstyled/useTabs.ts | [
"MIT"
] |
(module
(type $FUNCSIG$vf (func (param f32)))
(type $FUNCSIG$v (func))
(type $FUNCSIG$id (func (param f64) (result i32)))
(type $FUNCSIG$ddd (func (param f64 f64) (result f64)))
(type $4 (func (result f64)))
(type $5 (func (result i32)))
(type $6 (func (param i32) (result i32)))
(type $7 (func (param f64) (result f64)))
(type $8 (func (result i64)))
(type $9 (func (param i32 i64)))
(import "env" "_emscripten_asm_const_vi" (func $_emscripten_asm_const_vi))
(import "asm2wasm" "f64-to-int" (func $f64-to-int (param f64) (result i32)))
(import "asm2wasm" "f64-rem" (func $f64-rem (param f64 f64) (result f64)))
(table 10 funcref)
(elem (i32.const 0) $z $big_negative $z $z $w $w $importedDoubles $w $z $cneg)
(memory $0 4096 4096)
(data (i32.const 1026) "\14\00")
(export "big_negative" (func $big_negative))
(func $big_negative (type $FUNCSIG$v)
(local $temp f64)
(block $block0
(local.set $temp
(f64.const -2147483648)
)
(local.set $temp
(f64.const -2147483648)
)
(local.set $temp
(f64.const -21474836480)
)
(local.set $temp
(f64.const 0.039625)
)
(local.set $temp
(f64.const -0.039625)
)
)
)
(func $importedDoubles (type $4) (result f64)
(local $temp f64)
(block $topmost (result f64)
(local.set $temp
(f64.add
(f64.add
(f64.add
(f64.load
(i32.const 8)
)
(f64.load
(i32.const 16)
)
)
(f64.neg
(f64.load
(i32.const 16)
)
)
)
(f64.neg
(f64.load
(i32.const 8)
)
)
)
)
(if
(i32.gt_s
(i32.load
(i32.const 24)
)
(i32.const 0)
)
(br $topmost
(f64.const -3.4)
)
)
(if
(f64.gt
(f64.load
(i32.const 32)
)
(f64.const 0)
)
(br $topmost
(f64.const 5.6)
)
)
(f64.const 1.2)
)
)
(func $doubleCompares (type $FUNCSIG$ddd) (param $x f64) (param $y f64) (result f64)
(local $t f64)
(local $Int f64)
(local $Double i32)
(block $topmost (result f64)
(if
(f64.gt
(local.get $x)
(f64.const 0)
)
(br $topmost
(f64.const 1.2)
)
)
(if
(f64.gt
(local.get $Int)
(f64.const 0)
)
(br $topmost
(f64.const -3.4)
)
)
(if
(i32.gt_s
(local.get $Double)
(i32.const 0)
)
(br $topmost
(f64.const 5.6)
)
)
(if
(f64.lt
(local.get $x)
(local.get $y)
)
(br $topmost
(local.get $x)
)
)
(local.get $y)
)
)
(func $intOps (type $5) (result i32)
(local $x i32)
(i32.eq
(local.get $x)
(i32.const 0)
)
)
(func $hexLiterals (type $FUNCSIG$v)
(drop
(i32.add
(i32.add
(i32.const 0)
(i32.const 313249263)
)
(i32.const -19088752)
)
)
)
(func $conversions (type $FUNCSIG$v)
(local $i i32)
(local $d f64)
(block $block0
(local.set $i
(call $f64-to-int
(local.get $d)
)
)
(local.set $d
(f64.convert_i32_s
(local.get $i)
)
)
(local.set $d
(f64.convert_i32_u
(i32.shr_u
(local.get $i)
(i32.const 0)
)
)
)
)
)
(func $seq (type $FUNCSIG$v)
(local $J f64)
(local.set $J
(f64.sub
(block $block0 (result f64)
(drop
(f64.const 0.1)
)
(f64.const 5.1)
)
(block $block1 (result f64)
(drop
(f64.const 3.2)
)
(f64.const 4.2)
)
)
)
)
(func $switcher (type $6) (param $x i32) (result i32)
(block $topmost (result i32)
(block $switch$0
(block $switch-default$3
(block $switch-case$2
(block $switch-case$1
(br_table $switch-case$1 $switch-case$2 $switch-default$3
(i32.sub
(local.get $x)
(i32.const 1)
)
)
)
(br $topmost
(i32.const 1)
)
)
(br $topmost
(i32.const 2)
)
)
(nop)
)
(block $switch$4
(block $switch-default$7
(block $switch-case$6
(block $switch-case$5
(br_table $switch-case$6 $switch-default$7 $switch-default$7 $switch-default$7 $switch-default$7 $switch-default$7 $switch-default$7 $switch-case$5 $switch-default$7
(i32.sub
(local.get $x)
(i32.const 5)
)
)
)
(br $topmost
(i32.const 121)
)
)
(br $topmost
(i32.const 51)
)
)
(nop)
)
(block $label$break$Lout
(block $switch-default$16
(block $switch-case$15
(block $switch-case$12
(block $switch-case$9
(block $switch-case$8
(br_table $switch-case$15 $switch-default$16 $switch-default$16 $switch-case$12 $switch-default$16 $switch-default$16 $switch-default$16 $switch-default$16 $switch-case$9 $switch-default$16 $switch-case$8 $switch-default$16
(i32.sub
(local.get $x)
(i32.const 2)
)
)
)
(br $label$break$Lout)
)
(br $label$break$Lout)
)
(block $while-out$10
(loop $while-in$11
(block $block1
(br $while-out$10)
(br $while-in$11)
)
)
(br $label$break$Lout)
)
)
(block $while-out$13
(loop $while-in$14
(block $block3
(br $label$break$Lout)
(br $while-in$14)
)
)
(br $label$break$Lout)
)
)
(nop)
)
(i32.const 0)
)
)
(func $blocker (type $FUNCSIG$v)
(block $label$break$L
(br $label$break$L)
)
)
(func $frem (type $4) (result f64)
(call $f64-rem
(f64.const 5.5)
(f64.const 1.2)
)
)
(func $big_uint_div_u (type $5) (result i32)
(local $x i32)
(block $topmost (result i32)
(local.set $x
(i32.and
(i32.div_u
(i32.const -1)
(i32.const 2)
)
(i32.const -1)
)
)
(local.get $x)
)
)
(func $fr (type $FUNCSIG$vf) (param $x f32)
(local $y f32)
(local $z f64)
(block $block0
(drop
(f32.demote_f64
(local.get $z)
)
)
(drop
(local.get $y)
)
(drop
(f32.const 5)
)
(drop
(f32.const 0)
)
(drop
(f32.const 5)
)
(drop
(f32.const 0)
)
)
)
(func $negZero (type $4) (result f64)
(f64.const -0)
)
(func $abs (type $FUNCSIG$v)
(local $x i32)
(local $y f64)
(local $z f32)
(local $asm2wasm_i32_temp i32)
(block $block0
(local.set $x
(block $block1 (result i32)
(local.set $asm2wasm_i32_temp
(i32.const 0)
)
(select
(i32.sub
(i32.const 0)
(local.get $asm2wasm_i32_temp)
)
(local.get $asm2wasm_i32_temp)
(i32.lt_s
(local.get $asm2wasm_i32_temp)
(i32.const 0)
)
)
)
)
(local.set $y
(f64.abs
(f64.const 0)
)
)
(local.set $z
(f32.abs
(f32.const 0)
)
)
)
)
(func $neg (type $FUNCSIG$v)
(local $x f32)
(block $block0
(local.set $x
(f32.neg
(local.get $x)
)
)
(call_indirect (type $FUNCSIG$vf)
(local.get $x)
(i32.add
(i32.and
(i32.const 1)
(i32.const 7)
)
(i32.const 8)
)
)
)
)
(func $cneg (type $FUNCSIG$vf) (param $x f32)
(call_indirect (type $FUNCSIG$vf)
(local.get $x)
(i32.add
(i32.and
(i32.const 1)
(i32.const 7)
)
(i32.const 8)
)
)
)
(func $___syscall_ret (type $FUNCSIG$v)
(local $$0 i32)
(drop
(i32.gt_u
(i32.shr_u
(local.get $$0)
(i32.const 0)
)
(i32.const -4096)
)
)
)
(func $z (type $FUNCSIG$v)
(nop)
)
(func $w (type $FUNCSIG$v)
(nop)
)
(func $block_and_after (type $5) (result i32)
(block $waka
(drop
(i32.const 1)
)
(br $waka)
)
(i32.const 0)
)
(func $loop-roundtrip (type $7) (param $0 f64) (result f64)
(loop $loop-in1 (result f64)
(drop
(local.get $0)
)
(local.get $0)
)
)
(func $big-i64 (type $8) (result i64)
(i64.const -9218868437227405313)
)
(func $i64-store32 (type $9) (param $0 i32) (param $1 i64)
(i64.store32
(local.get $0)
(local.get $1)
)
)
(func $return-unreachable (result i32)
(return (i32.const 1))
)
(func $unreachable-block (result i32)
(f64.abs
(block ;; note no type - valid in binaryen IR, in wasm must be i32
(drop (i32.const 1))
(return (i32.const 2))
)
)
)
(func $unreachable-block-toplevel (result i32)
(block ;; note no type - valid in binaryen IR, in wasm must be i32
(drop (i32.const 1))
(return (i32.const 2))
)
)
(func $unreachable-block0 (result i32)
(f64.abs
(block ;; note no type - valid in binaryen IR, in wasm must be i32
(return (i32.const 2))
)
)
)
(func $unreachable-block0-toplevel (result i32)
(block ;; note no type - valid in binaryen IR, in wasm must be i32
(return (i32.const 2))
)
)
(func $unreachable-block-with-br (result i32)
(block $block ;; unreachable type due to last element having that type, but the block is exitable
(drop (i32.const 1))
(br $block)
)
(i32.const 1)
)
(func $unreachable-if (result i32)
(f64.abs
(if ;; note no type - valid in binaryen IR, in wasm must be i32
(i32.const 3)
(return (i32.const 2))
(return (i32.const 1))
)
)
)
(func $unreachable-if-toplevel (result i32)
(if ;; note no type - valid in binaryen IR, in wasm must be i32
(i32.const 3)
(return (i32.const 2))
(return (i32.const 1))
)
)
(func $unreachable-loop (result i32)
(f64.abs
(loop ;; note no type - valid in binaryen IR, in wasm must be i32
(nop)
(return (i32.const 1))
)
)
)
(func $unreachable-loop0 (result i32)
(f64.abs
(loop ;; note no type - valid in binaryen IR, in wasm must be i32
(return (i32.const 1))
)
)
)
(func $unreachable-loop-toplevel (result i32)
(loop ;; note no type - valid in binaryen IR, in wasm must be i32
(nop)
(return (i32.const 1))
)
)
(func $unreachable-loop0-toplevel (result i32)
(loop ;; note no type - valid in binaryen IR, in wasm must be i32
(return (i32.const 1))
)
)
(func $unreachable-ifs
(if (unreachable) (nop))
(if (unreachable) (unreachable))
(if (unreachable) (nop) (nop))
(if (unreachable) (unreachable) (nop))
(if (unreachable) (nop) (unreachable))
(if (unreachable) (unreachable) (unreachable))
;;
(if (i32.const 1) (unreachable) (nop))
(if (i32.const 1) (nop) (unreachable))
(if (i32.const 1) (unreachable) (unreachable))
)
(func $unreachable-if-arm
(if
(i32.const 1)
(block
(nop)
)
(block
(unreachable)
(drop
(i32.const 1)
)
)
)
)
)
| WebAssembly | 3 | phated/binaryen | test/unit.wat | [
"Apache-2.0"
] |
package test
fun useDefault() {
f(5)
} | Groff | 1 | qussarah/declare | jps-plugin/testData/incremental/pureKotlin/defaultValueRemoved1/useDefault.kt.new.2 | [
"Apache-2.0"
] |
CLASS zcl_abapgit_object_scvi DEFINITION
PUBLIC
INHERITING FROM zcl_abapgit_objects_super
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES zif_abapgit_object .
PROTECTED SECTION.
PRIVATE SECTION.
TYPES:
BEGIN OF ty_screen_variant,
shdsvci TYPE shdsvci,
shdsvtxci TYPE STANDARD TABLE OF shdsvtxci WITH DEFAULT KEY,
shdsvfvci TYPE STANDARD TABLE OF shdsvfvci WITH DEFAULT KEY,
shdguixt TYPE STANDARD TABLE OF shdguixt WITH DEFAULT KEY,
shdgxtcode TYPE STANDARD TABLE OF shdgxtcode WITH DEFAULT KEY,
END OF ty_screen_variant .
ENDCLASS.
CLASS zcl_abapgit_object_scvi IMPLEMENTATION.
METHOD zif_abapgit_object~changed_by.
DATA: lv_screen_variant TYPE scvariant.
lv_screen_variant = ms_item-obj_name.
SELECT SINGLE chuser
FROM shdsvci
INTO rv_user
WHERE scvariant = lv_screen_variant.
IF sy-subrc <> 0
OR rv_user IS INITIAL.
rv_user = c_user_unknown.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA: lv_screen_variant TYPE scvariant.
lv_screen_variant = ms_item-obj_name.
CALL FUNCTION 'RS_HDSYS_DELETE_SC_VARIANT'
EXPORTING
scvariant = lv_screen_variant
EXCEPTIONS
variant_enqueued = 1
no_correction = 2
scvariant_used = 3
OTHERS = 4.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA: ls_screen_variant TYPE ty_screen_variant.
DATA: lv_text TYPE natxt.
io_xml->read(
EXPORTING
iv_name = 'SCVI'
CHANGING
cg_data = ls_screen_variant ).
CALL FUNCTION 'ENQUEUE_ESSCVARCIU'
EXPORTING
scvariant = ls_screen_variant-shdsvci-scvariant
EXCEPTIONS
OTHERS = 01.
IF sy-subrc <> 0.
MESSAGE e413(ms) WITH ls_screen_variant-shdsvci-scvariant INTO lv_text.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
corr_insert( iv_package = iv_package ).
* Populate user details
ls_screen_variant-shdsvci-crdate = sy-datum.
ls_screen_variant-shdsvci-cruser = sy-uname.
ls_screen_variant-shdsvci-chdate = sy-datum.
ls_screen_variant-shdsvci-chuser = sy-uname.
MODIFY shdsvci FROM ls_screen_variant-shdsvci.
MODIFY shdsvtxci FROM TABLE ls_screen_variant-shdsvtxci[].
MODIFY shdsvfvci FROM TABLE ls_screen_variant-shdsvfvci[].
MODIFY shdguixt FROM TABLE ls_screen_variant-shdguixt[].
MODIFY shdgxtcode FROM TABLE ls_screen_variant-shdgxtcode[].
CALL FUNCTION 'DEQUEUE_ESSCVARCIU'
EXPORTING
scvariant = ls_screen_variant-shdsvci-scvariant.
ENDMETHOD.
METHOD zif_abapgit_object~exists.
DATA: lv_screen_variant TYPE scvariant.
lv_screen_variant = ms_item-obj_name.
CALL FUNCTION 'RS_HDSYS_READ_SC_VARIANT_DB'
EXPORTING
scvariant = lv_screen_variant
EXCEPTIONS
no_variant = 1
OTHERS = 2.
rv_bool = boolc( sy-subrc = 0 ).
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = abap_false.
ENDMETHOD.
METHOD zif_abapgit_object~jump.
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: ls_screen_variant TYPE ty_screen_variant.
ls_screen_variant-shdsvci-scvariant = ms_item-obj_name.
CALL FUNCTION 'RS_HDSYS_READ_SC_VARIANT_DB'
EXPORTING
scvariant = ls_screen_variant-shdsvci-scvariant
IMPORTING
header_scvariant = ls_screen_variant-shdsvci
TABLES
values_scvariant = ls_screen_variant-shdsvfvci[]
guixt_scripts = ls_screen_variant-shdguixt[]
EXCEPTIONS
no_variant = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
* Clear all user details
CLEAR: ls_screen_variant-shdsvci-crdate,
ls_screen_variant-shdsvci-cruser,
ls_screen_variant-shdsvci-chdate,
ls_screen_variant-shdsvci-chuser.
SELECT *
FROM shdsvtxci
INTO TABLE ls_screen_variant-shdsvtxci[]
WHERE scvariant = ls_screen_variant-shdsvci-scvariant.
SELECT *
FROM shdgxtcode
INTO TABLE ls_screen_variant-shdgxtcode[]
WHERE scvariant = ls_screen_variant-shdsvci-scvariant.
io_xml->add( iv_name = 'SCVI'
ig_data = ls_screen_variant ).
ENDMETHOD.
ENDCLASS.
| ABAP | 4 | IvxLars/abapGit | src/objects/zcl_abapgit_object_scvi.clas.abap | [
"MIT"
] |
#
# @expect=org.quattor.pan.exceptions.EvaluationException
#
object template join6;
'/x1' = dict('key1', 1, 'key2', 2);
'/x2' = join(',', value('/x1'));
| Pan | 4 | aka7/pan | panc/src/test/pan/Functionality/join/join6.pan | [
"Apache-2.0"
] |
// errno.hb
extern char*[] sys_errlist;
extern int sys_nerr;
extern int errno;
| Harbour | 2 | ueki5/cbc | import/errno.hb | [
"Unlicense"
] |
#!/bin/bash
release=$1
cp mobile/build/outputs/apk/release/mobile-armeabi-v7a-release.apk shadowsocks-armeabi-v7a-${release}.apk
cp mobile/build/outputs/apk/release/mobile-arm64-v8a-release.apk shadowsocks-arm64-v8a-${release}.apk
cp mobile/build/outputs/apk/release/mobile-x86-release.apk shadowsocks-x86-${release}.apk
cp mobile/build/outputs/apk/release/mobile-x86_64-release.apk shadowsocks-x86_64-${release}.apk
cp mobile/build/outputs/apk/release/mobile-universal-release.apk shadowsocks--universal-${release}.apk
cp tv/build/outputs/apk/freedom/release/tv-freedom-armeabi-v7a-release.apk shadowsocks-tv-armeabi-v7a-${release}.apk
cp tv/build/outputs/apk/freedom/release/tv-freedom-arm64-v8a-release.apk shadowsocks-tv-arm64-v8a-${release}.apk
cp tv/build/outputs/apk/freedom/release/tv-freedom-x86-release.apk shadowsocks-tv-x86-${release}.apk
cp tv/build/outputs/apk/freedom/release/tv-freedom-x86_64-release.apk shadowsocks-tv-x86_64-${release}.apk
cp tv/build/outputs/apk/freedom/release/tv-freedom-universal-release.apk shadowsocks-tv-universal-${release}.apk
| Shell | 3 | BitlikerAppFork/shadowsocks-android | release.sh | [
"ISC",
"OpenSSL",
"MIT"
] |
very is_sooper = false
| Dogescript | 0 | PinkDiamond1/dogescript | test/language-spec/sooper/identifier-part/source.djs | [
"MIT"
] |
; CLW file contains information for the MFC ClassWizard
[General Info]
Version=1
ClassCount=1
ResourceCount=1
NewFileInclude1=#include "stdafx.h"
Class1=CPortView
LastClass=CPortView
LastTemplate=CFormView
Resource1=IDD_NODEVIEW
[DLG:IDD_NODEVIEW]
Type=1
Class=CPortView
ControlCount=6
Control1=IDC_STATIC,static,1342308352
Control2=IDC_STATIC,static,1342308352
Control3=IDC_COMBO1,combobox,1344339971
Control4=IDC_STATIC,static,1342308352
Control5=IDC_EDIT1,edit,1350631552
Control6=IDC_EDIT2,edit,1350631552
[CLS:CPortView]
Type=0
HeaderFile=PortView.h
ImplementationFile=PortView.cpp
BaseClass=CFormView
Filter=D
LastObject=IDC_EDIT2
VirtualFilter=VWC
| Clarion | 1 | CarysT/medusa | Tools/NodeBlurPort/NodeBlurPort.clw | [
"MIT"
] |
ru внизу
http://sanskritdocuments.org/doc_vishhnu/bhajagovindam.html?lang=sa
भज गोविन्दं
भजगोविन्दं भजगोविन्दं
गोविन्दं भजमूढमते ।
सम्प्राप्ते सन्निहिते काले
नहि नहि रक्षति डुकृञ्करणे ॥ १॥
Worship Govinda, worship Govinda, worship Govinda, Oh fool !
Rules of grammar will not save you at the time of your death.
मूढ जहीहि धनागमतृष्णां
कुरु सद्बुद्धिं मनसि वितृष्णाम् ।
यल्लभसे निजकर्मोपात्तं
वित्तं तेन विनोदय चित्तम् ॥ २॥
Oh fool ! Give up your thirst to amass wealth, devote your
mind to thoughts to the Real. Be content with what comes
through actions already performed in the past.
नारीस्तनभर नाभीदेशं
दृष्ट्वा मागामोहावेशम् ।
एतन्मांसवसादि विकारं
मनसि विचिन्तय वारं वारम् ॥ ३॥
Do not get drowned in delusion by going wild with passions and
lust by seeing a woman's navel and chest. These are nothing but
a modification of flesh. Fail not to remember this again and
again in your mind.
नलिनीदलगत जलमतितरलं
तद्वज्जीवितमतिशयचपलम् ।
विद्धि व्याध्यभिमानग्रस्तं
लोकं शोकहतं च समस्तम् ॥ ४॥
The life of a person is as uncertain as rain drops trembling on a
lotus leaf. Know that the whole world remains a prey to
disease, ego and grief.
यावद्वित्तोपार्जन सक्त-
स्तावन्निज परिवारो रक्तः ।
पश्चाज्जीवति जर्जर देहे
वार्तां कोऽपि न पृच्छति गेहे ॥ ५॥
So long as a man is fit and able to support his family, see
what affection all those around him show. But no one at home
cares to even have a word with him when his body totters due to
old age.
यावत्पवनो निवसति देहे
तावत्पृच्छति कुशलं गेहे ।
गतवति वायौ देहापाये
भार्या बिभ्यति तस्मिन्काये ॥ ६॥
When one is alive, his family members enquire kindly about his
welfare. But when the soul departs from the body, even his wife
runs away in fear of the corpse.
बालस्तावत्क्रीडासक्तः
तरुणस्तावत्तरुणीसक्तः ।
वृद्धस्तावच्चिन्तासक्तः
परमे ब्रह्मणि कोऽपि न सक्तः ॥ ७॥ var परे
The childhood is lost by attachment to playfulness. Youth is lost by
attachment to woman. Old age passes away by thinking over many
things. But there is hardly anyone who wants to be lost in
parabrahman.
काते कान्ता कस्ते पुत्रः
संसारोऽयमतीव विचित्रः ।
कस्य त्वं कः कुत आयातः
तत्त्वं चिन्तय तदिह भ्रातः ॥ ८॥
Who is your wife ? Who is your son ? Strange is this samsAra,
the world. Of whom are you ? From where have you come ?
Brother, ponder over these truths.
सत्सङ्गत्वे निस्सङ्गत्वं
निस्सङ्गत्वे निर्मोहत्वम् ।
निर्मोहत्वे निश्चलतत्त्वं
निश्चलतत्त्वे जीवन्मुक्तिः ॥ ९॥
From satsanga, company of good people, comes non-attachment,
from non-attachment comes freedom from delusion, which leads to
self-settledness. From self-settledness comes JIvan muktI.
वयसिगते कः कामविकारः
शुष्के नीरे कः कासारः ।
क्षीणेवित्ते कः परिवारः
ज्ञाते तत्त्वे कः संसारः ॥ १०॥
What good is lust when youth has fled ? What use is a lake
which has no water ? Where are the relatives when wealth is
gone ? Where is samsAra, the world, when the Truth is known ?
मा कुरु धन जन यौवन गर्वं
हरति निमेषात्कालः सर्वम् ।
मायामयमिदमखिलं हित्वा var बुध्वा
ब्रह्मपदं त्वं प्रविश विदित्वा ॥ ११॥
Do not boast of wealth, friends, and youth. Each one of these
are destroyed within a minute by time. Free yourself from the
illusion of the world of Maya and attain the timeless Truth.
दिनयामिन्यौ सायं प्रातः
शिशिरवसन्तौ पुनरायातः ।
कालः क्रीडति गच्छत्यायुः
तदपि न मुञ्चत्याशावायुः ॥ १२॥
Daylight and darkness, dusk and dawn, winter and springtime
come and go. Time plays and life ebbs away. But the storm of
desire never leaves.
द्वादशमञ्जरिकाभिरशेषः
कथितो वैयाकरणस्यैषः ।
उपदेशो भूद्विद्यानिपुणैः
श्रीमच्छन्करभगवच्छरणैः ॥ १२अ ॥
This bouquet of twelve verses was imparted to a grammarian
by the all-knowing Shankara, adored as the bhagavadpada.
काते कान्ता धन गतचिन्ता
वातुल किं तव नास्ति नियन्ता ।
त्रिजगति सज्जनसं गतिरैका
भवति भवार्णवतरणे नौका ॥ १३॥
Oh mad man ! Why this engrossment in thoughts of wealth ? Is
there no one to guide you ? There is only one thing in three
worlds that can save you from the ocean of samsAra, get into
the boat of satsanga, company of good people, quickly.
Stanza attributed to Padmapada.
जटिलो मुण्डी लुञ्छितकेशः
काषायाम्बरबहुकृतवेषः ।
पश्यन्नपि चन पश्यति मूढः
उदरनिमित्तं बहुकृतवेषः ॥ १४॥
There are many who go with matted locks, many who have clean
shaven heads, many whose hairs have been plucked out; some are
clothed in orange, yet others in various colours --- all just for
a livelihood. Seeing truth revealed before them, still the
foolish ones see it not.
Stanza attributed to Totakacharya.
अङ्गं गलितं पलितं मुण्डं
दशनविहीनं जातं तुण्डम् ।
वृद्धो याति गृहीत्वा दण्डं
तदपि न मुञ्चत्याशापिण्डम् ॥ १५॥
Strength has left the old man's body; his head has become bald,
his gums toothless and leaning on crutches. Even then the
attachment is strong and he clings firmly to fruitless desires.
Stanza attributed to Hastamalaka.
अग्रे वह्निः पृष्ठेभानुः
रात्रौ चुबुकसमर्पितजानुः ।
करतलभिक्षस्तरुतलवासः
तदपि न मुञ्चत्याशापाशः ॥ १६॥
Behold there lies the man who sits warming up his body with the
fire in front and the sun at the back; at night he curls up the
body to keep out of the cold; he eats his beggar's food from
the bowl of his hand and sleeps beneath the tree. Still in his
heart, he is a wretched puppet at the hands of passions.
Stanza attributed to Subodha.
कुरुते गङ्गासागरगमनं
व्रतपरिपालनमथवा दानम् ।
ज्ञानविहीनः सर्वमतेन
मुक्तिं न भजति जन्मशतेन ॥ १७॥ var भजति न मुक्तिं
One may go to Gangasagar, observe fasts, and give away riches
in charity ! Yet, devoid of jnana, nothing can give mukti even
at the end of a hundred births.
Stanza attributed to vArtikakAra.
सुर मन्दिर तरु मूल निवासः
शय्या भूतल मजिनं वासः ।
सर्व परिग्रह भोग त्यागः
कस्य सुखं न करोति विरागः ॥ १८॥
Take your residence in a temple or below a tree, wear the
deerskin for the dress, and sleep with mother earth as your
bed. Give up all attachments and renounce all comforts. Blessed
with such vairgya, could any fail to be content ?
Stanza attributed to nityAnanda.
योगरतो वाभोगरतोवा
सङ्गरतो वा सङ्गविहीनः ।
यस्य ब्रह्मणि रमते चित्तं
नन्दति नन्दति नन्दत्येव ॥ १९॥
One may take delight in yoga or bhoga, may have attachment or
detachment. But only he whose mind steadily delights in Brahman
enjoys bliss, no one else.
Stanza attributed to anandagiriH.
भगवद् गीता किञ्चिदधीता
गङ्गा जललव कणिकापीता ।
सकृदपि येन मुरारि समर्चा
क्रियते तस्य यमेन न चर्चा ॥ २०॥
Let a man read but a little from bhagavadgItA, drink just a drop of
water from the Ganges, worship but once murAri. He then will
have no altercation with Yama.
Stanza attributed to dRiDhabhakta.
पुनरपि जननं पुनरपि मरणं
पुनरपि जननी जठरे शयनम् ।
इह संसारे बहुदुस्तारे
कृपयाऽपारे पाहि मुरारे ॥ २१॥
Born again, death again, again to stay in the mother's womb !
It is indeed hard to cross this boundless ocean of samsAra. Oh
Murari ! Redeem me through Thy mercy.
Stanza attributed to nityanAtha.
रथ्या चर्पट विरचित कन्थः
पुण्यापुण्य विवर्जित पन्थः ।
योगी योगनियोजित चित्तो
रमते बालोन्मत्तवदेव ॥ २२॥
There is no shortage of clothing for a monk so long as there
are rags cast off the road. Freed from vices and virtues, onward
he wanders. One who lives in communion with god enjoys bliss,
pure and uncontaminated, like a child and as an intoxicated.
Stanza attributed to nityanAtha.
कस्त्वं कोऽहं कुत आयातः
का मे जननी को मे तातः ।
इति परिभावय सर्वमसारम्
विश्वं त्यक्त्वा स्वप्न विचारम् ॥ २३॥
Who are you ? Who am I ? From where do I come ? Who is my
mother, who is my father ? Ponder thus, look at everything as
essence-less and give up the world as an idle dream.
Stanza attributed to surendra.
त्वयि मयि चान्यत्रैको विष्णुः
व्यर्थं कुप्यसि मय्यसहिष्णुः ।
भव समचित्तः सर्वत्र त्वं
वाञ्छस्यचिराद्यदि विष्णुत्वम् ॥ २४॥
In me, in you and in everything, none but the same Vishnu
dwells. Your anger and impatience is meaningless. If you wish
to attain the status of Vishnu, have samabhAva, equanimity, always.
Stanza attributed to medhAtithira.
शत्रौ मित्रे पुत्रे बन्धौ
मा कुरु यत्नं विग्रहसन्धौ ।
सर्वस्मिन्नपि पश्यात्मानं
सर्वत्रोत्सृज भेदाज्ञानम् ॥ २५॥
Waste not your efforts to win the love of or to fight against
friend and foe, children and relatives. See yourself in
everyone and give up all feelings of duality completely.
Stanza attributed to medhAtithira.
कामं क्रोधं लोभं मोहं
त्यक्त्वाऽऽत्मानं भावय कोऽहम्। var पश्यति सोऽहम्
आत्मज्ञान विहीना मूढाः
ते पच्यन्ते नरकनिगूढाः ॥ २६॥
Give up lust, anger, infatuation, and greed. Ponder over your
real nature. Fools are they who are blind to the Self. Cast
into hell, they suffer there endlessly.
Stanza attributed to bhArativamsha.
गेयं गीता नाम सहस्रं
ध्येयं श्रीपति रूपमजस्रम् ।
नेयं सज्जन सङ्गे चित्तं
देयं दीनजनाय च वित्तम् ॥ २७॥
Regularly recite from the Gita, meditate on Vishnu in your
heart, and chant His thousand glories. Take delight to be with
the noble and the holy. Distribute your wealth in charity to
the poor and the needy.
Stanza attributed to sumatir.
सुखतः क्रियते रामाभोगः
पश्चाद्धन्त शरीरे रोगः ।
यद्यपि लोके मरणं शरणं
तदपि न मुञ्चति पापाचरणम् ॥ २८॥
He who yields to lust for pleasure leaves his body a prey to
disease. Though death brings an end to everything, man does not
give-up the sinful path.
अर्थमनर्थं भावय नित्यं
नास्तिततः सुखलेशः सत्यम् ।
पुत्रादपि धन भाजां भीतिः
सर्वत्रैषा विहिता रीतिः ॥ २९॥
Wealth is not welfare, truly there is no joy in it. Reflect
thus at all times. A rich man fears even his own son. This is
the way of wealth everywhere.
प्राणायामं प्रत्याहारं
नित्यानित्य विवेकविचारम् ।
जाप्यसमेत समाधिविधानं
कुर्ववधानं महदवधानम् ॥ ३०॥
Regulate the prANa-s, life forces, remain unaffected by external
influences and discriminate between the real and the fleeting.
Chant the holy name of God and silence the turbulent mind.
Perform these with care, with extreme care.
गुरुचरणाम्बुज निर्भर भक्तः
संसारादचिराद्भव मुक्तः ।
सेन्द्रियमानस नियमादेवं
द्रक्ष्यसि निज हृदयस्थं देवम् ॥ ३१॥
Oh devotee of the lotus feet of the Guru ! May thou be soon
free from Samsara. Through disciplined senses and controlled
mind, thou shalt come to experience the indwelling Lord of your
heart !
मूढः कश्चन वैयाकरणो
डुकृञ्करणाध्ययन धुरिणः ।
श्रीमच्छम्कर भगवच्छिष्यै
बोधित आसिच्छोधितकरणः ॥ ३२॥
Thus a silly grammarian lost in rules cleansed of his narrow
vision and shown the Light by Shankara's apostles.
भजगोविन्दं भजगोविन्दं
गोविन्दं भजमूढमते ।
नामस्मरणादन्यमुपायं
नहि पश्यामो भवतरणे ॥ ३३॥
Worship Govinda, worship Govinda, worship Govinda, Oh fool !
Other than chanting the Lord's names, there is no other way
to cross the life's ocean.
स्ectionAppendix: Word meanings
The following words and meanings are added as an appendix to
allow the reader to learn Sanskrit words.
भज = worship;
गोविन्दं = Govinda;
मूढमते = O, foolish mind!;
सम्प्राप्ते = ( when you have) reached/obtained;
सन्निहिते = (in the) presence/nearness of;
काले = Time (here:Lord of Death, Yama);
नहि = No; never;
रक्षति = protects;
डुकृञ्करणे = the grammatical formula DukRi~NkaraNe;
॥ १॥
मूढ = Oh fool!;
जहीहि = jahi+iha, leave/give up+here(in this world);
धन = wealth;
अगम = coming/arrival;
तृष्णां = thirst/desire;
कुरु = Do;act;
सद्बुद्धिं = sat+buddhiM, good+awareness(loosely speaking:mind);
मनसि = in the mind;
वितृष्णां = desirelessness;
यल्लभसे = yat+labhase, whatever+(you)obtain;
निजकर्म = nija+karma, one's+duty(normal work);
उपात्त = obtained;
वित्तं = wealth;
तेन = by that; with that;
विनोदय = divert/recreate(be happy);
चित्तं = mind;
॥ २॥
नारी = woman;
स्तनभर = breasts that are(full-with milk);
नाभीदेशं = nAbhI+deshaM, navel+region/country;
दृष्ट्वा = having seen;
मागा = mA+gA, Don't+go;
मोहावेशं = infatuated state(moha+AveshaM-seizure);
एतन् = this;
मांसवसादि = flesh+etc;
विकारं = appearance (generally, grotesque/ugly);
मनसि = in the mind;
विचिन्तय = think well;
वारं = again;
वारं = and again;
॥ ३॥
नलिनीदलगत = nalinI+dala+gata, lotus+petal+reached/gone;
जल = water(drop);
अतितरलं = ati+tarala, very+unstable;
तद्वत् = like that;
जीवित = life;
अतिशय = wonderful;
चपलं = fickle-minded;
विद्धि = know for sure;
व्याधि = disease;
अभिमान = self-importance;
ग्रस्तं = having been caught/seized;
लोकं = world;people;
शोकहतं = attacked(hata) by grief(shoka);
च = and;
समस्तं = entire;
॥ ४॥
यावत् = so long as;
वित्त = wealth;
उपार्जन = earning/acquiring;
सक्तः = capable of;
तावन्निज = tAvat+nija, till then+one's;
परिवारः = family;
रक्तः = attached;
पश्चात् = later;
जीवति = while living(without earning);
जर्जर = old/digested (by disease etc);
देहे = in the body;
वार्तां = word (here enquiry/inquiry);
कोऽपि = kaH+api, whosoever; even one;
न = not;
पृच्छति = inquires/asks/minds;
गेहे = in the house;
॥ ५॥
यावत् = so long as;
पवनः = air/breath;
निवसति = lives/dwells;
देहे = in the body;
तावत् = till then;
पृच्छति = asks/inquires;
कुशलं = welfare;
गेहे = in the house;
गतवति = while gone;
वायौ = air(life-breath);
देहापाये = when life departs the body;
भार्या = wife;
बिभ्यति = is afraid;fears;
तस्मिन्काये = tasmin+kaye, in that body;
॥ ६॥
बालः = young boy;
तावत् = till then (till he is young);
क्रीडा = play;
सक्तः = attached/engrossed/absorbed;
तरुणः = young man;
तावत् = till then;
तरुणी = young woman;
सक्तः = attached/engrossed;
वृद्धः = old man;
तावत् = till then;
चिन्ता = worry;
सक्तः = attached/engrossed/absorbed;
परमे = in the lofty;high;supreme; also pare
ब्रह्मणि = Brahman ;God;
कोऽपि = whosoever;
न = not;
सक्तः = attached/absorbed/engrossed;
॥ ७॥
काते = kA+te, who+your;
कान्ता = wife;
कस्ते = kaH+te, who+your;
पुत्रः = son;
संसारः = world/family;
अयं = this;
अतीव = great/big/very much;
विचित्रः = wonderful/mysterious;
कस्य = whose;
त्वं = you;
कः = who;
कुतः = from where;
आयातः = have come;
तत्त्वं = truth/nature;
चिन्तय = think well/consider;
तदिह = tat+iha, that+here;
भ्रातः = brother;
॥ ८॥
सत्सङ्गत्वे = in good company;
निस्सङ्गत्वं = aloneness/non-attachment/detachment;
निर्मोहत्वं = non-infatuated state/clear-headedness;
निश्चलतत्त्वं = tranquillity/imperturbability;
जीवन्मुक्तिः = salvation+freedom from bondage of birth;
वयसिगते = vayasi+gate, when age has advanced/gone;
॥ ९॥
कः = who/what use( in the sense of kva?(where));
कामविकारः = sensual/sexual attraction;
शुष्के = in the drying up of;
नीरे = water;
क = what( use) is the;
कासारः = lake;
क्षीणे = spent-up/weakened state of;
वित्ते = wealth;
कः = what( use) for;
परिवारः = family(is there?);
ज्ञाते = in the realised state;
तत्त्वे = truth;
कः = what (use) is;
संसारः = world/family bond;
॥ १०॥
मा = do not;
कुरु = do/act;
धन = wealth;
जन = people;
यौवन = youth;
गर्वं = arrogance/haughtiness;
हरति = takes away/steals away;
निमेषात् = in the twinkling of the eye;
कालः = Master Time;
सर्वं = all;
माया = delusion;
मयं = full of/completely filled;
इदं = this;
अखिलं = whole/entire;
हित्वा = having given up/abandoned;
ब्रह्मपदं = the state/position of Brahma/god-realised state;
त्वं = you;
प्रविश = enter;
विदित्वा = having known/realised;
॥ ११॥
दिनयामिन्यौ = dina+yAminI, day + night;
सायं = evening;
प्रातः = morning;
शिशिर = frosty season;
वसन्तौ = (and) Spring season;
पुनः = again;
आयातः = have arrived;
कालः = Master Time;
क्रीडति = plays;
गच्छति = goes (away);
आयुः = life/age;
तदपि = tat+api, then even;
न = not;
मुञ्चति = releases;
आशा = desire;
वायुः = air (the wind of desire does not let off its hold);
॥ १२॥
द्वादशमञ्जरिकाभिः = by the bouquet consisting of 12 flowers (12;
shlokas above)
अशेष = without remainder/totally;
कथित = was told;
वैयाकरणस्यैषः = to the grammarian+this;
उपदेशः = advice;
भूद् = was;
विद्यनिपुणै = by the ace scholar Shankara (Plural is used for reverence);
श्रीमच्छन्करभगवत्+चरणैः = by the Shankaracharya who is known;
as shankarabhagavat +charaNAH or pAdAH (plural for reverence)
॥ १२अ ॥
काते = kA+te, who+your;
कान्ता = wife;
धन = wealth;
गतचिन्ता = thinking of;
वातुल = ;
कि = ;
तव = your;
नास्ति = na+asti, not there;
नियन्ता = controller;
त्रिजगति = in the three worlds;
सज्जन = good people;
सङ्गतिरैका = sa~NgatiH+ekA, company+(only) one (way);
भवति = becomes;
भवार्णव = bhava+arNava, birth and death+ocean;
तरणे = in crossing;
नौका = boat/ship;
॥ १३॥
जटिलः = with knotted hair;
मुण्डी = shaven head;
लुञ्छितकेश = hair cut here and there;
काषाय = saffron cloth;
अम्बर = cloth/sky;
बहुकृत = variously done/made-up;
वेषः = make-ups/garbs/roles;
पश्यन्नपि = even after seeing;
चन = cha(?)+na, and +not;
पश्यति = sees;
मूढः = the fool;
उदरनिमित्तं = for the sake of the belly/living;
बहुकृतवेषः = various make-ups/roles;
॥ १४॥
अङ्गं = limb(s);
गलितं = weakened;
पलितं = ripened(grey);
मुण्डं = head;
दशनविहीनं = dashana+vihInaM, teeth+bereft;
जातं = having become;
तुण्डं = jaws/mouth?;
वृद्धः = the old man;
याति = goes;
गृहीत्वा = holding the;
दण्डं = stick(walking);
तदपि = then even;
न = not;
मुञ्चति = lets go/releases/gives up;
आशापिण्डं = AshA+pindaM, desire+lump(piNDaM also means rice-ball given;
as oblation for the dead)
॥ १५॥
अग्रे = in front of/ahead/beforehand;
वह्निः = fire ( for worship);
पृष्ठेभानुः = pRiShThe+bhAnuH, behind+sun;
रात्रौ = in the night;
चुबुकसमर्पितजानु = face dedicated to(huddled up between) the knees;
करतलभिक्षा = alms in the palms;
तरुतलवासं = living under the trees;
तदपि = then even;
न = not;
मुञ्चति = releases/lets go;
आशा = desire;
पाशं = rope/ties;
॥ १६॥
कुरुते = one takes resort to;
गङ्गासागर = the sea of Ganga (banks of the Ganges);
गमनं = going;
व्रत = austerities;
परिपालनं = observance/governance;
अथवा = or/else;
दानं = charity;
ज्ञानविहीनः = (but)bereft of knowledge of the Self;
सर्वमतेन = according to all schools of thought/unanimously;
मुक्तिं = salvation/freedom;
न = not;
भजति = attains;
जन्म = birth(s);
शतेन = hundred;
॥ १७॥
सुर = gods;
मन्दिर = temple;
तरु = tree;
मूल = root;
निवासः = living;
शय्या = bed;
भूतल = on the surface of the earth;
मजिन = deer skin?;
वासः = living;
सर्व = all;
परिग्रह = attachment;
भोग = enjoyable things/worldly pleasures;
त्याग = sacrificing/abandonment;
कस्य = whose;
सुखं = happiness;
न = not;
करोति = does;
विरागः = Non-attachment/desirelessness;
॥ १८॥
योगरतः = indulging in yoga;
वा = or;
भोगरतः = indulging in worldly pleasures;
वा = or;
सङ्गरतः = indulging in good company;
वा = or;
सङ्गविहीनः = bereft of company;
यस्य = whose;
ब्रह्मणि = in Brahman(God);
रमते = delights;
चित्तं = mind (here soul);
नन्दति = revels;
नन्दत्येव = nandati+eva, revels alone/revels indeed;
॥ १९॥
भगवद् = god's;
गीता = song (here the scripture `bhagavatgItA');
किञ्चित् = a little;
अधीता = studied;
गङ्गा = river Ganga;
जललव = water drop;
कणिकापीता = a little droplet, drunk;
सकृदपि = once even;
येन = by whom;
मुरारि = the enemy of `MurA' (Lord Krishna);
समर्चा = well worshipped;
क्रियते = is done;
तस्य = his;
यमेन = by Yama, the lord of Death;
न = not;
चर्चा = discussion;
॥ २०॥
पुनरपि = punaH+api, again again;
जननं = birth;
पुनरपि = again again;
मरणं = death;
पुनरपि = again again;
जननी = mother;
जठरे = in the stomach;
शयनं = sleep;
इह = in this world/here;
संसारे = family/world;
बहुदुस्तारे = fordable with great difficulty;
कृपयाऽपारे = out of boundless compassion;
पाहि = protect;
मुरारे = Oh MurA's enemy!(KriShNa);
॥ २१॥
रथ्या = ?;
चर्पट = torn/tattered cloth;
विरचित = created;
कन्थः = throated man;
पुण्यापुण्य = virtues sins;
विवर्जित = without/ having abandoned;
पन्थः = wayfarer?;
योगी = the man seeking union with god;
योगनियोजित = controlled by yoga;
चित्तः = mind;
रमते = delights;
बालोन्मत्तवदेव = like a child who has gone mad;
॥ २२॥
कः = who (are);
त्वं = you;
कः = who(am);
अहं = I;
कुतः = whence;
आयातः = has come;
का = who;
मे = my;
जननी = mother;
कः = who;
मे = my;
तातः = father;
इति = thus;
परिभावय = deem well/visualise;
सर्वं = the entire;
असारं = worthless/without essence;
विश्वं = world;
त्यक्त्वा = having abandoned/sacrificed;
स्वप्न = dream;
विचारं = consideration/thinking;
॥ २३॥
त्वयि = in yourself;
मयि = in myself;
चान्यत्रैक = cha+anyatra+ekaH, and+in any other place+only one;
विष्णुः = the Lord MahAviShNu;
व्यर्थ = in vain ; for nothing;purposeless;
कुप्यसि = you get angry;
मय्यसहिष्णु = mayi+asahiShNuH, in me+intolerant;
भव = become;
समचित्तः = equal-minded/equanimity;
सर्वत्र = everywhere;
त्वं = you;
वाञ्छसि = you desire;
अचिराद् = without delay/in no time;
यदि = if;
विष्णुत्वं = the quality/state of Brahman/god-realisation;
॥ २४॥
शत्रौ = in (towards)the enemy;
मित्रे = in (towards) the friend;
पुत्रे = in(towards) the son;
बन्धौ = in (towards) relatives;
मा = don't;
कुरु = do;
यत्नं = effort;
विग्रहसन्धौ = for war(dissension) or peace-making;
सर्वस्मिन्नपि = in all beings;
पश्यात्मानं = see your own self;
सर्वत्र = everywhere;
उत्सृज = give up;
भेदाज्ञानं = difference/otherness/duality;
॥ २५॥
कामं = desire;
क्रोधं = anger;
लोभं = greed;
मोहं = infatuation;
त्यक्त्वाऽत्मानं = having abandoned see as one's own self;
भावय = deem/consider/visualise/imagine;
कोऽहं = who am I;
आत्मज्ञान = knowledge of self;
विहीना = bereft;
मूढा = fools;
ते = they;
पच्यन्ते = are cooked?;
नरक = in the hell;
निगूढा = cast in;
॥ २६॥
गेयं = is to be sung;
गीता = bhagavatgItA;
नाम = name of the lord;
सहस्रं = 1000 times;
ध्येयं = is to be meditated;
श्रीपति = LakShmi's consort MahAviShNu's;
रूपं = form/image;
अजस्रं = the unborn one;
नेयं = is to be lead/taken;
सज्जन = good people;
सङ्गे = in the company;
चित्तं = mind;
देयं = is to be given;
दीनजनाय = to the poor (humble state) people;
च = and;
वित्तं = wealth;
॥ २७॥
सुखतः = for happiness;
क्रियते = is done;
रामाभोग = sexual pleasures?;
पश्चाद्धन्त = later on in the end;
शरीरे = in the body;
रोग = disease;
यद्यपि = even though;
लोके = in the world;
मरण = death;
शरणं = resort/surrender;
तदपि = even then;
न = not;
मुञ्चति = releases/gives up;
पापाचरणं = pApa+AcharaNa, sin-practising;
॥ २८॥
अर्थं = wealth;
अनर्थं = purposeless/in vain/danger-productive;
भावय = deem/consider/visualise;
नित्यं = daily/always;
न = not;
अस्ति = is;
ततः = from that;
सुखलेशः = (even a little) happiness;
सत्यं = Truth;
पुत्रादपि = even from the the son;
धन = wealth;
भाजां = acquiring people;
भीतिः = fear;
सर्वत्र = everywhere;
एषा = this;
विहिता = understood;
रीतिः = procedure/practice/custom;
॥ २९॥
प्राणायाम = breath-control;
प्रत्याहार = diet-control;
नित्यं = always/daily/certain;
अनित्य = uncertain/temporary/ephemeral/transient;
विवेक = awareness after reasoning;
विचार = thought/considered conclusion/opinion;
जाप्यसमेत = with chanting of the names of the lord;
समाधिविधान = in the state of trance;
कुर्ववधानं = pay attention;
महदवधानं = great care attention;
॥ ३०॥
गुरुचरणाम्बुज = the lotus feet of the teacher/guru;
निर्भर = dependent;
भक्तः = devotee;
संसारात् = from the world;
अचिराद्भव = in no time from the cycle of birth and death;
मुक्तः = released;
सेन्द्रियमानस = sa+indriya+mAnasa, with senses and mind;
नियमादेव = control alone(niyamAt eva);
द्रक्ष्यसि = you will see;
निज = one's own;
हृदयस्थं = heart-stationed;
देवं = God;
॥ ३१॥
मूढ = fool;
कश्चन = certain;
वैयाकरण = Grammar;
डुकृञ्करण = grammatical formula DukRi~NkaraNa;
अध्ययन = study;
धुरिण = awakened/aroused?;
श्रीमत् = honourable prefix;
शङ्कर = Shankara;
भगवत् = God;
शिष्यैः = disciples;
बोधित = having been taught/enlightened;
आसित् = was/existed;
चोधितकरण = tested or awakened senses;
॥ ३२॥
भज = worship;
गोविन्दं = lord Govinda;
मूढमते = Oh foolish mind!;
नामस्मरणात् = (except) through/from remembrance of the Lord's name;
अन्य = other;
उपाय = plan/method/means;
नहि = not;
पश्याम = we see;
भवतरणे = for crossing the ocean of births deaths;
॥ ३३॥
========================== RU
"Двенадцатицветие", БХАДЖА-ГОВИНДАМ
Ади Шанкарачарья
Перевод Шактананды
भज गोविन्दं भज गोविन्दं,गोविन्दं भज मूढ़मते।
संप्राप्ते सन्निहिते काले न हि न हि रक्षति डुकृञ् करणे ॥१॥
1. Поклоняйся Говинде, поклоняйся Говинде, поклоняйся Говинде! Глупец! Никакие правила грамматики не спасут тебя в момент смерти! Не спасут!
मूढ़ जहीहि धनागमतृष्णाम् कुरु सद्बुद्धिमं मनसि वितृष्णाम्।
यल्लभसे निजकर्मोपात्तम् वित्तं तेन विनोदय चित्तं ॥२॥
2. О, глупец! Оставь планы приобрести что-то в этом мире. Все, что суждено, ты и так получишь, просто выполняя свои обязанности. Будь удовлетворен тем, что приходит само собой, а желания направь на очищение разума. Сделай его духовным!
नारीस्तनभरनाभीदेशम् दृष्ट्वा मागा मोहावेशम्।
एतन्मान्सवसादिविकारम् मनसि विचिन्तय वारं वारम् ॥३॥
3. Не бросай духовного пути и не впадай в иллюзию, едва завидев женскую грудь. Помни, что это только плоть, всего лишь жир, кровь и мясо! Вспоминай об этом почаще!
नलिनीदलगतजलमतितरलम् तद्वज्जीवितमतिशयचपलम्।
विद्धि व्याध्यभिमानग्रस्तं लोक शोकहतं च समस्तम् ॥४॥
4. Наша жизнь так же устойчива, как капля росы, которая дрожит на лепестке лотоса. Знай же, что этот мир всегда останется в плену болезни, гордости и скорби!
यावद्वित्तोपार्जनसक्त: तावन्निजपरिवारो रक्तः।
पश्चाज्जीवति जर्जरदेहे वार्तां कोऽपि न पृच्छति गेहे ॥५॥
5. Пока ты богат и можешь заработать деньги, тебя окружает семья и друзья, восхищенно поющие твою славу, но придет старость, и никто не захочет с тобой даже просто поговорить!
यावत्पवनो निवसति देहे तावत् पृच्छति कुशलं गेहे।
गतवति वायौ देहापाये भार्या बिभ्यति तस्मिन्काये ॥६॥
6. Пока в нашем теле движется воздух, все в доме интересуются: "Как твои дела? Как здоровье?" Но стоит дыханию жизни покинуть тело, даже жена в страхе устремится прочь от него!
बालस्तावत् क्रीडासक्तः तरुणस्तावत् तरुणीसक्तः।
वृद्धस्तावच्चिन्तासक्तः परे ब्रह्मणि कोऽपि न सक्तः ॥७॥
7. Ребенок привязан к детским играм, а юноша все свое время тратит на молодых девушек; и в старости беспокойные мысли о том и о сем не дают покоя... Когда же ты найдешь время, чтобы постичь Верховного Господа?!
का ते कांता कस्ते पुत्रः संसारोऽयमतीव विचित्रः।
कस्य त्वं वा कुत अयातः तत्त्वं चिन्तय तदिह भ्रातः ॥८॥
8. Кто твоя жена? Кто твой сын? Кому принадлежит этот столь пестрый мир? Кто ты? И откуда? Брат! Задумайся об этом сейчас!
सत्संगत्वे निस्संगत्वं निस्संगत्वे निर्मोहत्वं।
निर्मोहत्वे निश्चलतत्त्वं निश्चलतत्त्वे जीवन्मुक्तिः ॥९॥
9. В общении со святыми развивается непривязанность; непривязанность устраняет иллюзию, а разрушение иллюзии позволяет обрести духовную стойкость. Сосредоточенный на Абсолютной Истине человек уже в этой жизни получает освобождение.
वयसि गते कः कामविकारः शुष्के नीरे कः कासारः।
क्षीणे वित्ते कः परिवारः ज्ञाते तत्त्वे कः संसारः ॥१०॥
10. Откуда красота в дряхлом теле? И откуда вода в пересохшем пруду? Если ты потерял богатство, то откуда взяться многочисленным родственникам? И если ты осознал Истину, откуда возьмутся рождение и смерть?!
मा कुरु धनजनयौवनगर्वं हरति निमेषात्कालः सर्वं।
मायामयमिदमखिलम् हित्वा ब्रह्मपदम् त्वं प्रविश विदित्वा ॥११॥
11. Не гордись богатством, хорошими друзьями и молодостью. Все это может исчезнуть в одно мгновение. Оставь мир иллюзии, предайся Господу и вступи в Его вечную обитель!
दिनयामिन्यौ सायं प्रातः शिशिरवसन्तौ पुनरायातः।
कालः क्रीडति गच्छत्यायुस्तदपि न मुन्च्त्याशावायुः ॥१२॥
12. День и ночь, сумерки и рассвет, зима и весна... Вновь и вновь приходят и уходят. Время играет с нами, и жизнь вот-вот пройдет... Но ураган желаний никогда не утихает в нашем сердце!..
Однажды, проходя по улицам Каши (совр. Варанаси) вместе со своими учениками, Ади Шанкарачарья увидел старого пандита, который, сидя под деревом, штудировал санскритскую грамматику, заучивая наизусть правила. По всей видимости, он зубрил фундаментальный труд Панини «Аштадхйаи» («Восьмикнижие»). (К слову, заучивание наизусть грамматических правил, сформулированных Панини в «Аштадхйаи» до сих пор является обязательным компонентом традиционного изучения санскрита в Индии). Внезапно Шанкара проникся глубочайшим состраданием к этому старому человеку, который последние годы своей жизни тратил не на самореализацию и не на постижение Всевышнего, а на изучение грамматики, которая после смерти вряд ли бы ему пригодилась. Потом Шанкара осознал, что подавляющее большинство людей находятся в таком же, если не в ещё более худшем положении: почти половину всей своей жизни они проводят во сне, а из оставшейся половины детство проводят в играх и забавах, юность – в погоне за наслаждениями, зрелость – в зарабатывании денег и накоплении богатств, и даже в старости, если и не выживают из ума, то занимаются какой-нибудь ерундой. Потом они умирают, так и не познав ни себя, ни Бога, а всё, что им удалось заработать за время жизни, у них отбирает смерть. Шокированный этим внезапным осознанием Ади Шанкарачарья экспромтом сложил двенадцать шлок – наставлений, обращённых к этому пандиту, а его ученики записали их. Впоследствии это произведение получило название «двадаша-манджарика-стотрам» ("Двенадцатицветие") и стало первой частью поэмы «Бхаджа Говиндам».
| Objective-J | 1 | hareeshbabu82ns/sandhi | test/bhaja_govindam.sj | [
"Apache-2.0"
] |
// (c) Copyright 1995-2015 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a license and does not grant any
// rights to the materials distributed herewith. Except as
// otherwise provided in a valid license issued to you by
// Xilinx, and to the maximum extent permitted by applicable
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
// (2) Xilinx shall not be liable (whether in contract or tort,
// including negligence, or under any other theory of
// liability) for any loss or damage of any kind or nature
// related to, arising under or in connection with these
// materials, including for any direct, or any indirect,
// special, incidental, or consequential loss or damage
// (including loss of data, profits, goodwill, or any type of
// loss or damage suffered as a result of any action brought
// by a third party) even if such damage or loss was
// reasonably foreseeable or Xilinx had been advised of the
// possibility of the same.
//
// CRITICAL APPLICATIONS
// Xilinx products are not designed or intended to be fail-
// safe, or for use in any application requiring fail-safe
// performance, such as life-support or safety devices or
// systems, Class III medical devices, nuclear facilities,
// applications related to the deployment of airbags, or any
// other applications that could lead to death, personal
// injury, or severe property or environmental damage
// (individually and collectively, "Critical
// Applications"). Customer assumes the sole risk and
// liability of any use of Xilinx products in Critical
// Applications, subject only to applicable laws and
// regulations governing limitations on product liability.
//
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
// PART OF THIS FILE AT ALL TIMES.
//
// DO NOT MODIFY THIS FILE.
// IP VLNV: adapteva.com:Adapteva:eio_rx:1.0
// IP Revision: 9
// The following must be inserted into your Verilog file for this
// core to be instantiated. Change the instance name and port connections
// (in parentheses) to your own signal names.
//----------- Begin Cut here for INSTANTIATION Template ---// INST_TAG
elink2_top_eio_rx_0_0 your_instance_name (
.RX_WR_WAIT_P(RX_WR_WAIT_P), // output wire RX_WR_WAIT_P
.RX_WR_WAIT_N(RX_WR_WAIT_N), // output wire RX_WR_WAIT_N
.RX_RD_WAIT_P(RX_RD_WAIT_P), // output wire RX_RD_WAIT_P
.RX_RD_WAIT_N(RX_RD_WAIT_N), // output wire RX_RD_WAIT_N
.rxlclk_p(rxlclk_p), // output wire rxlclk_p
.rxframe_p(rxframe_p), // output wire [7 : 0] rxframe_p
.rxdata_p(rxdata_p), // output wire [63 : 0] rxdata_p
.ecfg_datain(ecfg_datain), // output wire [10 : 0] ecfg_datain
.RX_LCLK_P(RX_LCLK_P), // input wire RX_LCLK_P
.RX_LCLK_N(RX_LCLK_N), // input wire RX_LCLK_N
.reset(reset), // input wire reset
.ioreset(ioreset), // input wire ioreset
.RX_FRAME_P(RX_FRAME_P), // input wire RX_FRAME_P
.RX_FRAME_N(RX_FRAME_N), // input wire RX_FRAME_N
.RX_DATA_P(RX_DATA_P), // input wire [7 : 0] RX_DATA_P
.RX_DATA_N(RX_DATA_N), // input wire [7 : 0] RX_DATA_N
.rx_wr_wait(rx_wr_wait), // input wire rx_wr_wait
.rx_rd_wait(rx_rd_wait), // input wire rx_rd_wait
.ecfg_rx_enable(ecfg_rx_enable), // input wire ecfg_rx_enable
.ecfg_rx_gpio_mode(ecfg_rx_gpio_mode), // input wire ecfg_rx_gpio_mode
.ecfg_rx_loopback_mode(ecfg_rx_loopback_mode), // input wire ecfg_rx_loopback_mode
.ecfg_dataout(ecfg_dataout), // input wire [10 : 0] ecfg_dataout
.tx_wr_wait(tx_wr_wait), // input wire tx_wr_wait
.tx_rd_wait(tx_rd_wait), // input wire tx_rd_wait
.txlclk_p(txlclk_p), // input wire txlclk_p
.loopback_data(loopback_data), // input wire [63 : 0] loopback_data
.loopback_frame(loopback_frame) // input wire [7 : 0] loopback_frame
);
// INST_TAG_END ------ End INSTANTIATION Template ---------
| Verilog | 4 | security-geeks/parallella-examples | rpi-camera/parallella_7020_headless_gpiose_elink2/parallella_7020_headless_gpiose_elink2.srcs/sources_1/bd/elink2_top/ip/elink2_top_eio_rx_0_0/elink2_top_eio_rx_0_0.veo | [
"BSD-3-Clause"
] |
// check-pass
fn macros() {
macro_rules! foo {
($p:pat, $e:expr, $b:block) => {{
if let $p = $e $b
//~^ WARN irrefutable `if let`
//~| WARN irrefutable `if let`
}}
}
macro_rules! bar{
($p:pat, $e:expr, $b:block) => {{
foo!($p, $e, $b)
}}
}
foo!(a, 1, {
println!("irrefutable pattern");
});
bar!(a, 1, {
println!("irrefutable pattern");
});
}
pub fn main() {
if let a = 1 { //~ WARN irrefutable `if let`
println!("irrefutable pattern");
}
if let a = 1 { //~ WARN irrefutable `if let`
println!("irrefutable pattern");
} else if true {
println!("else-if in irrefutable `if let`");
} else {
println!("else in irrefutable `if let`");
}
if let 1 = 2 {
println!("refutable pattern");
} else if let a = 1 { //~ WARN irrefutable `if let`
println!("irrefutable pattern");
}
if true {
println!("if");
} else if let a = 1 { //~ WARN irrefutable `if let`
println!("irrefutable pattern");
}
}
| Rust | 4 | mbc-git/rust | src/test/ui/expr/if/if-let.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
i 00001 00 010 2000 00 036 0160
i 00002 00 031 0000 00 000 2002
i 00003 00 031 0000 00 012 2000
i 00004 00 27 00061 00 010 2002
i 00005 00 012 2000 00 27 00061
i 00006 00 010 2000 00 036 0160
i 00007 00 037 0023 00 031 0123
i 00010 00 000 2002 00 031 0065
i 00011 00 012 2003 00 27 00061
i 00012 00 010 2002 00 012 2004
i 00013 00 27 00061 00 010 2000
i 00014 00 012 2001 00 036 0160
i 00015 00 037 0013 00 031 0123
i 00016 00 000 2002 00 031 0065
i 00017 00 012 2005 00 27 00061
i 00020 00 010 2002 00 012 2006
i 00021 00 27 00061 00 010 2000
i 00022 00 036 0160 00 037 0003
i 00023 00 031 0123 00 000 2002
i 00024 00 031 0065 00 012 2003
i 00025 00 27 00061 00 010 2002
i 00026 00 012 2004 00 27 00061
i 00027 00 010 2000 00 036 0160
i 00030 00 011 2001 00 031 0000
i 00031 00 27 00061 00 010 2000
i 00032 00 036 0160 00 015 2001
i 00033 00 031 0000 00 27 00061
i 00034 00 010 2000 00 036 0160
i 00035 00 013 2001 00 037 0007
i 00036 00 031 0000 00 27 00061
i 00037 00 010 2000 00 036 0160
i 00040 00 022 2001 00 031 0000
i 00041 00 27 00061 00 010 2000
i 00042 00 036 0160 00 020 2001
i 00043 00 031 0000 00 27 00061
i 00044 00 010 2000 00 036 0160
i 00045 00 021 2001 00 031 0000
i 00046 00 27 00061 00 010 2000
i 00047 00 26 00061 00 031 0000
i 00050 00 012 2000 00 27 00061
i 00051 00 011 0000 00 010 2000
i 00052 00 27 00053 00 30 00061
i 00053 00 031 0000 00 012 2000
i 00054 00 27 00061 00 011 0000
i 00055 00 010 2000 00 012 0000
i 00056 00 031 0000 00 012 2000
i 00057 00 27 00061 00 22 00000
i 00060 06 33 12345 00 22 00000
i 00061 02 33 76543 00 22 00000
d 02000 1234 5671 2345 6712
d 02001 7777 7777 7777 7777
d 02003 0414 5671 2345 6712
d 02004 1154 5671 2345 6712
d 02005 0403 2106 5432 1065
d 02006 1143 2106 5432 1065
| Octave | 0 | besm6/mesm6 | test/yta/yta.oct | [
"MIT"
] |
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* Title Label */
.monaco-workbench .part.editor > .content .editor-group-container > .title > .label-container {
height: 35px;
display: flex;
justify-content: flex-start;
align-items: center;
overflow: hidden;
flex: auto;
}
.monaco-workbench .part.editor > .content .editor-group-container > .title > .label-container > .title-label {
line-height: 35px;
overflow: hidden;
text-overflow: ellipsis;
position: relative;
padding-left: 20px;
}
.monaco-workbench .part.editor > .content .editor-group-container > .title > .label-container > .title-label > .monaco-icon-label-container {
flex: none; /* helps to show decorations right next to the label and not at the end */
}
/* Breadcrumbs */
.monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .no-tabs.title-label {
flex: none;
}
.monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control {
flex: 1 50%;
overflow: hidden;
margin-left: .45em;
}
.monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item {
font-size: 0.9em;
}
.monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control.preview .monaco-breadcrumb-item {
font-style: italic;
}
.monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item::before {
content: '/';
opacity: 1;
height: inherit;
width: inherit;
background-image: none;
}
.monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control.backslash-path .monaco-breadcrumb-item::before {
content: '\\';
}
.monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item.root_folder::before,
.monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item.root_folder + .monaco-breadcrumb-item::before,
.monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control.relative-path .monaco-breadcrumb-item:nth-child(2)::before,
.monaco-workbench.windows .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item:nth-child(2)::before {
display: none; /* workspace folder, item following workspace folder, or relative path -> hide first seperator */
}
.monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item.root_folder::after {
content: '\00a0•\00a0'; /* use dot separator for workspace folder */
padding: 0;
}
.monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item:last-child {
padding-right: 4px; /* does not have trailing separator*/
}
.monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item .codicon[class*='codicon-symbol-'] {
padding: 0 1px;
}
.monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item .codicon:last-child {
display: none; /* hides chevrons when no tabs visible */
}
.monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-icon-label::before {
height: 18px;
padding-right: 2px;
}
/* Editor Actions Toolbar (via title actions) */
.monaco-workbench .part.editor > .content .editor-group-container > .title > .title-actions {
display: flex;
flex: initial;
opacity: 0.5;
padding-right: 8px;
height: 35px;
}
.monaco-workbench .part.editor > .content .editor-group-container > .title > .title-actions .action-item {
margin-right: 4px;
}
.monaco-workbench .part.editor > .content .editor-group-container.active > .title > .title-actions {
opacity: 1;
}
| CSS | 3 | sbj42/vscode | src/vs/workbench/browser/parts/editor/media/notabstitlecontrol.css | [
"MIT"
] |
#include <stdio.h>
#include <stdlib.h>
#define BUPC_USE_UPC_NAMESPACE
#include <upc_relaxed.h>
#include <upc_collective.h>
#include <bupc_timers.h>
#include "params.h"
#include "mt-cilkp.h"
#define second() (TIME()/1000000.0)
shared matblock_t A[THREADS];
upc_cilk_common_t commons;
/*re-check if this really is the max?*/
shared const void * srclst[K];
double buf[BUFFER_SIZE];
/* *********************************************************************** */
/* setup initial data with consecutive row major numbering */
/* *********************************************************************** */
void initM (shared matblock_t *X)
{
int b,i,j,ki,kj, I, J;
upc_forall(b=0; b < THREADS; b++; &A[b]){
I = (MYTHREAD / PSQRT) ;
J = (MYTHREAD % PSQRT) ;
ki = (I == PSQRT -1)? N-K*(PSQRT-1): K;
kj = (J == PSQRT -1)? N-K*(PSQRT-1): K;
i_block(I,J,0,ki,0,kj);
}
}
/*recursivly copys fitting blocks into buf from the adjacent transpose block in matrix A[bt]*/
/*and applies cache oblivious transpose between the subblock of A[MYTHREAD] and buf*/
void t_oopl_cbuf(int i0, int i1, int j0, int j1, int bt)
{
int di = i1 - i0, dj = j1 - j0, i, j;
double *b = commons.buf;
matblock_t *a = commons.a;
shared matblock_t *at = &A[bt];
void * dstlst[] = {commons.buf};
if ( di*dj <= BUFFER_SIZE) {
for (j=j0; j < j1; j++) { // block into buffer
srclst[j-j0] = &(at->blk[j][i0]);
#if 0
upc_memget(&b[(j-j0)*di],&(at->blk[j][i0]),di*sizeof(double));
#endif
}
upc_memget_ilist(1,dstlst,di*dj*sizeof(double), dj, srclst, di*sizeof(double));
#ifndef COMONLY
t_oopl_buf( i0,i1,j0,j1, di,i0, j0 );
#endif
#if 0
for (j=j0; j < j1; j++){ // put k transposed block lines back into westsouthwest
upc_memput(&(at->blk[j][i0]), &b[(j-j0)*di],di*sizeof(double));
}
#endif
upc_memput_ilist(dj,(void * const)srclst,di*sizeof(double),1,(const void* const)dstlst,di*dj*sizeof(double));
} else if (di > dj ) {
int im = (i0 + i1) / 2;
t_oopl_cbuf(i0, im, j0, j1, bt );
t_oopl_cbuf(im, i1, j0, j1, bt );
} else { // dj >= di
int jm = (j0 + j1) / 2;
t_oopl_cbuf(i0, i1, j0, jm, bt );
t_oopl_cbuf(i0, i1, jm, j1, bt );
}
}
void t_blockedP5 (shared struct sq_mat *A){
int b, I, J, i, j,k,k2;
double t;
upc_forall (b = 0; b < THREADS; b++; &A[b]){
I = b / PSQRT ; //global block indices
J = b % PSQRT ;
k = (I == PSQRT -1)? N-K*(PSQRT-1): K;
if ( I == J ){
#ifndef COMONLY
t_inpl(0,k);
#endif
}else if (I < J){ //work on top half row blocks of north-east
int bt=J*PSQRT + I;
t_oopl_cbuf( 0, K2, 0, k, bt );
}else { // right half column block of southwest (=eastsouthwest)
int bt = J*PSQRT + I; int bs;
t_oopl_cbuf( 0 ,k, K2, K, bt ); //offset, target block
}
}
}
shared int err[THREADS];
/* trans = 0 -> check original mat */
void checkm(shared matblock_t *A, int trans){
int b, i, j, ki, kj, I, J; double val;
upc_forall(b=0; b < THREADS; b++; &A[b]){
I = (b / PSQRT) ; //global indices of block local values
J = (b % PSQRT) ;
ki = (I == PSQRT -1)? N-K*(PSQRT-1): K;
kj = (J == PSQRT -1)? N-K*(PSQRT-1): K;
err[b] = c_block(trans, I, J, 0, ki, 0, kj);
}
}
void printm(shared matblock_t *A, const char* frmt) {
int block,I,J;
for (I=0; I < N; I++){
for (J=0; J < N; J++){
block = (I / K) *PSQRT + J / K;
printf(frmt,A[block].blk[I % K][J % K]);
}
printf("\n");
}
}
void printa(shared matblock_t *A, const char* frmt) {
int block,I,J;
for (I=0; I < N; I++){
for (J=0; J < N; J++){
block = (I / K) *PSQRT + J/K;
printf(frmt,upc_threadof(&A[block].blk[I % K][J % K]));
}
printf("\n");
}
}
int main(int argc, char* argv[]) {
int i,terr, ct;
double sec,sec1,gswp,gcom;
setenv("CILK_NWORKERS", bupc_getenv("UPC_CILK_NWORKERS"), 1);
if (THREADS != PSQRT*PSQRT){
printf("the number of threads does not fit the data partitioning: %d != %d x %d\n",THREADS,PSQRT,PSQRT);
upc_global_exit(1);
}
commons.a = (matblock_t*)&A[MYTHREAD];
commons.buf = buf;
#ifndef COMONLY
initM(A);
#endif
if (!MYTHREAD && N <=16){
printa(A,"%d ");
}
upc_barrier;
sec = second();
t_blockedP5(A);
upc_barrier;
sec = second();
t_blockedP5(A);
upc_barrier;
sec1 = second()-sec;
#ifndef COMONLY
checkm(A, 0);
upc_barrier;
#endif
if (!MYTHREAD) {
gswp = 1e-9 /sec1 * N * N * sizeof(double);
gcom = 1e-9 / sec1 * ((double)N * N - (double)N*N/PSQRT)*sizeof(double);
printf("mt-cbuf-cilk+: N=%d K=%d BUFSIZE=%d %d UThreads %d CThreads , rt %f %f GBxhg/s %f GBcom/s ",N, K, BUFFER_SIZE, THREADS,__cilkrts_get_nworkers() ,sec1,gswp,gcom);
terr=0;
#ifndef COMONLY
for (i=0; i < THREADS; i++)
terr += err[i];
if (terr==0)
fprintf(stdout, " ..success\n");
else
fprintf(stdout, " ..failed with %d errors\n",terr);
#else
fprintf(stdout, " ..comm only - unchecked\n");
#endif
if (N < 16){
printm(A, "%02.0f ");
}
}
upc_barrier;
}
| Unified Parallel C | 4 | fredmorcos/attic | Projects/Matrix FFT UPC Cilk/mt/mt-single-buffer-cilkp.upc | [
"Unlicense"
] |
PREFIX : <http://example.org/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?s ?num (ROUND(?num) AS ?round) WHERE {
?s :num ?num
}
| SPARQL | 3 | alpano-unibz/ontop | test/sparql-compliance/src/test/resources/testcases-dawg-sparql-1.1/functions/round01.rq | [
"Apache-2.0"
] |
source ./test-functions.sh
install_service
start_service
echo "PID: $(cat /var/run/spring-boot-app/spring-boot-app.pid)"
start_service
echo "Status: $?"
| Shell | 3 | Martin-real/spring-boot-2.1.0.RELEASE | spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/start-when-started.sh | [
"Apache-2.0"
] |
// (c) Copyright 1995-2015 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a license and does not grant any
// rights to the materials distributed herewith. Except as
// otherwise provided in a valid license issued to you by
// Xilinx, and to the maximum extent permitted by applicable
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
// (2) Xilinx shall not be liable (whether in contract or tort,
// including negligence, or under any other theory of
// liability) for any loss or damage of any kind or nature
// related to, arising under or in connection with these
// materials, including for any direct, or any indirect,
// special, incidental, or consequential loss or damage
// (including loss of data, profits, goodwill, or any type of
// loss or damage suffered as a result of any action brought
// by a third party) even if such damage or loss was
// reasonably foreseeable or Xilinx had been advised of the
// possibility of the same.
//
// CRITICAL APPLICATIONS
// Xilinx products are not designed or intended to be fail-
// safe, or for use in any application requiring fail-safe
// performance, such as life-support or safety devices or
// systems, Class III medical devices, nuclear facilities,
// applications related to the deployment of airbags, or any
// other applications that could lead to death, personal
// injury, or severe property or environmental damage
// (individually and collectively, "Critical
// Applications"). Customer assumes the sole risk and
// liability of any use of Xilinx products in Critical
// Applications, subject only to applicable laws and
// regulations governing limitations on product liability.
//
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
// PART OF THIS FILE AT ALL TIMES.
//
// DO NOT MODIFY THIS FILE.
// IP VLNV: xilinx.com:ip:axi_cdma:4.1
// IP Revision: 5
// The following must be inserted into your Verilog file for this
// core to be instantiated. Change the instance name and port connections
// (in parentheses) to your own signal names.
//----------- Begin Cut here for INSTANTIATION Template ---// INST_TAG
design_1_axi_cdma_0_0 your_instance_name (
.m_axi_aclk(m_axi_aclk), // input wire m_axi_aclk
.s_axi_lite_aclk(s_axi_lite_aclk), // input wire s_axi_lite_aclk
.s_axi_lite_aresetn(s_axi_lite_aresetn), // input wire s_axi_lite_aresetn
.cdma_introut(cdma_introut), // output wire cdma_introut
.s_axi_lite_awready(s_axi_lite_awready), // output wire s_axi_lite_awready
.s_axi_lite_awvalid(s_axi_lite_awvalid), // input wire s_axi_lite_awvalid
.s_axi_lite_awaddr(s_axi_lite_awaddr), // input wire [5 : 0] s_axi_lite_awaddr
.s_axi_lite_wready(s_axi_lite_wready), // output wire s_axi_lite_wready
.s_axi_lite_wvalid(s_axi_lite_wvalid), // input wire s_axi_lite_wvalid
.s_axi_lite_wdata(s_axi_lite_wdata), // input wire [31 : 0] s_axi_lite_wdata
.s_axi_lite_bready(s_axi_lite_bready), // input wire s_axi_lite_bready
.s_axi_lite_bvalid(s_axi_lite_bvalid), // output wire s_axi_lite_bvalid
.s_axi_lite_bresp(s_axi_lite_bresp), // output wire [1 : 0] s_axi_lite_bresp
.s_axi_lite_arready(s_axi_lite_arready), // output wire s_axi_lite_arready
.s_axi_lite_arvalid(s_axi_lite_arvalid), // input wire s_axi_lite_arvalid
.s_axi_lite_araddr(s_axi_lite_araddr), // input wire [5 : 0] s_axi_lite_araddr
.s_axi_lite_rready(s_axi_lite_rready), // input wire s_axi_lite_rready
.s_axi_lite_rvalid(s_axi_lite_rvalid), // output wire s_axi_lite_rvalid
.s_axi_lite_rdata(s_axi_lite_rdata), // output wire [31 : 0] s_axi_lite_rdata
.s_axi_lite_rresp(s_axi_lite_rresp), // output wire [1 : 0] s_axi_lite_rresp
.m_axi_arready(m_axi_arready), // input wire m_axi_arready
.m_axi_arvalid(m_axi_arvalid), // output wire m_axi_arvalid
.m_axi_araddr(m_axi_araddr), // output wire [31 : 0] m_axi_araddr
.m_axi_arlen(m_axi_arlen), // output wire [7 : 0] m_axi_arlen
.m_axi_arsize(m_axi_arsize), // output wire [2 : 0] m_axi_arsize
.m_axi_arburst(m_axi_arburst), // output wire [1 : 0] m_axi_arburst
.m_axi_arprot(m_axi_arprot), // output wire [2 : 0] m_axi_arprot
.m_axi_arcache(m_axi_arcache), // output wire [3 : 0] m_axi_arcache
.m_axi_rready(m_axi_rready), // output wire m_axi_rready
.m_axi_rvalid(m_axi_rvalid), // input wire m_axi_rvalid
.m_axi_rdata(m_axi_rdata), // input wire [31 : 0] m_axi_rdata
.m_axi_rresp(m_axi_rresp), // input wire [1 : 0] m_axi_rresp
.m_axi_rlast(m_axi_rlast), // input wire m_axi_rlast
.m_axi_awready(m_axi_awready), // input wire m_axi_awready
.m_axi_awvalid(m_axi_awvalid), // output wire m_axi_awvalid
.m_axi_awaddr(m_axi_awaddr), // output wire [31 : 0] m_axi_awaddr
.m_axi_awlen(m_axi_awlen), // output wire [7 : 0] m_axi_awlen
.m_axi_awsize(m_axi_awsize), // output wire [2 : 0] m_axi_awsize
.m_axi_awburst(m_axi_awburst), // output wire [1 : 0] m_axi_awburst
.m_axi_awprot(m_axi_awprot), // output wire [2 : 0] m_axi_awprot
.m_axi_awcache(m_axi_awcache), // output wire [3 : 0] m_axi_awcache
.m_axi_wready(m_axi_wready), // input wire m_axi_wready
.m_axi_wvalid(m_axi_wvalid), // output wire m_axi_wvalid
.m_axi_wdata(m_axi_wdata), // output wire [31 : 0] m_axi_wdata
.m_axi_wstrb(m_axi_wstrb), // output wire [3 : 0] m_axi_wstrb
.m_axi_wlast(m_axi_wlast), // output wire m_axi_wlast
.m_axi_bready(m_axi_bready), // output wire m_axi_bready
.m_axi_bvalid(m_axi_bvalid), // input wire m_axi_bvalid
.m_axi_bresp(m_axi_bresp), // input wire [1 : 0] m_axi_bresp
.cdma_tvect_out(cdma_tvect_out) // output wire [31 : 0] cdma_tvect_out
);
// INST_TAG_END ------ End INSTANTIATION Template ---------
// You must compile the wrapper file design_1_axi_cdma_0_0.v when simulating
// the core, design_1_axi_cdma_0_0. When compiling the wrapper file, be sure to
// reference the Verilog simulation library.
| Verilog | 2 | williambong/Vivado | Zynq/ZynqAXIMemoryMappedInterface/ZynqAXIMemoryMappedInterface.srcs/sources_1/bd/design_1/ip/design_1_axi_cdma_0_0/design_1_axi_cdma_0_0.veo | [
"MIT"
] |
0 reg32_t "dword"
1 code_t "proc*"
2 uint32_t "unsigned int"
3 num32_t "int"
4 num8_t "char"
2 uint32_t "size_t"
5 ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(struct(0:num32_t,4:ptr(reg8_t),8:ptr(reg8_t),12:ptr(reg8_t),16:ptr(reg8_t),20:ptr(reg8_t),24:ptr(reg8_t),28:ptr(reg8_t),32:ptr(reg8_t),36:ptr(reg8_t),40:ptr(reg8_t),44:ptr(reg8_t),48:ptr(TOP),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),8:num32_t)),52:ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(TOP),8:num32_t)),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))) "FILE*"
6 ptr(num8_t) "char*"
7 ptr(TOP) "void*"
8 ptr(struct(0:union(code_t,code_t),4:struct(0:array(uint32_t,32)),132:num32_t,136:code_t)) "sigaction*"
9 ptr(struct(0:array(uint32_t,32))) "sigset_t*"
1 code_t "(int -?-> void)*"
10 ptr(ptr(num8_t)) "char**"
11 union(ptr(struct(0:array(reg8_t,72),72:ptr(struct(0:reg32_t,4:reg32_t,652:ptr(TOP))))),ptr(struct(0:array(reg8_t,72),72:ptr(struct(0:reg32_t,4:reg32_t,652:ptr(TOP)))))) "Union_5"
12 ptr(array(reg8_t,16)) "unknown_128*"
13 ptr(array(reg8_t,56)) "unknown_448*"
14 ptr(array(reg8_t,167)) "unknown_1336*"
15 ptr(array(reg8_t,42)) "unknown_336*"
16 ptr(reg32_t) "dword*"
17 ptr(num32_t) "int*"
18 union(ptr(num8_t),uint32_t,ptr(struct(0:reg16_t,2:num8_t))) "Union_2"
19 ptr(struct(8:reg32_t,652:ptr(TOP))) "Struct_2*"
20 ptr(struct(0:array(reg8_t,72),72:ptr(struct(0:reg32_t,4:reg32_t,652:ptr(TOP))))) "StructFrag_27*"
21 ptr(struct(0:ptr(TOP))) "Singleton_0*"
6 ptr(num8_t) "char[]"
20 ptr(struct(0:array(reg8_t,72),72:ptr(struct(0:reg32_t,4:reg32_t,652:ptr(TOP))))) "StructFrag_26*"
22 ptr(ptr(struct(8:reg32_t,652:ptr(TOP)))) "Struct_2**"
23 ptr(struct(0:num32_t,4:ptr(ptr(num8_t)),4294967292:reg32_t)) "Struct_9*"
24 ptr(struct(0:ptr(num8_t),4:num32_t,8:ptr(num32_t),12:num32_t)) "option*"
25 uint64_t "unsigned long long"
26 array(reg8_t,3) "unknown_24"
27 ptr(struct(0:num64_t,8:uint64_t,12:union(ptr(num8_t),uint32_t,ptr(struct(0:reg16_t,2:num8_t))),16:reg32_t,20:union(ptr(num8_t),uint32_t,ptr(struct(0:reg16_t,2:num8_t))),24:union(ptr(num8_t),uint32_t,ptr(struct(0:reg16_t,2:num8_t))),28:num8_t,29:num8_t,30:num8_t,32:reg32_t,36:reg32_t,48:ptr(num8_t),52:reg32_t)) "Struct_10*"
28 ptr(uint16_t) "unsigned short*"
1 code_t "(void -> void)*"
29 ptr(array(reg8_t,29)) "unknown_232*"
30 ptr(struct(0:reg32_t,40:ptr(TOP),44:ptr(num8_t))) "Struct_5*"
31 ptr(uint32_t) "size_t*"
32 union(uint32_t,uint32_t) "Union_8"
33 ptr(struct(0:reg32_t,4:ptr(TOP))) "Struct_0*"
34 union(ptr(num8_t),ptr(struct(0:array(reg8_t,72),72:ptr(struct(0:reg32_t,4:reg32_t,652:ptr(TOP))))),ptr(struct(0:array(reg8_t,72),72:ptr(struct(0:reg32_t,4:reg32_t,652:ptr(TOP))))),ptr(struct(0:ptr(TOP)))) "Union_7"
35 ptr(struct(0:num32_t,4:reg32_t,40:ptr(num8_t),44:ptr(num8_t))) "Struct_39*"
36 reg64_t "qword"
37 int32_t "signed int"
38 ptr(struct(0:array(reg8_t,64),64:ptr(TOP))) "StructFrag_24*"
39 ptr(struct(0:array(reg8_t,18),18:num8_t)) "StructFrag_9*"
40 ptr(struct(0:array(reg8_t,40),40:num8_t)) "StructFrag_32*"
41 ptr(struct(0:array(reg8_t,3),3:num8_t)) "StructFrag_29*"
31 ptr(uint32_t) "unsigned int*"
42 union(ptr(num8_t),ptr(struct(0:array(reg8_t,72),72:ptr(struct(0:reg32_t,4:reg32_t,652:ptr(TOP))))),ptr(struct(0:array(reg8_t,72),72:ptr(struct(0:reg32_t,4:reg32_t,652:ptr(TOP)))))) "Union_6"
43 num64_t "long long"
17 ptr(num32_t) "int[]"
44 union(ptr(reg32_t),ptr(struct(0:array(reg8_t,3),3:num8_t,4:union(ptr(num8_t),uint32_t,ptr(struct(0:reg16_t,2:num8_t))),5:array(reg8_t,3)))) "Union_9"
3 num32_t "__ssize_t"
45 ptr(ptr(uint16_t)) "unsigned short**"
46 union(ptr(num8_t),ptr(struct(0:num64_t,8:uint64_t,12:union(ptr(num8_t),uint32_t,ptr(struct(0:reg16_t,2:num8_t))),16:reg32_t,20:union(ptr(num8_t),uint32_t,ptr(struct(0:reg16_t,2:num8_t))),24:union(ptr(num8_t),uint32_t,ptr(struct(0:reg16_t,2:num8_t))),28:num8_t,29:num8_t,30:num8_t,32:reg32_t,36:reg32_t,48:ptr(num8_t),52:reg32_t))) "Union_3"
16 ptr(reg32_t) "dword[]"
47 struct(0:ptr(TOP)) "Singleton_0"
48 ptr(struct(8:reg32_t,12:reg32_t,24:reg32_t,32:ptr(struct(0:array(reg8_t,652),652:ptr(TOP))),40:ptr(TOP))) "Struct_27*"
49 ptr(struct(0:reg64_t,8:num8_t)) "StructFrag_3*"
50 ptr(ptr(TOP)) "void**"
51 ptr(struct(0:num32_t,4:uint32_t,40:ptr(num8_t),44:ptr(num8_t))) "Struct_43*"
52 ptr(struct(0:num32_t,40:ptr(num8_t),44:ptr(num8_t))) "Struct_35*"
53 ptr(reg16_t) "word[]"
54 ptr(struct(0:array(reg8_t,24),24:num32_t)) "StructFrag_21*"
55 ptr(struct(0:array(reg8_t,98970),98970:reg32_t)) "StructFrag_13*"
56 ptr(struct(0:array(reg8_t,536870908),4294967292:reg32_t)) "StructFrag_14*"
57 ptr(struct(0:array(reg8_t,46300),46300:reg32_t)) "StructFrag_19*"
58 ptr(struct(0:array(reg8_t,648),648:reg32_t)) "StructFrag_20*"
59 ptr(struct(0:uint32_t,4:union(ptr(num8_t),ptr(struct(0:array(reg8_t,72),72:ptr(struct(0:reg32_t,4:reg32_t,652:ptr(TOP))))),ptr(struct(0:array(reg8_t,72),72:ptr(struct(0:reg32_t,4:reg32_t,652:ptr(TOP))))),ptr(struct(0:ptr(TOP)))))) "Struct_40*"
60 ptr(struct(0:array(reg8_t,652),652:ptr(TOP))) "StructFrag_10*"
61 ptr(union(ptr(num8_t),uint32_t,ptr(struct(0:reg16_t,2:num8_t)))) "Union_2*"
62 ptr(array(reg8_t,128)) "unknown_1024*"
63 ptr(struct(12:uint32_t,16:ptr(struct(0:array(reg8_t,72),72:ptr(struct(0:reg32_t,4:reg32_t,652:ptr(TOP))))))) "Struct_37*"
64 ptr(struct(0:reg64_t,8:uint32_t)) "StructFrag_28*"
65 array(reg8_t,4096) "unknown_32768"
66 array(reg8_t,135168) "unknown_1081344"
67 array(reg8_t,30) "unknown_240"
68 array(reg8_t,5) "unknown_40"
69 array(reg8_t,21) "unknown_168"
70 array(reg8_t,16) "unknown_128"
71 array(reg8_t,167) "unknown_1336"
72 array(reg8_t,105) "unknown_840"
73 array(reg8_t,37) "unknown_296"
74 array(reg8_t,59) "unknown_472"
75 array(reg8_t,12) "unknown_96"
76 array(reg8_t,15) "unknown_120"
77 array(reg8_t,43) "unknown_344"
78 array(reg8_t,10) "unknown_80"
79 array(reg8_t,57) "unknown_456"
80 array(reg8_t,40) "unknown_320"
81 array(reg8_t,77) "unknown_616"
82 array(reg8_t,36) "unknown_288"
83 array(reg8_t,32) "unknown_256"
84 array(reg8_t,75) "unknown_600"
85 array(reg8_t,29) "unknown_232"
86 array(reg8_t,116) "unknown_928"
87 array(reg8_t,18) "unknown_144"
88 array(reg8_t,78) "unknown_624"
89 array(reg8_t,24) "unknown_192"
90 array(reg8_t,7) "unknown_56"
91 array(reg8_t,67) "unknown_536"
92 array(reg8_t,17) "unknown_136"
93 array(reg8_t,13) "unknown_104"
94 array(reg8_t,194) "unknown_1552"
95 array(reg8_t,9) "unknown_72"
96 array(reg8_t,93) "unknown_744"
97 array(reg8_t,82) "unknown_656"
98 array(reg8_t,19) "unknown_152"
99 array(reg8_t,48) "unknown_384"
100 array(reg8_t,60) "unknown_480"
101 array(reg8_t,14) "unknown_112"
102 array(reg8_t,34) "unknown_272"
103 array(reg8_t,41) "unknown_328"
104 array(reg8_t,38) "unknown_304"
105 array(reg8_t,45) "unknown_360"
106 array(reg8_t,47) "unknown_376"
107 array(reg8_t,42) "unknown_336"
108 array(reg8_t,70) "unknown_560"
109 array(reg8_t,25) "unknown_200"
110 array(reg8_t,11) "unknown_88"
111 array(reg8_t,99) "unknown_792"
112 array(reg8_t,23) "unknown_184"
113 array(reg8_t,22) "unknown_176"
114 array(reg8_t,35) "unknown_280"
115 array(reg8_t,20) "unknown_160"
116 array(reg8_t,50) "unknown_400"
117 array(reg8_t,26) "unknown_208"
118 array(reg8_t,61) "unknown_488"
119 array(reg8_t,58) "unknown_464"
120 array(reg8_t,52) "unknown_416"
121 array(reg8_t,6) "unknown_48"
122 array(reg8_t,76) "unknown_608"
123 array(reg8_t,54) "unknown_432"
124 array(reg8_t,33) "unknown_264"
125 array(reg8_t,51) "unknown_408"
126 array(reg8_t,69) "unknown_552"
127 array(reg8_t,27) "unknown_216"
128 array(reg8_t,53) "unknown_424"
129 array(reg8_t,80) "unknown_640"
130 array(reg8_t,128) "unknown_1024"
131 array(reg8_t,157) "unknown_1256"
132 array(reg8_t,152) "unknown_1216"
133 array(reg8_t,74) "unknown_592"
134 array(reg8_t,39) "unknown_312"
135 array(reg8_t,110) "unknown_880"
136 array(reg8_t,68) "unknown_544"
137 array(reg8_t,72) "unknown_576"
138 array(reg8_t,44) "unknown_352"
139 reg16_t "word"
140 array(reg8_t,49) "unknown_392"
141 array(reg8_t,158) "unknown_1264"
142 array(reg8_t,396) "unknown_3168"
143 array(reg8_t,66) "unknown_528"
144 array(reg8_t,81) "unknown_648"
145 array(reg8_t,64) "unknown_512"
146 array(reg8_t,109) "unknown_872"
147 array(reg8_t,31) "unknown_248"
148 array(reg8_t,96) "unknown_768"
149 array(reg8_t,112) "unknown_896"
150 array(reg8_t,62) "unknown_496"
151 array(reg8_t,28) "unknown_224"
152 array(reg8_t,90) "unknown_720"
153 array(reg8_t,87) "unknown_696"
154 array(reg8_t,162) "unknown_1296"
155 array(reg8_t,176) "unknown_1408"
156 array(reg8_t,160) "unknown_1280"
157 array(reg8_t,56) "unknown_448"
158 array(reg8_t,83) "unknown_664"
159 array(reg8_t,65) "unknown_520"
160 array(reg8_t,71) "unknown_568"
161 array(reg8_t,86) "unknown_688"
162 array(reg8_t,108) "unknown_864"
163 array(reg8_t,147) "unknown_1176"
164 array(reg8_t,111) "unknown_888"
165 array(num8_t,5) "char[5]"
166 array(num8_t,19) "char[19]"
167 array(num8_t,2) "char[2]"
168 array(num8_t,17) "char[17]"
169 array(num8_t,11) "char[11]"
170 array(num8_t,24) "char[24]"
171 array(num8_t,18) "char[18]"
172 array(num8_t,23) "char[23]"
173 array(num8_t,10) "char[10]"
174 array(num8_t,4) "char[4]"
175 array(num8_t,3) "char[3]"
176 array(num8_t,16) "char[16]"
177 array(num8_t,12) "char[12]"
178 array(num8_t,7) "char[7]"
179 array(num8_t,25) "char[25]"
180 array(num8_t,27) "char[27]"
181 array(num8_t,20) "char[20]"
182 array(num8_t,29) "char[29]"
183 array(num8_t,33) "char[33]"
184 array(num8_t,39) "char[39]"
185 array(num8_t,134) "char[134]"
186 array(num8_t,75) "char[75]"
187 array(num8_t,188) "char[188]"
188 array(num8_t,66) "char[66]"
189 array(num8_t,199) "char[199]"
190 array(num8_t,45) "char[45]"
191 array(num8_t,54) "char[54]"
192 array(num8_t,58) "char[58]"
193 array(num8_t,426) "char[426]"
194 array(num8_t,69) "char[69]"
195 array(num8_t,65) "char[65]"
196 array(num8_t,87) "char[87]"
197 array(num8_t,48) "char[48]"
198 array(num8_t,43) "char[43]"
199 array(num8_t,46) "char[46]"
200 array(num8_t,50) "char[50]"
201 array(num8_t,35) "char[35]"
202 array(num8_t,37) "char[37]"
203 array(num8_t,42) "char[42]"
204 array(num8_t,57) "char[57]"
205 array(num8_t,61) "char[61]"
206 array(num8_t,36) "char[36]"
207 struct(0:ptr(num8_t),4:num32_t,8:ptr(num32_t),12:num32_t) "option"
208 array(num8_t,56) "char[56]"
209 array(num8_t,8) "char[8]"
210 array(reg32_t,9) "dword[9]"
211 array(reg32_t,127) "dword[127]"
212 array(reg32_t,34) "dword[34]"
213 array(num8_t,28) "char[28]"
214 array(num8_t,21) "char[21]"
215 array(num8_t,22) "char[22]"
216 array(num8_t,203) "char[203]"
217 array(num8_t,32) "char[32]"
218 array(num8_t,40) "char[40]"
219 array(num8_t,44) "char[44]"
220 array(num8_t,52) "char[52]"
221 array(num8_t,60) "char[60]"
222 array(num8_t,64) "char[64]"
223 array(ptr(TOP),10) "void*[10]"
224 array(num8_t,47) "char[47]"
225 array(num8_t,14) "char[14]"
226 array(num8_t,38) "char[38]"
227 array(ptr(TOP),54) "void*[54]"
228 array(num8_t,9) "char[9]"
229 array(num8_t,6) "char[6]"
230 array(num8_t,78) "char[78]"
231 array(reg8_t,820) "unknown_6560"
232 array(reg8_t,8204) "unknown_65632"
233 array(reg8_t,7680) "unknown_61440"
1 code_t "(void -?-> dword)*"
234 array(reg8_t,232) "unknown_1856"
235 ptr(struct(0:reg16_t,2:num8_t)) "StructFrag_0*"
236 ptr(struct(0:array(reg8_t,64),64:ptr(struct(0:array(reg8_t,652),652:reg32_t)))) "StructFrag_4*"
237 union(ptr(num8_t),ptr(struct(0:reg64_t,8:num8_t))) "Union_0"
236 ptr(struct(0:array(reg8_t,64),64:ptr(struct(0:array(reg8_t,652),652:reg32_t)))) "StructFrag_6*"
238 array(reg8_t,256) "unknown_2048"
| BlitzBasic | 2 | matt-noonan/retypd-data | data/csplit.decls | [
"MIT"
] |
#!/usr/bin/env bash
DIRNAME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
LH_ROOT="$DIRNAME/.."
tmp_dir=$(mktemp -d -t lh-XXXXXXXXXX)
cd "$tmp_dir"
npm pack "$LH_ROOT" 2>/dev/null
mv *.tgz "$LH_ROOT/dist/lighthouse.tgz"
rmdir "$tmp_dir"
| Shell | 4 | martin-maunoury/lighthouse | build/build-pack.sh | [
"Apache-2.0"
] |
{* This is temporary page, you can delete it *}
{block content}
<div id="test">
This is example file.
{foreach [1,2] as $item}
{$item}
{/foreach}
</div>
{/block} | Latte | 3 | arusinha/incubator-netbeans | php/php.latte/src/org/netbeans/modules/php/latte/resources/LatteExample.latte | [
"Apache-2.0"
] |
--TEST--
Success cases for static variance
--FILE--
<?php
class A {
public function test1(): self {}
public function test2(): B {}
public function test3(): object {}
public function test4(): X|Y|self {}
public function test5(): ?static {}
}
class B extends A {
public function test1(): static {}
public function test2(): static {}
public function test3(): static {}
public function test4(): X|Y|static {}
public function test5(): static {}
}
?>
===DONE===
--EXPECT--
===DONE===
| PHP | 4 | thiagooak/php-src | Zend/tests/type_declarations/variance/static_variance_success.phpt | [
"PHP-3.01"
] |
precision highp float;
varying vec2 vTextureCoord;
varying vec4 vColor;
uniform float uNoise;
uniform float uSeed;
uniform sampler2D uSampler;
float rand(vec2 co)
{
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
}
void main()
{
vec4 color = texture2D(uSampler, vTextureCoord);
float randomValue = rand(gl_FragCoord.xy * uSeed);
float diff = (randomValue - 0.5) * uNoise;
// Un-premultiply alpha before applying the color matrix. See issue #3539.
if (color.a > 0.0) {
color.rgb /= color.a;
}
color.r += diff;
color.g += diff;
color.b += diff;
// Premultiply alpha again.
color.rgb *= color.a;
gl_FragColor = color;
}
| GLSL | 4 | fanlistener/pixijs | packages/filters/filter-noise/src/noise.frag | [
"MIT"
] |
ruleset org.sovrin.agency {
meta {
use module io.picolabs.visual_params alias vp
use module io.picolabs.wrangler alias wrangler
use module org.sovrin.agency.ui alias ui
shares __testing, html, invitation
}
global {
__testing = { "queries":
[ { "name": "__testing" }
//, { "name": "entry", "args": [ "key" ] }
] , "events":
[ { "domain": "agency", "type": "new_agent", "attrs": [ "name", "color", "label" ] }
//, { "domain": "d2", "type": "t2", "attrs": [ "a1", "a2" ] }
]
}
html = function(name){
ui:html(name || vp:dname() || "Agency")
}
invitation = function(name){
info = wrangler:skyQuery(
ent:agents_eci,
"org.sovrin.agents",
"agentByName",
{"name":name}
);
ui:invitation(info{"name"},info{"did"})
}
agents_rids = [
"io.picolabs.collection",
"org.sovrin.agents"
]
agent_rids = [
"org.sovrin.agent",
"org.sovrin.agency_agent"
]
}
rule initialize_agency {
select when wrangler ruleset_added where event:attr("rids") >< meta:rid
if ent:agents_eci.isnull() then
wrangler:createChannel(meta:picoId,"agency","sovrin") setting(channel)
fired {
raise wrangler event "new_child_request" attributes {
"name": "Agents", "rids": agents_rids,
"agency_eci": channel{"id"}, "color": "#f6a12b"
}
}
}
rule record_agents_eci {
select when agents ready agents_eci re#(.+)# setting(agents_eci)
pre {
wellKnown_Rx = wrangler:skyQuery(agents_eci,
"io.picolabs.subscription",
"wellKnown_Rx")
subs_eci = wellKnown_Rx{"error"} => null | wellKnown_Rx{"id"}
}
fired {
ent:agents_eci := agents_eci;
ent:subs_eci := subs_eci
}
}
rule create_new_agent_pico {
select when agency new_agent
name re#.+@.+[.].+#
color re#\#[0-9a-f]{6}#
label re#.+#
pre {
child_specs = event:attrs
.delete("_headers")
.put({ "subs_eci": ent:subs_eci })
.put("method","did")
}
every {
send_directive("HATEOAS".uc(),{
"url": meta:host
+ "/sky/cloud/"
+ meta:eci
+ "/org.sovrin.agency/invitation.html?name="
+ event:attr("name")
})
event:send({"eci":wrangler:parent_eci(),
"domain": "owner", "type": "creation",
"attrs": child_specs.put({"rids":agent_rids})
});
}
}
}
| KRL | 5 | Picolab/G2S | krl/org.sovrin.agency.krl | [
"MIT"
] |
const Columns = Object.freeze({ name: "name", snack: "snack", drink: "drink" })
export default Columns
| JavaScript | 3 | waltercruz/gatsby | examples/functions-google-sheets/src/models/columns.js | [
"MIT"
] |
<<< "Hello world!">>>; | ChucK | 0 | JStearsman/hello-worlds | examples/ChucK.ck | [
"Unlicense"
] |
pragma solidity ^0.8.0;
contract Version8Pragma {
uint x;
constructor() {
x = 5;
}
}
| Solidity | 3 | santanaluiz/truffle | packages/compile-solidity/test/sources/v0.8.x/Version8Pragma.sol | [
"MIT"
] |
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
print_error() {
echo "Error: \`$1\` is not a valid commit. To debug, run:"
echo
echo " git rev-parse --verify $1"
echo
}
full_sha() {
git rev-parse \
--verify \
--quiet \
"$1^{object}" || print_error $1
}
commit_message_with_backport_note() {
message=$(git log --format=%B -n 1 $1)
echo $message | awk "NR==1{print; print \"\n(backport-of: $1)\"} NR!=1"
}
cherry_pick_commit() {
sha=$(full_sha $1)
git cherry-pick $sha > /dev/null
git commit \
--amend \
--file <(commit_message_with_backport_note $sha)
}
for arg ; do
cherry_pick_commit $arg
done
| Shell | 4 | mbc-git/rust | src/tools/cherry-pick.sh | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: calendar curses curses.ffi kernel random sequences threads
tools.test ;
IN: curses.tests
: hello-curses ( -- )
<curses-window> [
"Hello Curses!" [
dup cmove addch
] each-index
crefresh
2 seconds sleep
] with-curses ;
: hello-curses-color ( -- )
<curses-window> [
"Hello Curses!" [
8 random 8 random ccolor addch
] each crefresh
2 seconds sleep
] with-curses ;
curses-ok? [
{ } [ hello-curses ] unit-test
has_colors [
{ } [ hello-curses-color ] unit-test
] when
] when
| Factor | 4 | alex-ilin/factor | extra/curses/curses-tests.factor | [
"BSD-2-Clause"
] |
{% form_theme form '@SyliusAdmin/Product/Attribute/attributesCollection.html.twig' %}
<div class="ui tab" data-tab="attributes">
<h3 class="ui top attached header">{{ 'sylius.ui.attributes'|trans }}</h3>
<div class="ui attached segment">
{{ render(url('sylius_admin_get_product_attributes')) }}
<div id="attributesContainer" data-count="{{ form.attributes|length }}">
{{ form_widget(form.attributes, {'attr': {'translations': form.translations} }) }}
</div>
{{ sylius_template_event(['sylius.admin.product.' ~ action ~ '.tab_attributes', 'sylius.admin.product.tab_attributes'], {'form': form}) }}
</div>
</div>
| Twig | 4 | titomtd/Sylius | src/Sylius/Bundle/AdminBundle/Resources/views/Product/Tab/_attributes.html.twig | [
"MIT"
] |
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { IUserDataSyncEnablementService, SyncResource } from 'vs/platform/userDataSync/common/userDataSync';
import { UserDataSyncEnablementService as BaseUserDataSyncEnablementService } from 'vs/platform/userDataSync/common/userDataSyncEnablementService';
import { IBrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService';
export class UserDataSyncEnablementService extends BaseUserDataSyncEnablementService implements IUserDataSyncEnablementService {
protected get workbenchEnvironmentService(): IBrowserWorkbenchEnvironmentService { return <IBrowserWorkbenchEnvironmentService>this.environmentService; }
override getResourceSyncStateVersion(resource: SyncResource): string | undefined {
return resource === SyncResource.Extensions ? this.workbenchEnvironmentService.options?.settingsSyncOptions?.extensionsSyncStateVersion : undefined;
}
}
registerSingleton(IUserDataSyncEnablementService, UserDataSyncEnablementService);
| TypeScript | 4 | KevinAo22/vscode | src/vs/workbench/services/userDataSync/browser/userDataSyncEnablementService.ts | [
"MIT"
] |