content
stringlengths
4
1.04M
lang
stringclasses
358 values
score
int64
0
5
repo_name
stringlengths
5
114
repo_path
stringlengths
4
229
repo_licenses
listlengths
1
8
unique template site/ceph/client/libvirt; include 'site/ceph/client/config'; variable CEPH_LIBVIRT_USER ?= 'oneadmin'; variable CEPH_LIBVIRT_GROUP ?= CEPH_LIBVIRT_USER; prefix '/software/components/metaconfig/services/{/etc/ceph/ceph.client.libvirt.keyring}'; "contents" = if (is_defined(CEPH_LIBVIRT_SECRET)) { dict("client.libvirt", dict( "key", CEPH_LIBVIRT_SECRET, ) ); } else { dict(); }; 'module' = 'tiny'; 'mode' = 0600; 'owner' = CEPH_LIBVIRT_USER; 'group' = CEPH_LIBVIRT_GROUP;
Pan
3
JavascriptID/sourcerer-app
src/test/resources/samples/langs/Pan/libvirt.pan
[ "MIT" ]
- public_visible = local_assigns.fetch(:public_visible, false) - if rate_limit && (public_visible || user_signed_in?) %tr %td= title %td= instance_configuration_cell_html(rate_limit[:enabled] ? rate_limit[:requests_per_period] : nil) %td= instance_configuration_cell_html(rate_limit[:enabled] ? rate_limit[:period_in_seconds] : nil)
Haml
4
Testiduk/gitlabhq
app/views/help/instance_configuration/_rate_limit_row.html.haml
[ "MIT" ]
# Copyright (C) 2001-2012, Parrot Foundation. =begin pod =head1 NAME examples/mops/mops.p6 - Benchmark Integer Mops =head1 SYNOPSIS % perl6 examples/mops/mops.p6 =head1 DESCRIPTION A Perl 6 implementation of the F<examples/benchmarks/mops_intval.pasm> benchmark, for speed comparisons. Calculates a value for Mops (also known as M ops/s or million operations per second) using integer arithmetic. Prints out: =over 4 =item * the number of loop iterations, =item * the estimated number of ops performed, =item * the elapsed time, and =item * the calculated Mops. =back =head1 SEE ALSO F<examples/benchmarks/mops.pasm>, F<examples/benchmarks/mops_intval.pasm>, F<examples/mops/mops.c>, F<examples/mops/mops.cs>, F<examples/mops/mops.il>, F<examples/mops/mops.pl>, F<examples/mops/mops.ps>, F<examples/mops/mops.py>, F<examples/mops/mops.rb>, F<examples/mops/mops.scheme>. =end pod sub MAIN() { my ($I1, $I2, $I3, $I4, $I5, $N1, $N2, $N4, $N5); $I2 = 0; # set I2, 0 $I3 = 1; # set I3, 1 $I4 = 1000000; # set I4, 100000000 # print "Iterations: ",$I4,"\n"; # print "Iterations: " # print I4 # print "\n" # $I1 = 2; # set I1, 2 $I5 = $I4 * $I1; # mul I5, I4, I1 # print "Estimated ops: ",$I5,"\n"; # print "Estimated ops: " # print I5 # print "\n" # $N1 = time; # time N1 # $I4 = $I4 - $I3 # sub I4, I4, I3 while ($I4>0); # if I4, REDO # $N5 = time; # time N5 # $N2 = $N5 - $N1; # sub N2, N5, N1 # print "Elapsed time: ",$N2,"\n"; # print "Elapsed time: " # print N2 # print "\n" # $N1 = $I5; # set N1, I5 $N1 = $N1 / $N2; # div N1, N1, N2 $N2 = 1000000.0; # set N2, 1000000.0 $N1 = $N1 / $N2; # div N1, N1, N2 # print "M op/s: ",$N1,"\n"; # print "M op/s: " # print N1 # print "\n" # } # end
Perl6
4
winnit-myself/Wifie
examples/mops/mops.p6
[ "Artistic-2.0" ]
package com.baeldung.emptystringoptional; import com.google.common.base.Strings; import org.junit.Assert; import org.junit.Test; import java.util.Optional; import java.util.function.Predicate; public class EmptyStringToEmptyOptionalUnitTest { @Test public void givenEmptyString_whenFilteringOnOptional_thenEmptyOptionalIsReturned() { String str = ""; Optional<String> opt = Optional.ofNullable(str).filter(s -> !s.isEmpty()); Assert.assertFalse(opt.isPresent()); } // Uncomment code when code base is compatible with Java 11 // @Test // public void givenEmptyString_whenFilteringOnOptionalInJava11_thenEmptyOptionalIsReturned() { // String str = ""; // Optional<String> opt = Optional.ofNullable(str).filter(Predicate.not(String::isEmpty)); // Assert.assertFalse(opt.isPresent()); // } @Test public void givenEmptyString_whenPassingResultOfEmptyToNullToOfNullable_thenEmptyOptionalIsReturned() { String str = ""; Optional<String> opt = Optional.ofNullable(Strings.emptyToNull(str)); Assert.assertFalse(opt.isPresent()); } }
Java
4
DBatOWL/tutorials
core-java-modules/core-java-optional/src/test/java/com/baeldung/emptystringoptional/EmptyStringToEmptyOptionalUnitTest.java
[ "MIT" ]
param ($CertBase64) $ErrorActionPreference = "Stop" $CertBytes = [System.Convert]::FromBase64String($CertBase64) $CertCollection = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2Collection $CertCollection.Import($CertBytes, $null, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Exportable -bxor [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::PersistKeySet) $CertStore = New-Object System.Security.Cryptography.X509Certificates.X509Store("My","LocalMachine") $CertStore.Open("ReadWrite") $CertStore.AddRange($CertCollection) $CertStore.Close() $ESRPAuthCertificateSubjectName = $CertCollection[0].Subject Write-Output ("##vso[task.setvariable variable=ESRPAuthCertificateSubjectName;]$ESRPAuthCertificateSubjectName")
PowerShell
4
sbj42/vscode
build/azure-pipelines/win32/import-esrp-auth-cert.ps1
[ "MIT" ]
""" 42 """ import System.Collections import System.Collections.Generic class IntCollection (ICollection[of int]): Count as int: get: return 42 def IEnumerable.GetEnumerator(): raise System.NotImplementedException() c = IntCollection() print len(c)
Boo
2
popcatalin81/boo
tests/testcases/regression/BOO-1154-1.boo
[ "BSD-3-Clause" ]
#main internal fib_closure() { a = 0 b = 1 return () => { c = b b = a + b a = c return a } } var f = fib_closure() for i = 0 to 9 { echo "$i ==> ${f()}" }
Tea
4
jackwiy/tea
examples/fib_closure.tea
[ "Apache-2.0" ]
<title>Some Title</title> <link href="/" rel="canonical"> <meta content="some description" name="description"> <meta content="some keywords" name="keywords">
HTML
3
vatro/svelte
test/hydration/samples/head-meta-hydrate-duplicate/_after_head.html
[ "MIT" ]
/* This is a stylesheet. How exciting! Content of this file is irrelevant; it is used for testing `getPrecachePages` */
CSS
1
JQuinnie/gatsby
packages/gatsby-plugin-offline/src/__tests__/fixtures/public/style.css
[ "MIT" ]
include: - issue-47182.stateA.newer
SaltStack
0
byteskeptical/salt
tests/integration/files/file/base/issue-47182/stateA/init.sls
[ "Apache-2.0" ]
# Copyright 2021 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """Immutable mapping.""" import collections.abc # WARNING: this class is used internally by extension types (tf.ExtensionType), # and may be deleted if/when extension types transition to a different encoding # in the future. class ImmutableDict(collections.abc.Mapping): """Immutable `Mapping`.""" # Note: keys, items, values, get, __eq__, and __ne__ are implemented by # the `Mapping` base class. def __init__(self, *args, **kwargs): self._dict = dict(*args, **kwargs) def __getitem__(self, key): return self._dict[key] def __contains__(self, key): return key in self._dict def __iter__(self): return iter(self._dict) def __len__(self): return len(self._dict) def __repr__(self): return f'ImmutableDict({self._dict})'
Python
4
EricRemmerswaal/tensorflow
tensorflow/python/framework/immutable_dict.py
[ "Apache-2.0" ]
{% extends "form_div_layout.html.twig" %} {%- block checkbox_row -%} {%- set parent_class = parent_class|default(attr.class|default('')) -%} {%- if 'switch-input' in parent_class -%} {{- form_label(form) -}} {%- set attr = attr|merge({class: (attr.class|default('') ~ ' switch-input')|trim}) -%} {{- form_widget(form) -}} <label class="switch-paddle" for="{{ form.vars.id }}"></label> {{- form_errors(form) -}} {%- else -%} {{- block('form_row') -}} {%- endif -%} {%- endblock checkbox_row -%} {% block money_widget -%} {% set prepend = not (money_pattern starts with '{{') %} {% set append = not (money_pattern ends with '}}') %} {% if prepend or append %} <div class="input-group"> {% if prepend %} <span class="input-group-label">{{ money_pattern|form_encode_currency }}</span> {% endif %} {% set attr = attr|merge({class: (attr.class|default('') ~ ' input-group-field')|trim}) %} {{- block('form_widget_simple') -}} {% if append %} <span class="input-group-label">{{ money_pattern|form_encode_currency }}</span> {% endif %} </div> {% else %} {{- block('form_widget_simple') -}} {% endif %} {%- endblock money_widget %} {% block percent_widget -%} {%- if symbol -%} <div class="input-group"> {% set attr = attr|merge({class: (attr.class|default('') ~ ' input-group-field')|trim}) %} {{- block('form_widget_simple') -}} <span class="input-group-label">{{ symbol|default('%') }}</span> </div> {%- else -%} {{- block('form_widget_simple') -}} {%- endif -%} {%- endblock percent_widget %} {% block button_widget -%} {% set attr = attr|merge({class: (attr.class|default('') ~ ' button')|trim}) %} {{- parent() -}} {%- endblock button_widget %}
Twig
4
simonberger/symfony
src/Symfony/Bridge/Twig/Resources/views/Form/foundation_6_layout.html.twig
[ "MIT" ]
import ComponentPage from "./ComponentPage" export default ComponentPage
JavaScript
1
cwlsn/gatsby
examples/styleguide/src/templates/ComponentPage/index.js
[ "MIT" ]
// @target: es2015 class Parent { #foo = 3; static #bar = 5; accessChildProps() { new Child().#foo; // OK (`#foo` was added when `Parent`'s constructor was called on `child`) Child.#bar; // Error: not found } } class Child extends Parent { #foo = "foo"; // OK (Child's #foo does not conflict, as `Parent`'s `#foo` is not accessible) #bar = "bar"; // OK }
TypeScript
4
monciego/TypeScript
tests/cases/conformance/classes/members/privateNames/privateNamesConstructorChain-1.ts
[ "Apache-2.0" ]
precision highp float; varying vec4 fragColor; attribute vec4 p01_04, p05_08, p09_12, p13_16, p17_20, p21_24, p25_28, p29_32, p33_36, p37_40, p41_44, p45_48, p49_52, p53_56, p57_60, colors; uniform mat4 dim0A, dim1A, dim0B, dim1B, dim0C, dim1C, dim0D, dim1D, loA, hiA, loB, hiB, loC, hiC, loD, hiD; uniform vec2 resolution, viewBoxPos, viewBoxSize; uniform float maskHeight; uniform float drwLayer; // 0: context, 1: focus, 2: pick uniform vec4 contextColor; uniform sampler2D maskTexture, palette; bool isPick = (drwLayer > 1.5); bool isContext = (drwLayer < 0.5); const vec4 ZEROS = vec4(0.0, 0.0, 0.0, 0.0); const vec4 UNITS = vec4(1.0, 1.0, 1.0, 1.0); float val(mat4 p, mat4 v) { return dot(matrixCompMult(p, v) * UNITS, UNITS); } float axisY(float ratio, mat4 A, mat4 B, mat4 C, mat4 D) { float y1 = val(A, dim0A) + val(B, dim0B) + val(C, dim0C) + val(D, dim0D); float y2 = val(A, dim1A) + val(B, dim1B) + val(C, dim1C) + val(D, dim1D); return y1 * (1.0 - ratio) + y2 * ratio; } int iMod(int a, int b) { return a - b * (a / b); } bool fOutside(float p, float lo, float hi) { return (lo < hi) && (lo > p || p > hi); } bool vOutside(vec4 p, vec4 lo, vec4 hi) { return ( fOutside(p[0], lo[0], hi[0]) || fOutside(p[1], lo[1], hi[1]) || fOutside(p[2], lo[2], hi[2]) || fOutside(p[3], lo[3], hi[3]) ); } bool mOutside(mat4 p, mat4 lo, mat4 hi) { return ( vOutside(p[0], lo[0], hi[0]) || vOutside(p[1], lo[1], hi[1]) || vOutside(p[2], lo[2], hi[2]) || vOutside(p[3], lo[3], hi[3]) ); } bool outsideBoundingBox(mat4 A, mat4 B, mat4 C, mat4 D) { return mOutside(A, loA, hiA) || mOutside(B, loB, hiB) || mOutside(C, loC, hiC) || mOutside(D, loD, hiD); } bool outsideRasterMask(mat4 A, mat4 B, mat4 C, mat4 D) { mat4 pnts[4]; pnts[0] = A; pnts[1] = B; pnts[2] = C; pnts[3] = D; for(int i = 0; i < 4; ++i) { for(int j = 0; j < 4; ++j) { for(int k = 0; k < 4; ++k) { if(0 == iMod( int(255.0 * texture2D(maskTexture, vec2( (float(i * 2 + j / 2) + 0.5) / 8.0, (pnts[i][j][k] * (maskHeight - 1.0) + 1.0) / maskHeight ))[3] ) / int(pow(2.0, float(iMod(j * 4 + k, 8)))), 2 )) return true; } } } return false; } vec4 position(bool isContext, float v, mat4 A, mat4 B, mat4 C, mat4 D) { float x = 0.5 * sign(v) + 0.5; float y = axisY(x, A, B, C, D); float z = 1.0 - abs(v); z += isContext ? 0.0 : 2.0 * float( outsideBoundingBox(A, B, C, D) || outsideRasterMask(A, B, C, D) ); return vec4( 2.0 * (vec2(x, y) * viewBoxSize + viewBoxPos) / resolution - 1.0, z, 1.0 ); } void main() { mat4 A = mat4(p01_04, p05_08, p09_12, p13_16); mat4 B = mat4(p17_20, p21_24, p25_28, p29_32); mat4 C = mat4(p33_36, p37_40, p41_44, p45_48); mat4 D = mat4(p49_52, p53_56, p57_60, ZEROS); float v = colors[3]; gl_Position = position(isContext, v, A, B, C, D); fragColor = isContext ? vec4(contextColor) : isPick ? vec4(colors.rgb, 1.0) : texture2D(palette, vec2(abs(v), 0.5)); }
GLSL
4
njwhite/plotly.js
src/traces/parcoords/shaders/vertex.glsl
[ "MIT" ]
/*! * Copyright 2017-2020 by Contributors * \file hist_util.cc */ #include <dmlc/timer.h> #include <dmlc/omp.h> #include <rabit/rabit.h> #include <numeric> #include <vector> #include "xgboost/base.h" #include "../common/common.h" #include "hist_util.h" #include "random.h" #include "column_matrix.h" #include "quantile.h" #include "../data/gradient_index.h" #if defined(XGBOOST_MM_PREFETCH_PRESENT) #include <xmmintrin.h> #define PREFETCH_READ_T0(addr) _mm_prefetch(reinterpret_cast<const char*>(addr), _MM_HINT_T0) #elif defined(XGBOOST_BUILTIN_PREFETCH_PRESENT) #define PREFETCH_READ_T0(addr) __builtin_prefetch(reinterpret_cast<const char*>(addr), 0, 3) #else // no SW pre-fetching available; PREFETCH_READ_T0 is no-op #define PREFETCH_READ_T0(addr) do {} while (0) #endif // defined(XGBOOST_MM_PREFETCH_PRESENT) namespace xgboost { namespace common { HistogramCuts::HistogramCuts() { cut_ptrs_.HostVector().emplace_back(0); } /*! * \brief fill a histogram by zeros in range [begin, end) */ template<typename GradientSumT> void InitilizeHistByZeroes(GHistRow<GradientSumT> hist, size_t begin, size_t end) { #if defined(XGBOOST_STRICT_R_MODE) && XGBOOST_STRICT_R_MODE == 1 std::fill(hist.begin() + begin, hist.begin() + end, xgboost::detail::GradientPairInternal<GradientSumT>()); #else // defined(XGBOOST_STRICT_R_MODE) && XGBOOST_STRICT_R_MODE == 1 memset(hist.data() + begin, '\0', (end-begin)* sizeof(xgboost::detail::GradientPairInternal<GradientSumT>)); #endif // defined(XGBOOST_STRICT_R_MODE) && XGBOOST_STRICT_R_MODE == 1 } template void InitilizeHistByZeroes(GHistRow<float> hist, size_t begin, size_t end); template void InitilizeHistByZeroes(GHistRow<double> hist, size_t begin, size_t end); /*! * \brief Increment hist as dst += add in range [begin, end) */ template<typename GradientSumT> void IncrementHist(GHistRow<GradientSumT> dst, const GHistRow<GradientSumT> add, size_t begin, size_t end) { GradientSumT* pdst = reinterpret_cast<GradientSumT*>(dst.data()); const GradientSumT* padd = reinterpret_cast<const GradientSumT*>(add.data()); for (size_t i = 2 * begin; i < 2 * end; ++i) { pdst[i] += padd[i]; } } template void IncrementHist(GHistRow<float> dst, const GHistRow<float> add, size_t begin, size_t end); template void IncrementHist(GHistRow<double> dst, const GHistRow<double> add, size_t begin, size_t end); /*! * \brief Copy hist from src to dst in range [begin, end) */ template<typename GradientSumT> void CopyHist(GHistRow<GradientSumT> dst, const GHistRow<GradientSumT> src, size_t begin, size_t end) { GradientSumT* pdst = reinterpret_cast<GradientSumT*>(dst.data()); const GradientSumT* psrc = reinterpret_cast<const GradientSumT*>(src.data()); for (size_t i = 2 * begin; i < 2 * end; ++i) { pdst[i] = psrc[i]; } } template void CopyHist(GHistRow<float> dst, const GHistRow<float> src, size_t begin, size_t end); template void CopyHist(GHistRow<double> dst, const GHistRow<double> src, size_t begin, size_t end); /*! * \brief Compute Subtraction: dst = src1 - src2 in range [begin, end) */ template<typename GradientSumT> void SubtractionHist(GHistRow<GradientSumT> dst, const GHistRow<GradientSumT> src1, const GHistRow<GradientSumT> src2, size_t begin, size_t end) { GradientSumT* pdst = reinterpret_cast<GradientSumT*>(dst.data()); const GradientSumT* psrc1 = reinterpret_cast<const GradientSumT*>(src1.data()); const GradientSumT* psrc2 = reinterpret_cast<const GradientSumT*>(src2.data()); for (size_t i = 2 * begin; i < 2 * end; ++i) { pdst[i] = psrc1[i] - psrc2[i]; } } template void SubtractionHist(GHistRow<float> dst, const GHistRow<float> src1, const GHistRow<float> src2, size_t begin, size_t end); template void SubtractionHist(GHistRow<double> dst, const GHistRow<double> src1, const GHistRow<double> src2, size_t begin, size_t end); struct Prefetch { public: static constexpr size_t kCacheLineSize = 64; static constexpr size_t kPrefetchOffset = 10; private: static constexpr size_t kNoPrefetchSize = kPrefetchOffset + kCacheLineSize / sizeof(decltype(GHistIndexMatrix::row_ptr)::value_type); public: static size_t NoPrefetchSize(size_t rows) { return std::min(rows, kNoPrefetchSize); } template <typename T> static constexpr size_t GetPrefetchStep() { return Prefetch::kCacheLineSize / sizeof(T); } }; constexpr size_t Prefetch::kNoPrefetchSize; template <typename FPType, bool do_prefetch, typename BinIdxType, bool first_page, bool any_missing = true> void BuildHistKernel(const std::vector<GradientPair> &gpair, const RowSetCollection::Elem row_indices, const GHistIndexMatrix &gmat, GHistRow<FPType> hist) { const size_t size = row_indices.Size(); const size_t *rid = row_indices.begin; auto const *pgh = reinterpret_cast<const float *>(gpair.data()); const BinIdxType *gradient_index = gmat.index.data<BinIdxType>(); auto const &row_ptr = gmat.row_ptr.data(); auto base_rowid = gmat.base_rowid; const uint32_t *offsets = gmat.index.Offset(); auto get_row_ptr = [&](size_t ridx) { return first_page ? row_ptr[ridx] : row_ptr[ridx - base_rowid]; }; auto get_rid = [&](size_t ridx) { return first_page ? ridx : (ridx - base_rowid); }; const size_t n_features = get_row_ptr(row_indices.begin[0] + 1) - get_row_ptr(row_indices.begin[0]); auto hist_data = reinterpret_cast<FPType *>(hist.data()); const uint32_t two{2}; // Each element from 'gpair' and 'hist' contains // 2 FP values: gradient and hessian. // So we need to multiply each row-index/bin-index by 2 // to work with gradient pairs as a singe row FP array for (size_t i = 0; i < size; ++i) { const size_t icol_start = any_missing ? get_row_ptr(rid[i]) : get_rid(rid[i]) * n_features; const size_t icol_end = any_missing ? get_row_ptr(rid[i] + 1) : icol_start + n_features; const size_t row_size = icol_end - icol_start; const size_t idx_gh = two * rid[i]; if (do_prefetch) { const size_t icol_start_prefetch = any_missing ? get_row_ptr(rid[i + Prefetch::kPrefetchOffset]) : get_rid(rid[i + Prefetch::kPrefetchOffset]) * n_features; const size_t icol_end_prefetch = any_missing ? get_row_ptr(rid[i + Prefetch::kPrefetchOffset] + 1) : icol_start_prefetch + n_features; PREFETCH_READ_T0(pgh + two * rid[i + Prefetch::kPrefetchOffset]); for (size_t j = icol_start_prefetch; j < icol_end_prefetch; j += Prefetch::GetPrefetchStep<uint32_t>()) { PREFETCH_READ_T0(gradient_index + j); } } const BinIdxType *gr_index_local = gradient_index + icol_start; for (size_t j = 0; j < row_size; ++j) { const uint32_t idx_bin = two * (static_cast<uint32_t>(gr_index_local[j]) + (any_missing ? 0 : offsets[j])); hist_data[idx_bin] += pgh[idx_gh]; hist_data[idx_bin + 1] += pgh[idx_gh + 1]; } } } template <typename FPType, bool do_prefetch, bool any_missing> void BuildHistDispatch(const std::vector<GradientPair> &gpair, const RowSetCollection::Elem row_indices, const GHistIndexMatrix &gmat, GHistRow<FPType> hist) { auto first_page = gmat.base_rowid == 0; if (first_page) { switch (gmat.index.GetBinTypeSize()) { case kUint8BinsTypeSize: BuildHistKernel<FPType, do_prefetch, uint8_t, true, any_missing>( gpair, row_indices, gmat, hist); break; case kUint16BinsTypeSize: BuildHistKernel<FPType, do_prefetch, uint16_t, true, any_missing>( gpair, row_indices, gmat, hist); break; case kUint32BinsTypeSize: BuildHistKernel<FPType, do_prefetch, uint32_t, true, any_missing>( gpair, row_indices, gmat, hist); break; default: CHECK(false); // no default behavior } } else { switch (gmat.index.GetBinTypeSize()) { case kUint8BinsTypeSize: BuildHistKernel<FPType, do_prefetch, uint8_t, false, any_missing>( gpair, row_indices, gmat, hist); break; case kUint16BinsTypeSize: BuildHistKernel<FPType, do_prefetch, uint16_t, false, any_missing>( gpair, row_indices, gmat, hist); break; case kUint32BinsTypeSize: BuildHistKernel<FPType, do_prefetch, uint32_t, false, any_missing>( gpair, row_indices, gmat, hist); break; default: CHECK(false); // no default behavior } } } template <typename GradientSumT> template <bool any_missing> void GHistBuilder<GradientSumT>::BuildHist( const std::vector<GradientPair> &gpair, const RowSetCollection::Elem row_indices, const GHistIndexMatrix &gmat, GHistRowT hist) const { const size_t nrows = row_indices.Size(); const size_t no_prefetch_size = Prefetch::NoPrefetchSize(nrows); // if need to work with all rows from bin-matrix (e.g. root node) const bool contiguousBlock = (row_indices.begin[nrows - 1] - row_indices.begin[0]) == (nrows - 1); if (contiguousBlock) { // contiguous memory access, built-in HW prefetching is enough BuildHistDispatch<GradientSumT, false, any_missing>(gpair, row_indices, gmat, hist); } else { const RowSetCollection::Elem span1(row_indices.begin, row_indices.end - no_prefetch_size); const RowSetCollection::Elem span2(row_indices.end - no_prefetch_size, row_indices.end); BuildHistDispatch<GradientSumT, true, any_missing>(gpair, span1, gmat, hist); // no prefetching to avoid loading extra memory BuildHistDispatch<GradientSumT, false, any_missing>(gpair, span2, gmat, hist); } } template void GHistBuilder<float>::BuildHist<true>(const std::vector<GradientPair> &gpair, const RowSetCollection::Elem row_indices, const GHistIndexMatrix &gmat, GHistRow<float> hist) const; template void GHistBuilder<float>::BuildHist<false>(const std::vector<GradientPair> &gpair, const RowSetCollection::Elem row_indices, const GHistIndexMatrix &gmat, GHistRow<float> hist) const; template void GHistBuilder<double>::BuildHist<true>(const std::vector<GradientPair> &gpair, const RowSetCollection::Elem row_indices, const GHistIndexMatrix &gmat, GHistRow<double> hist) const; template void GHistBuilder<double>::BuildHist<false>(const std::vector<GradientPair> &gpair, const RowSetCollection::Elem row_indices, const GHistIndexMatrix &gmat, GHistRow<double> hist) const; } // namespace common } // namespace xgboost
C++
4
GinkoBalboa/xgboost
src/common/hist_util.cc
[ "Apache-2.0" ]
package org.opencv.test.calib3d; import org.opencv.test.OpenCVTestCase; public class StereoBMTest extends OpenCVTestCase { public void testComputeMatMatMat() { fail("Not yet implemented"); } public void testComputeMatMatMatInt() { fail("Not yet implemented"); } public void testStereoBM() { fail("Not yet implemented"); } public void testStereoBMInt() { fail("Not yet implemented"); } public void testStereoBMIntInt() { fail("Not yet implemented"); } public void testStereoBMIntIntInt() { fail("Not yet implemented"); } }
Java
1
thisisgopalmandal/opencv
modules/calib3d/misc/java/test/StereoBMTest.java
[ "BSD-3-Clause" ]
--TEST-- Trying to clone mysqli object --EXTENSIONS-- mysqli --SKIPIF-- <?php require_once('skipifconnectfailure.inc'); ?> --FILE-- <?php require_once("connect.inc"); if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); $link_clone = clone $link; mysqli_close($link); print "done!"; ?> --EXPECTF-- Fatal error: Uncaught Error: Trying to clone an uncloneable object of class mysqli in %s:%d Stack trace: #0 {main} thrown in %s on line %d
PHP
3
NathanFreeman/php-src
ext/mysqli/tests/mysqli_unclonable.phpt
[ "PHP-3.01" ]
// rustfmt-indent_style: Block // Where predicate indent fn lorem<Ipsum, Dolor, Sit, Amet>() -> T where Ipsum: Eq, Dolor: Eq, Sit: Eq, Amet: Eq, { // body }
Rust
3
mbc-git/rust
src/tools/rustfmt/tests/target/configs/indent_style/block_where_pred.rs
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
Conv1 Conv2 Identity Reshape Dense Dense CustomOp AvgPool3D SoftmaxH
PureBasic
0
yage99/tensorflow
tensorflow/lite/toco/logging/testdata/toco_log_before.pb
[ "Apache-2.0" ]
<html> <body> <span id="opacity" style="transition-duration: 2s;">opacity</span> <script> document.getElementById('opacity').addEventListener('click', function(event) { event.target.style.opacity = 0 }) </script> </body> </html>
HTML
4
bkucera2/cypress
packages/driver/cypress/fixtures/opacity.html
[ "MIT" ]
// dpl.eh // see dpl.ec #ifndef _DPL_EH #define _DPL_EH 1 // Debug Print Line Format (_dplf) #ifdef _DPL_ON #define _dplf(...) __dplf(__FILE__, __LINE__, ##__VA_ARGS__) #else #define _dplf(...) #endif // Debug Print Channel Line (_dpcl) #ifdef _DPL_ON #define _dpcl(...) __dpcl(__FILE__, __LINE__, ##__VA_ARGS__) #else #define _dpcl(...) #endif // Debug Print Channel Line Format (_dpclf) #ifdef _DPL_ON #define _dpclf(...) __dpclf(__FILE__, __LINE__, ##__VA_ARGS__) #else #define _dpclf(...) #endif #endif // dpl.eh
eC
3
N-eil/ecere-sdk
extras/include/dpl.eh
[ "BSD-3-Clause" ]
--TEST-- Bug #39508 (imagefill crashes with small images 3 pixels or less) --EXTENSIONS-- gd --FILE-- <?php $im = imagecreatetruecolor(3,1); $bgcolor = imagecolorallocatealpha($im,255, 255, 0, 0); imagefill($im,0,0,$bgcolor); print_r(imagecolorat($im, 1,0)); ?> --EXPECT-- 16776960
PHP
4
NathanFreeman/php-src
ext/gd/tests/bug39508.phpt
[ "PHP-3.01" ]
/* [The "BSD licence"] Copyright (c) 2005-2008 Terence Parr All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ lexer grammar ActionTranslator; options { filter=true; // try all non-fragment rules in order specified // output=template; TODO: can we make tokens return templates somehow? } @header { package org.antlr.grammar.v3; import org.antlr.stringtemplate.StringTemplate; import org.antlr.runtime.*; import org.antlr.tool.*; import org.antlr.codegen.*; import org.antlr.runtime.*; import java.util.List; import java.util.ArrayList; import org.antlr.grammar.v2.ANTLRParser; } @members { public List chunks = new ArrayList(); Rule enclosingRule; int outerAltNum; Grammar grammar; CodeGenerator generator; antlr.Token actionToken; public ActionTranslator(CodeGenerator generator, String ruleName, GrammarAST actionAST) { this(new ANTLRStringStream(actionAST.token.getText())); this.generator = generator; this.grammar = generator.grammar; this.enclosingRule = grammar.getLocallyDefinedRule(ruleName); this.actionToken = actionAST.token; this.outerAltNum = actionAST.outerAltNum; } public ActionTranslator(CodeGenerator generator, String ruleName, antlr.Token actionToken, int outerAltNum) { this(new ANTLRStringStream(actionToken.getText())); this.generator = generator; grammar = generator.grammar; this.enclosingRule = grammar.getRule(ruleName); this.actionToken = actionToken; this.outerAltNum = outerAltNum; } /** Return a list of strings and StringTemplate objects that * represent the translated action. */ public List translateToChunks() { // System.out.println("###\naction="+action); Token t; do { t = nextToken(); } while ( t.getType()!= Token.EOF ); return chunks; } public String translate() { List theChunks = translateToChunks(); //System.out.println("chunks="+a.chunks); StringBuffer buf = new StringBuffer(); for (int i = 0; i < theChunks.size(); i++) { Object o = (Object) theChunks.get(i); buf.append(o); } //System.out.println("translated: "+buf.toString()); return buf.toString(); } public List translateAction(String action) { String rname = null; if ( enclosingRule!=null ) { rname = enclosingRule.name; } ActionTranslator translator = new ActionTranslator(generator, rname, new antlr.CommonToken(ANTLRParser.ACTION,action),outerAltNum); return translator.translateToChunks(); } public boolean isTokenRefInAlt(String id) { return enclosingRule.getTokenRefsInAlt(id, outerAltNum)!=null; } public boolean isRuleRefInAlt(String id) { return enclosingRule.getRuleRefsInAlt(id, outerAltNum)!=null; } public Grammar.LabelElementPair getElementLabel(String id) { return enclosingRule.getLabel(id); } public void checkElementRefUniqueness(String ref, boolean isToken) { List refs = null; if ( isToken ) { refs = enclosingRule.getTokenRefsInAlt(ref, outerAltNum); } else { refs = enclosingRule.getRuleRefsInAlt(ref, outerAltNum); } if ( refs!=null && refs.size()>1 ) { ErrorManager.grammarError(ErrorManager.MSG_NONUNIQUE_REF, grammar, actionToken, ref); } } /** For \$rulelabel.name, return the Attribute found for name. It * will be a predefined property or a return value. */ public Attribute getRuleLabelAttribute(String ruleName, String attrName) { Rule r = grammar.getRule(ruleName); AttributeScope scope = r.getLocalAttributeScope(attrName); if ( scope!=null && !scope.isParameterScope ) { return scope.getAttribute(attrName); } return null; } AttributeScope resolveDynamicScope(String scopeName) { if ( grammar.getGlobalScope(scopeName)!=null ) { return grammar.getGlobalScope(scopeName); } Rule scopeRule = grammar.getRule(scopeName); if ( scopeRule!=null ) { return scopeRule.ruleScope; } return null; // not a valid dynamic scope } protected StringTemplate template(String name) { StringTemplate st = generator.getTemplates().getInstanceOf(name); chunks.add(st); return st; } } /** $x.y x is enclosing rule, y is a return value, parameter, or * predefined property. * * r[int i] returns [int j] * : {$r.i, $r.j, $r.start, $r.stop, $r.st, $r.tree} * ; */ SET_ENCLOSING_RULE_SCOPE_ATTR : '$' x=ID '.' y=ID WS? '=' expr=ATTR_VALUE_EXPR ';' {enclosingRule!=null && $x.text.equals(enclosingRule.name) && enclosingRule.getLocalAttributeScope($y.text)!=null}? //{System.out.println("found \$rule.attr");} { StringTemplate st = null; AttributeScope scope = enclosingRule.getLocalAttributeScope($y.text); if ( scope.isPredefinedRuleScope ) { if ( $y.text.equals("st") || $y.text.equals("tree") ) { st = template("ruleSetPropertyRef_"+$y.text); grammar.referenceRuleLabelPredefinedAttribute($x.text); st.setAttribute("scope", $x.text); st.setAttribute("attr", $y.text); st.setAttribute("expr", translateAction($expr.text)); } else { ErrorManager.grammarError(ErrorManager.MSG_WRITE_TO_READONLY_ATTR, grammar, actionToken, $x.text, $y.text); } } else if ( scope.isPredefinedLexerRuleScope ) { // this is a better message to emit than the previous one... ErrorManager.grammarError(ErrorManager.MSG_WRITE_TO_READONLY_ATTR, grammar, actionToken, $x.text, $y.text); } else if ( scope.isParameterScope ) { st = template("parameterSetAttributeRef"); st.setAttribute("attr", scope.getAttribute($y.text)); st.setAttribute("expr", translateAction($expr.text)); } else { // must be return value st = template("returnSetAttributeRef"); st.setAttribute("ruleDescriptor", enclosingRule); st.setAttribute("attr", scope.getAttribute($y.text)); st.setAttribute("expr", translateAction($expr.text)); } } ; ENCLOSING_RULE_SCOPE_ATTR : '$' x=ID '.' y=ID {enclosingRule!=null && $x.text.equals(enclosingRule.name) && enclosingRule.getLocalAttributeScope($y.text)!=null}? //{System.out.println("found \$rule.attr");} { if ( isRuleRefInAlt($x.text) ) { ErrorManager.grammarError(ErrorManager.MSG_RULE_REF_AMBIG_WITH_RULE_IN_ALT, grammar, actionToken, $x.text); } StringTemplate st = null; AttributeScope scope = enclosingRule.getLocalAttributeScope($y.text); if ( scope.isPredefinedRuleScope ) { st = template("rulePropertyRef_"+$y.text); grammar.referenceRuleLabelPredefinedAttribute($x.text); st.setAttribute("scope", $x.text); st.setAttribute("attr", $y.text); } else if ( scope.isPredefinedLexerRuleScope ) { // perhaps not the most precise error message to use, but... ErrorManager.grammarError(ErrorManager.MSG_RULE_HAS_NO_ARGS, grammar, actionToken, $x.text); } else if ( scope.isParameterScope ) { st = template("parameterAttributeRef"); st.setAttribute("attr", scope.getAttribute($y.text)); } else { // must be return value st = template("returnAttributeRef"); st.setAttribute("ruleDescriptor", enclosingRule); st.setAttribute("attr", scope.getAttribute($y.text)); } } ; /** Setting $tokenlabel.attr or $tokenref.attr where attr is predefined property of a token is an error. */ SET_TOKEN_SCOPE_ATTR : '$' x=ID '.' y=ID WS? '=' {enclosingRule!=null && input.LA(1)!='=' && (enclosingRule.getTokenLabel($x.text)!=null|| isTokenRefInAlt($x.text)) && AttributeScope.tokenScope.getAttribute($y.text)!=null}? //{System.out.println("found \$tokenlabel.attr or \$tokenref.attr");} { ErrorManager.grammarError(ErrorManager.MSG_WRITE_TO_READONLY_ATTR, grammar, actionToken, $x.text, $y.text); } ; /** $tokenlabel.attr or $tokenref.attr where attr is predefined property of a token. * If in lexer grammar, only translate for strings and tokens (rule refs) */ TOKEN_SCOPE_ATTR : '$' x=ID '.' y=ID {enclosingRule!=null && (enclosingRule.getTokenLabel($x.text)!=null|| isTokenRefInAlt($x.text)) && AttributeScope.tokenScope.getAttribute($y.text)!=null && (grammar.type!=Grammar.LEXER || getElementLabel($x.text).elementRef.token.getType()==ANTLRParser.TOKEN_REF || getElementLabel($x.text).elementRef.token.getType()==ANTLRParser.STRING_LITERAL)}? // {System.out.println("found \$tokenlabel.attr or \$tokenref.attr");} { String label = $x.text; if ( enclosingRule.getTokenLabel($x.text)==null ) { // \$tokenref.attr gotta get old label or compute new one checkElementRefUniqueness($x.text, true); label = enclosingRule.getElementLabel($x.text, outerAltNum, generator); if ( label==null ) { ErrorManager.grammarError(ErrorManager.MSG_FORWARD_ELEMENT_REF, grammar, actionToken, "\$"+$x.text+"."+$y.text); label = $x.text; } } StringTemplate st = template("tokenLabelPropertyRef_"+$y.text); st.setAttribute("scope", label); st.setAttribute("attr", AttributeScope.tokenScope.getAttribute($y.text)); } ; /** Setting $rulelabel.attr or $ruleref.attr where attr is a predefined property is an error * This must also fail, if we try to access a local attribute's field, like $tree.scope = localObject * That must be handled by LOCAL_ATTR below. ANTLR only concerns itself with the top-level scope * attributes declared in scope {} or parameters, return values and the like. */ SET_RULE_SCOPE_ATTR @init { Grammar.LabelElementPair pair=null; String refdRuleName=null; } : '$' x=ID '.' y=ID WS? '=' {enclosingRule!=null && input.LA(1)!='='}? { pair = enclosingRule.getRuleLabel($x.text); refdRuleName = $x.text; if ( pair!=null ) { refdRuleName = pair.referencedRuleName; } } // supercomplicated because I can't exec the above action. // This asserts that if it's a label or a ref to a rule proceed but only if the attribute // is valid for that rule's scope {(enclosingRule.getRuleLabel($x.text)!=null || isRuleRefInAlt($x.text)) && getRuleLabelAttribute(enclosingRule.getRuleLabel($x.text)!=null?enclosingRule.getRuleLabel($x.text).referencedRuleName:$x.text,$y.text)!=null}? //{System.out.println("found set \$rulelabel.attr or \$ruleref.attr: "+$x.text+"."+$y.text);} { ErrorManager.grammarError(ErrorManager.MSG_WRITE_TO_READONLY_ATTR, grammar, actionToken, $x.text, $y.text); } ; /** $rulelabel.attr or $ruleref.attr where attr is a predefined property*/ RULE_SCOPE_ATTR @init { Grammar.LabelElementPair pair=null; String refdRuleName=null; } : '$' x=ID '.' y=ID {enclosingRule!=null}? { pair = enclosingRule.getRuleLabel($x.text); refdRuleName = $x.text; if ( pair!=null ) { refdRuleName = pair.referencedRuleName; } } // supercomplicated because I can't exec the above action. // This asserts that if it's a label or a ref to a rule proceed but only if the attribute // is valid for that rule's scope {(enclosingRule.getRuleLabel($x.text)!=null || isRuleRefInAlt($x.text)) && getRuleLabelAttribute(enclosingRule.getRuleLabel($x.text)!=null?enclosingRule.getRuleLabel($x.text).referencedRuleName:$x.text,$y.text)!=null}? //{System.out.println("found \$rulelabel.attr or \$ruleref.attr: "+$x.text+"."+$y.text);} { String label = $x.text; if ( pair==null ) { // \$ruleref.attr gotta get old label or compute new one checkElementRefUniqueness($x.text, false); label = enclosingRule.getElementLabel($x.text, outerAltNum, generator); if ( label==null ) { ErrorManager.grammarError(ErrorManager.MSG_FORWARD_ELEMENT_REF, grammar, actionToken, "\$"+$x.text+"."+$y.text); label = $x.text; } } StringTemplate st; Rule refdRule = grammar.getRule(refdRuleName); AttributeScope scope = refdRule.getLocalAttributeScope($y.text); if ( scope.isPredefinedRuleScope ) { st = template("ruleLabelPropertyRef_"+$y.text); grammar.referenceRuleLabelPredefinedAttribute(refdRuleName); st.setAttribute("scope", label); st.setAttribute("attr", $y.text); } else if ( scope.isPredefinedLexerRuleScope ) { st = template("lexerRuleLabelPropertyRef_"+$y.text); grammar.referenceRuleLabelPredefinedAttribute(refdRuleName); st.setAttribute("scope", label); st.setAttribute("attr", $y.text); } else if ( scope.isParameterScope ) { // TODO: error! } else { st = template("ruleLabelRef"); st.setAttribute("referencedRule", refdRule); st.setAttribute("scope", label); st.setAttribute("attr", scope.getAttribute($y.text)); } } ; /** $label either a token label or token/rule list label like label+=expr */ LABEL_REF : '$' ID {enclosingRule!=null && getElementLabel($ID.text)!=null && enclosingRule.getRuleLabel($ID.text)==null}? // {System.out.println("found \$label");} { StringTemplate st; Grammar.LabelElementPair pair = getElementLabel($ID.text); if ( pair.type==Grammar.RULE_LIST_LABEL || pair.type==Grammar.TOKEN_LIST_LABEL || pair.type==Grammar.WILDCARD_TREE_LIST_LABEL ) { st = template("listLabelRef"); } else { st = template("tokenLabelRef"); } st.setAttribute("label", $ID.text); } ; /** $tokenref in a non-lexer grammar */ ISOLATED_TOKEN_REF : '$' ID {grammar.type!=Grammar.LEXER && enclosingRule!=null && isTokenRefInAlt($ID.text)}? //{System.out.println("found \$tokenref");} { String label = enclosingRule.getElementLabel($ID.text, outerAltNum, generator); checkElementRefUniqueness($ID.text, true); if ( label==null ) { ErrorManager.grammarError(ErrorManager.MSG_FORWARD_ELEMENT_REF, grammar, actionToken, $ID.text); } else { StringTemplate st = template("tokenLabelRef"); st.setAttribute("label", label); } } ; /** $lexerruleref from within the lexer */ ISOLATED_LEXER_RULE_REF : '$' ID {grammar.type==Grammar.LEXER && enclosingRule!=null && isRuleRefInAlt($ID.text)}? //{System.out.println("found \$lexerruleref");} { String label = enclosingRule.getElementLabel($ID.text, outerAltNum, generator); checkElementRefUniqueness($ID.text, false); if ( label==null ) { ErrorManager.grammarError(ErrorManager.MSG_FORWARD_ELEMENT_REF, grammar, actionToken, $ID.text); } else { StringTemplate st = template("lexerRuleLabel"); st.setAttribute("label", label); } } ; /** $y return value, parameter, predefined rule property, or token/rule * reference within enclosing rule's outermost alt. * y must be a "local" reference; i.e., it must be referring to * something defined within the enclosing rule. * * r[int i] returns [int j] * : {$i, $j, $start, $stop, $st, $tree} * ; * * TODO: this might get the dynamic scope's elements too.!!!!!!!!! */ SET_LOCAL_ATTR : '$' ID WS? '=' expr=ATTR_VALUE_EXPR ';' {enclosingRule!=null && enclosingRule.getLocalAttributeScope($ID.text)!=null && !enclosingRule.getLocalAttributeScope($ID.text).isPredefinedLexerRuleScope}? //{System.out.println("found set \$localattr");} { StringTemplate st; AttributeScope scope = enclosingRule.getLocalAttributeScope($ID.text); if ( scope.isPredefinedRuleScope ) { if ($ID.text.equals("tree") || $ID.text.equals("st")) { st = template("ruleSetPropertyRef_"+$ID.text); grammar.referenceRuleLabelPredefinedAttribute(enclosingRule.name); st.setAttribute("scope", enclosingRule.name); st.setAttribute("attr", $ID.text); st.setAttribute("expr", translateAction($expr.text)); } else { ErrorManager.grammarError(ErrorManager.MSG_WRITE_TO_READONLY_ATTR, grammar, actionToken, $ID.text, ""); } } else if ( scope.isParameterScope ) { st = template("parameterSetAttributeRef"); st.setAttribute("attr", scope.getAttribute($ID.text)); st.setAttribute("expr", translateAction($expr.text)); } else { st = template("returnSetAttributeRef"); st.setAttribute("ruleDescriptor", enclosingRule); st.setAttribute("attr", scope.getAttribute($ID.text)); st.setAttribute("expr", translateAction($expr.text)); } } ; LOCAL_ATTR : '$' ID {enclosingRule!=null && enclosingRule.getLocalAttributeScope($ID.text)!=null}? //{System.out.println("found \$localattr");} { StringTemplate st; AttributeScope scope = enclosingRule.getLocalAttributeScope($ID.text); if ( scope.isPredefinedRuleScope ) { st = template("rulePropertyRef_"+$ID.text); grammar.referenceRuleLabelPredefinedAttribute(enclosingRule.name); st.setAttribute("scope", enclosingRule.name); st.setAttribute("attr", $ID.text); } else if ( scope.isPredefinedLexerRuleScope ) { st = template("lexerRulePropertyRef_"+$ID.text); st.setAttribute("scope", enclosingRule.name); st.setAttribute("attr", $ID.text); } else if ( scope.isParameterScope ) { st = template("parameterAttributeRef"); st.setAttribute("attr", scope.getAttribute($ID.text)); } else { st = template("returnAttributeRef"); st.setAttribute("ruleDescriptor", enclosingRule); st.setAttribute("attr", scope.getAttribute($ID.text)); } } ; /** $x::y the only way to access the attributes within a dynamic scope * regardless of whether or not you are in the defining rule. * * scope Symbols { List names; } * r * scope {int i;} * scope Symbols; * : {$r::i=3;} s {$Symbols::names;} * ; * s : {$r::i; $Symbols::names;} * ; */ SET_DYNAMIC_SCOPE_ATTR : '$' x=ID '::' y=ID WS? '=' expr=ATTR_VALUE_EXPR ';' {resolveDynamicScope($x.text)!=null && resolveDynamicScope($x.text).getAttribute($y.text)!=null}? //{System.out.println("found set \$scope::attr "+ $x.text + "::" + $y.text + " to " + $expr.text);} { AttributeScope scope = resolveDynamicScope($x.text); if ( scope!=null ) { StringTemplate st = template("scopeSetAttributeRef"); st.setAttribute("scope", $x.text); st.setAttribute("attr", scope.getAttribute($y.text)); st.setAttribute("expr", translateAction($expr.text)); } else { // error: invalid dynamic attribute } } ; DYNAMIC_SCOPE_ATTR : '$' x=ID '::' y=ID {resolveDynamicScope($x.text)!=null && resolveDynamicScope($x.text).getAttribute($y.text)!=null}? //{System.out.println("found \$scope::attr "+ $x.text + "::" + $y.text);} { AttributeScope scope = resolveDynamicScope($x.text); if ( scope!=null ) { StringTemplate st = template("scopeAttributeRef"); st.setAttribute("scope", $x.text); st.setAttribute("attr", scope.getAttribute($y.text)); } else { // error: invalid dynamic attribute } } ; ERROR_SCOPED_XY : '$' x=ID '::' y=ID { chunks.add(getText()); generator.issueInvalidScopeError($x.text,$y.text, enclosingRule,actionToken, outerAltNum); } ; /** To access deeper (than top of stack) scopes, use the notation: * * $x[-1]::y previous (just under top of stack) * $x[-i]::y top of stack - i where the '-' MUST BE PRESENT; * i.e., i cannot simply be negative without the '-' sign! * $x[i]::y absolute index i (0..size-1) * $x[0]::y is the absolute 0 indexed element (bottom of the stack) */ DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR : '$' x=ID '[' '-' expr=SCOPE_INDEX_EXPR ']' '::' y=ID // {System.out.println("found \$scope[-...]::attr");} { StringTemplate st = template("scopeAttributeRef"); st.setAttribute("scope", $x.text); st.setAttribute("attr", resolveDynamicScope($x.text).getAttribute($y.text)); st.setAttribute("negIndex", $expr.text); } ; DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR : '$' x=ID '[' expr=SCOPE_INDEX_EXPR ']' '::' y=ID // {System.out.println("found \$scope[...]::attr");} { StringTemplate st = template("scopeAttributeRef"); st.setAttribute("scope", $x.text); st.setAttribute("attr", resolveDynamicScope($x.text).getAttribute($y.text)); st.setAttribute("index", $expr.text); } ; fragment SCOPE_INDEX_EXPR : (~']')+ ; /** $r y is a rule's dynamic scope or a global shared scope. * Isolated $rulename is not allowed unless it has a dynamic scope *and* * there is no reference to rulename in the enclosing alternative, * which would be ambiguous. See TestAttributes.testAmbiguousRuleRef() */ ISOLATED_DYNAMIC_SCOPE : '$' ID {resolveDynamicScope($ID.text)!=null}? // {System.out.println("found isolated \$scope where scope is a dynamic scope");} { StringTemplate st = template("isolatedDynamicScopeRef"); st.setAttribute("scope", $ID.text); } ; // antlr.g then codegen.g does these first two currently. // don't want to duplicate that code. /** %foo(a={},b={},...) ctor */ TEMPLATE_INSTANCE : '%' ID '(' ( WS? ARG (',' WS? ARG)* WS? )? ')' // {System.out.println("found \%foo(args)");} { String action = getText().substring(1,getText().length()); String ruleName = "<outside-of-rule>"; if ( enclosingRule!=null ) { ruleName = enclosingRule.name; } StringTemplate st = generator.translateTemplateConstructor(ruleName, outerAltNum, actionToken, action); if ( st!=null ) { chunks.add(st); } } ; /** %({name-expr})(a={},...) indirect template ctor reference */ INDIRECT_TEMPLATE_INSTANCE : '%' '(' ACTION ')' '(' ( WS? ARG (',' WS? ARG)* WS? )? ')' // {System.out.println("found \%({...})(args)");} { String action = getText().substring(1,getText().length()); StringTemplate st = generator.translateTemplateConstructor(enclosingRule.name, outerAltNum, actionToken, action); chunks.add(st); } ; fragment ARG : ID '=' ACTION ; /** %{expr}.y = z; template attribute y of StringTemplate-typed expr to z */ SET_EXPR_ATTRIBUTE : '%' a=ACTION '.' ID WS? '=' expr=ATTR_VALUE_EXPR ';' // {System.out.println("found \%{expr}.y = z;");} { StringTemplate st = template("actionSetAttribute"); String action = $a.text; action = action.substring(1,action.length()-1); // stuff inside {...} st.setAttribute("st", translateAction(action)); st.setAttribute("attrName", $ID.text); st.setAttribute("expr", translateAction($expr.text)); } ; /* %x.y = z; set template attribute y of x (always set never get attr) * to z [languages like python without ';' must still use the * ';' which the code generator is free to remove during code gen] */ SET_ATTRIBUTE : '%' x=ID '.' y=ID WS? '=' expr=ATTR_VALUE_EXPR ';' // {System.out.println("found \%x.y = z;");} { StringTemplate st = template("actionSetAttribute"); st.setAttribute("st", $x.text); st.setAttribute("attrName", $y.text); st.setAttribute("expr", translateAction($expr.text)); } ; /** Don't allow an = as first char to prevent $x == 3; kind of stuff. */ fragment ATTR_VALUE_EXPR : ~'=' (~';')* ; /** %{string-expr} anonymous template from string expr */ TEMPLATE_EXPR : '%' a=ACTION // {System.out.println("found \%{expr}");} { StringTemplate st = template("actionStringConstructor"); String action = $a.text; action = action.substring(1,action.length()-1); // stuff inside {...} st.setAttribute("stringExpr", translateAction(action)); } ; fragment ACTION : '{' (options {greedy=false;}:.)* '}' ; ESC : '\\' '$' {chunks.add("\$");} | '\\' '%' {chunks.add("\%");} | '\\' ~('$'|'%') {chunks.add(getText());} ; ERROR_XY : '$' x=ID '.' y=ID { chunks.add(getText()); generator.issueInvalidAttributeError($x.text,$y.text, enclosingRule,actionToken, outerAltNum); } ; ERROR_X : '$' x=ID { chunks.add(getText()); generator.issueInvalidAttributeError($x.text, enclosingRule,actionToken, outerAltNum); } ; UNKNOWN_SYNTAX : '$' { chunks.add(getText()); // shouldn't need an error here. Just accept \$ if it doesn't look like anything } | '%' (ID|'.'|'('|')'|','|'{'|'}'|'"')* { chunks.add(getText()); ErrorManager.grammarError(ErrorManager.MSG_INVALID_TEMPLATE_ACTION, grammar, actionToken, getText()); } ; TEXT: ~('$'|'%'|'\\')+ {chunks.add(getText());} ; fragment ID : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')* ; fragment INT : '0'..'9'+ ; fragment WS : (' '|'\t'|'\n'|'\r')+ ;
G-code
5
DanielMabadeje/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials
java/java2py/antlr-3.1.3/tool/src/main/antlr/org/antlr/grammar/v3/ActionTranslator.g
[ "Apache-2.0" ]
%%{ machine FRAME; include UUID "./uuid-grammar.rl"; action spec_start { ps.omitted = 15; } action redef_uuid { if (atm>0) { atoms[atm] = atoms[atm-1]; } } action spec_uuid_start { n = (int)(ABC[fc]); hlf, dgt = VALUE, 0; if (n < atm) { // parse #op1#op2#op3 without Ragel state explosion fnext *RON_start; frame.position ++ p--; fbreak; } else { // next UUID atm = n; ps.omitted -= 1<<uint(n); } } action spec_uuid_end { atm++; } action atom_start { hlf, dgt = VALUE, 0; atoms = append(atoms, Atom{}) } action atom_end { atm++; } action int_atom_start { atoms[atm].setType(ATOM_INT) atoms[atm].setFrom(p) } action float_atom_start { atoms[atm].setType(ATOM_FLOAT) atoms[atm].setFrom(p) } action string_atom_start { atoms[atm].setType(ATOM_STRING) atoms[atm].setFrom(p) } action scalar_atom_end { atoms[atm].setTill(p) atoms[atm].parseValue(frame.Body) } action uuid_atom_start { if (atm==4) { atoms[atm] = atoms[SPEC_OBJECT]; } else if (atoms[atm-1].Type()==ATOM_UUID) { atoms[atm] = atoms[atm-1]; } } action uuid_atom_end { atoms[atm][1] |= ((uint64)(ATOM_UUID))<<62; } action atoms_start { atm = 4; hlf = VALUE; dgt = 0; } action atoms { } action opterm { frame.term = int(ABC[fc]); } action op_start { hlf = VALUE; if (p>frame.Parser.off && frame.position!=-1) { // one op is done, so stop parsing for now // make sure the parser restarts with the next op p--; fnext *RON_start; fbreak; } else { //op_idx++; if (frame.term!=TERM_RAW) { frame.term = TERM_REDUCED; } } } action op_end { frame.position ++ } action spec_end { } action frame_end { fnext *RON_FULL_STOP; fbreak; } # one of op spec UUIDs: type, object, event id or a reference REDEF = "`" @redef_uuid; QUANT = [*#@:] @spec_uuid_start ; SPEC_UUID = QUANT space* REDEF? (UUID space*)? %spec_uuid_end ; # 64-bit signed integer INT_ATOM = ([\-+]? digit+ ) >int_atom_start %scalar_atom_end; # 64-bit (double) float FLOAT_ATOM = ( [\-+]? digit+ ("." digit+ ([eE] [\-+]? digit+)? | [eE] [\-+]? digit+ ) ) >float_atom_start %scalar_atom_end; UUID_ATOM = UUID >uuid_atom_start %uuid_atom_end; # JSON-escaped string UNIESC = "\\u" [0-9a-fA-F]{4}; ESC = "\\" [^\n\r]; CHAR = [^"'\n\r\\]; STRING_ATOM = (UNIESC|ESC|CHAR)* %scalar_atom_end >string_atom_start; # an atom (int, float, string or UUID) ATOM = ( "=" space* INT_ATOM | "^" space* FLOAT_ATOM | ['] STRING_ATOM ['] | ">" space* UUID_ATOM ) >atom_start %atom_end space*; # op value - an atom, an atom tuple, or empty ATOMS = ATOM+ %atoms >atoms_start; # an optional op terminator (raw, reduced, header, query) OPTERM = [,;!?] @opterm space*; # a RON op "specifier" (four UUIDs for its type, object, event, and ref) SPEC = SPEC_UUID+ >spec_start %spec_end ; # a RON op # op types: (0) raw op (1) reduced op (2) frame header (3) query header OP = space* ( SPEC ATOMS? OPTERM? | ATOMS OPTERM? | OPTERM) $2 %1 >op_start %op_end; # optional frame terminator; mandatory in the streaming mode DOT = "." @frame_end; # RON frame, including multiframes (those have more headers inside) FRAME = OP* DOT? ; }%%
Ragel in Ruby Host
4
gritzko/ron
op-grammar.rl
[ "Apache-2.0" ]
module.exports = require('./dist/shared/lib/dynamic')
JavaScript
0
blomqma/next.js
packages/next/dynamic.js
[ "MIT" ]
/** @type {import("../../../../").LoaderDefinition<{}, { shouldReplace: boolean }>} */ module.exports = function (source) { if (this.shouldReplace) { this._module.buildInfo._isReplaced = true; return "module.exports = { foo: { foo: 'bar' }, doThings: (v) => v}"; } return source; };
JavaScript
3
fourstash/webpack
test/configCases/rebuild/finishModules/loader.js
[ "MIT" ]
( Generated from test_oper_ternary_in.muv by the MUV compiler. ) ( https://github.com/revarbat/pymuv ) : _main[ _arg -- ret ] 1 if "T" else "F" then ; : __start "me" match me ! me @ location loc ! trig trigger ! _main ;
MUF
3
revarbat/pymuv
tests/test_oper_ternary_cmp.muf
[ "MIT" ]
#include "mop.h" MODULE = Class::MOP::Attribute PACKAGE = Class::MOP::Attribute PROTOTYPES: DISABLE BOOT: INSTALL_SIMPLE_READER(Attribute, associated_class); INSTALL_SIMPLE_READER(Attribute, associated_methods);
XS
3
skington/Moose
xs/Attribute.xs
[ "Artistic-1.0" ]
0 reg32_t "dword" 1 code_t "proc*" 2 num32_t "int" 3 uint32_t "size_t" 4 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*" 5 ptr(num8_t) "char*" 6 ptr(TOP) "void*" 3 uint32_t "unsigned int" 7 num8_t "char" 8 ptr(array(reg8_t,16)) "unknown_128*" 9 ptr(array(reg8_t,56)) "unknown_448*" 10 ptr(array(reg8_t,187)) "unknown_1496*" 11 ptr(array(reg8_t,58)) "unknown_464*" 12 ptr(ptr(TOP)) "void**" 13 ptr(ptr(num8_t)) "char**" 14 union(ptr(num8_t),ptr(struct(0:reg16_t,2:num8_t))) "Union_0" 15 ptr(struct(0:reg16_t,2:num8_t)) "StructFrag_0*" 5 ptr(num8_t) "char[]" 16 ptr(reg32_t) "dword*" 17 ptr(struct(0:num32_t,4:ptr(struct(0:ptr(num8_t),8:ptr(num8_t))),4294967292:reg32_t)) "Struct_10*" 18 ptr(struct(0:ptr(num8_t),8:ptr(num8_t))) "Struct_11*" 19 ptr(struct(0:ptr(num8_t),4:num32_t,8:ptr(num32_t),12:num32_t)) "option*" 20 ptr(struct(0:reg32_t,40:ptr(num8_t),44:ptr(num8_t))) "Struct_7*" 21 ptr(struct(40:ptr(num8_t),44:ptr(num8_t))) "Struct_8*" 22 ptr(uint32_t) "size_t*" 23 array(reg8_t,3) "unknown_24" 24 ptr(struct(0:reg32_t,4:ptr(TOP))) "Struct_0*" 25 reg64_t "qword" 26 array(reg8_t,32) "unknown_256" 16 ptr(reg32_t) "dword[]" 27 int32_t "signed int" 22 ptr(uint32_t) "unsigned int*" 28 union(ptr(reg32_t),ptr(struct(0:reg32_t,40:ptr(num8_t),44:ptr(num8_t)))) "Union_4" 29 array(reg8_t,72) "unknown_576" 30 array(reg8_t,120) "unknown_960" 31 ptr(struct(0:array(reg8_t,168),168:reg32_t)) "StructFrag_1*" 32 union(ptr(reg32_t),ptr(struct(0:reg32_t,64:reg32_t,68:reg32_t,72:reg32_t,76:reg32_t,80:uint32_t))) "Union_2" 33 union(ptr(reg32_t),ptr(num32_t)) "Union_1" 34 ptr(num32_t) "int[]" 34 ptr(num32_t) "int*" 35 ptr(ptr(uint16_t)) "unsigned short**" 36 ptr(reg16_t) "word*" 37 ptr(struct(0:array(reg8_t,16),16:uint32_t)) "StructFrag_10*" 38 ptr(code_t) "proc**" 39 ptr(uint16_t) "unsigned short*" 40 ptr(struct(0:array(reg8_t,247362),247362:reg32_t)) "StructFrag_4*" 41 ptr(struct(0:array(reg8_t,536870908),4294967292:reg32_t)) "StructFrag_5*" 17 ptr(struct(0:num32_t,4:ptr(struct(0:ptr(num8_t),8:ptr(num8_t))),4294967292:reg32_t)) "Struct_12*" 42 ptr(struct(0:array(reg8_t,33564),33564:reg32_t)) "StructFrag_6*" 43 ptr(struct(0:array(reg8_t,584),584:reg32_t)) "StructFrag_7*" 22 ptr(uint32_t) "unsigned int[]" 44 array(reg8_t,4096) "unknown_32768" 45 array(reg8_t,135168) "unknown_1081344" 46 array(reg8_t,30) "unknown_240" 47 array(reg8_t,5) "unknown_40" 48 array(reg8_t,25) "unknown_200" 49 array(reg8_t,16) "unknown_128" 50 array(reg8_t,41) "unknown_328" 51 array(reg8_t,7) "unknown_56" 52 array(reg8_t,51) "unknown_408" 53 array(reg8_t,13) "unknown_104" 54 array(reg8_t,27) "unknown_216" 55 array(reg8_t,54) "unknown_432" 56 reg16_t "word" 57 array(reg8_t,50) "unknown_400" 58 array(reg8_t,142) "unknown_1136" 59 array(reg8_t,53) "unknown_424" 60 array(reg8_t,55) "unknown_440" 61 array(reg8_t,23) "unknown_184" 62 array(reg8_t,323) "unknown_2584" 63 array(reg8_t,11) "unknown_88" 64 array(reg8_t,24) "unknown_192" 65 array(reg8_t,44) "unknown_352" 66 array(reg8_t,42) "unknown_336" 67 array(reg8_t,14) "unknown_112" 68 array(reg8_t,31) "unknown_248" 69 array(reg8_t,28) "unknown_224" 70 array(reg8_t,21) "unknown_168" 71 array(reg8_t,19) "unknown_152" 72 array(reg8_t,52) "unknown_416" 73 array(reg8_t,6) "unknown_48" 74 array(reg8_t,48) "unknown_384" 75 array(reg8_t,20) "unknown_160" 76 array(reg8_t,63) "unknown_504" 77 array(reg8_t,90) "unknown_720" 78 array(reg8_t,61) "unknown_488" 79 array(reg8_t,58) "unknown_464" 80 array(reg8_t,12) "unknown_96" 81 array(reg8_t,15) "unknown_120" 82 array(reg8_t,56) "unknown_448" 83 array(reg8_t,64) "unknown_512" 84 array(reg8_t,92) "unknown_736" 85 array(reg8_t,62) "unknown_496" 86 array(reg8_t,201) "unknown_1608" 87 array(reg8_t,76) "unknown_608" 88 array(reg8_t,34) "unknown_272" 89 array(reg8_t,115) "unknown_920" 90 array(reg8_t,89) "unknown_712" 91 array(reg8_t,68) "unknown_544" 92 array(reg8_t,122) "unknown_976" 93 array(reg8_t,150) "unknown_1200" 94 array(reg8_t,69) "unknown_552" 95 array(reg8_t,46) "unknown_368" 96 array(reg8_t,84) "unknown_672" 97 array(reg8_t,74) "unknown_592" 98 array(reg8_t,71) "unknown_568" 99 array(reg8_t,17) "unknown_136" 100 array(reg8_t,45) "unknown_360" 101 array(reg8_t,22) "unknown_176" 102 array(reg8_t,10) "unknown_80" 103 array(reg8_t,187) "unknown_1496" 104 array(reg8_t,9) "unknown_72" 105 array(reg8_t,26) "unknown_208" 106 array(reg8_t,47) "unknown_376" 107 array(reg8_t,43) "unknown_344" 108 array(reg8_t,40) "unknown_320" 109 array(reg8_t,88) "unknown_704" 110 array(reg8_t,35) "unknown_280" 111 array(reg8_t,86) "unknown_688" 112 array(reg8_t,79) "unknown_632" 113 array(reg8_t,185) "unknown_1480" 114 array(reg8_t,503) "unknown_4024" 115 array(reg8_t,1722) "unknown_13776" 116 array(reg8_t,39) "unknown_312" 117 array(reg8_t,18) "unknown_144" 118 array(reg8_t,206) "unknown_1648" 119 array(reg8_t,37) "unknown_296" 120 array(reg8_t,117) "unknown_936" 121 array(reg8_t,315) "unknown_2520" 122 array(reg8_t,634) "unknown_5072" 123 array(reg8_t,83108) "unknown_664864" 124 array(reg8_t,29) "unknown_232" 125 array(reg8_t,65) "unknown_520" 126 array(reg8_t,49) "unknown_392" 127 array(reg8_t,139) "unknown_1112" 128 array(reg8_t,33) "unknown_264" 129 array(reg8_t,95) "unknown_760" 130 array(reg8_t,91) "unknown_728" 131 array(reg8_t,36) "unknown_288" 132 array(reg8_t,126) "unknown_1008" 133 array(reg8_t,59) "unknown_472" 134 array(reg8_t,70) "unknown_560" 135 array(reg8_t,190) "unknown_1520" 136 array(reg8_t,173) "unknown_1384" 137 array(reg8_t,149) "unknown_1192" 138 array(reg8_t,146) "unknown_1168" 139 array(reg8_t,94) "unknown_752" 140 array(reg8_t,140) "unknown_1120" 141 array(reg8_t,57) "unknown_456" 142 array(reg8_t,97) "unknown_776" 143 array(reg8_t,38) "unknown_304" 144 array(reg8_t,129) "unknown_1032" 145 array(reg8_t,102) "unknown_816" 146 array(reg8_t,98) "unknown_784" 147 array(reg8_t,113) "unknown_904" 148 array(reg8_t,60) "unknown_480" 149 array(reg8_t,100) "unknown_800" 150 array(reg8_t,77) "unknown_616" 151 array(reg8_t,111) "unknown_888" 152 array(num8_t,23) "char[23]" 153 array(num8_t,39) "char[39]" 154 array(num8_t,14) "char[14]" 155 array(num8_t,4) "char[4]" 156 array(num8_t,69) "char[69]" 157 array(num8_t,65) "char[65]" 158 struct(0:ptr(num8_t),4:num32_t,8:ptr(num32_t),12:num32_t) "option" 159 array(reg8_t,160) "unknown_1280" 160 array(num8_t,126) "char[126]" 161 array(num8_t,7) "char[7]" 162 array(num8_t,44) "char[44]" 163 array(num8_t,67) "char[67]" 164 array(num8_t,52) "char[52]" 165 array(num8_t,365) "char[365]" 166 array(num8_t,45) "char[45]" 167 array(num8_t,54) "char[54]" 168 array(num8_t,257) "char[257]" 169 array(num8_t,11) "char[11]" 170 array(num8_t,2) "char[2]" 171 array(num8_t,3) "char[3]" 172 array(num8_t,15) "char[15]" 173 array(num8_t,28) "char[28]" 174 array(num8_t,48) "char[48]" 175 array(num8_t,25) "char[25]" 176 array(num8_t,8) "char[8]" 177 array(num8_t,50) "char[50]" 178 array(num8_t,43) "char[43]" 179 array(num8_t,47) "char[47]" 180 array(num8_t,46) "char[46]" 181 array(num8_t,90) "char[90]" 182 array(num8_t,10) "char[10]" 183 array(num8_t,13) "char[13]" 184 array(num8_t,5) "char[5]" 185 array(num8_t,35) "char[35]" 186 array(num8_t,57) "char[57]" 187 array(num8_t,73) "char[73]" 188 array(num8_t,64) "char[64]" 189 array(num8_t,62) "char[62]" 190 array(num8_t,63) "char[63]" 191 array(num8_t,12) "char[12]" 192 array(reg8_t,640) "unknown_5120" 193 array(num8_t,56) "char[56]" 194 array(num8_t,6) "char[6]" 195 array(reg32_t,127) "dword[127]" 196 array(reg32_t,30) "dword[30]" 197 array(reg32_t,34) "dword[34]" 198 array(num8_t,203) "char[203]" 199 array(num8_t,16) "char[16]" 200 array(num8_t,32) "char[32]" 201 array(num8_t,36) "char[36]" 202 array(num8_t,40) "char[40]" 203 array(num8_t,60) "char[60]" 204 array(num8_t,21) "char[21]" 205 array(num8_t,22) "char[22]" 206 array(num8_t,20) "char[20]" 207 array(num8_t,17) "char[17]" 208 array(num8_t,81) "char[81]" 209 array(reg8_t,964) "unknown_7712" 210 array(reg8_t,4080) "unknown_32640" 211 array(reg8_t,5288) "unknown_42304" 1 code_t "(void -?-> dword)*" 212 array(reg8_t,232) "unknown_1856" 213 array(reg8_t,256) "unknown_2048"
BlitzBasic
1
matt-noonan/retypd-data
data/sha384sum.decls
[ "MIT" ]
<!--- <!--- Used for the default query ---> <cfset variables.defaultQueryList = "title,description,link,date,enclosure,categories"> --->
ColdFusion
1
fourplusone/SubEthaEdit
Documentation/ModeDevelopment/Reference Files/CFML/RecursiveComments.cfm
[ "MIT" ]
@keyframes svelte-xyz-why{0%{color:red}100%{color:blue}}.animated.svelte-xyz{animation:svelte-xyz-why 2s}.also-animated.svelte-xyz{animation:not-defined-here 2s}
CSS
2
Theo-Steiner/svelte
test/css/samples/keyframes/expected.css
[ "MIT" ]
"""Support for Fibaro locks.""" from __future__ import annotations from typing import Any from homeassistant.components.lock import ENTITY_ID_FORMAT, LockEntity from homeassistant.config_entries import ConfigEntry from homeassistant.const import Platform from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback from . import FIBARO_DEVICES, FibaroDevice from .const import DOMAIN async def async_setup_entry( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback, ) -> None: """Set up the Fibaro locks.""" async_add_entities( [ FibaroLock(device) for device in hass.data[DOMAIN][entry.entry_id][FIBARO_DEVICES][ Platform.LOCK ] ], True, ) class FibaroLock(FibaroDevice, LockEntity): """Representation of a Fibaro Lock.""" def __init__(self, fibaro_device): """Initialize the Fibaro device.""" self._state = False super().__init__(fibaro_device) self.entity_id = ENTITY_ID_FORMAT.format(self.ha_id) def lock(self, **kwargs: Any) -> None: """Lock the device.""" self.action("secure") self._state = True def unlock(self, **kwargs: Any) -> None: """Unlock the device.""" self.action("unsecure") self._state = False @property def is_locked(self) -> bool: """Return true if device is locked.""" return self._state def update(self): """Update device state.""" self._state = self.current_binary_state
Python
4
mcx/core
homeassistant/components/fibaro/lock.py
[ "Apache-2.0" ]
--TEST-- Testing null byte injection in imagegd2 --EXTENSIONS-- gd --FILE-- <?php $image = imagecreate(1,1);// 1px image try { imagegd($image, "./foo\0bar"); } catch (ValueError $e) { echo $e->getMessage(), "\n"; } ?> --EXPECT-- imagegd(): Argument #2 ($file) must not contain any null bytes
PHP
4
NathanFreeman/php-src
ext/gd/tests/imagegd2_nullbyte_injection.phpt
[ "PHP-3.01" ]
' Medium Frequency R2R Sine Wave Generator 1.25MHz - v0.1 using PASM ' (c) Tubular Controls June 2011. MIT license, see end of DAT section ' ' DESCRIPTION: ' This object generates a Medium Frequency Sine Wave using a "DDS precalculation" technique. ' The cosine wave has N=16 steps, each step takes 4CLK for a max sine output of 1.25MHz@80MHz (1.56MHz@100MHz CLK) ' This technique can easily be adapted for other values of N => 3, including odd values. ' N=8 should still give a reasonably good sine wave at up to 3MHz (using 100MHz clock) ' The secret is to offset the steps by half a step in the time domain, ' eg for N=16, don't use 0,22.5,45 degrees but 11.25, 33.75, 56.25 degrees etc ' such that two successive samples near the peak have the same output value. ' Then instead of outputting the second identical sample, JMP to the start of the loop and repeat. ' The JMP and Output (MOV OUTA, SampleValue) both use 4 CLKs. ' CIRCUIT: ' Bourns 4614X-R2R-103 - 10k/20k, 14 pin, 12 resistor network on P0...P11. ' P0 is LSB, P11 is MSB. Dot is output end, other end to Vss. ' Note: Suspect this would be more robust (better sine waves) with a network with lower R than 10k tested here. CON _clkmode = xtal1 + pll16x 'use crystal x 16 _xinfreq = 5_000_000 'external xtal is 5 MHz PUB Main cognew(@cogstart, 0) 'start a PASM cog DAT cogstart MOV DIRA, #511 'make lower 9 bits an output (P0..8) MOVD DIRA, #7 'and next 3 bits also an output (12b total for Bourns 4612X-R2R-103) loop MOV OUTA, sample1 'output first value of cosine on pins P0..11 MOV OUTA, sample2 MOV OUTA, sample3 MOV OUTA, sample4 MOV OUTA, sample5 MOV OUTA, sample6 MOV OUTA, sample7 MOV OUTA, sample8 MOV OUTA, sample9 MOV OUTA, sample10 MOV OUTA, sample11 MOV OUTA, sample12 MOV OUTA, sample13 MOV OUTA, sample14 MOV OUTA, sample15 '... output 15th value of cosine JMP #loop 'during the jump hold same value (effectively a sample16=sample15=4057 'Total loop uses 64 clocks (1.25 MHz sine @ 80 MHz) '**** Precalculated sine wave data for 12 bit R2R ladder, eg Bourns 4614X-R2R-103 sample1 LONG 3751 '=2048+2048*cos(33.75 degrees) sample2 LONG 3186 '=2048+2048*cos(56.25 degrees) sample3 LONG 2448 '=2048+2048*cos(78.75 ... every 360/16=22.5 degrees apart sample4 LONG 1648 sample5 LONG 910 sample6 LONG 345 sample7 LONG 39 'samples 7 and 8 (at trough of cosine) are identical if N even sample8 LONG 39 sample9 LONG 345 sample10 LONG 910 sample11 LONG 1648 sample12 LONG 2448 sample13 LONG 3186 sample14 LONG 3751 sample15 LONG 4057 '=2048+2048*cos(348.75 degrees) ' phantom s16 4057 is held while jumping. S15(@348.75degrees) and S16(@11.25degrees) ' are identical always, since they are equidistant from the peak of cosine at 0 degrees ' { /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // TERMS OF USE: MIT License /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // 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. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }
Propeller Spin
4
deets/propeller
libraries/community/p1/All/Medium Frequency R2R Sine Wave Generator 1.25 Mhz/Medium_Frequency_R2R_Sine_Wave_Generator_1.25_Mhz_v01.spin
[ "MIT" ]
#include "script_component.hpp" /* Name: TFAR_fnc_copyRadioSettingMenu Author: NKey Returns a sub menu for radio settings copying. Arguments: None Return Value: Flexi-menu <ARRAY> Example: call TFAR_fnc_copyRadioSettingMenu; Public: No */ private _menu = []; private _menuDef = ["main", localize LSTRING(select_action_copy_settings_from), "buttonList", "", false]; private _positions = []; { if (((_x call TFAR_fnc_getSwRadioCode) == (TF_sw_dialog_radio call TFAR_fnc_getSwRadioCode)) and {TF_sw_dialog_radio != _x}) then { private _command = format["['%1',TF_sw_dialog_radio] call TFAR_fnc_copySettings;", _x]; _position = [ ([_x, "displayName", ""] call DFUNC(getWeaponConfigProperty)), _command, ([_x, "picture", ""] call DFUNC(getWeaponConfigProperty)), "", "", -1, true, true ]; _positions pushBack _position; }; } forEach (TFAR_currentUnit call TFAR_fnc_radiosList); _menu = [ _menuDef, _positions ]; _menu
SQF
4
MrDj200/task-force-arma-3-radio
addons/core/functions/flexiUI/fnc_copyRadioSettingMenu.sqf
[ "RSA-MD" ]
import { withRouter } from "next/router"; class AddonsPage extends React.Component { render() { const { router } = this.props return ( <Page> <Header user={user} pathname={router.pathname} onLogout={() => onUser(null)} onLogoRightClick={() => Router.push('/logos')} /> <SubMenu subscription={subscription} teamsAndUser={teamsAndUser} teams={teams} user={user} url={router} /> </Page> ); } } export default withRouter(withAppContainer(withAuthRequired(withError(AddonsPage))));
JavaScript
4
blomqma/next.js
packages/next-codemod/transforms/__testfixtures__/url-to-withrouter/destructuring-this-props.output.js
[ "MIT" ]
struct S; impl S { fn get<K, V: Default>(_: K) -> Option<V> { Default::default() } } enum Val { Foo, Bar, } impl Default for Val { fn default() -> Self { Val::Foo } } fn main() { match S::get(1) { Some(Val::Foo) => {} _ => {} } match S::get(2) { Some(Val::Foo) => 3; //~ ERROR `match` arm body without braces _ => 4, } match S::get(5) { Some(Val::Foo) => 7; //~ ERROR `match` arm body without braces 8; _ => 9, } match S::get(10) { Some(Val::Foo) => 11; //~ ERROR `match` arm body without braces 12; _ => (), } match S::get(13) { None => {} Some(Val::Foo) => 14; //~ ERROR `match` arm body without braces 15; } match S::get(16) { Some(Val::Foo) => 17 _ => 18, //~ ERROR expected one of } match S::get(19) { Some(Val::Foo) => 20; //~ ERROR `match` arm body without braces 21 _ => 22, } match S::get(23) { Some(Val::Foo) => 24; //~ ERROR `match` arm body without braces 25 _ => (), } match S::get(26) { None => {} Some(Val::Foo) => 27; //~ ERROR `match` arm body without braces 28 } match S::get(29) { Some(Val::Foo) => 30; //~ ERROR expected one of 31, _ => 32, } match S::get(33) { Some(Val::Foo) => 34; //~ ERROR expected one of 35, _ => (), } match S::get(36) { None => {} Some(Val::Foo) => 37; //~ ERROR expected one of 38, } }
Rust
3
mbc-git/rust
src/test/ui/parser/match-arm-without-braces.rs
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
Red/System [ Title: "Red/System #define test script" Author: "Nenad Rakocevic & Peter W A Wood" File: %define-test.reds Version: "0.1.0" Tabs: 4 Rights: "Copyright (C) 2011-2015 Red Foundation. All rights reserved." License: "BSD-3 - https://github.com/red/red/blob/origin/BSD-3-License.txt" ] #include %../../../../quick-test/quick-test.reds ~~~start-file~~~ "define" ===start-group=== "reported issues" --test-- "issue #504" #define I504-MAX-SIZE 2 i504-arr: as int-ptr! allocate I504-MAX-SIZE * size? integer! i504-arr/1: 1 i504-arr/2: 2 --assert 2 = i504-arr/I504-MAX-SIZE ===end-group=== ~~~end-file~~~
Red
3
0xflotus/red
system/tests/source/compiler/define-test.reds
[ "BSL-1.0", "BSD-3-Clause" ]
functor import FD Search export Return define Data = [ belgium # [france netherlands germany luxemburg] germany # [austria france luxemburg netherlands] switzerland # [italy france germany austria] austria # [italy switzerland germany] france # [spain luxemburg italy] spain # [portugal] ] Once = fun {$ L A} case L of H|T then {Once T if {Member H A} then A else H|A end} else A end end MapColoring = {fun {$ Data} Countries = {FoldR Data fun {$ C#Cs A} {Append Cs C|A} end nil} in proc {$ Color} NbColors = {FD.decl} in % Color: Countries --> 1#NbColors thread {FD.record color {Once Countries nil} 1#NbColors Color} end {ForAll Data proc {$ A#Bs} {ForAll Bs proc {$ B} thread Color.A \=: Color.B end end} end} {FD.distribute naive [NbColors]} {FD.distribute ff Color} end end Data} MapColoringSol = [color( austria:1 belgium:3 france:1 germany:2 italy:2 luxemburg:4 netherlands:1 portugal:1 spain:2 switzerland:3)] Return= fd([mapcoloring([ one(equal(fun {$} {Search.base.one MapColoring} end MapColoringSol) keys: [fd]) one_entailed(entailed(proc {$} {Search.base.one MapColoring _} end) keys: [fd entailed]) ]) ]) end
Oz
4
Ahzed11/mozart2
platform-test/fd/mapcoloring.oz
[ "BSD-2-Clause" ]
[{:type :warning, :file "/win32nativeext/src/main.cpp", :line 30, :column 9, :message "unused variable 'a' [-Wunused-variable]\n int a;\n ^"} {:type :warning, :file "/win32nativeext/src/main.cpp", :line 46, :column 9, :message "unused variable 'b' [-Wunused-variable]\n int b = 100;\n ^"} {:type :warning, :file "/win32nativeext/ext.manifest", :message "clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]"} {:type :warning, :file "/ext2/src/main.cpp", :line 16, :column 9, :message "unused variable 'a' [-Wunused-variable]\n int a;\n ^"} {:type :error, :file "/win32nativeext/ext.manifest", :message "/usr/local/bin/lld-link: error: could not open plopp.lib: No such file or directory"} {:type :error, :file "/win32nativeext/ext.manifest", :message "clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)"}]
edn
2
cmarincia/defold
editor/test/resources/native_extension_error_parsing/missingSymbols_parsed_2.edn
[ "ECL-2.0", "Apache-2.0" ]
#include "textures.inc" camera { location <2.3, 5, -4> look_at <2, 2, 1> } // Light source on the left side of the scene light_source { <-6, 10, 2> color rgb <1, 1, 1> } // Tiled floor #declare white_floor = plane { y, 0 pigment { rgb <1.0, 1.0, 1.0> } finish { specular 0.2 roughness 0.1 reflection 0.2 } } // Lattice dimensions #declare dim = 5; #declare node_radius = 0.15; #declare edge_radius = 0.05; // Nodes #declare nodes = union { #declare x_i = 0; #while (x_i < dim) #declare y_i = 0; #while (y_i < dim) #declare z_i = 0; #while (z_i < dim) sphere { <x_i, y_i, z_i>, node_radius } #declare z_i = z_i + 1; #end #declare y_i = y_i + 1; #end #declare x_i = x_i + 1; #end } // Horizontal edges along x axis #declare x_edges = union { #declare x_i = 0; #while (x_i < dim - 1) #declare y_i = 0; #while (y_i < dim) #declare z_i = 0; #while (z_i < dim) cylinder { <x_i, y_i, z_i>, <x_i + 1, y_i, z_i>, edge_radius } #declare z_i = z_i + 1; #end #declare y_i = y_i + 1; #end #declare x_i = x_i + 1; #end } // Vertical edges along y axis #declare y_edges = union { #declare x_i = 0; #while (x_i < dim) #declare y_i = 0; #while (y_i < dim - 1) #declare z_i = 0; #while (z_i < dim) cylinder { <x_i, y_i, z_i>, <x_i, y_i + 1, z_i>, edge_radius } #declare z_i = z_i + 1; #end #declare y_i = y_i + 1; #end #declare x_i = x_i + 1; #end } // Horizontal edges along z axis #declare z_edges = union { #declare x_i = 0; #while (x_i < dim) #declare y_i = 0; #while (y_i < dim) #declare z_i = 0; #while (z_i < dim - 1) cylinder { <x_i, y_i, z_i>, <x_i, y_i, z_i + 1>, edge_radius } #declare z_i = z_i + 1; #end #declare y_i = y_i + 1; #end #declare x_i = x_i + 1; #end } // Floor object { white_floor } // Lattice merge { object { nodes } object { x_edges } object { y_edges } object { z_edges } pigment { color rgbf <1, 1, 1, 0.9> } finish { ambient 0.6 reflection 0.1 phong 0.9 } interior { refraction 1.0 ior 1.5 } translate <0, node_radius / 2, 0> }
POV-Ray SDL
4
spcask/pov-ray-tracing
src/scene21.pov
[ "MIT" ]
LiveScript = require './index' # `.run`s LiveScript code and calls back, passing error if any. LiveScript.stab = (code, callback, filename) !-> try LiveScript.run code, {filename, map: 'embedded'} catch callback? e # `.stab`s a remote script via `XMLHttpRequest`. LiveScript.load = (url, callback) -> xhr = new XMLHttpRequest xhr.open 'GET', url, true xhr.override-mime-type 'text/plain' if 'overrideMimeType' of xhr xhr.onreadystatechange = !-> if xhr.ready-state is 4 if xhr.status in [200 0] LiveScript.stab xhr.response-text, callback, url else callback? Error "#url: #{xhr.status} #{xhr.status-text}" xhr.send null xhr # Execute `<script>`s with _livescript_ type. LiveScript.go = !-> type = //^ (?: text/ | application/ )? ls $//i sink = !(error) -> error and set-timeout -> throw error for script in document.get-elements-by-tag-name 'script' when type.test script.type if script.src LiveScript.load that, sink else LiveScript.stab script.inner-HTML, sink, script.id module.exports = LiveScript
LiveScript
4
apaleslimghost/LiveScript
src/browser.ls
[ "MIT" ]
const fs = require('fs'); const process = require('process'); const assert = require('assert'); const buffer = fs.readFileSync(process.argv[2]); let m = new WebAssembly.Module(buffer); let imports = WebAssembly.Module.imports(m); console.log('imports', imports); assert.strictEqual(imports.length, 2); assert.strictEqual(imports[0].kind, 'function'); assert.strictEqual(imports[1].kind, 'function'); let modules = [imports[0].module, imports[1].module]; modules.sort(); assert.strictEqual(modules[0], './dep'); assert.strictEqual(modules[1], './me');
JavaScript
3
Eric-Arellano/rust
src/test/run-make/wasm-import-module/foo.js
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
--TEST-- Bug #81249: Intermittent property assignment failure with JIT enabled --EXTENSIONS-- opcache --INI-- opcache.enable=1 opcache.enable_cli=1 opcache.jit_buffer_size=1M opcache.jit=tracing --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip: 64-bit only"); ?> --FILE-- <?php declare(strict_types=1); final class EucJpDecoder { private const JIS0212_INDEX = [108 => 728]; private const JIS0208_INDEX = []; private const CONTINUE = -1; private const FINISHED = -2; private const ERROR = -3; /** * @var int */ private $lead; /** * @var bool */ private $isJis0212; public function __construct() { $this->lead = 0x00; $this->isJis0212 = false; } public function handle(array &$ioQueue, string $byte): int { if ($byte === '') { if ($this->lead !== 0x00) { $this->lead = 0x00; return self::ERROR; } return self::FINISHED; } $byte = ord($byte); if ($this->lead === 0x8E && ($byte >= 0xA1 && $byte <= 0xDF)) { $this->lead = 0x00; return 0xFF61 - 0xA1 + $byte; } if ($this->lead === 0x8F && ($byte >= 0xA1 && $byte <= 0xFE)) { $this->isJis0212 = true; $this->lead = $byte; return self::CONTINUE; } if ($this->lead !== 0x00) { $lead = $this->lead; $this->lead = 0x00; $codePoint = null; if (($lead >= 0xA1 && $lead <= 0xFE) && ($byte >= 0xA1 && $byte <= 0xFE)) { $index = self::JIS0208_INDEX; if ($this->isJis0212) { $index = self::JIS0212_INDEX; } $codePoint = $index[($lead - 0xA1) * 94 + $byte - 0xA1] ?? null; } $this->isJis0212 = false; if ($codePoint !== null) { return $codePoint; } if ($byte <= 0x7F) { array_unshift($ioQueue, chr($byte)); } return self::ERROR; } if ($byte <= 0x7F) { return $byte; } if ($byte === 0x8E || $byte === 0x8F || ($byte >= 0xA1 && $byte <= 0xFE)) { $this->lead = $byte; return self::CONTINUE; } return self::ERROR; } } for ($i = 0; $i < 2000; ++$i) { $decoder = new EucJpDecoder(); $bytes = ["\x8F", "\xA2", "\xAF", '']; $out = null; foreach ($bytes as $byte) { $result = $decoder->handle($bytes, $byte); if ($result >= 0) { $out = $result; } } // $bytes array should be decoded to U+2D8, decimal 728 assert($out === 728); } ?> OK --EXPECT-- OK
PHP
4
NathanFreeman/php-src
ext/opcache/tests/jit/bug81249.phpt
[ "PHP-3.01" ]
package jadx.tests.integration.invoke; import org.junit.jupiter.api.Test; import jadx.tests.api.IntegrationTest; import static jadx.tests.api.utils.assertj.JadxAssertions.assertThat; public class TestVarArg2 extends IntegrationTest { @SuppressWarnings("ConstantConditions") public static class TestCls { protected static boolean b1; protected static final boolean IS_VALID = b1 && isValid("test"); private static boolean isValid(String... string) { return false; } } @Test public void test() { assertThat(getClassNode(TestCls.class)) .code() .containsOne("isValid(\"test\")"); // TODO: .containsOne("b1 && isValid(\"test\")"); } }
Java
4
Dev-kishan1999/jadx
jadx-core/src/test/java/jadx/tests/integration/invoke/TestVarArg2.java
[ "Apache-2.0" ]
# configuration file for util/mkerr.pl # # use like this: # # perl ../../../util/mkerr.pl -conf hw_zencod.ec \ # -nostatic -staticloader -write *.c L ZENCOD hw_zencod_err.h hw_zencod_err.c
eC
2
jiangzhu1212/oooii
Ouroboros/External/OpenSSL/openssl-1.0.0e/demos/engines/zencod/hw_zencod.ec
[ "MIT" ]
fn badly_formatted ( ) {}
Rust
0
mbc-git/rust
src/tools/rustfmt/tests/mod-resolver/issue-4874/foo/qux.rs
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
cylinder(h = 10, r1 = 20, r2 = 10, center = true);
OpenSCAD
1
heristhesiya/OpenJSCAD.org
packages/io/scad-deserializer/tests/primitive_solids/cylinderEx2.scad
[ "MIT" ]
Note 0 Copyright (C) 2018 Jonathan Hough. All rights reserved. ) NB. Genetic Algorithm Solver implementation. This implementation NB. requires two object. The 'GenObj' which creates and holds NB. chromosome population and cost information, and the 'GASolver' NB. object which runs the search algorithm whose goal is to find NB. the chromosome which minimizes the cost function. NB. Abstract base 'GenObj' class. Extend this class for use with NB. the 'GASolver'. coclass 'GenObj' create=: destroy=: codestroy NB. get the list of chromosomes chromsomes=: 3 : 0 0 ) NB. get the population size populationSize=: 3 : 0 0 ) NB. get the chromosome length. chromosomeLength=: 3 : 0 0 ) NB. Gets a new sequence of chromosomes, NB. for instance if the GP algorithm is NB. not improving, restart. newSequence=: 3 : 0 '' ) NB. runs the cost function on each chromosome. Returns the NB. cost for each chromosome. cost=: 3 : 0"0 0 ) NB. Example GenOj class. This is an example implementation of NB. GenObj. NB. Travelling Salesman Problem Class. This class defines the NB. travelling Salesman problem for a given city count, and NB. chromosome population count. coclass 'TSPObj' coinsert 'GenObj' NB. Creates a 'TSPObj'. Will create random distances between all NB. cities. NB. Parameters: NB. 0: Population of Chromsomes size. Larger sizes take longer to NB. run searches on, but can give better results. NB. 1: City count. The number of cities. create=: 3 : 0 'popSize cCount'=: y list=: (#~ </"1)@(#: i.@:(*/)) 2 # cCount cities=: list,"(1 1) (1,~ 2!cCount) $ 1000 * (? (2!cCount) # 0) cities=: modifyDistance"1 cities boxedcities=: <"1 ( 0 1 {"1 cities) chromo=: (] ?&.> (<"0@:(popSize&$)))cCount ) newSequence=: 3 : 0 '' ) chromosomes=: 3 : 0 chromo ) populationSize=: 3 : 0 popSize ) chromosomeLength=: 3 : 0 cCount ) cost=: 3 : 0"0 edges=. <"1 /:~"1 (2]\ > y) +/, 2{"1 ((edges ="0 _ boxedcities) # cities) ) modifyDistance=: 3 : 0 'from to distance'=. y if. to = >: from do. distance=. 1 elseif. distance < 10 do. distance=. 10 end. from, to, distance ) destroy=: codestroy coclass 'GASolver' convertString=: #.@:".@:((,&' '@[,])/) addBString=: ,@:(*@:+&."."0) NB. add binary strings. NB. Creates an instance of the GASolver class. NB. The solver needs a GenObj object, which holds the NB. chromosome list and cost function. Also the NB. mutation rate, mutation population, selection population NB. needs to be set. The selected population must be less than NB. or equal to the mutation population, and the mutation rate NB. must be a value between 0 and 1. NB. Parametets: NB. 0: GenObj instance. NB. 1: Mutation rate, in range (0,1) NB. 2: Mutation population, must be less than or equal to NB. the GenObj population size. If both are the same, then NB. all chromosomes, after ordering, can undergo mutation. NB. 3: Selected population. Must be at most the same size as NB. Mutation population. NB. 4: threshold of the minimum cost function. If minimum cost NB. is less than this value, then the algorithm will stop. NB. 5: Unique flag, if true all items per chromosome should be unique. NB. i.e. no repeats in a chromosome. NB. 6: Log realtime flag. If true, best result will be displayed on NB. each iteration end. NB. Example: NB. > myGASolver =: (myGenObj;0.4;100;50;0.4;1) conew 'GASolver' create=: 3 : 0 'genobj mRate mPop sPop threshold unique log'=: y pop=: populationSize__genobj chromosomes=: chromosomes__genobj '' ) NB. Mate the chromosomes. Mother, Father and 2 children NB. will produce mutated child chromosomes which will NB. replace the children in the chromosome list. mate=: 3 : 0 'mother father child1 child2'=: y cutoff=. 5 for_j. i. # mother do. if. j < cutoff do. for_k. i. chromosomeLength__genobj '' do. if. unique *. -.(k e. child1) do. child1=. k (j}) child1 break. end. end. for_k. i.chromosomeLength__genobj '' do. if. unique *. -.(k e. child2) do. child2=. (k{father) j} child2 break. end. end. elseif. j > cutoff do. for_k. i. chromosomeLength__genobj '' do. k=. <: (chromosomeLength__genobj '') - k if. unique *. -.(k e. child1) do. child1=. (k) j}child1 break. end. end. for_k. i.chromosomeLength__genobj '' do. k=. <: (chromosomeLength__genobj '') - k if. unique *. -.((k{father) e. child2) do. child2=. (k{father) j}child2 break. end. end. end. end. NB. handle mutations 'c1 c2'=. ? 2 # 0 if. mRate > c1 do. mutated=. ? 2 # chromosomeLength__genobj '' m1=. (0{mutated){child1 m2=. (1{mutated){child1 child1=. (m2, m1) mutated} child1 end. if. mRate > c2 do. mutated=. ? 2 # chromosomeLength__genobj '' m1=. (0{mutated){child2 m2=. (1{mutated){child2 child2=. (m2, m1) mutated} child2 end. child1;child2 ) NB. Sort (ascending) the chromsomes of the GenOBj. The order NB. is decided by the cost function. sortChromosomes=: 3 : 0 (] /: cost__genobj"0) y ) fit=: 4 : 0 generations=. x orderedChromosomes=. y oc=. orderedChromosomes minCost=: _ minCostNoChange=: 0 c=. 0 while. c < generations do. c=. c + 1 nextchild=. mPop for_j. i. sPop do. mother=. j { oc father=. (? sPop) { oc child1=. nextchild { oc child2=. (>: nextchild) { oc newGeneration=. mate mother,father,child1,child2 oc=. newGeneration (nextchild, (>: nextchild)) } oc nextchild=. nextchild + 2 end. oc=. sortChromosomes oc chromo=: oc cmincost=. cost__genobj {. oc if. cmincost < minCost do. minCost=: cmincost minCostNoChange=: 0 else. minCostNoChange=: >: minCostNoChange end. if. 0= 10 | c do. NB. If minCost is infinity after 10 iterations, NB. get new sequence of chromosomes. if. minCost=_ do. oc=. newSequence__genobj '' end. chromo__genobj=: chromo end. if. log do. smoutput 'Iteration complete: ',":cost__genobj {. oc wd^:1 'msgs' end. if. threshold > cost__genobj {. oc do. break. end. end. oc ) destroy=: 3 : 0 try. if. -. genobj -: '' do. destroy__genobj '' end. catch. smoutput 'Error destroying GASolver' end. codestroy '' )
J
4
jonghough/jlearn
genetic/gasolver.ijs
[ "MIT" ]
<?xml version="1.0"?> <rdf:RDF xmlns = "http://neo4j.com/voc/movies#" xmlns:mov = "http://neo4j.com/voc/movies#" xml:base = "http://neo4j.com/voc/movies#" xmlns:owl = "http://www.w3.org/2002/07/owl#" xmlns:rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs= "http://www.w3.org/2000/01/rdf-schema#" xmlns:xsd = "http://www.w3.org/2001/XMLSchema#"> <owl:Ontology rdf:about=""> <rdfs:comment>A basic OWL ontology for Neo4j's movie database</rdfs:comment> <rdfs:comment>Simple ontology providing basic vocabulary and domain+range axioms for the movie database.</rdfs:comment> <rdfs:label>Neo4j's Movie Ontology</rdfs:label> </owl:Ontology> <owl:Class rdf:ID="Person"> <rdfs:label xml:lang="en">Person</rdfs:label> <rdfs:label xml:lang="es">Persona</rdfs:label> <rdfs:comment xml:lang="en">Individual involved in the film industry</rdfs:comment> <rdfs:comment xml:lang="es">Individuo relacionado con la industria del cine</rdfs:comment> </owl:Class> <owl:Class rdf:ID="Movie"> <rdfs:label xml:lang="en">Movie</rdfs:label> <rdfs:label xml:lang="es">Pelicula</rdfs:label> <rdfs:comment xml:lang="en">A film</rdfs:comment> <rdfs:comment xml:lang="es">Una pelicula</rdfs:comment> </owl:Class> <owl:DatatypeProperty rdf:ID="name"> <rdfs:label xml:lang="en">name</rdfs:label> <rdfs:label xml:lang="es">nombre</rdfs:label> <rdfs:comment xml:lang="en">A person's name</rdfs:comment> <rdfs:comment xml:lang="es">El nombre de una persona</rdfs:comment> <rdfs:domain rdf:resource="#Person" /> </owl:DatatypeProperty> <owl:DatatypeProperty rdf:ID="born"> <rdfs:label xml:lang="en">born</rdfs:label> <rdfs:label xml:lang="es">fechaNacimiento</rdfs:label> <rdfs:comment xml:lang="en">A person's date of birth</rdfs:comment> <rdfs:comment xml:lang="es">La fecha de nacimiento de una persona</rdfs:comment> <rdfs:domain rdf:resource="#Person" /> </owl:DatatypeProperty> <owl:DatatypeProperty rdf:ID="title"> <rdfs:label xml:lang="en">title</rdfs:label> <rdfs:label xml:lang="es">titulo</rdfs:label> <rdfs:comment xml:lang="en">The title of a film</rdfs:comment> <rdfs:comment xml:lang="es">El titulo de una pelicula</rdfs:comment> <rdfs:domain rdf:resource="#Movie" /> </owl:DatatypeProperty> <owl:DatatypeProperty rdf:ID="released"> <rdfs:label xml:lang="en">released</rdfs:label> <rdfs:label xml:lang="es">estreno</rdfs:label> <rdfs:comment xml:lang="en">A film's release date</rdfs:comment> <rdfs:comment xml:lang="es">La fecha de estreno de una pelicula</rdfs:comment> <rdfs:domain rdf:resource="#Movie" /> </owl:DatatypeProperty> <owl:DatatypeProperty rdf:ID="tagline"> <rdfs:label xml:lang="en">tagline</rdfs:label> <rdfs:label xml:lang="es">lema</rdfs:label> <rdfs:comment xml:lang="en">Tagline for a film</rdfs:comment> <rdfs:comment xml:lang="es">El lema o eslogan de una pelicula</rdfs:comment> <rdfs:domain rdf:resource="#Movie" /> </owl:DatatypeProperty> <owl:ObjectProperty rdf:ID="ACTED_IN"> <rdfs:label xml:lang="en">ACTED_IN</rdfs:label> <rdfs:label xml:lang="es">ACTUA_EN</rdfs:label> <rdfs:comment xml:lang="en">Actor had a role in film</rdfs:comment> <rdfs:comment xml:lang="es">Actor con un papel en una pelicula a role in film</rdfs:comment> <rdfs:domain rdf:resource="#Person" /> <rdfs:range rdf:resource="#Movie" /> </owl:ObjectProperty> <owl:ObjectProperty rdf:ID="DIRECTED"> <rdfs:label xml:lang="en">DIRECTED</rdfs:label> <rdfs:label xml:lang="es">DIRIGE</rdfs:label> <rdfs:comment xml:lang="en">Director directed film</rdfs:comment> <rdfs:domain rdf:resource="#Person" /> <rdfs:range rdf:resource="#Movie" /> </owl:ObjectProperty> <owl:ObjectProperty rdf:ID="PRODUCED"> <rdfs:label xml:lang="en">PRODUCED</rdfs:label> <rdfs:label xml:lang="es">PRODUCE</rdfs:label> <rdfs:comment xml:lang="en">Producer produced film</rdfs:comment> <rdfs:comment xml:lang="es">productor de una pelicula</rdfs:comment> <rdfs:domain rdf:resource="#Person" /> <rdfs:range rdf:resource="#Movie" /> </owl:ObjectProperty> <owl:ObjectProperty rdf:ID="REVIEWED"> <rdfs:label xml:lang="en">REVIEWED</rdfs:label> <rdfs:label xml:lang="es">HACE_CRITICA</rdfs:label> <rdfs:comment xml:lang="en">Critic reviewed film</rdfs:comment> <rdfs:comment xml:lang="es">critico que publica una critica sobre una pelicula</rdfs:comment> <rdfs:domain rdf:resource="#Person" /> <rdfs:range rdf:resource="#Movie" /> </owl:ObjectProperty> <owl:ObjectProperty rdf:ID="FOLLOWS"> <rdfs:label xml:lang="en">FOLLOWS</rdfs:label> <rdfs:label xml:lang="es">SIGUE</rdfs:label> <rdfs:comment xml:lang="en">Critic follows another critic</rdfs:comment> <rdfs:comment xml:lang="es">Un critico que sigue a otro (en redes sociales)</rdfs:comment> <rdfs:domain rdf:resource="#Person" /> <rdfs:range rdf:resource="#Person" /> </owl:ObjectProperty> <owl:ObjectProperty rdf:ID="WROTE"> <rdfs:label xml:lang="en">WROTE</rdfs:label> <rdfs:label xml:lang="es">ESCRIBE</rdfs:label> <rdfs:comment xml:lang="en">Screenwriter wrote screenplay of</rdfs:comment> <rdfs:comment xml:lang="es">escribe el guion de una pelicula</rdfs:comment> <rdfs:domain rdf:resource="#Person" /> <rdfs:range rdf:resource="#Movie" /> </owl:ObjectProperty> </rdf:RDF>
Web Ontology Language
5
jonmcalder/neosemantics
src/test/resources/moviesontologyMultilabel.owl
[ "Apache-2.0" ]
// // DoraemonMCGustureSerializer.h // DoraemonKit-DoraemonKit // // Created by litianhao on 2021/7/13. // #import <UIKit/UIKit.h> NS_ASSUME_NONNULL_BEGIN @interface DoraemonMCGustureSerializer : NSObject + (NSDictionary *)dictFromGusture:(UIGestureRecognizer *)gusture; + (void)syncInfoToGusture:(UIGestureRecognizer *)gusture withDict:(NSDictionary *)dict; @end NS_ASSUME_NONNULL_END
C
4
didichuxing/DoraemonKit
iOS/DoraemonKit/Src/MultiControl/Function/EventSync/Serialize/EventInfo/DoraemonMCGustureSerializer.h
[ "Apache-2.0" ]
package org.openapitools.model import io.swagger.annotations.ApiModel import io.swagger.annotations.ApiModelProperty import java.math.BigDecimal import io.micronaut.test.extensions.spock.annotation.MicronautTest import spock.lang.Specification import jakarta.inject.Inject /** * Model tests for OuterComposite */ @MicronautTest public class OuterCompositeSpec extends Specification { private final OuterComposite model = new OuterComposite() /** * Model tests for OuterComposite */ void "OuterComposite test"() { // TODO: test OuterComposite } /** * Test the property 'myNumber' */ void "OuterComposite property myNumber test"() { // TODO: test myNumber } /** * Test the property 'myString' */ void "OuterComposite property myString test"() { // TODO: test myString } /** * Test the property 'myBoolean' */ void "OuterComposite property myBoolean test"() { // TODO: test myBoolean } }
Groovy
4
JigarJoshi/openapi-generator
samples/client/petstore/java-micronaut-client/src/test/groovy/org/openapitools/model/OuterCompositeSpec.groovy
[ "Apache-2.0" ]
\section{Motivation} \label{sec:motivation} Before describing the \emph{implementation} of our library, we will provide a brief introduction to Agda's reflection mechanism and illustrate how the proof automation described in this paper may be used. \subsection*{Reflection in Agda} Agda has a \emph{reflection} mechanism\footnote{Note that Agda's reflection mechanism should not be confused with `proof by reflection' -- the technique of writing a verified decision procedure for some class of problems.} for compile time metaprogramming in the style of Lisp~\citep{lisp-macros}, MetaML~\citep{metaml}, and Template Haskell~\citep{template-haskell}. This reflection mechanism makes it possible to convert a program fragment into its corresponding abstract syntax tree and vice versa. We will introduce Agda's reflection mechanism here with several short examples, based on the explanation in previous work~\citep{van-der-walt}. A more complete overview can be found in the Agda release notes~\citep{agda-relnotes-228} and Van der Walt's thesis~\citeyearpar{vdWalt:Thesis:2012}. The type |Term : Set| is the central type provided by the reflection mechanism. It defines an abstract syntax tree for Agda terms. There are several language constructs for quoting and unquoting program fragments. The simplest example of the reflection mechanism is the quotation of a single term. In the definition of |idTerm| below, we quote the identity function on Boolean values. \begin{code} idTerm : Term idTerm = quoteTerm (λ (x : Bool) → x) \end{code} When evaluated, the |idTerm| yields the following value: \begin{code} lam visible (var 0 []) \end{code} On the outermost level, the |lam| constructor produces a lambda abstraction. It has a single argument that is passed explicitly (as opposed to Agda's implicit arguments). The body of the lambda consists of the variable identified by the De Bruijn index 0, applied to an empty list of arguments. The |quote| language construct allows users to access the internal representation of an \emph{identifier}, a value of a built-in type |Name|. Users can subsequently request the type or definition of such names. Dual to quotation, the |unquote| mechanism allows users to splice in a |Term|, replacing it with its concrete syntax. For example, we could give a convoluted definition of the |K| combinator as follows: \begin{code} const : ∀ {A B} → A → B → A const = unquote (lam visible (lam visible (var 1 []))) \end{code} The language construct |unquote| is followed by a value of type |Term|. In this example, we manually construct a |Term| representing the |K| combinator and splice it in the definition of |const|. The |unquote| construct then type-checks the given term, and turns it into the definition |λ x → λ y → x|. The final piece of the reflection mechanism that we will use is the |quoteGoal| construct. The usage of |quoteGoal| is best illustrated with an example: \begin{code} goalInHole : ℕ goalInHole = quoteGoal g in hole \end{code} In this example, the construct |quoteGoal g| binds the |Term| representing the \emph{type} of the current goal, |ℕ|, to the variable |g|. When completing this definition by filling in the hole labeled |0|, we may now refer to the variable |g|. This variable is bound to |def ℕ []|, the |Term| representing the type |ℕ|. \subsection*{Using proof automation} To illustrate the usage of our proof automation, we begin by defining a predicate |Even| on natural numbers as follows: \begin{code} data Even : ℕ → Set where isEven0 : Even 0 isEven+2 : ∀ {n} → Even n → Even (suc (suc n)) \end{code} % Next we may want to prove properties of this definition: % \begin{code} even+ : Even n → Even m → Even (n + m) even+ isEven0 e2 = e2 even+ ( isEven+2 e1) e2 = isEven+2 (even+ e1 e2) \end{code} % Note that we omit universally quantified implicit arguments from the typeset version of this paper, in accordance with convention used by Haskell~\citep{haskell-report} and Idris~\citep{idris}. As shown by Van der Walt and Swierstra~\citeyearpar{van-der-walt}, it is easy to decide the |Even| property for closed terms using proof by reflection. The interesting terms, however, are seldom closed. For instance, if we would like to use the |even+| lemma in the proof below, we need to call it explicitly. \begin{code} trivial : Even n → Even (n + 2) trivial e = even+ e (isEven+2 isEven0) \end{code} Manually constructing explicit proof objects in this fashion is not easy. The proof is brittle. We cannot easily reuse it to prove similar statements such as |Even (n + 4)|. If we need to reformulate our statement slightly, proving |Even (2 + n)| instead, we need to rewrite our proof. Proof automation can make propositions more robust against such changes. Coq's proof search tactics, such as |auto|, can be customized with a \emph{hint database}, a collection of related lemmas. In our example, |auto| would be able to prove the |trivial| lemma, provided the hint database contains at least the constructors of the |Even| data type and the |even+| lemma. In contrast to the construction of explicit proof terms, changes to the theorem statement need not break the proof. This paper shows how to implement a similar tactic as an ordinary function in Agda. Before we can use our |auto| function, we need to construct a hint database: \begin{code} hints : HintDB hints = ε << quote isEven0 << quote isEven+2 << quote even+ \end{code} To construct such a database, we use |quote| to obtain the names of any terms that we wish to include in it and pass them to the right-hand side of the |_<<_| function, which will insert them into a hint database to the left. Note that |ε| represents the empty hint database. We will describe the implementation of |_<<_| in more detail in Section~\ref{sec:hintdbs}. For now it should suffice to say that, in the case of |even+|, after the |quote| construct obtains an Agda |Name|, |_<<_| uses the built-in function |type| to look up the type associated with |even+|, and generates a derivation rule which states that given two proofs of |Even n| and |Even m|, applying the rule |even+| will result in a proof of |Even (n + m)|. Note, however, that unlike Coq, the hint data base is a \emph{first-class} value that can be manipulated, inspected, or passed as an argument to a function. We now give an alternative proof of the |trivial| lemma using the |auto| tactic and the hint database defined above: \begin{code} trivial : Even n → Even (n + 2) trivial = quoteGoal g in unquote (auto 5 hints g) \end{code} Or, using the newly added Agda tactic syntax\footnote{ Syntax for Agda tactics was added in Agda 2.4.2. }: \begin{code} trivial : Even n → Even (n + 2) trivial = tactic (auto 5 hints) \end{code} The notation |tactic f| is simply syntactic sugar for |quoteGoal g in unquote (f g)|, for some function |f|. The central ingredient is a \emph{function} |auto| with the following type: \begin{code} auto : (depth : ℕ) → HintDB → Term → Term \end{code} Given a maximum depth, hint database, and goal, it searches for a proof |Term| that witnesses our goal. If this term can be found, it is spliced back into our program using the |unquote| statement. Of course, such invocations of the |auto| function may fail. What happens if no proof exists? For example, trying to prove |Even n → Even (n + 3)| in this style gives the following error: \begin{verbatim} Exception searchSpaceExhausted !=< Even .n -> Even (.n + 3) of type Set \end{verbatim} When no proof can be found, the |auto| function generates a dummy term with a type that explains the reason the search has failed. In this example, the search space has been exhausted. Unquoting this term, then gives the type error message above. It is up to the programmer to fix this, either by providing a manual proof or diagnosing why no proof could be found. \paragraph{Overview} The remainder of this paper describes how the |auto| function is implemented. Before delving into the details of its implementation, however, we will give a high-level overview of the steps involved: \begin{enumerate} \item The |tactic| keyword converts the goal type to an abstract syntax tree, i.e., a value of type |Term|. In what follows we will use |AgTerm| to denote such terms, to avoid confusion with the other term data type that we use. \item Next, we check the goal term. If it has a functional type, we add the arguments of this function to our hint database, implicitly introducing additional lambdas to the proof term we intend to construct. At this point we check that the remaining type and all its original arguments are are first-order. If this check fails, we produce an error message, not unlike the |searchSpaceExhausted| term we saw above. We require terms to be first-order to ensure that the unification algorithm, used in later steps for proof search, is decidable. If the goal term is first-order, we convert it to our own term data type for proof search, |PsTerm|. \item The key proof search algorithm, presented in the next section, then tries to apply the hints from the hint database to prove the goal. This process coinductively generates a (potentially infinite) search tree. A simple bounded depth-first search through this tree tries to find a series of hints that can be used to prove the goal. \item If such a proof is found, this is converted back to an |AgTerm|; otherwise, we produce an erroneous term describing that the search space has been exhausted. Finally, the |unquote| keyword type checks the generated |AgTerm| and splices it back into our development. \end{enumerate} % But the biggest problem is that the paper doesn't clearly separate % what in the code is a good idea, what is an engineering trick, and % what is wart required to satisfy Agda. A discussion at that level % would be very informative and useful. % % Tricks + Warts % * Finite types, shifting indices, Generation of fresh variables % * 'Plumbing' reflection-conversion % * Proof obligations? regarding syntax % * constructing incomplete proofs \noindent The rest of this paper will explain these steps in greater detail. %%% Local Variables: %%% mode: latex %%% TeX-master: t %%% TeX-command-default: "rake" %%% End:
Literate Agda
4
wenkokke/AutoInAgda
doc/motivation.lagda
[ "MIT" ]
fn main() { inline!(); //~ ERROR cannot find macro `inline` in this scope }
Rust
1
Eric-Arellano/rust
src/test/ui/macros/macro-path-prelude-fail-3.rs
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
# Ubuntu 16.04 with nvidia-docker2 beta opengl support @{suffix = '16.04' if image_distro_version == '16.04' else '18.04'}@ FROM nvidia/opengl:1.0-glvnd-devel-ubuntu@(suffix) as glvnd
EmberScript
2
traversaro/rocker
src/rocker/templates/nvidia_preamble.Dockerfile.em
[ "Apache-2.0" ]
/* Copyright (c) Microsoft Corporation. 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. */ .context-selector { min-width: 38px; border: 1px solid transparent; border-radius: 0; padding: 0 13px 0 5px; position: relative; height: 22px; align-self: center; margin-right: 20px; background: rgba(222, 222, 222, 0.3); color: white; border-radius: 3px; outline: none !important; }
CSS
3
NareshMurthy/playwright
src/web/traceViewer/ui/contextSelector.css
[ "Apache-2.0" ]
var $arr1 <[10] f32> func $ArrayAdd () f32 { var %ff i32 var %sum f32 dassign %sum ( constval f32 0.0f ) foreachelem %ff $arr1 { dassign %sum ( add f32 ( dread f32 %sum, dread f32 %ff ) ) } return ( dread f32 %sum ) } # EXEC: %irbuild Main.mpl # EXEC: %irbuild Main.irb.mpl # EXEC: %cmp Main.irb.mpl Main.irb.irb.mpl
Maple
3
harmonyos-mirror/OpenArkCompiler-test
test/testsuite/irbuild_test/I0034-mapleall-irbuild-edge-foreachelem/Main.mpl
[ "MulanPSL-1.0" ]
/************************************************************************************************** * * * This file is part of BLASFEO. * * * * BLASFEO -- BLAS For Embedded Optimization. * * Copyright (C) 2019 by Gianluca Frison. * * Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * * All rights reserved. * * * * The 2-Clause BSD License * * * * Redistribution and use in source and binary forms, with or without * * modification, are permitted provided that the following conditions are met: * * * * 1. Redistributions of source code must retain the above copyright notice, this * * list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * * this list of conditions and the following disclaimer in the documentation * * and/or other materials provided with the distribution. * * * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * * * Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * * * **************************************************************************************************/ /* * ----------- TOMOVE * * expecting column major matrices * */ #include "blasfeo_common.h" void dtrcp_l_lib(int m, double alpha, int offsetA, double *A, int sda, int offsetB, double *B, int sdb); void dgead_lib(int m, int n, double alpha, int offsetA, double *A, int sda, int offsetB, double *B, int sdb); // TODO remove ??? void ddiain_sqrt_lib(int kmax, double *x, int offset, double *pD, int sdd); // TODO ddiaad1 void ddiareg_lib(int kmax, double reg, int offset, double *pD, int sdd); void dgetr_lib(int m, int n, double alpha, int offsetA, double *pA, int sda, int offsetC, double *pC, int sdc); void dtrtr_l_lib(int m, double alpha, int offsetA, double *pA, int sda, int offsetC, double *pC, int sdc); void dtrtr_u_lib(int m, double alpha, int offsetA, double *pA, int sda, int offsetC, double *pC, int sdc); void ddiaex_lib(int kmax, double alpha, int offset, double *pD, int sdd, double *x); void ddiaad_lib(int kmax, double alpha, double *x, int offset, double *pD, int sdd); void ddiain_libsp(int kmax, int *idx, double alpha, double *x, double *pD, int sdd); void ddiaex_libsp(int kmax, int *idx, double alpha, double *pD, int sdd, double *x); void ddiaad_libsp(int kmax, int *idx, double alpha, double *x, double *pD, int sdd); void ddiaadin_libsp(int kmax, int *idx, double alpha, double *x, double *y, double *pD, int sdd); void drowin_lib(int kmax, double alpha, double *x, double *pD); void drowex_lib(int kmax, double alpha, double *pD, double *x); void drowad_lib(int kmax, double alpha, double *x, double *pD); void drowin_libsp(int kmax, double alpha, int *idx, double *x, double *pD); void drowad_libsp(int kmax, int *idx, double alpha, double *x, double *pD); void drowadin_libsp(int kmax, int *idx, double alpha, double *x, double *y, double *pD); void dcolin_lib(int kmax, double *x, int offset, double *pD, int sdd); void dcolad_lib(int kmax, double alpha, double *x, int offset, double *pD, int sdd); void dcolin_libsp(int kmax, int *idx, double *x, double *pD, int sdd); void dcolad_libsp(int kmax, double alpha, int *idx, double *x, double *pD, int sdd); void dcolsw_lib(int kmax, int offsetA, double *pA, int sda, int offsetC, double *pC, int sdc); void dvecin_libsp(int kmax, int *idx, double *x, double *y); void dvecad_libsp(int kmax, int *idx, double alpha, double *x, double *y);
C
4
shoes22/openpilot
third_party/acados/include/blasfeo/include/blasfeo_d_aux_old.h
[ "MIT" ]
#tag IOSView Begin iosView CreateQRView BackButtonTitle = "Back" Compatibility = "" LargeTitleMode = 2 Left = 0 NavigationBarVisible= True TabIcon = "" TabTitle = "" Title = "Create a QRCode" Top = 0 Begin iOSTextField TextField1 AccessibilityHint= "" AccessibilityLabel= "" AutoLayout = TextField1, 1, <Parent>, 1, False, +1.00, 1, 1, *kStdGapCtlToViewH, , True AutoLayout = TextField1, 3, Label1, 4, False, +1.00, 1, 1, *kStdControlGapV, , True AutoLayout = TextField1, 8, , 0, True, +1.00, 1, 1, 31, , True AutoLayout = TextField1, 7, , 0, False, +1.00, 1, 1, 220, , True Enabled = True Height = 31.0 KeyboardType = 0 Left = 20 LockedInPosition= False Password = False PlaceHolder = "" Scope = 0 Text = "" TextAlignment = 0 TextColor = &c00000000 TextFont = "" TextSize = 0 Top = 122 Visible = True Width = 220.0 End Begin iOSLabel Label1 AccessibilityHint= "" AccessibilityLabel= "" AutoLayout = Label1, 1, <Parent>, 1, False, +1.00, 1, 1, 20, , True AutoLayout = Label1, 3, <Parent>, 3, False, +1.00, 1, 1, 84, , True AutoLayout = Label1, 8, , 0, False, +1.00, 1, 1, 30, , True AutoLayout = Label1, 2, <Parent>, 2, False, +1.00, 1, 1, -*kStdGapCtlToViewH, , True Enabled = True Height = 30.0 Left = 20 LineBreakMode = 0 LockedInPosition= False Scope = 0 Text = "Enter text to be converted to a QRCode:" TextAlignment = 0 TextColor = &c00000000 TextFont = "" TextSize = 0 Top = 84 Visible = True Width = 280.0 End Begin iOSButton Button1 AccessibilityHint= "" AccessibilityLabel= "" AutoLayout = Button1, 1, TextField1, 2, False, +1.00, 1, 1, *kStdControlGapH, , True AutoLayout = Button1, 3, Label1, 4, False, +1.00, 1, 1, *kStdControlGapV, , True AutoLayout = Button1, 8, , 0, False, +1.00, 1, 1, 30, , True AutoLayout = Button1, 7, , 0, False, +1.00, 1, 1, 60, , True Caption = "Create" Enabled = False Height = 30.0 Left = 248 LockedInPosition= False Scope = 0 TextColor = &c007AFF00 TextFont = "" TextSize = 0 Top = 122 Visible = True Width = 60.0 End Begin iOSCanvas Canvas1 AccessibilityHint= "" AccessibilityLabel= "" AutoLayout = Canvas1, 9, <Parent>, 9, False, +1.00, 1, 1, 0, , True AutoLayout = Canvas1, 3, <Parent>, 3, False, +1.00, 1, 1, 168, , True AutoLayout = Canvas1, 8, , 0, False, +1.00, 1, 1, 200, , True AutoLayout = Canvas1, 7, , 0, False, +1.00, 1, 1, 200, , True Height = 200.0 Left = 60 LockedInPosition= False Scope = 0 Top = 168 Visible = True Width = 200.0 End End #tag EndIOSView #tag WindowCode #tag Event Sub ToolbarPressed(button As iOSToolButton) #if XojoVersion < 2015.03 if button.Type = iOSToolButton.Type.SystemAction then #Else if button.Type = iOSToolButton.Types.SystemAction then #Endif using Extensions using Foundation dim controller as UIActivityViewController controller = new UIActivityViewController(NSArray.CreateWithObject(new NSObject(p.Handle)),nil) self.PresentViewController(controller, True, nil) end if End Sub #tag EndEvent #tag Property, Flags = &h21 Private p As iOSImage #tag EndProperty #tag EndWindowCode #tag Events TextField1 #tag Event Sub TextChange() Button1.Enabled = (me.Text<>"") End Sub #tag EndEvent #tag EndEvents #tag Events Button1 #tag Event Sub Action() p = QRCode.Create(TextField1.Text) Canvas1.Invalidate static added as Boolean if not added then #if XojoVersion < 2015.03 Toolbar.Add(iOSToolButton.NewSystemItem(iOSToolButton.Type.SystemAction)) #Else Toolbar.Add(iOSToolButton.NewSystemItem(iOSToolButton.Types.SystemAction)) #Endif added = True end if End Sub #tag EndEvent #tag EndEvents #tag Events Canvas1 #tag Event Sub Paint(g As iOSGraphics) if p <> nil then g.DrawImage p,0,0 end if End Sub #tag EndEvent #tag EndEvents #tag ViewBehavior #tag ViewProperty Name="LargeTitleMode" Visible=true Group="Behavior" InitialValue="2" Type="LargeTitleDisplayModes" EditorType="Enum" #tag EnumValues "0 - Automatic" "1 - Always" "2 - Never" #tag EndEnumValues #tag EndViewProperty #tag ViewProperty Name="BackButtonTitle" Visible=false Group="Behavior" InitialValue="" Type="Text" EditorType="MultiLineEditor" #tag EndViewProperty #tag ViewProperty Name="Index" Visible=true Group="ID" InitialValue="-2147483648" Type="Integer" EditorType="" #tag EndViewProperty #tag ViewProperty Name="Left" Visible=true Group="Position" InitialValue="0" Type="Integer" EditorType="" #tag EndViewProperty #tag ViewProperty Name="Name" Visible=true Group="ID" InitialValue="" Type="String" EditorType="" #tag EndViewProperty #tag ViewProperty Name="NavigationBarVisible" Visible=false Group="Behavior" InitialValue="" Type="Boolean" EditorType="" #tag EndViewProperty #tag ViewProperty Name="Super" Visible=true Group="ID" InitialValue="" Type="String" EditorType="" #tag EndViewProperty #tag ViewProperty Name="TabIcon" Visible=false Group="Behavior" InitialValue="" Type="iOSImage" EditorType="" #tag EndViewProperty #tag ViewProperty Name="TabTitle" Visible=false Group="Behavior" InitialValue="" Type="Text" EditorType="" #tag EndViewProperty #tag ViewProperty Name="Title" Visible=false Group="Behavior" InitialValue="" Type="Text" EditorType="MultiLineEditor" #tag EndViewProperty #tag ViewProperty Name="Top" Visible=true Group="Position" InitialValue="0" Type="Integer" EditorType="" #tag EndViewProperty #tag EndViewBehavior
Xojo
4
kingj5/iOSKit
ExampleViews/CreateQRView.xojo_code
[ "MIT" ]
<html> <header> <title>@title</title> <meta charset="utf-8"/> @css 'assets/site.css' </header> <body> <h1>@title</h1> <button>Close the connection</button> <ul></ul> <script> "use strict"; var button = document.querySelector('button'); var eventList = document.querySelector('ul'); const evtSource = new EventSource('/sse'); evtSource.onerror = function() { console.log("EventSource failed."); }; console.log(evtSource.withCredentials); console.log(evtSource.readyState); console.log(evtSource.url); evtSource.onopen = function() { console.log("Connection to server opened."); }; evtSource.onmessage = function(e) { var newElement = document.createElement("li"); newElement.textContent = "message: " + e.data; eventList.appendChild(newElement); }; evtSource.addEventListener("ping", function(e) { console.log(e) var newElement = document.createElement("li"); var obj = JSON.parse(e.data); newElement.innerHTML = "ping at " + obj.time + ' server data: ' + e.data; eventList.appendChild(newElement); }, false); button.onclick = function() { console.log('Connection closed'); evtSource.close(); }; </script> </body> </html>
HTML
3
gamemaker1/v
examples/vweb/server_sent_events/index.html
[ "MIT" ]
"~~\{say .perl~\$_}"~~{say .perl~$_}
Perl6
0
MakeNowJust/quine
quine.p6
[ "Beerware" ]
diff --git a/node_modules/@popperjs/core/lib/modifiers/preventOverflow.js b/node_modules/@popperjs/core/lib/modifiers/preventOverflow.js index 1776c09..e08aad1 100644 --- a/node_modules/@popperjs/core/lib/modifiers/preventOverflow.js +++ b/node_modules/@popperjs/core/lib/modifiers/preventOverflow.js @@ -52,26 +52,27 @@ function preventOverflow(_ref) { return; } - if (checkMainAxis || checkAltAxis) { - var mainSide = mainAxis === 'y' ? top : left; - var altSide = mainAxis === 'y' ? bottom : right; - var len = mainAxis === 'y' ? 'height' : 'width'; - var offset = popperOffsets[mainAxis]; - var min = popperOffsets[mainAxis] + overflow[mainSide]; - var max = popperOffsets[mainAxis] - overflow[altSide]; + function setOffset(axis) { + var isMainAxis = axis === mainAxis; + var mainSide = axis === 'y' ? top : left; + var altSide = axis === 'y' ? bottom : right; + var len = axis === 'y' ? 'height' : 'width'; + var offset = popperOffsets[axis]; + var min = popperOffsets[axis] + overflow[mainSide]; + var max = popperOffsets[axis] - overflow[altSide]; var additive = tether ? -popperRect[len] / 2 : 0; var minLen = variation === start ? referenceRect[len] : popperRect[len]; var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go - // outside the reference bounds + // outside the reference bounds when on the main axis var arrowElement = state.elements.arrow; - var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : { + var arrowRect = tether && arrowElement && isMainAxis ? getLayoutRect(arrowElement) : { width: 0, height: 0 }; var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject(); - var arrowPaddingMin = arrowPaddingObject[mainSide]; - var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want + var arrowPaddingMin = isMainAxis ? arrowPaddingObject[mainSide] : 0; + var arrowPaddingMax = isMainAxis ? arrowPaddingObject[altSide] : 0; // If the reference length is smaller than the arrow length, we don't want // to include its full size in the calculation. If the reference is small // and near the edge of a boundary, the popper can overflow even if the // reference is not overflowing as well (e.g. virtual elements with no @@ -81,33 +82,22 @@ function preventOverflow(_ref) { var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue; var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue; var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow); - var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0; - var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0; - var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset; - var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue; - - if (checkMainAxis) { - var preventedOffset = within(tether ? mathMin(min, tetherMin) : min, offset, tether ? mathMax(max, tetherMax) : max); - popperOffsets[mainAxis] = preventedOffset; - data[mainAxis] = preventedOffset - offset; - } - - if (checkAltAxis) { - var _mainSide = mainAxis === 'x' ? top : left; - - var _altSide = mainAxis === 'x' ? bottom : right; - - var _offset = popperOffsets[altAxis]; - - var _min = _offset + overflow[_mainSide]; - - var _max = _offset - overflow[_altSide]; + var clientOffset = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0; + var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][axis] : 0; + var referenceRectEnd = referenceRect[axis] + referenceRect[len]; + var tetherMin = !isMainAxis && referenceRect[axis] < popperRect[axis] ? popperOffsets[axis] + minOffset - offsetModifierValue - clientOffset : referenceRectEnd; + var tetherMax = !isMainAxis && referenceRectEnd < popperRect[axis] ? popperOffsets[axis] + maxOffset - offsetModifierValue : referenceRect[axis]; + var preventedOffset = within(tether ? mathMin(min, tetherMin) : min, offset, tether ? mathMax(max, tetherMax) : max); + popperOffsets[axis] = preventedOffset; + data[axis] = preventedOffset - offset; + } - var _preventedOffset = within(tether ? mathMin(_min, tetherMin) : _min, _offset, tether ? mathMax(_max, tetherMax) : _max); + if (checkMainAxis) { + setOffset(mainAxis); + } - popperOffsets[altAxis] = _preventedOffset; - data[altAxis] = _preventedOffset - _offset; - } + if (checkAltAxis) { + setOffset(altAxis); } state.modifiersData[name] = data;
Diff
4
mm73628486283/cypress
patches/@popperjs+core+2.9.2.dev.patch
[ "MIT" ]
// 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/base/platform/time.h" #if V8_OS_MACOSX #include <mach/mach_time.h> #endif #if V8_OS_POSIX #include <sys/time.h> #endif #if V8_OS_WIN #include <windows.h> #include "src/base/win32-headers.h" #endif #include <vector> #include "src/base/platform/elapsed-timer.h" #include "src/base/platform/platform.h" #include "testing/gtest/include/gtest/gtest.h" namespace v8 { namespace base { TEST(TimeDelta, ZeroMinMax) { constexpr TimeDelta kZero; static_assert(kZero.IsZero(), ""); constexpr TimeDelta kMax = TimeDelta::Max(); static_assert(kMax.IsMax(), ""); static_assert(kMax == TimeDelta::Max(), ""); EXPECT_GT(kMax, TimeDelta::FromDays(100 * 365)); static_assert(kMax > kZero, ""); constexpr TimeDelta kMin = TimeDelta::Min(); static_assert(kMin.IsMin(), ""); static_assert(kMin == TimeDelta::Min(), ""); EXPECT_LT(kMin, TimeDelta::FromDays(-100 * 365)); static_assert(kMin < kZero, ""); } TEST(TimeDelta, MaxConversions) { // static_assert also confirms constexpr works as intended. constexpr TimeDelta kMax = TimeDelta::Max(); EXPECT_EQ(kMax.InDays(), std::numeric_limits<int>::max()); EXPECT_EQ(kMax.InHours(), std::numeric_limits<int>::max()); EXPECT_EQ(kMax.InMinutes(), std::numeric_limits<int>::max()); EXPECT_EQ(kMax.InSecondsF(), std::numeric_limits<double>::infinity()); EXPECT_EQ(kMax.InSeconds(), std::numeric_limits<int64_t>::max()); EXPECT_EQ(kMax.InMillisecondsF(), std::numeric_limits<double>::infinity()); EXPECT_EQ(kMax.InMilliseconds(), std::numeric_limits<int64_t>::max()); EXPECT_EQ(kMax.InMillisecondsRoundedUp(), std::numeric_limits<int64_t>::max()); // TODO(v8-team): Import overflow support from Chromium's base. // EXPECT_TRUE(TimeDelta::FromDays(std::numeric_limits<int>::max()).IsMax()); // EXPECT_TRUE( // TimeDelta::FromHours(std::numeric_limits<int>::max()).IsMax()); // EXPECT_TRUE( // TimeDelta::FromMinutes(std::numeric_limits<int>::max()).IsMax()); // constexpr int64_t max_int = std::numeric_limits<int64_t>::max(); // constexpr int64_t min_int = std::numeric_limits<int64_t>::min(); // EXPECT_TRUE( // TimeDelta::FromSeconds(max_int / Time::kMicrosecondsPerSecond + 1) // .IsMax()); // EXPECT_TRUE(TimeDelta::FromMilliseconds( // max_int / Time::kMillisecondsPerSecond + 1) // .IsMax()); // EXPECT_TRUE(TimeDelta::FromMicroseconds(max_int).IsMax()); // EXPECT_TRUE( // TimeDelta::FromSeconds(min_int / Time::kMicrosecondsPerSecond - 1) // .IsMin()); // EXPECT_TRUE(TimeDelta::FromMilliseconds( // min_int / Time::kMillisecondsPerSecond - 1) // .IsMin()); // EXPECT_TRUE(TimeDelta::FromMicroseconds(min_int).IsMin()); // EXPECT_TRUE( // TimeDelta::FromMicroseconds(std::numeric_limits<int64_t>::min()) // .IsMin()); } TEST(TimeDelta, NumericOperators) { constexpr int i = 2; EXPECT_EQ(TimeDelta::FromMilliseconds(2000), (TimeDelta::FromMilliseconds(1000) * i)); EXPECT_EQ(TimeDelta::FromMilliseconds(500), (TimeDelta::FromMilliseconds(1000) / i)); EXPECT_EQ(TimeDelta::FromMilliseconds(2000), (TimeDelta::FromMilliseconds(1000) *= i)); EXPECT_EQ(TimeDelta::FromMilliseconds(500), (TimeDelta::FromMilliseconds(1000) /= i)); constexpr int64_t i64 = 2; EXPECT_EQ(TimeDelta::FromMilliseconds(2000), (TimeDelta::FromMilliseconds(1000) * i64)); EXPECT_EQ(TimeDelta::FromMilliseconds(500), (TimeDelta::FromMilliseconds(1000) / i64)); EXPECT_EQ(TimeDelta::FromMilliseconds(2000), (TimeDelta::FromMilliseconds(1000) *= i64)); EXPECT_EQ(TimeDelta::FromMilliseconds(500), (TimeDelta::FromMilliseconds(1000) /= i64)); EXPECT_EQ(TimeDelta::FromMilliseconds(2000), (TimeDelta::FromMilliseconds(1000) * 2)); EXPECT_EQ(TimeDelta::FromMilliseconds(500), (TimeDelta::FromMilliseconds(1000) / 2)); EXPECT_EQ(TimeDelta::FromMilliseconds(2000), (TimeDelta::FromMilliseconds(1000) *= 2)); EXPECT_EQ(TimeDelta::FromMilliseconds(500), (TimeDelta::FromMilliseconds(1000) /= 2)); } // TODO(v8-team): Import support for overflow from Chromium's base. TEST(TimeDelta, DISABLED_Overflows) { // Some sanity checks. static_assert's used were possible to verify constexpr // evaluation at the same time. static_assert(TimeDelta::Max().IsMax(), ""); static_assert(-TimeDelta::Max() < TimeDelta(), ""); static_assert(-TimeDelta::Max() > TimeDelta::Min(), ""); static_assert(TimeDelta() > -TimeDelta::Max(), ""); TimeDelta large_delta = TimeDelta::Max() - TimeDelta::FromMilliseconds(1); TimeDelta large_negative = -large_delta; EXPECT_GT(TimeDelta(), large_negative); EXPECT_FALSE(large_delta.IsMax()); EXPECT_FALSE((-large_negative).IsMin()); const TimeDelta kOneSecond = TimeDelta::FromSeconds(1); // Test +, -, * and / operators. EXPECT_TRUE((large_delta + kOneSecond).IsMax()); EXPECT_TRUE((large_negative + (-kOneSecond)).IsMin()); EXPECT_TRUE((large_negative - kOneSecond).IsMin()); EXPECT_TRUE((large_delta - (-kOneSecond)).IsMax()); EXPECT_TRUE((large_delta * 2).IsMax()); EXPECT_TRUE((large_delta * -2).IsMin()); // Test +=, -=, *= and /= operators. TimeDelta delta = large_delta; delta += kOneSecond; EXPECT_TRUE(delta.IsMax()); delta = large_negative; delta += -kOneSecond; EXPECT_TRUE((delta).IsMin()); delta = large_negative; delta -= kOneSecond; EXPECT_TRUE((delta).IsMin()); delta = large_delta; delta -= -kOneSecond; EXPECT_TRUE(delta.IsMax()); delta = large_delta; delta *= 2; EXPECT_TRUE(delta.IsMax()); // Test operations with Time and TimeTicks. EXPECT_TRUE((large_delta + Time::Now()).IsMax()); EXPECT_TRUE((large_delta + TimeTicks::Now()).IsMax()); EXPECT_TRUE((Time::Now() + large_delta).IsMax()); EXPECT_TRUE((TimeTicks::Now() + large_delta).IsMax()); Time time_now = Time::Now(); EXPECT_EQ(kOneSecond, (time_now + kOneSecond) - time_now); EXPECT_EQ(-kOneSecond, (time_now - kOneSecond) - time_now); TimeTicks ticks_now = TimeTicks::Now(); EXPECT_EQ(-kOneSecond, (ticks_now - kOneSecond) - ticks_now); EXPECT_EQ(kOneSecond, (ticks_now + kOneSecond) - ticks_now); } TEST(TimeDelta, FromAndIn) { EXPECT_EQ(TimeDelta::FromDays(2), TimeDelta::FromHours(48)); EXPECT_EQ(TimeDelta::FromHours(3), TimeDelta::FromMinutes(180)); EXPECT_EQ(TimeDelta::FromMinutes(2), TimeDelta::FromSeconds(120)); EXPECT_EQ(TimeDelta::FromSeconds(2), TimeDelta::FromMilliseconds(2000)); EXPECT_EQ(TimeDelta::FromMilliseconds(2), TimeDelta::FromMicroseconds(2000)); EXPECT_EQ(static_cast<int>(13), TimeDelta::FromDays(13).InDays()); EXPECT_EQ(static_cast<int>(13), TimeDelta::FromHours(13).InHours()); EXPECT_EQ(static_cast<int>(13), TimeDelta::FromMinutes(13).InMinutes()); EXPECT_EQ(static_cast<int64_t>(13), TimeDelta::FromSeconds(13).InSeconds()); EXPECT_DOUBLE_EQ(13.0, TimeDelta::FromSeconds(13).InSecondsF()); EXPECT_EQ(static_cast<int64_t>(13), TimeDelta::FromMilliseconds(13).InMilliseconds()); EXPECT_DOUBLE_EQ(13.0, TimeDelta::FromMilliseconds(13).InMillisecondsF()); EXPECT_EQ(static_cast<int64_t>(13), TimeDelta::FromMicroseconds(13).InMicroseconds()); } #if V8_OS_MACOSX TEST(TimeDelta, MachTimespec) { TimeDelta null = TimeDelta(); EXPECT_EQ(null, TimeDelta::FromMachTimespec(null.ToMachTimespec())); TimeDelta delta1 = TimeDelta::FromMilliseconds(42); EXPECT_EQ(delta1, TimeDelta::FromMachTimespec(delta1.ToMachTimespec())); TimeDelta delta2 = TimeDelta::FromDays(42); EXPECT_EQ(delta2, TimeDelta::FromMachTimespec(delta2.ToMachTimespec())); } #endif TEST(Time, Max) { Time max = Time::Max(); EXPECT_TRUE(max.IsMax()); EXPECT_EQ(max, Time::Max()); EXPECT_GT(max, Time::Now()); EXPECT_GT(max, Time()); } TEST(Time, MaxConversions) { Time t = Time::Max(); EXPECT_EQ(std::numeric_limits<int64_t>::max(), t.ToInternalValue()); // TODO(v8-team): Time::FromJsTime() overflows with infinity. Import support // from Chromium's base. // t = Time::FromJsTime(std::numeric_limits<double>::infinity()); // EXPECT_TRUE(t.IsMax()); // EXPECT_EQ(std::numeric_limits<double>::infinity(), t.ToJsTime()); #if defined(OS_POSIX) struct timeval tval; tval.tv_sec = std::numeric_limits<time_t>::max(); tval.tv_usec = static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1; t = Time::FromTimeVal(tval); EXPECT_TRUE(t.IsMax()); tval = t.ToTimeVal(); EXPECT_EQ(std::numeric_limits<time_t>::max(), tval.tv_sec); EXPECT_EQ(static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1, tval.tv_usec); #endif #if defined(OS_WIN) FILETIME ftime; ftime.dwHighDateTime = std::numeric_limits<DWORD>::max(); ftime.dwLowDateTime = std::numeric_limits<DWORD>::max(); t = Time::FromFileTime(ftime); EXPECT_TRUE(t.IsMax()); ftime = t.ToFileTime(); EXPECT_EQ(std::numeric_limits<DWORD>::max(), ftime.dwHighDateTime); EXPECT_EQ(std::numeric_limits<DWORD>::max(), ftime.dwLowDateTime); #endif } TEST(Time, JsTime) { Time t = Time::FromJsTime(700000.3); EXPECT_DOUBLE_EQ(700000.3, t.ToJsTime()); } #if V8_OS_POSIX TEST(Time, Timespec) { Time null; EXPECT_TRUE(null.IsNull()); EXPECT_EQ(null, Time::FromTimespec(null.ToTimespec())); Time now = Time::Now(); EXPECT_EQ(now, Time::FromTimespec(now.ToTimespec())); Time now_sys = Time::NowFromSystemTime(); EXPECT_EQ(now_sys, Time::FromTimespec(now_sys.ToTimespec())); Time unix_epoch = Time::UnixEpoch(); EXPECT_EQ(unix_epoch, Time::FromTimespec(unix_epoch.ToTimespec())); Time max = Time::Max(); EXPECT_TRUE(max.IsMax()); EXPECT_EQ(max, Time::FromTimespec(max.ToTimespec())); } TEST(Time, Timeval) { Time null; EXPECT_TRUE(null.IsNull()); EXPECT_EQ(null, Time::FromTimeval(null.ToTimeval())); Time now = Time::Now(); EXPECT_EQ(now, Time::FromTimeval(now.ToTimeval())); Time now_sys = Time::NowFromSystemTime(); EXPECT_EQ(now_sys, Time::FromTimeval(now_sys.ToTimeval())); Time unix_epoch = Time::UnixEpoch(); EXPECT_EQ(unix_epoch, Time::FromTimeval(unix_epoch.ToTimeval())); Time max = Time::Max(); EXPECT_TRUE(max.IsMax()); EXPECT_EQ(max, Time::FromTimeval(max.ToTimeval())); } #endif #if V8_OS_WIN TEST(Time, Filetime) { Time null; EXPECT_TRUE(null.IsNull()); EXPECT_EQ(null, Time::FromFiletime(null.ToFiletime())); Time now = Time::Now(); EXPECT_EQ(now, Time::FromFiletime(now.ToFiletime())); Time now_sys = Time::NowFromSystemTime(); EXPECT_EQ(now_sys, Time::FromFiletime(now_sys.ToFiletime())); Time unix_epoch = Time::UnixEpoch(); EXPECT_EQ(unix_epoch, Time::FromFiletime(unix_epoch.ToFiletime())); Time max = Time::Max(); EXPECT_TRUE(max.IsMax()); EXPECT_EQ(max, Time::FromFiletime(max.ToFiletime())); } #endif namespace { template <typename T> static void ResolutionTest(T (*Now)(), TimeDelta target_granularity) { // We're trying to measure that intervals increment in a VERY small amount // of time -- according to the specified target granularity. Unfortunately, // if we happen to have a context switch in the middle of our test, the // context switch could easily exceed our limit. So, we iterate on this // several times. As long as we're able to detect the fine-granularity // timers at least once, then the test has succeeded. static const TimeDelta kExpirationTimeout = TimeDelta::FromSeconds(1); ElapsedTimer timer; timer.Start(); TimeDelta delta; do { T start = Now(); T now = start; // Loop until we can detect that the clock has changed. Non-HighRes timers // will increment in chunks, i.e. 15ms. By spinning until we see a clock // change, we detect the minimum time between measurements. do { now = Now(); delta = now - start; } while (now <= start); EXPECT_NE(static_cast<int64_t>(0), delta.InMicroseconds()); } while (delta > target_granularity && !timer.HasExpired(kExpirationTimeout)); EXPECT_LE(delta, target_granularity); } } // namespace TEST(Time, NowResolution) { // We assume that Time::Now() has at least 16ms resolution. static const TimeDelta kTargetGranularity = TimeDelta::FromMilliseconds(16); ResolutionTest<Time>(&Time::Now, kTargetGranularity); } TEST(TimeTicks, NowResolution) { // TimeTicks::Now() is documented as having "no worse than one microsecond" // resolution. Unless !TimeTicks::IsHighResolution() in which case the clock // could be as coarse as ~15.6ms. const TimeDelta kTargetGranularity = TimeTicks::IsHighResolution() ? TimeDelta::FromMicroseconds(1) : TimeDelta::FromMilliseconds(16); ResolutionTest<TimeTicks>(&TimeTicks::Now, kTargetGranularity); } TEST(TimeTicks, IsMonotonic) { TimeTicks previous_normal_ticks; TimeTicks previous_highres_ticks; ElapsedTimer timer; timer.Start(); while (!timer.HasExpired(TimeDelta::FromMilliseconds(100))) { TimeTicks normal_ticks = TimeTicks::Now(); TimeTicks highres_ticks = TimeTicks::HighResolutionNow(); EXPECT_GE(normal_ticks, previous_normal_ticks); EXPECT_GE((normal_ticks - previous_normal_ticks).InMicroseconds(), 0); EXPECT_GE(highres_ticks, previous_highres_ticks); EXPECT_GE((highres_ticks - previous_highres_ticks).InMicroseconds(), 0); previous_normal_ticks = normal_ticks; previous_highres_ticks = highres_ticks; } } namespace { void Sleep(TimeDelta wait_time) { ElapsedTimer waiter; waiter.Start(); while (!waiter.HasExpired(wait_time)) { OS::Sleep(TimeDelta::FromMilliseconds(1)); } } } // namespace TEST(ElapsedTimer, StartStop) { TimeDelta wait_time = TimeDelta::FromMilliseconds(100); TimeDelta noise = TimeDelta::FromMilliseconds(100); ElapsedTimer timer; DCHECK(!timer.IsStarted()); timer.Start(); DCHECK(timer.IsStarted()); Sleep(wait_time); TimeDelta delta = timer.Elapsed(); DCHECK(timer.IsStarted()); EXPECT_GE(delta, wait_time); EXPECT_LT(delta, wait_time + noise); DCHECK(!timer.IsPaused()); timer.Pause(); DCHECK(timer.IsPaused()); Sleep(wait_time); timer.Resume(); DCHECK(timer.IsStarted()); delta = timer.Elapsed(); DCHECK(!timer.IsPaused()); timer.Pause(); DCHECK(timer.IsPaused()); EXPECT_GE(delta, wait_time); EXPECT_LT(delta, wait_time + noise); Sleep(wait_time); timer.Resume(); DCHECK(!timer.IsPaused()); DCHECK(timer.IsStarted()); delta = timer.Elapsed(); EXPECT_GE(delta, wait_time); EXPECT_LT(delta, wait_time + noise); timer.Stop(); DCHECK(!timer.IsStarted()); } TEST(ElapsedTimer, StartStopArgs) { TimeDelta wait_time = TimeDelta::FromMilliseconds(100); ElapsedTimer timer1; ElapsedTimer timer2; DCHECK(!timer1.IsStarted()); DCHECK(!timer2.IsStarted()); TimeTicks now = TimeTicks::HighResolutionNow(); timer1.Start(now); timer2.Start(now); DCHECK(timer1.IsStarted()); DCHECK(timer2.IsStarted()); Sleep(wait_time); now = TimeTicks::HighResolutionNow(); TimeDelta delta1 = timer1.Elapsed(now); Sleep(wait_time); TimeDelta delta2 = timer2.Elapsed(now); DCHECK(timer1.IsStarted()); DCHECK(timer2.IsStarted()); EXPECT_GE(delta1, delta2); Sleep(wait_time); EXPECT_NE(delta1, timer2.Elapsed()); TimeTicks now2 = TimeTicks::HighResolutionNow(); EXPECT_NE(timer1.Elapsed(now), timer1.Elapsed(now2)); EXPECT_NE(delta1, timer1.Elapsed(now2)); EXPECT_NE(delta2, timer2.Elapsed(now2)); EXPECT_GE(timer1.Elapsed(now2), timer2.Elapsed(now2)); now = TimeTicks::HighResolutionNow(); timer1.Pause(now); timer2.Pause(now); DCHECK(timer1.IsPaused()); DCHECK(timer2.IsPaused()); Sleep(wait_time); now = TimeTicks::HighResolutionNow(); timer1.Resume(now); DCHECK(!timer1.IsPaused()); DCHECK(timer2.IsPaused()); Sleep(wait_time); timer2.Resume(now); DCHECK(!timer1.IsPaused()); DCHECK(!timer2.IsPaused()); DCHECK(timer1.IsStarted()); DCHECK(timer2.IsStarted()); delta1 = timer1.Elapsed(now); Sleep(wait_time); delta2 = timer2.Elapsed(now); EXPECT_GE(delta1, delta2); timer1.Stop(); timer2.Stop(); DCHECK(!timer1.IsStarted()); DCHECK(!timer2.IsStarted()); } #if V8_OS_ANDROID #define MAYBE_ThreadNow DISABLED_ThreadNow #else #define MAYBE_ThreadNow ThreadNow #endif TEST(ThreadTicks, MAYBE_ThreadNow) { if (ThreadTicks::IsSupported()) { ThreadTicks::WaitUntilInitialized(); TimeTicks end, begin = TimeTicks::Now(); ThreadTicks end_thread, begin_thread = ThreadTicks::Now(); TimeDelta delta; // Make sure that ThreadNow value is non-zero. EXPECT_GT(begin_thread, ThreadTicks()); int iterations_count = 0; // Some systems have low resolution thread timers, this code makes sure // that thread time has progressed by at least one tick. // Limit waiting to 10ms to prevent infinite loops. while (ThreadTicks::Now() == begin_thread && ((TimeTicks::Now() - begin).InMicroseconds() < 10000)) { } EXPECT_GT(ThreadTicks::Now(), begin_thread); do { // Sleep for 10 milliseconds to get the thread de-scheduled. OS::Sleep(base::TimeDelta::FromMilliseconds(10)); end_thread = ThreadTicks::Now(); end = TimeTicks::Now(); delta = end - begin; EXPECT_LE(++iterations_count, 2); // fail after 2 attempts. } while (delta.InMicroseconds() < 10000); // Make sure that the OS did sleep for at least 10 ms. TimeDelta delta_thread = end_thread - begin_thread; // Make sure that some thread time have elapsed. EXPECT_GT(delta_thread.InMicroseconds(), 0); // But the thread time is at least 9ms less than clock time. TimeDelta difference = delta - delta_thread; EXPECT_GE(difference.InMicroseconds(), 9000); } } #if V8_OS_WIN TEST(TimeTicks, TimerPerformance) { // Verify that various timer mechanisms can always complete quickly. // Note: This is a somewhat arbitrary test. const int kLoops = 10000; using TestFunc = TimeTicks (*)(); struct TestCase { TestFunc func; const char *description; }; // Cheating a bit here: assumes sizeof(TimeTicks) == sizeof(Time) // in order to create a single test case list. static_assert(sizeof(TimeTicks) == sizeof(Time), "TimeTicks and Time must be the same size"); std::vector<TestCase> cases; cases.push_back({reinterpret_cast<TestFunc>(&Time::Now), "Time::Now"}); cases.push_back({&TimeTicks::Now, "TimeTicks::Now"}); if (ThreadTicks::IsSupported()) { ThreadTicks::WaitUntilInitialized(); cases.push_back( {reinterpret_cast<TestFunc>(&ThreadTicks::Now), "ThreadTicks::Now"}); } for (const auto& test_case : cases) { TimeTicks start = TimeTicks::Now(); for (int index = 0; index < kLoops; index++) test_case.func(); TimeTicks stop = TimeTicks::Now(); // Turning off the check for acceptable delays. Without this check, // the test really doesn't do much other than measure. But the // measurements are still useful for testing timers on various platforms. // The reason to remove the check is because the tests run on many // buildbots, some of which are VMs. These machines can run horribly // slow, and there is really no value for checking against a max timer. // const int kMaxTime = 35; // Maximum acceptable milliseconds for test. // EXPECT_LT((stop - start).InMilliseconds(), kMaxTime); printf("%s: %1.2fus per call\n", test_case.description, (stop - start).InMillisecondsF() * 1000 / kLoops); } } #endif // V8_OS_WIN } // namespace base } // namespace v8
C++
5
EXHades/v8
test/unittests/base/platform/time-unittest.cc
[ "BSD-3-Clause" ]
# # program needs: # DONE miniseed2days BH and LH data # DONE miniseed2days VH, UH, and SOH data into year files # DONE miniseed2db into one db # DONE attach dbmaster, dbops, and idserver # DONE verify if start and endtimes match deployment table # # DONE idservers dbpath locking # DONE net-sta chec check # DONE check to make sure correct channels are in file # # check for overlaps # # check for pffile existance # # use Getopt::Std ; use strict ; use Datascope ; use archive ; use timeslice ; use utilfunct ; use orb ; our ( $pgm, $host ); our ( $opt_v, $opt_V, $opt_m, $opt_n, $opt_p ); { # Main program my ( $Pf, $bhname, $cmd, $dbavail, $dbdevice, $dbname, $dirname, $etime, $fsta, $line ) ; my ( $maxtime, $maxtime_baler, $maxtime_rt, $mintime, $mintime_baler, $mintime_rt, $mseedfile ) ; my ( $nrows, $prob, $prob_check, $problems, $row, $rtdb, $snet, $sohname, $sta, $sta_base ) ; my ( $sta_size, $statmp, $stime, $subject, $table, $usage ) ; my ( @db, @dbbh, @dbrt, @dbsnet, @dbtest, @dbwfdisc, @mseedfiles ) ; my ( %pf ) ; $pgm = $0 ; $pgm =~ s".*/"" ; elog_init( $pgm, @ARGV) ; $cmd = "\n$0 @ARGV" ; if ( ! getopts('vVnm:p:') || @ARGV < 1 ) { $usage = "\n\n\nUsage: $0 \n [-v] [-V] [-n] \n" ; $usage .= " [-p pf] [-m mail_to] \n" ; $usage .= " sta [sta_1 sta_2 ...]\n\n" ; elog_notify($cmd) ; elog_die ( $usage ) ; } &savemail() if $opt_m ; elog_notify($cmd) ; $stime = strydtime(now()); chop ($host = `uname -n` ) ; elog_notify ("\nstarting execution on $host $stime\n\n"); $Pf = $opt_p || $pgm ; $opt_v = defined($opt_V) ? $opt_V : $opt_v ; %pf = getparam( $Pf ); if (system_check(0)) { $subject = "Problems - $pgm $host Ran out of system resources"; &sendmail($subject, $opt_m) if $opt_m ; elog_die("\n$subject"); } $problems = 0; # subset for unprocessed data # # process all new stations # $table = "wfdisc"; foreach $sta ( sort ( @ARGV ) ) { $stime = strydtime( now() ); ( $dbdevice, $dbavail ) = &df( $pf{archivebase} ); $sta_base = "$pf{balerdirbase}\/$sta"; $sta_size = `du -sk $sta_base` ; $sta_size =~ /^(\d+)/ ; $sta_size = ( $sta_size / 1024 ) + (2 * 1024) ; # make sure 2 Gbytes free space if ($dbavail < $sta_size ) { $problems++ ; elog_complain( "Problem #$problems" ); elog_complain( sprintf( "Only %d available on $pf{archivebase} ", $dbavail) ); elog_complain( sprintf( "Need %d megabytes available ", $sta_size) ); $subject = "Problems - $pgm $host $problems problems" ; &sendmail($subject, $opt_m) if $opt_m ; elog_die("\n$subject") ; } elog_notify ("\nstarting processing station $sta\n\n"); # # perform existance checks # $prob_check = $problems ; $bhname = "$pf{balerdirbase}\/$sta\/$pf{bhdata_dir}"; $sohname = "$pf{balerdirbase}\/$sta\/$pf{sohdata_dir}"; elog_notify("bhname $bhname sohname $sohname") if $opt_v ; if (! -d $bhname ) { $problems++ ; elog_complain("\nProblem $problems \n directory $bhname does not exist \n Skipping to next station"); } if ( ! -d $sohname ) { $problems++ ; elog_complain("\nProblem $problems \n directory $sohname does not exist \n Skipping to next station"); } $dirname = "$pf{archivebase}\/$sta"; $dbname = "$pf{archivebase}\/$sta\/$sta"; elog_notify("dirname $dirname dbname $dbname") if $opt_v ; if (-d $dbname || -e "$dbname.$table") { @dbtest = dbopen($dbname,"r") ; @dbtest = dblookup(@dbtest,0,"$table",0,0) ; if (dbquery(@dbtest,dbTABLE_PRESENT)) { $problems++ ; elog_complain("\nProblem $problems \n database $dbname.$table already exists! \n Skipping to next station") ; } dbclose(@dbtest); } $rtdb = "$pf{rt_sta_dir}\/$sta/$sta"; elog_notify("rtdb $rtdb ") if $opt_v ; if ( ! -f $rtdb ) { $problems++ ; elog_complain("\nProblem $problems \n station rt data db $rtdb does not exist \n Skipping to next station"); } next if ($prob_check != $problems); # # make output directory # makedir($dirname); chdir($dirname); elog_notify("\nChanged directory to $dirname") if $opt_v ; # # build station-channel-day seed files from baler final seismic miniseed directory # opendir( DIR, $bhname ); @mseedfiles = grep { /C.*\.bms.*/ } readdir(DIR); closedir( DIR ); if ($#mseedfiles == -1 ) { $problems++ ; elog_complain("\nProblem $problems \n $dbname has no '.*bms.*' files in $bhname! \n Skipping to next station") ; next; } foreach $mseedfile (@mseedfiles) { $cmd = "miniseed2days -c -U -m \".*_.*_[BL]H._.*\" "; $cmd .= "-v " if $opt_V; $cmd .= " - < $bhname/$mseedfile "; if ( ! &run_cmd( $cmd ) ) { $problems++ ; } } # # build station-channel-year seed files from baler final soh, VH, UH miniseed directory # opendir( DIR, $sohname ); @mseedfiles = grep { /C.*\.bms.*/ } readdir(DIR); closedir( DIR ); if ($#mseedfiles == -1 ) { $problems++ ; elog_complain("\nProblem $problems \n $dbname has no '.*bms.*' files in $sohname! \n Skipping to next station") ; next; } foreach $mseedfile (@mseedfiles) { $cmd = "miniseed2days -c -U -r \".*_.*_[BHL]H[ZNE12]_.*\" -w %Y/%{net}_%{sta}_%{chan}.msd "; $cmd .= "-v " if $opt_V; $cmd .= " - < $sohname/$mseedfile "; if ( ! &run_cmd( $cmd ) ) { $problems++ ; } } # # run miniseed2db for all baler data. set miniseed_segment_seconds=0 to remove one day wfdisc # default in miniseed2db # unlink($sta) if (-e $sta); open( TR, ">trdefaults.pf" ); print TR "miniseed_segment_seconds 0\n"; close( TR ); $cmd = "miniseed2db "; $cmd .= "-v " if $opt_V; $cmd .= "20\*/[0-3][0-9][0-9] $sta "; if ( ! &run_cmd( $cmd ) ) { $problems++ ; } $cmd = "miniseed2db -T 0.001 "; $cmd .= "-v " if $opt_V; $cmd .= "20\*/\*.msd $sta "; if ( ! &run_cmd( $cmd ) ) { $problems++ ; } unlink("trdefaults.pf"); # # Clean up final station wfdsic # $cmd = "dbsubset $sta.wfdisc \"$pf{wfclean}\" | dbdelete -"; if ( ! &run_cmd( $cmd ) ) { $problems++ ; } # # Check for anomolous net and sta # $prob = 0; open(PROB,"> /tmp/prob_$sta\_$$"); @db = dbopen( $sta, 'r' ); @dbsnet = dblookup( @db, 0, "snetsta", 0, 0 ); $nrows = dbquery( @dbsnet, "dbRECORD_COUNT" ); if ($nrows > 1) { $line = "\nDatabase problem\n $sta database has $nrows unique net-sta pairs"; elog_complain($line); print PROB "$line\n"; for ($row = 0; $row<$nrows; $row++) { $dbsnet[3] = $row; ($snet,$fsta,$statmp) = dbgetv(@dbsnet,"snet","fsta","sta"); $line = " snet $snet fsta $fsta sta $statmp"; elog_complain($line) ; print PROB "$line\n"; } $prob++; } unlink("$sta"); unlink("$sta.lastid"); # # Set up descriptor file # &cssdescriptor ( $sta, $pf{dbpath}, $pf{dblocks}, $pf{dbidserver} ) unless $opt_n; # # Find start time and end times # unless ($opt_n) { @dbwfdisc = dblookup( @db, 0, "wfdisc", 0, 0); @dbbh = dbsubset( @dbwfdisc, "sta =~/$sta/ && chan =~ /[BL]H[ZNE]/"); if (dbquery( @dbbh, "dbRECORD_COUNT" ) == 0 ) { $problems++ ; elog_complain("\nProblem $problems \n $dbname\.wfdisc has no chan =~ /[BL]H[ZNE]/! \n Skipping to next station") ; next; } $mintime_baler = dbex_eval( @dbbh, "min(time)" ) ; $maxtime_baler = dbex_eval( @dbbh, "max(endtime)" ) ; elog_notify(sprintf("Baler times %s %s", strydtime( $mintime_baler ), strydtime( $maxtime_baler ))); @dbrt = dbopen ( $rtdb, "r" ) ; @dbrt = dblookup ( @dbrt, 0, "wfdisc", 0, 0 ) ; $mintime_rt = dbex_eval( @dbrt, "min(time)" ) ; $maxtime_rt = dbex_eval( @dbrt, "max(endtime)" ) ; dbclose( @dbrt ) ; elog_notify(sprintf("Rt times %s %s", strydtime( $mintime_rt ), strydtime( $maxtime_rt ))); $mintime = $mintime_baler ; $maxtime = $maxtime_baler ; $mintime = $mintime_rt if ( $mintime_rt < $mintime ) ; $maxtime = $maxtime_rt if ( $maxtime_rt > $maxtime ) ; $maxtime = epoch( yearday( $maxtime + 86400 ) ) if ($maxtime > epoch( yearday( $maxtime ) ) ) ; } dbclose( @db ) ; $stime = strtime( $mintime ) ; $etime = strtime( $maxtime ) ; # # Check for anomolous channels # $prob = unwanted_channels($sta,$prob) unless $opt_n; # # identify gaps in baler seismic data # $cmd = "rt_daily_return "; $cmd .= "-v " if $opt_V ; $cmd .= "-t \"$stime\" -e \"$etime\" "; $cmd .= "-s \"sta =~/$sta/ && chan=~/[BL]H./\" $dbname $dbname"; if ( ! &run_cmd( $cmd ) ) { $problems++ ; } # # evaluate data return # ( $prob, $problems ) = eval_data_return ( $sta, $prob, $problems ) unless $opt_n; close(PROB); # # clean up # $subject = "TA $sta baler data net, station, channel problem"; $cmd = "rtmail -C -s '$subject' $pf{prob_mail} < /tmp/prob_$sta\_$$"; if ( ! &run_cmd( $cmd ) ) { $problems++ ; } if ( -d "$pf{balerprocbase}\/$sta" ) { $prob++ ; $problems++ ; elog_complain("\nProblem $problems \n $pf{balerprocbase}\/$sta already exists"); } $cmd = "mv $pf{balerdirbase}\/$sta $pf{balerprocbase}"; if ( ! &run_cmd( $cmd ) ) { $problems++ ; } unlink "/tmp/$sta\_return_$$" unless $opt_V; unlink "/tmp/tmp_miniseed2db\_$$" unless $opt_V; unlink "/tmp/prob_$sta\_$$" unless $opt_V; } $stime = strydtime(now()); elog_notify ("completed successfully $stime\n\n"); if ($problems == 0 ) { $subject = sprintf("Success $pgm $host"); elog_notify ($subject); &sendmail ( $subject, $opt_m ) if $opt_m ; } else { $subject = "Problems - $pgm $host $problems problems" ; &sendmail($subject, $opt_m) if $opt_m ; elog_die("\n$subject") ; } exit(0); } sub unwanted_channels { # $prob = unwanted_channels( $sta, $prob ); my ( $sta, $prob ) = @_ ; my ( $chantmp, $fchan, $line, $nrows, $row, $statmp ) ; my ( @db, @dbschan, @dbsensor, @dbwfdisc ); @db = dbopen( $sta, 'r' ); @dbschan = dblookup( @db, 0, "schanloc", 0, 0 ); @dbschan = dbsubset( @dbschan, "chan !~ /UH./" ); @dbsensor = dblookup( @db, 0, "sensor", 0, 0 ); @dbwfdisc = dblookup( @db, 0, "wfdisc", 0, 0 ); @dbschan = dbjoin( @dbschan, @dbwfdisc ); @dbschan = dbseparate( @dbschan, "schanloc" ); @dbschan = dbnojoin( @dbschan, @dbsensor ); $nrows = dbquery( @dbschan, "dbRECORD_COUNT" ); if ($nrows > 0) { $line = "\nDatabase problem\n $sta schanloc has $nrows channels which do not join with sensor table"; elog_complain($line); print PROB "$line\n"; for ($row = 0; $row<$nrows; $row++) { $dbschan[3] = $row; ( $statmp, $fchan, $chantmp) = dbgetv( @dbschan, "sta", "fchan", "chan" ); $line = " sta $statmp fchan $fchan chan $chantmp"; elog_complain( $line ) ; print PROB "$line\n"; $prob++; } } dbclose(@db); unlink( "$sta.snetsta" ); unlink( "$sta.schanloc" ); return ($prob); } sub eval_data_return { # $prob = eval_data_return ( $sta, $prob, $problems ) ; my ( $sta, $prob, $problems ) = @_ ; my ( $chan, $endtime, $line, $time ) ; my ( @db, @dbcd, @dbchanperf, @dbdeploy ) ; my ( %staperf ); %staperf = (); elog_notify(" "); $staperf{max_ave_perf} = 0; $staperf{max_nperfdays} = 0; $staperf{max_datadays} = 0; @db = dbopen( $sta, "r" ); @dbdeploy = dblookup( @db, 0, "deployment", 0, 0 ); @dbdeploy = dbsubset( @dbdeploy, "sta=~/$sta/" ); if (! dbquery( @dbdeploy, "dbRECORD_COUNT" ) ) { $prob++; $problems++; $line = "$sta does not exist in deployment table!"; elog_notify(" $line"); print PROB "$line\n" ; return ($prob,$problems); } $dbdeploy[3] = 0; ( $time, $endtime ) = dbgetv( @dbdeploy, "time", "endtime" ); $staperf{deploy_days} = int( $endtime/86400 ) - int( $time/86400. ) ; @db = dblookup( @db, 0, "chanperf", 0, 0 ); if (! dbquery( @db, "dbTABLE_PRESENT" ) ) { $prob++; $problems++; $line = "$sta\.chanperf table has no records!"; elog_notify(" $line"); print PROB "$line\n" ; return ( $prob, $problems ); } foreach $chan (qw( BHZ BHN BHE LHZ LHN LHE)) { @dbchanperf = dbsubset( @db, "chan =~ /$chan/" ); @dbcd = dbsubset( @dbchanperf, "perf > 0.0" ); $staperf{$chan}{days} = dbquery( @dbcd, "dbRECORD_COUNT" ); $staperf{max_datadays} = $staperf{$chan}{days} if ($staperf{$chan}{days} > $staperf{max_datadays}); if ($staperf{$chan}{days} == 0.0) { $staperf{$chan}{ave_perf} = 0.0; } else { $staperf{$chan}{ave_perf} = (dbex_eval(@dbchanperf,"sum(perf)"))/$staperf{$chan}{days}; } $staperf{max_ave_perf} = $staperf{$chan}{ave_perf} if ($staperf{$chan}{ave_perf} > $staperf{max_ave_perf}); @dbchanperf = dbsubset( @dbchanperf, "perf == 100." ); $staperf{$chan}{nperfdays} = dbquery( @dbchanperf, "dbRECORD_COUNT" ); $staperf{max_nperfdays} = $staperf{$chan}{nperfdays} if ($staperf{$chan}{nperfdays} > $staperf{max_nperfdays}) ; $line = sprintf("%s %s %4d days with 100%% data return with %5.1f%% average daily data return on days with data", $sta, $chan, $staperf{$chan}{nperfdays}, $staperf{$chan}{ave_perf} ); elog_notify(" $line"); print PROB "$line\n" ; } dbclose(@db); $line = sprintf("maximimum average data return on seismic channels is %5.1f%% - desire 95%% or better", $staperf{max_ave_perf}); if ($staperf{max_ave_perf} < 95.) { $prob++; print PROB "\n$line\n" ; $problems++ ; elog_complain("\nProblem $problems \n $line"); } else { elog_notify("\n $line\n\n"); } $staperf{deploy_days} = 0.1 if ($staperf{deploy_days} < 0.1) ; $line = sprintf("%s %4d deployment days %4d days with data return %5.1f%% of possible days\n Check deployment table", $sta, $staperf{deploy_days}, $staperf{max_datadays}, (100*$staperf{max_datadays}/$staperf{deploy_days})); if ( ( $staperf{deploy_days} * 1.05) < $staperf{max_datadays} ) { # Don't worry if within 5% $prob++; print PROB "\n$line\n" ; $problems++ ; elog_complain("\nProblem $problems \n $line"); } else { elog_notify("\n $line\n\n"); } %staperf = (); return ($prob,$problems); }
XProc
4
jreyes1108/antelope_contrib
bin/usarray/sta_final_prep/sta_final_prep.xpl
[ "BSD-2-Clause", "MIT" ]
frequency,raw 20.00,-5.30 20.20,-5.29 20.40,-5.29 20.61,-5.29 20.81,-5.24 21.02,-5.24 21.23,-5.24 21.44,-5.20 21.66,-5.20 21.87,-5.17 22.09,-5.16 22.31,-5.16 22.54,-5.16 22.76,-5.12 22.99,-5.11 23.22,-5.11 23.45,-5.08 23.69,-5.06 23.92,-5.03 24.16,-4.98 24.40,-4.95 24.65,-4.92 24.89,-4.90 25.14,-4.87 25.39,-4.85 25.65,-4.85 25.91,-4.82 26.16,-4.81 26.43,-4.77 26.69,-4.75 26.96,-4.72 27.23,-4.68 27.50,-4.64 27.77,-4.64 28.05,-4.61 28.33,-4.59 28.62,-4.59 28.90,-4.64 29.19,-4.64 29.48,-4.67 29.78,-4.68 30.08,-4.71 30.38,-4.72 30.68,-4.72 30.99,-4.72 31.30,-4.70 31.61,-4.67 31.93,-4.64 32.24,-4.61 32.57,-4.58 32.89,-4.55 33.22,-4.51 33.55,-4.47 33.89,-4.44 34.23,-4.39 34.57,-4.38 34.92,-4.35 35.27,-4.36 35.62,-4.38 35.97,-4.38 36.33,-4.39 36.70,-4.40 37.06,-4.38 37.43,-4.38 37.81,-4.38 38.19,-4.38 38.57,-4.38 38.95,-4.40 39.34,-4.40 39.74,-4.40 40.14,-4.42 40.54,-4.42 40.94,-4.42 41.35,-4.42 41.76,-4.42 42.18,-4.42 42.60,-4.42 43.03,-4.38 43.46,-4.38 43.90,-4.38 44.33,-4.33 44.78,-4.33 45.23,-4.31 45.68,-4.29 46.13,-4.26 46.60,-4.25 47.06,-4.25 47.53,-4.23 48.01,-4.20 48.49,-4.20 48.97,-4.16 49.46,-4.16 49.96,-4.16 50.46,-4.14 50.96,-4.15 51.47,-4.16 51.99,-4.16 52.51,-4.16 53.03,-4.16 53.56,-4.17 54.10,-4.18 54.64,-4.18 55.18,-4.17 55.74,-4.16 56.29,-4.16 56.86,-4.16 57.42,-4.12 58.00,-4.12 58.58,-4.12 59.16,-4.07 59.76,-4.07 60.35,-4.03 60.96,-4.03 61.57,-4.00 62.18,-3.99 62.80,-3.99 63.43,-3.95 64.07,-3.94 64.71,-3.94 65.35,-3.94 66.01,-3.90 66.67,-3.90 67.33,-3.90 68.01,-3.90 68.69,-3.90 69.37,-3.87 70.07,-3.86 70.77,-3.86 71.48,-3.86 72.19,-3.86 72.91,-3.86 73.64,-3.84 74.38,-3.83 75.12,-3.81 75.87,-3.81 76.63,-3.81 77.40,-3.81 78.17,-3.81 78.95,-3.81 79.74,-3.81 80.54,-3.81 81.35,-3.81 82.16,-3.79 82.98,-3.79 83.81,-3.79 84.65,-3.77 85.50,-3.77 86.35,-3.77 87.22,-3.77 88.09,-3.77 88.97,-3.77 89.86,-3.77 90.76,-3.77 91.66,-3.77 92.58,-3.77 93.51,-3.77 94.44,-3.77 95.39,-3.77 96.34,-3.77 97.30,-3.77 98.28,-3.77 99.26,-3.77 100.25,-3.77 101.25,-3.77 102.27,-3.77 103.29,-3.77 104.32,-3.77 105.37,-3.77 106.42,-3.77 107.48,-3.77 108.56,-3.77 109.64,-3.77 110.74,-3.77 111.85,-3.77 112.97,-3.77 114.10,-3.77 115.24,-3.77 116.39,-3.77 117.55,-3.77 118.73,-3.77 119.92,-3.77 121.12,-3.77 122.33,-3.77 123.55,-3.77 124.79,-3.75 126.03,-3.75 127.29,-3.74 128.57,-3.73 129.85,-3.73 131.15,-3.73 132.46,-3.73 133.79,-3.73 135.12,-3.73 136.48,-3.73 137.84,-3.73 139.22,-3.73 140.61,-3.70 142.02,-3.69 143.44,-3.68 144.87,-3.68 146.32,-3.68 147.78,-3.68 149.26,-3.68 150.75,-3.68 152.26,-3.68 153.78,-3.68 155.32,-3.68 156.88,-3.68 158.44,-3.67 160.03,-3.66 161.63,-3.64 163.24,-3.64 164.88,-3.64 166.53,-3.64 168.19,-3.64 169.87,-3.64 171.57,-3.64 173.29,-3.64 175.02,-3.64 176.77,-3.64 178.54,-3.64 180.32,-3.64 182.13,-3.62 183.95,-3.60 185.79,-3.60 187.65,-3.60 189.52,-3.60 191.42,-3.60 193.33,-3.60 195.27,-3.60 197.22,-3.60 199.19,-3.60 201.18,-3.58 203.19,-3.57 205.23,-3.55 207.28,-3.55 209.35,-3.55 211.44,-3.55 213.56,-3.55 215.69,-3.55 217.85,-3.55 220.03,-3.55 222.23,-3.53 224.45,-3.51 226.70,-3.51 228.96,-3.51 231.25,-3.51 233.57,-3.51 235.90,-3.51 238.26,-3.51 240.64,-3.51 243.05,-3.51 245.48,-3.51 247.93,-3.51 250.41,-3.49 252.92,-3.49 255.45,-3.49 258.00,-3.49 260.58,-3.49 263.19,-3.47 265.82,-3.47 268.48,-3.47 271.16,-3.47 273.87,-3.47 276.61,-3.47 279.38,-3.47 282.17,-3.47 284.99,-3.47 287.84,-3.49 290.72,-3.49 293.63,-3.51 296.57,-3.51 299.53,-3.51 302.53,-3.51 305.55,-3.51 308.61,-3.51 311.69,-3.51 314.81,-3.51 317.96,-3.51 321.14,-3.51 324.35,-3.51 327.59,-3.51 330.87,-3.51 334.18,-3.51 337.52,-3.51 340.90,-3.51 344.30,-3.47 347.75,-3.47 351.23,-3.46 354.74,-3.42 358.28,-3.42 361.87,-3.38 365.49,-3.36 369.14,-3.34 372.83,-3.30 376.56,-3.29 380.33,-3.25 384.13,-3.24 387.97,-3.21 391.85,-3.16 395.77,-3.15 399.73,-3.12 403.72,-3.09 407.76,-3.08 411.84,-3.03 415.96,-3.02 420.12,-2.99 424.32,-2.95 428.56,-2.93 432.85,-2.90 437.18,-2.86 441.55,-2.82 445.96,-2.79 450.42,-2.76 454.93,-2.73 459.48,-2.70 464.07,-2.67 468.71,-2.64 473.40,-2.60 478.13,-2.58 482.91,-2.56 487.74,-2.52 492.62,-2.49 497.55,-2.47 502.52,-2.43 507.55,-2.42 512.62,-2.38 517.75,-2.38 522.93,-2.34 528.16,-2.34 533.44,-2.30 538.77,-2.30 544.16,-2.26 549.60,-2.25 555.10,-2.25 560.65,-2.21 566.25,-2.21 571.92,-2.21 577.64,-2.17 583.41,-2.17 589.25,-2.12 595.14,-2.12 601.09,-2.08 607.10,-2.06 613.17,-2.04 619.30,-2.00 625.50,-1.97 631.75,-1.95 638.07,-1.91 644.45,-1.88 650.89,-1.86 657.40,-1.82 663.98,-1.82 670.62,-1.78 677.32,-1.78 684.10,-1.76 690.94,-1.73 697.85,-1.73 704.83,-1.70 711.87,-1.69 718.99,-1.69 726.18,-1.65 733.44,-1.64 740.78,-1.60 748.19,-1.58 755.67,-1.53 763.23,-1.49 770.86,-1.42 778.57,-1.35 786.35,-1.26 794.22,-1.20 802.16,-1.09 810.18,-0.99 818.28,-0.93 826.46,-0.83 834.73,-0.77 843.08,-0.68 851.51,-0.61 860.02,-0.54 868.62,-0.48 877.31,-0.41 886.08,-0.37 894.94,-0.32 903.89,-0.28 912.93,-0.24 922.06,-0.19 931.28,-0.16 940.59,-0.13 950.00,-0.09 959.50,-0.05 969.09,-0.04 978.78,0.00 988.57,0.00 998.46,0.00 1008.44,0.00 1018.53,0.00 1028.71,0.00 1039.00,0.00 1049.39,-0.04 1059.88,-0.07 1070.48,-0.10 1081.19,-0.15 1092.00,-0.19 1102.92,-0.26 1113.95,-0.33 1125.09,-0.40 1136.34,-0.48 1147.70,-0.57 1159.18,-0.66 1170.77,-0.77 1182.48,-0.87 1194.30,-0.97 1206.25,-1.08 1218.31,-1.18 1230.49,-1.28 1242.80,-1.36 1255.22,-1.43 1267.78,-1.47 1280.45,-1.47 1293.26,-1.47 1306.19,-1.47 1319.25,-1.46 1332.45,-1.41 1345.77,-1.36 1359.23,-1.30 1372.82,-1.26 1386.55,-1.26 1400.41,-1.26 1414.42,-1.26 1428.56,-1.21 1442.85,-1.21 1457.28,-1.21 1471.85,-1.21 1486.57,-1.26 1501.43,-1.26 1516.45,-1.26 1531.61,-1.26 1546.93,-1.30 1562.40,-1.30 1578.02,-1.34 1593.80,-1.34 1609.74,-1.35 1625.84,-1.39 1642.10,-1.39 1658.52,-1.41 1675.10,-1.43 1691.85,-1.43 1708.77,-1.43 1725.86,-1.43 1743.12,-1.47 1760.55,-1.49 1778.15,-1.52 1795.94,-1.54 1813.90,-1.56 1832.03,-1.57 1850.36,-1.60 1868.86,-1.60 1887.55,-1.60 1906.42,-1.59 1925.49,-1.56 1944.74,-1.50 1964.19,-1.45 1983.83,-1.40 2003.67,-1.33 2023.71,-1.25 2043.94,-1.17 2064.38,-1.07 2085.03,-0.97 2105.88,-0.86 2126.94,-0.76 2148.20,-0.66 2169.69,-0.57 2191.38,-0.45 2213.30,-0.35 2235.43,-0.22 2257.78,-0.12 2280.36,0.02 2303.17,0.13 2326.20,0.26 2349.46,0.36 2372.95,0.48 2396.68,0.61 2420.65,0.71 2444.86,0.81 2469.31,0.92 2494.00,1.02 2518.94,1.12 2544.13,1.23 2569.57,1.35 2595.27,1.48 2621.22,1.58 2647.43,1.68 2673.90,1.80 2700.64,1.93 2727.65,2.01 2754.93,2.12 2782.48,2.22 2810.30,2.28 2838.40,2.36 2866.79,2.43 2895.46,2.49 2924.41,2.51 2953.65,2.56 2983.19,2.52 3013.02,2.51 3043.15,2.46 3073.58,2.40 3104.32,2.32 3135.36,2.24 3166.72,2.14 3198.38,2.03 3230.37,1.91 3262.67,1.79 3295.30,1.66 3328.25,1.51 3361.53,1.37 3395.15,1.22 3429.10,1.03 3463.39,0.87 3498.03,0.65 3533.01,0.45 3568.34,0.22 3604.02,-0.01 3640.06,-0.27 3676.46,-0.53 3713.22,-0.79 3750.36,-1.06 3787.86,-1.32 3825.74,-1.59 3864.00,-1.88 3902.64,-2.17 3941.66,-2.47 3981.08,-2.80 4020.89,-3.12 4061.10,-3.45 4101.71,-3.78 4142.73,-4.10 4184.15,-4.40 4226.00,-4.66 4268.26,-4.90 4310.94,-5.09 4354.05,-5.22 4397.59,-5.34 4441.56,-5.40 4485.98,-5.42 4530.84,-5.36 4576.15,-5.28 4621.91,-5.18 4668.13,-5.05 4714.81,-4.87 4761.96,-4.68 4809.58,-4.45 4857.67,-4.18 4906.25,-3.89 4955.31,-3.60 5004.87,-3.28 5054.91,-3.01 5105.46,-2.73 5156.52,-2.51 5208.08,-2.33 5260.16,-2.20 5312.77,-2.10 5365.89,-2.09 5419.55,-2.14 5473.75,-2.26 5528.49,-2.38 5583.77,-2.52 5639.61,-2.66 5696.00,-2.76 5752.96,-2.84 5810.49,-2.86 5868.60,-2.80 5927.28,-2.68 5986.56,-2.50 6046.42,-2.29 6106.89,-2.03 6167.96,-1.78 6229.64,-1.52 6291.93,-1.33 6354.85,-1.18 6418.40,-1.22 6482.58,-1.40 6547.41,-1.68 6612.88,-2.09 6679.01,-2.54 6745.80,-3.02 6813.26,-3.53 6881.39,-4.01 6950.21,-4.38 7019.71,-4.63 7089.91,-4.79 7160.81,-4.68 7232.41,-4.49 7304.74,-4.24 7377.79,-3.95 7451.56,-3.66 7526.08,-3.40 7601.34,-3.17 7677.35,-3.01 7754.13,-3.09 7831.67,-3.31 7909.98,-3.64 7989.08,-4.12 8068.98,-4.71 8149.67,-5.45 8231.16,-6.32 8313.47,-7.34 8396.61,-8.48 8480.57,-9.68 8565.38,-10.83 8651.03,-11.92 8737.54,-12.86 8824.92,-13.61 8913.17,-14.22 9002.30,-14.66 9092.32,-14.99 9183.25,-15.42 9275.08,-15.91 9367.83,-16.53 9461.51,-16.92 9556.12,-17.22 9651.68,-16.49 9748.20,-15.67 9845.68,-14.31 9944.14,-12.92 10043.58,-11.62 10144.02,-10.49 10245.46,-9.59 10347.91,-9.00 10451.39,-8.61 10555.91,-8.64 10661.46,-8.96 10768.08,-9.43 10875.76,-10.00 10984.52,-10.60 11094.36,-11.12 11205.31,-11.44 11317.36,-11.48 11430.53,-11.19 11544.84,-10.83 11660.29,-10.41 11776.89,-10.04 11894.66,-9.60 12013.60,-9.12 12133.74,-8.54 12255.08,-7.87 12377.63,-7.17 12501.41,-6.55 12626.42,-6.09 12752.68,-5.82 12880.21,-5.99 13009.01,-6.37 13139.10,-6.88 13270.49,-7.45 13403.20,-7.93 13537.23,-8.25 13672.60,-8.10 13809.33,-7.57 13947.42,-6.75 14086.90,-5.77 14227.77,-4.73 14370.04,-3.88 14513.74,-3.33 14658.88,-3.17 14805.47,-3.57 14953.52,-4.06 15103.06,-4.60 15254.09,-5.01 15406.63,-5.04 15560.70,-4.64 15716.30,-4.09 15873.47,-3.51 16032.20,-2.95 16192.52,-2.58 16354.45,-2.54 16517.99,-2.82 16683.17,-3.18 16850.01,-3.62 17018.51,-4.07 17188.69,-4.49 17360.58,-4.90 17534.18,-5.28 17709.53,-5.64 17886.62,-5.90 18065.49,-6.09 18246.14,-6.13 18428.60,-6.07 18612.89,-5.94 18799.02,-6.02 18987.01,-6.27 19176.88,-6.66 19368.65,-7.16 19562.33,-7.73 19757.96,-8.31 19955.54,-8.69
CSV
0
vinzmc/AutoEq
measurements/oratory1990/data/onear/Audeze LCD-4/Audeze LCD-4.csv
[ "MIT" ]
# Copyright 2019 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. cdef class CallbackFailureHandler: cdef str _core_function_name cdef object _error_details cdef object _exception_type cdef handle(self, object future) cdef struct CallbackContext: # C struct to store callback context in the form of pointers. # # Attributes: # functor: A grpc_completion_queue_functor represents the # callback function in the only way Core understands. # waiter: An asyncio.Future object that fulfills when the callback is # invoked by Core. # failure_handler: A CallbackFailureHandler object that called when Core # returns 'success == 0' state. # wrapper: A self-reference to the CallbackWrapper to help life cycle # management. grpc_completion_queue_functor functor cpython.PyObject *waiter cpython.PyObject *loop cpython.PyObject *failure_handler cpython.PyObject *callback_wrapper cdef class CallbackWrapper: cdef CallbackContext context cdef object _reference_of_future cdef object _reference_of_failure_handler @staticmethod cdef void functor_run( grpc_completion_queue_functor* functor, int succeed) cdef grpc_completion_queue_functor *c_functor(self) cdef class GrpcCallWrapper: cdef grpc_call* call
Cython
4
warlock135/grpc
src/python/grpcio/grpc/_cython/_cygrpc/aio/callback_common.pxd.pxi
[ "Apache-2.0" ]
# bug #2039 type RegionTy = object ThingyPtr = RegionTy ptr Thingy Thingy = object next: ThingyPtr name: string proc iname(t: ThingyPtr) = var x = t while not x.isNil: echo x.name x = x.next proc go() = var athing : ThingyPtr iname(athing) go()
Nimrod
4
alehander92/Nim
tests/typerel/tregionptrs2.nim
[ "MIT" ]
#pragma once #include <cstdint> #ifdef _MSC_VER #include <intrin.h> #endif #include <c10/macros/Export.h> namespace caffe2 { class CpuId; TORCH_API const CpuId& GetCpuId(); /////////////////////////////////////////////////////////////////////////////// // Implementation of CpuId that is borrowed from folly. /////////////////////////////////////////////////////////////////////////////// // TODO: It might be good to use cpuinfo third-party dependency instead for // consistency sake. /** * Identification of an Intel CPU. * Supports CPUID feature flags (EAX=1) and extended features (EAX=7, ECX=0). * Values from * http://www.intel.com/content/www/us/en/processors/processor-identification-cpuid-instruction-note.html */ class CpuId { public: CpuId(); #define X(name, r, bit) \ inline bool name() const { \ return ((r) & (1U << bit)) != 0; \ } // cpuid(1): Processor Info and Feature Bits. #define C(name, bit) X(name, f1c_, bit) C(sse3, 0) C(pclmuldq, 1) C(dtes64, 2) C(monitor, 3) C(dscpl, 4) C(vmx, 5) C(smx, 6) C(eist, 7) C(tm2, 8) C(ssse3, 9) C(cnxtid, 10) C(fma, 12) C(cx16, 13) C(xtpr, 14) C(pdcm, 15) C(pcid, 17) C(dca, 18) C(sse41, 19) C(sse42, 20) C(x2apic, 21) C(movbe, 22) C(popcnt, 23) C(tscdeadline, 24) C(aes, 25) C(xsave, 26) C(osxsave, 27) C(avx, 28) C(f16c, 29) C(rdrand, 30) #undef C #define D(name, bit) X(name, f1d_, bit) D(fpu, 0) D(vme, 1) D(de, 2) D(pse, 3) D(tsc, 4) D(msr, 5) D(pae, 6) D(mce, 7) D(cx8, 8) D(apic, 9) D(sep, 11) D(mtrr, 12) D(pge, 13) D(mca, 14) D(cmov, 15) D(pat, 16) D(pse36, 17) D(psn, 18) D(clfsh, 19) D(ds, 21) D(acpi, 22) D(mmx, 23) D(fxsr, 24) D(sse, 25) D(sse2, 26) D(ss, 27) D(htt, 28) D(tm, 29) D(pbe, 31) #undef D // cpuid(7): Extended Features. #define B(name, bit) X(name, f7b_, bit) B(bmi1, 3) B(hle, 4) B(avx2, 5) B(smep, 7) B(bmi2, 8) B(erms, 9) B(invpcid, 10) B(rtm, 11) B(mpx, 14) B(avx512f, 16) B(avx512dq, 17) B(rdseed, 18) B(adx, 19) B(smap, 20) B(avx512ifma, 21) B(pcommit, 22) B(clflushopt, 23) B(clwb, 24) B(avx512pf, 26) B(avx512er, 27) B(avx512cd, 28) B(sha, 29) B(avx512bw, 30) B(avx512vl, 31) #undef B #define E(name, bit) X(name, f7c_, bit) E(prefetchwt1, 0) E(avx512vbmi, 1) #undef E #undef X private: TORCH_API static uint32_t f1c_; TORCH_API static uint32_t f1d_; TORCH_API static uint32_t f7b_; TORCH_API static uint32_t f7c_; }; } // namespace caffe2
C
4
Hacky-DH/pytorch
caffe2/utils/cpuid.h
[ "Intel" ]
#Signature file v4.1 #Version 1.42 CLSS public abstract interface java.io.Serializable CLSS public abstract interface java.lang.Comparable<%0 extends java.lang.Object> meth public abstract int compareTo({java.lang.Comparable%0}) CLSS public abstract java.lang.Enum<%0 extends java.lang.Enum<{java.lang.Enum%0}>> cons protected init(java.lang.String,int) intf java.io.Serializable intf java.lang.Comparable<{java.lang.Enum%0}> meth protected final java.lang.Object clone() throws java.lang.CloneNotSupportedException meth protected final void finalize() meth public final boolean equals(java.lang.Object) meth public final int compareTo({java.lang.Enum%0}) meth public final int hashCode() meth public final int ordinal() meth public final java.lang.Class<{java.lang.Enum%0}> getDeclaringClass() meth public final java.lang.String name() meth public java.lang.String toString() meth public static <%0 extends java.lang.Enum<{%%0}>> {%%0} valueOf(java.lang.Class<{%%0}>,java.lang.String) supr java.lang.Object CLSS public java.lang.Object cons public init() meth protected java.lang.Object clone() throws java.lang.CloneNotSupportedException meth protected void finalize() throws java.lang.Throwable meth public boolean equals(java.lang.Object) meth public final java.lang.Class<?> getClass() meth public final void notify() meth public final void notifyAll() meth public final void wait() throws java.lang.InterruptedException meth public final void wait(long) throws java.lang.InterruptedException meth public final void wait(long,int) throws java.lang.InterruptedException meth public int hashCode() meth public java.lang.String toString() CLSS public abstract interface java.lang.annotation.Annotation meth public abstract boolean equals(java.lang.Object) meth public abstract int hashCode() meth public abstract java.lang.Class<? extends java.lang.annotation.Annotation> annotationType() meth public abstract java.lang.String toString() CLSS public abstract interface !annotation java.lang.annotation.Documented anno 0 java.lang.annotation.Documented() anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME) anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE]) intf java.lang.annotation.Annotation CLSS public abstract interface !annotation java.lang.annotation.Retention anno 0 java.lang.annotation.Documented() anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME) anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE]) intf java.lang.annotation.Annotation meth public abstract java.lang.annotation.RetentionPolicy value() CLSS public abstract interface !annotation java.lang.annotation.Target anno 0 java.lang.annotation.Documented() anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME) anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE]) intf java.lang.annotation.Annotation meth public abstract java.lang.annotation.ElementType[] value() CLSS public abstract interface !annotation javax.annotation.Nonnull intf java.lang.annotation.Annotation meth public abstract !hasdefault javax.annotation.meta.When when() CLSS public abstract interface !annotation javax.annotation.meta.TypeQualifier intf java.lang.annotation.Annotation meth public abstract !hasdefault java.lang.Class<?> applicableTo() CLSS public abstract interface !annotation javax.annotation.meta.TypeQualifierNickname intf java.lang.annotation.Annotation CLSS public final !enum javax.annotation.meta.When fld public final static javax.annotation.meta.When ALWAYS fld public final static javax.annotation.meta.When MAYBE fld public final static javax.annotation.meta.When UNKNOWN meth public static javax.annotation.meta.When valueOf(java.lang.String) meth public static javax.annotation.meta.When[] values() supr java.lang.Enum<javax.annotation.meta.When> CLSS public abstract interface !annotation org.netbeans.api.annotations.common.CheckForNull anno 0 java.lang.annotation.Documented() anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=CLASS) anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[METHOD]) intf java.lang.annotation.Annotation CLSS public abstract interface !annotation org.netbeans.api.annotations.common.CheckReturnValue anno 0 java.lang.annotation.Documented() anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=CLASS) anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[METHOD]) intf java.lang.annotation.Annotation CLSS public abstract interface !annotation org.netbeans.api.annotations.common.NonNull anno 0 java.lang.annotation.Documented() anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=CLASS) anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[FIELD, METHOD, PARAMETER, LOCAL_VARIABLE]) intf java.lang.annotation.Annotation CLSS public abstract interface !annotation org.netbeans.api.annotations.common.NullAllowed anno 0 java.lang.annotation.Documented() anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=CLASS) anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[FIELD, PARAMETER, LOCAL_VARIABLE]) intf java.lang.annotation.Annotation CLSS public abstract interface !annotation org.netbeans.api.annotations.common.NullUnknown anno 0 java.lang.annotation.Documented() anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=CLASS) anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[FIELD, METHOD, PARAMETER, LOCAL_VARIABLE]) intf java.lang.annotation.Annotation CLSS public abstract interface !annotation org.netbeans.api.annotations.common.StaticResource anno 0 java.lang.annotation.Documented() anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=SOURCE) anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[FIELD]) intf java.lang.annotation.Annotation meth public abstract !hasdefault boolean relative() meth public abstract !hasdefault boolean searchClasspath() CLSS public abstract interface !annotation org.netbeans.api.annotations.common.SuppressWarnings anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=CLASS) anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[CONSTRUCTOR, FIELD, LOCAL_VARIABLE, METHOD, PACKAGE, PARAMETER, TYPE]) intf java.lang.annotation.Annotation meth public abstract !hasdefault java.lang.String justification() meth public abstract !hasdefault java.lang.String[] value() CLSS abstract interface org.netbeans.api.annotations.common.package-info
Standard ML
1
timfel/netbeans
platform/api.annotations.common/nbproject/org-netbeans-api-annotations-common.sig
[ "Apache-2.0" ]
############################################################################# ## v # The Coq Proof Assistant ## ## <O___,, # INRIA - CNRS - LIX - LRI - PPS ## ## \VV/ # ## ## // # Makefile automagically generated by coq_makefile V8.3pl2 ## ############################################################################# # WARNING # # This Makefile has been automagically generated # Edit at your own risks ! # # END OF WARNING # # This Makefile was generated by the command line : # coq_makefile -f Make.coq -o Makefile.coq # # # This Makefile may take 3 arguments passed as environment variables: # - COQBIN to specify the directory where Coq binaries resides; # - CAMLBIN and CAMLP4BIN to give the path for the OCaml and Camlp4/5 binaries. COQLIB:=$(shell $(COQBIN)coqtop -where | sed -e 's/\\/\\\\/g') CAMLP4:="$(shell $(COQBIN)coqtop -config | awk -F = '/CAMLP4=/{print $$2}')" ifndef CAMLP4BIN CAMLP4BIN:=$(CAMLBIN) endif CAMLP4LIB:=$(shell $(CAMLP4BIN)$(CAMLP4) -where) ########################## # # # Libraries definitions. # # # ########################## OCAMLLIBS:= COQSRCLIBS:=-I $(COQLIB)/kernel -I $(COQLIB)/lib \ -I $(COQLIB)/library -I $(COQLIB)/parsing \ -I $(COQLIB)/pretyping -I $(COQLIB)/interp \ -I $(COQLIB)/proofs -I $(COQLIB)/tactics \ -I $(COQLIB)/toplevel \ -I $(COQLIB)/plugins/cc \ -I $(COQLIB)/plugins/dp \ -I $(COQLIB)/plugins/extraction \ -I $(COQLIB)/plugins/field \ -I $(COQLIB)/plugins/firstorder \ -I $(COQLIB)/plugins/fourier \ -I $(COQLIB)/plugins/funind \ -I $(COQLIB)/plugins/groebner \ -I $(COQLIB)/plugins/interface \ -I $(COQLIB)/plugins/micromega \ -I $(COQLIB)/plugins/nsatz \ -I $(COQLIB)/plugins/omega \ -I $(COQLIB)/plugins/quote \ -I $(COQLIB)/plugins/ring \ -I $(COQLIB)/plugins/romega \ -I $(COQLIB)/plugins/rtauto \ -I $(COQLIB)/plugins/setoid_ring \ -I $(COQLIB)/plugins/subtac \ -I $(COQLIB)/plugins/subtac/test \ -I $(COQLIB)/plugins/syntax \ -I $(COQLIB)/plugins/xml COQLIBS:= COQDOCLIBS:= ########################## # # # Variables definitions. # # # ########################## ZFLAGS=$(OCAMLLIBS) $(COQSRCLIBS) -I $(CAMLP4LIB) OPT:= COQFLAGS:=-q $(OPT) $(COQLIBS) $(OTHERFLAGS) $(COQ_XML) ifdef CAMLBIN COQMKTOPFLAGS:=-camlbin $(CAMLBIN) -camlp4bin $(CAMLP4BIN) endif COQC:=$(COQBIN)coqc COQDEP:=$(COQBIN)coqdep -c GALLINA:=$(COQBIN)gallina COQDOC:=$(COQBIN)coqdoc COQMKTOP:=$(COQBIN)coqmktop CAMLLIB:=$(shell $(CAMLBIN)ocamlc.opt -where) CAMLC:=$(CAMLBIN)ocamlc.opt -c -rectypes CAMLOPTC:=$(CAMLBIN)ocamlopt.opt -c -rectypes CAMLLINK:=$(CAMLBIN)ocamlc.opt -rectypes CAMLOPTLINK:=$(CAMLBIN)ocamlopt.opt -rectypes GRAMMARS:=grammar.cma CAMLP4EXTEND:=pa_extend.cmo pa_macro.cmo q_MLast.cmo CAMLP4OPTIONS:= PP:=-pp "$(CAMLP4BIN)$(CAMLP4)o -I $(CAMLLIB) -I . $(COQSRCLIBS) $(CAMLP4EXTEND) $(GRAMMARS) $(CAMLP4OPTIONS) -impl" ################################### # # # Definition of the "all" target. # # # ################################### all: html\ coq ################### # # # Custom targets. # # # ################### html: cd coq; $(MAKE) html ################### # # # Subdirectories. # # # ################### coq: cd coq ; $(MAKE) all #################### # # # Special targets. # # # #################### .PHONY: all opt byte archclean clean install depend html coq byte: $(MAKE) all "OPT:=-byte" opt: $(MAKE) all "OPT:=-opt" clean: rm -f $(CMOFILES) $(CMIFILES) $(CMXFILES) $(CMXSFILES) $(OFILES) $(VOFILES) $(VIFILES) $(GFILES) $(MLFILES:.ml=.cmo) $(MLFILES:.ml=.cmx) *~ rm -f all.ps all-gal.ps all.pdf all-gal.pdf all.glob $(VFILES:.v=.glob) $(HTMLFILES) $(GHTMLFILES) $(VFILES:.v=.tex) $(VFILES:.v=.g.tex) $(VFILES:.v=.v.d) - rm -rf html - rm -f html (cd coq ; $(MAKE) clean) archclean: rm -f *.cmx *.o (cd coq ; $(MAKE) archclean) printenv: @echo CAMLC = $(CAMLC) @echo CAMLOPTC = $(CAMLOPTC) @echo CAMLP4LIB = $(CAMLP4LIB) Makefile.coq: Make.coq mv -f Makefile.coq Makefile.coq.bak $(COQBIN)coq_makefile -f Make.coq -o Makefile.coq (cd coq ; $(MAKE) Makefile) # WARNING # # This Makefile has been automagically generated # Edit at your own risks ! # # END OF WARNING
Coq
3
yoshihiro503/ocaml_util
Makefile.coq
[ "MIT" ]
Extension { #name : #AsyncBehaviorAllLocalMethodsStream } { #category : #'*GToolkit-Extensions' } AsyncBehaviorAllLocalMethodsStream >> gtCompositionChildren [ ^ { instanceStream . classStream } ]
Smalltalk
2
feenkcom/gtoolk
src/GToolkit-Extensions/AsyncBehaviorAllLocalMethodsStream.extension.st
[ "MIT" ]
class A{ public a = 0; public static s = 1; function init(a){ this.a = a; print 'A init', a; } function f(a, b=1){ return a + b; } } print A.s; // 1 a = new A(1); // A init 1 print a.f(1, 2);
COBOL
2
cau991/ssdb
deps/cpy/samples/class.cpy
[ "BSD-3-Clause" ]
import QtQuick 2.0 import QtQuick.Dialogs 1.1 import "utils.js" as Utils MessageDialog { id: removeContactDialog title: qsTr("Remove %1").arg(Utils.htmlEscaped(contact.nickname)) //: %1 nickname text: qsTr("Do you want to permanently remove %1?").arg(Utils.htmlEscaped(contact.nickname)) informativeText: qsTr("This contact will no longer be able to message you, and will be notified about the removal. They may choose to send a new connection request.") standardButtons: StandardButton.Yes | StandardButton.No onYes: contact.deleteContact() }
QML
4
garrettr/ricochet
src/ui/qml/MessageDialogWrapper.qml
[ "OpenSSL" ]
record thingy { } class whatchamacallit { /* This field contains a thingy */ var aThingy: thingy; } class recursion { /* This field contains a whatchamacallit */ var aWhatchamacallit: whatchamacallit; /* This field is recursive */ var recursive: recursion; }
Chapel
2
jhh67/chapel
test/chpldoc/types/fields/recordsAndClasses.doc.chpl
[ "ECL-2.0", "Apache-2.0" ]
parser grammar FlatVyos_bgp; import FlatVyos_common; options { tokenVocab = FlatVyosLexer; } bnt_nexthop_self : NEXTHOP_SELF ; bnt_null : ( SOFT_RECONFIGURATION | TIMERS ) null_filler ; bnt_remote_as : REMOTE_AS asnum = DEC ; bnt_route_map_export : ROUTE_MAP EXPORT name = variable ; bnt_route_map_import : ROUTE_MAP IMPORT name = variable ; bt_neighbor : NEIGHBOR IP_ADDRESS bt_neighbor_tail ; bt_neighbor_tail : bnt_nexthop_self | bnt_null | bnt_remote_as | bnt_route_map_export | bnt_route_map_import ; s_protocols_bgp : BGP asnum = DEC s_protocols_bgp_tail ; s_protocols_bgp_tail : bt_neighbor ;
ANTLR
4
zabrewer/batfish
projects/batfish/src/main/antlr4/org/batfish/grammar/flatvyos/FlatVyos_bgp.g4
[ "Apache-2.0" ]
<div class="sidebar-section"> <li class="sidebar-title"> <span>{{ ::$ctrl.title }}</span> </li> <div class="sidebar-section-items" ng-transclude> </div> </div>
HTML
2
GizMan/portainer
app/portainer/components/sidebar/sidebar-section/sidebar-section.html
[ "Zlib" ]
create table t0 (x real primary key);
SQL
2
imtbkcat/tidb-lightning
tests/routes/data/routes_a0.t0-schema.sql
[ "Apache-2.0" ]
"""Tests for the SolarEdge component."""
Python
0
domwillcode/home-assistant
tests/components/solaredge/__init__.py
[ "Apache-2.0" ]
--- keylayout: valuelayout --- <div id="layout"> {{ content }} </div>
Liquid
2
binyamin/eleventy
test/stubs/_includes/layoutLiquid.liquid
[ "MIT" ]
package foo class A { companion object { val bar = 1 fun foo() {} } }
Groff
3
qussarah/declare
jps-plugin/testData/incremental/pureKotlin/removeAndRestoreCompanionWithImplicitUsages/A.kt.new.2
[ "Apache-2.0" ]
@app remix-architect-app @http /* method any src server @static # @aws # profile default # region us-west-1
Arc
1
andmayorov/remix
packages/create-remix/templates/arc/app.arc
[ "MIT" ]
// Copyright 2016 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. #include "textflag.h" // func archFloor(x float64) float64 TEXT ·archFloor(SB),NOSPLIT,$0 FMOVD x+0(FP), F0 FRINTMD F0, F0 FMOVD F0, ret+8(FP) RET // func archCeil(x float64) float64 TEXT ·archCeil(SB),NOSPLIT,$0 FMOVD x+0(FP), F0 FRINTPD F0, F0 FMOVD F0, ret+8(FP) RET // func archTrunc(x float64) float64 TEXT ·archTrunc(SB),NOSPLIT,$0 FMOVD x+0(FP), F0 FRINTZD F0, F0 FMOVD F0, ret+8(FP) RET
GAS
4
SSSDNSY/go
src/math/floor_arm64.s
[ "BSD-3-Clause" ]
#Signature file v4.1 #Version 1.30.0 CLSS public abstract interface !annotation java.lang.Deprecated anno 0 java.lang.annotation.Documented() anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME) anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[CONSTRUCTOR, FIELD, LOCAL_VARIABLE, METHOD, PACKAGE, PARAMETER, TYPE]) intf java.lang.annotation.Annotation CLSS public java.lang.Object cons public init() meth protected java.lang.Object clone() throws java.lang.CloneNotSupportedException meth protected void finalize() throws java.lang.Throwable meth public boolean equals(java.lang.Object) meth public final java.lang.Class<?> getClass() meth public final void notify() meth public final void notifyAll() meth public final void wait() throws java.lang.InterruptedException meth public final void wait(long) throws java.lang.InterruptedException meth public final void wait(long,int) throws java.lang.InterruptedException meth public int hashCode() meth public java.lang.String toString() CLSS public abstract interface java.lang.annotation.Annotation meth public abstract boolean equals(java.lang.Object) meth public abstract int hashCode() meth public abstract java.lang.Class<? extends java.lang.annotation.Annotation> annotationType() meth public abstract java.lang.String toString() CLSS public abstract interface !annotation java.lang.annotation.Documented anno 0 java.lang.annotation.Documented() anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME) anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE]) intf java.lang.annotation.Annotation CLSS public abstract interface !annotation java.lang.annotation.Retention anno 0 java.lang.annotation.Documented() anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME) anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE]) intf java.lang.annotation.Annotation meth public abstract java.lang.annotation.RetentionPolicy value() CLSS public abstract interface !annotation java.lang.annotation.Target anno 0 java.lang.annotation.Documented() anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME) anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE]) intf java.lang.annotation.Annotation meth public abstract java.lang.annotation.ElementType[] value() CLSS public junit.framework.Assert anno 0 java.lang.Deprecated() cons protected init() meth public static java.lang.String format(java.lang.String,java.lang.Object,java.lang.Object) meth public static void assertEquals(boolean,boolean) meth public static void assertEquals(byte,byte) meth public static void assertEquals(char,char) meth public static void assertEquals(double,double,double) meth public static void assertEquals(float,float,float) meth public static void assertEquals(int,int) meth public static void assertEquals(java.lang.Object,java.lang.Object) meth public static void assertEquals(java.lang.String,boolean,boolean) meth public static void assertEquals(java.lang.String,byte,byte) meth public static void assertEquals(java.lang.String,char,char) meth public static void assertEquals(java.lang.String,double,double,double) meth public static void assertEquals(java.lang.String,float,float,float) meth public static void assertEquals(java.lang.String,int,int) meth public static void assertEquals(java.lang.String,java.lang.Object,java.lang.Object) meth public static void assertEquals(java.lang.String,java.lang.String) meth public static void assertEquals(java.lang.String,java.lang.String,java.lang.String) meth public static void assertEquals(java.lang.String,long,long) meth public static void assertEquals(java.lang.String,short,short) meth public static void assertEquals(long,long) meth public static void assertEquals(short,short) meth public static void assertFalse(boolean) meth public static void assertFalse(java.lang.String,boolean) meth public static void assertNotNull(java.lang.Object) meth public static void assertNotNull(java.lang.String,java.lang.Object) meth public static void assertNotSame(java.lang.Object,java.lang.Object) meth public static void assertNotSame(java.lang.String,java.lang.Object,java.lang.Object) meth public static void assertNull(java.lang.Object) meth public static void assertNull(java.lang.String,java.lang.Object) meth public static void assertSame(java.lang.Object,java.lang.Object) meth public static void assertSame(java.lang.String,java.lang.Object,java.lang.Object) meth public static void assertTrue(boolean) meth public static void assertTrue(java.lang.String,boolean) meth public static void fail() meth public static void fail(java.lang.String) meth public static void failNotEquals(java.lang.String,java.lang.Object,java.lang.Object) meth public static void failNotSame(java.lang.String,java.lang.Object,java.lang.Object) meth public static void failSame(java.lang.String) supr java.lang.Object CLSS public abstract interface junit.framework.Test meth public abstract int countTestCases() meth public abstract void run(junit.framework.TestResult) CLSS public abstract junit.framework.TestCase cons public init() cons public init(java.lang.String) intf junit.framework.Test meth protected junit.framework.TestResult createResult() meth protected void runTest() throws java.lang.Throwable meth protected void setUp() throws java.lang.Exception meth protected void tearDown() throws java.lang.Exception meth public int countTestCases() meth public java.lang.String getName() meth public java.lang.String toString() meth public junit.framework.TestResult run() meth public static java.lang.String format(java.lang.String,java.lang.Object,java.lang.Object) meth public static void assertEquals(boolean,boolean) meth public static void assertEquals(byte,byte) meth public static void assertEquals(char,char) meth public static void assertEquals(double,double,double) meth public static void assertEquals(float,float,float) meth public static void assertEquals(int,int) meth public static void assertEquals(java.lang.Object,java.lang.Object) meth public static void assertEquals(java.lang.String,boolean,boolean) meth public static void assertEquals(java.lang.String,byte,byte) meth public static void assertEquals(java.lang.String,char,char) meth public static void assertEquals(java.lang.String,double,double,double) meth public static void assertEquals(java.lang.String,float,float,float) meth public static void assertEquals(java.lang.String,int,int) meth public static void assertEquals(java.lang.String,java.lang.Object,java.lang.Object) meth public static void assertEquals(java.lang.String,java.lang.String) meth public static void assertEquals(java.lang.String,java.lang.String,java.lang.String) meth public static void assertEquals(java.lang.String,long,long) meth public static void assertEquals(java.lang.String,short,short) meth public static void assertEquals(long,long) meth public static void assertEquals(short,short) meth public static void assertFalse(boolean) meth public static void assertFalse(java.lang.String,boolean) meth public static void assertNotNull(java.lang.Object) meth public static void assertNotNull(java.lang.String,java.lang.Object) meth public static void assertNotSame(java.lang.Object,java.lang.Object) meth public static void assertNotSame(java.lang.String,java.lang.Object,java.lang.Object) meth public static void assertNull(java.lang.Object) meth public static void assertNull(java.lang.String,java.lang.Object) meth public static void assertSame(java.lang.Object,java.lang.Object) meth public static void assertSame(java.lang.String,java.lang.Object,java.lang.Object) meth public static void assertTrue(boolean) meth public static void assertTrue(java.lang.String,boolean) meth public static void fail() meth public static void fail(java.lang.String) meth public static void failNotEquals(java.lang.String,java.lang.Object,java.lang.Object) meth public static void failNotSame(java.lang.String,java.lang.Object,java.lang.Object) meth public static void failSame(java.lang.String) meth public void run(junit.framework.TestResult) meth public void runBare() throws java.lang.Throwable meth public void setName(java.lang.String) supr junit.framework.Assert hfds fName CLSS public abstract interface org.netbeans.junit.NbTest intf junit.framework.Test meth public abstract boolean canRun() meth public abstract java.lang.String getExpectedFail() meth public abstract void setFilter(org.netbeans.junit.Filter) CLSS public abstract org.netbeans.junit.NbTestCase cons public init(java.lang.String) intf org.netbeans.junit.NbTest meth protected boolean runInEQ() meth protected final int getTestNumber() meth protected int timeOut() meth protected java.lang.String logRoot() meth protected java.util.logging.Level logLevel() meth public boolean canRun() meth public java.io.File getDataDir() meth public java.io.File getGoldenFile() meth public java.io.File getGoldenFile(java.lang.String) meth public java.io.File getWorkDir() throws java.io.IOException meth public java.io.PrintStream getLog() meth public java.io.PrintStream getLog(java.lang.String) meth public java.io.PrintStream getRef() meth public java.lang.String getExpectedFail() meth public java.lang.String getWorkDirPath() meth public static int assertSize(java.lang.String,java.util.Collection<?>,int,org.netbeans.junit.MemoryFilter) meth public static java.lang.String convertNBFSURL(java.net.URL) anno 0 java.lang.Deprecated() meth public static void assertFile(java.io.File,java.io.File) meth public static void assertFile(java.io.File,java.io.File,java.io.File) meth public static void assertFile(java.io.File,java.io.File,java.io.File,org.netbeans.junit.diff.Diff) meth public static void assertFile(java.lang.String,java.io.File,java.io.File,java.io.File) meth public static void assertFile(java.lang.String,java.io.File,java.io.File,java.io.File,org.netbeans.junit.diff.Diff) meth public static void assertFile(java.lang.String,java.lang.String) meth public static void assertFile(java.lang.String,java.lang.String,java.lang.String) meth public static void assertFile(java.lang.String,java.lang.String,java.lang.String,java.lang.String) meth public static void assertFile(java.lang.String,java.lang.String,java.lang.String,java.lang.String,org.netbeans.junit.diff.Diff) meth public static void assertFile(java.lang.String,java.lang.String,java.lang.String,org.netbeans.junit.diff.Diff) meth public static void assertGC(java.lang.String,java.lang.ref.Reference<?>) meth public static void assertGC(java.lang.String,java.lang.ref.Reference<?>,java.util.Set<?>) meth public static void assertSize(java.lang.String,int,java.lang.Object) meth public static void assertSize(java.lang.String,java.util.Collection<?>,int) meth public static void assertSize(java.lang.String,java.util.Collection<?>,int,java.lang.Object[]) meth public static void failByBug(int) meth public static void failByBug(int,java.lang.String) meth public void clearWorkDir() throws java.io.IOException meth public void compareReferenceFiles() meth public void compareReferenceFiles(java.lang.String,java.lang.String,java.lang.String) meth public void log(java.lang.String) meth public void log(java.lang.String,java.lang.String) meth public void ref(java.lang.String) meth public void run(junit.framework.TestResult) meth public void runBare() throws java.lang.Throwable meth public void setFilter(org.netbeans.junit.Filter) supr junit.framework.TestCase hfds DEFAULT_TIME_OUT_CALLED,filter,lastTestMethod,logStreamTable,radix,systemOutPSWrapper,time,usedPaths,vmDeadline,workDirPath hcls WFOS CLSS public org.netbeans.modules.java.hints.declarative.test.api.DeclarativeHintsTestBase cons public init() cons public init(org.openide.filesystems.FileObject,org.openide.filesystems.FileObject,org.netbeans.modules.java.hints.declarative.test.TestParser$TestCase) meth protected void runTest() throws java.lang.Throwable meth protected void setUp() throws java.lang.Exception meth public static junit.framework.TestSuite suite(java.lang.Class<?>) meth public static junit.framework.TestSuite suite(java.lang.Class<?>,java.lang.String) supr org.netbeans.junit.NbTestCase hfds hintFile,test,testFile
Standard ML
3
timfel/netbeans
java/java.hints.declarative.test/nbproject/org-netbeans-modules-java-hints-declarative-test.sig
[ "Apache-2.0" ]
[Exposed=Window, HTMLConstructor] interface HTMLHeadElement : HTMLElement {};
WebIDL
3
corsarstl/Learn-Vue-2
vue-testing/node_modules/jsdom/lib/jsdom/living/nodes/HTMLHeadElement.webidl
[ "MIT" ]
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap"); body { font-family: "Inter", sans-serif; } main { max-width: 95%; width: 600px; margin-left: auto; margin-right: auto; } h3 { display: inline-block; } input, textarea, h3 { width: 31%; padding: 5px; margin-bottom: 5px; margin-left: 3px; margin-right: 3px; resize: none; font-family: "Inter", sans-serif; } button { background: #333; color: white; padding: 15px 15px; border: none; border-radius: 3px; } .rows-container { padding-bottom: 400px; }
CSS
4
waltercruz/gatsby
examples/functions-google-sheets/src/pages/index.css
[ "MIT" ]
local helpers = require('test.functional.helpers')(after_each) local NIL = helpers.NIL local clear = helpers.clear local command = helpers.command local curbufmeths = helpers.curbufmeths local eq = helpers.eq local meths = helpers.meths local source = helpers.source local pcall_err = helpers.pcall_err describe('nvim_get_commands', function() local cmd_dict = { addr=NIL, bang=false, bar=false, complete=NIL, complete_arg=NIL, count=NIL, definition='echo "Hello World"', name='Hello', nargs='1', range=NIL, register=false, script_id=0, } local cmd_dict2 = { addr=NIL, bang=false, bar=false, complete=NIL, complete_arg=NIL, count=NIL, definition='pwd', name='Pwd', nargs='?', range=NIL, register=false, script_id=0, } before_each(clear) it('gets empty list if no commands were defined', function() eq({}, meths.get_commands({builtin=false})) end) it('validates input', function() eq('builtin=true not implemented', pcall_err(meths.get_commands, {builtin=true})) eq("Invalid key: 'foo'", pcall_err(meths.get_commands, {foo='blah'})) end) it('gets global user-defined commands', function() -- Define a command. command('command -nargs=1 Hello echo "Hello World"') eq({Hello=cmd_dict}, meths.get_commands({builtin=false})) -- Define another command. command('command -nargs=? Pwd pwd'); eq({Hello=cmd_dict, Pwd=cmd_dict2}, meths.get_commands({builtin=false})) -- Delete a command. command('delcommand Pwd') eq({Hello=cmd_dict}, meths.get_commands({builtin=false})) end) it('gets buffer-local user-defined commands', function() -- Define a buffer-local command. command('command -buffer -nargs=1 Hello echo "Hello World"') eq({Hello=cmd_dict}, curbufmeths.get_commands({builtin=false})) -- Define another buffer-local command. command('command -buffer -nargs=? Pwd pwd') eq({Hello=cmd_dict, Pwd=cmd_dict2}, curbufmeths.get_commands({builtin=false})) -- Delete a command. command('delcommand Pwd') eq({Hello=cmd_dict}, curbufmeths.get_commands({builtin=false})) -- {builtin=true} always returns empty for buffer-local case. eq({}, curbufmeths.get_commands({builtin=true})) end) it('gets various command attributes', function() local cmd0 = { addr='arguments', bang=false, bar=false, complete='dir', complete_arg=NIL, count='10', definition='pwd <args>', name='TestCmd', nargs='1', range='10', register=false, script_id=0, } local cmd1 = { addr=NIL, bang=false, bar=false, complete='custom', complete_arg='ListUsers', count=NIL, definition='!finger <args>', name='Finger', nargs='+', range=NIL, register=false, script_id=1, } local cmd2 = { addr=NIL, bang=true, bar=false, complete=NIL, complete_arg=NIL, count=NIL, definition='call \128\253R2_foo(<q-args>)', name='Cmd2', nargs='*', range=NIL, register=false, script_id=2, } local cmd3 = { addr=NIL, bang=false, bar=true, complete=NIL, complete_arg=NIL, count=NIL, definition='call \128\253R3_ohyeah()', name='Cmd3', nargs='0', range=NIL, register=false, script_id=3, } local cmd4 = { addr=NIL, bang=false, bar=false, complete=NIL, complete_arg=NIL, count=NIL, definition='call \128\253R4_just_great()', name='Cmd4', nargs='0', range=NIL, register=true, script_id=4, } source([[ command -complete=custom,ListUsers -nargs=+ Finger !finger <args> ]]) eq({Finger=cmd1}, meths.get_commands({builtin=false})) command('command -nargs=1 -complete=dir -addr=arguments -count=10 TestCmd pwd <args>') eq({Finger=cmd1, TestCmd=cmd0}, meths.get_commands({builtin=false})) source([[ command -bang -nargs=* Cmd2 call <SID>foo(<q-args>) ]]) source([[ command -bar -nargs=0 Cmd3 call <SID>ohyeah() ]]) source([[ command -register Cmd4 call <SID>just_great() ]]) -- TODO(justinmk): Order is stable but undefined. Sort before return? eq({Cmd2=cmd2, Cmd3=cmd3, Cmd4=cmd4, Finger=cmd1, TestCmd=cmd0}, meths.get_commands({builtin=false})) end) end)
Lua
5
uga-rosa/neovim
test/functional/api/command_spec.lua
[ "Vim" ]
// run-pass pub fn main() { let mut x: isize = 10; let mut y: isize = 0; while y < x { println!("{}", y); println!("hello"); y = y + 1; } while x > 0 { println!("goodbye"); x = x - 1; println!("{}", x); } }
Rust
3
Eric-Arellano/rust
src/test/ui/for-loop-while/while.rs
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
using System; using System.IO; using Xunit; namespace Microsoft.Maui.Resizetizer.Tests { public class SkiaSharpAppIconToolsTests { public class Resize : IDisposable { readonly string DestinationFilename; readonly TestLogger Logger; public Resize() { DestinationFilename = Path.GetTempFileName() + ".png"; Logger = new TestLogger(); } public void Dispose() { //Logger.Persist(); //File.Copy(DestinationFilename, "output.png", true); File.Delete(DestinationFilename); } [Theory] // nice increments [InlineData(0.5, 0.5, "appicon.svg", "appiconfg.svg")] [InlineData(0.5, 1, "appicon.svg", "appiconfg.svg")] [InlineData(0.5, 2, "appicon.svg", "appiconfg.svg")] [InlineData(1, 0.5, "appicon.svg", "appiconfg.svg")] [InlineData(1, 1, "appicon.svg", "appiconfg.svg")] [InlineData(1, 1, "dotnet_background.svg", "dotnet_logo.svg")] [InlineData(1, 2, "appicon.svg", "appiconfg.svg")] [InlineData(2, 0.5, "appicon.svg", "appiconfg.svg")] [InlineData(2, 1, "appicon.svg", "appiconfg.svg")] [InlineData(2, 2, "appicon.svg", "appiconfg.svg")] [InlineData(3, 3, "appicon.svg", "appiconfg.svg")] // scary increments [InlineData(0.3, 0.3, "appicon.svg", "appiconfg.svg")] [InlineData(0.3, 0.7, "appicon.svg", "appiconfg.svg")] [InlineData(0.7, 0.7, "appicon.svg", "appiconfg.svg")] [InlineData(1, 0.7, "appicon.svg", "appiconfg.svg")] [InlineData(2, 0.7, "appicon.svg", "appiconfg.svg")] [InlineData(2.3, 2.3, "appicon.svg", "appiconfg.svg")] [InlineData(0.3, 1, "appicon.svg", "appiconfg.svg")] [InlineData(0.3, 2, "appicon.svg", "appiconfg.svg")] // scary increments [InlineData(0.3, 0.3, "appicon.svg", "appiconfg-red-512.svg")] [InlineData(0.3, 0.7, "appicon.svg", "appiconfg-red-512.svg")] [InlineData(0.7, 0.7, "appicon.svg", "appiconfg-red-512.svg")] [InlineData(1, 0.7, "appicon.svg", "appiconfg-red-512.svg")] [InlineData(2, 0.7, "appicon.svg", "appiconfg-red-512.svg")] [InlineData(0.3, 1, "appicon.svg", "appiconfg-red-512.svg")] [InlineData(0.3, 2, "appicon.svg", "appiconfg-red-512.svg")] public void BasicTest(double dpi, double fgScale, string bg, string fg) { var info = new ResizeImageInfo(); info.Filename = "images/" + bg; info.ForegroundFilename = "images/" + fg; info.ForegroundScale = fgScale; info.IsAppIcon = true; var tools = new SkiaSharpAppIconTools(info, Logger); var dpiPath = new DpiPath("", (decimal)dpi); tools.Resize(dpiPath, DestinationFilename); //File.Copy(DestinationFilename, $"output-{dpi}-{fgScale}-{bg}-{fg}.png", true); } } } }
C#
3
andreas-nesheim/maui
src/SingleProject/Resizetizer/test/UnitTests/SkiaSharpAppIconToolsTests.cs
[ "MIT" ]
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24" android:tint="?attr/colorControlNormal"> <path android:fillColor="@android:color/white" android:pathData="M10.52,10.73L7.3,5.72C6.82,4.97 7.35,4 8.23,4h0c0.39,0 0.74,0.2 0.95,0.53l2.76,4.46h0.12l2.74,-4.45C15.01,4.2 15.37,4 15.76,4h0c0.88,0 1.42,0.98 0.94,1.72l-3.23,5l3.55,5.55C17.5,17.02 16.96,18 16.08,18h0c-0.38,0 -0.74,-0.2 -0.95,-0.52l-3.07,-4.89h-0.12l-3.07,4.89C8.67,17.8 8.31,18 7.92,18h0c-0.88,0 -1.42,-0.97 -0.94,-1.72L10.52,10.73zM23,19.5L23,19.5c0,-0.28 -0.22,-0.5 -0.5,-0.5c0,0 0,0 0,0H20v-1h2c0.55,0 1,-0.45 1,-1v-1c0,-0.55 -0.45,-1 -1,-1h-2.5c-0.28,0 -0.5,0.22 -0.5,0.5v0c0,0.28 0.22,0.5 0.5,0.5H22v1h-2c-0.55,0 -1,0.45 -1,1v1c0,0.55 0.45,1 1,1h2.5C22.78,20 23,19.78 23,19.5z"/> </vector>
XML
3
semoro/androidx
compose/material/material/icons/generator/raw-icons/rounded/subscript.xml
[ "Apache-2.0" ]
/* @generated */ digraph cfg { "dealloc#Bla#instance.febc9b8c0e8bc29905272eecbf85b31a_1" [label="1: Start Bla.dealloc\nFormals: self:Bla*\nLocals: \n " color=yellow style=filled] "dealloc#Bla#instance.febc9b8c0e8bc29905272eecbf85b31a_1" -> "dealloc#Bla#instance.febc9b8c0e8bc29905272eecbf85b31a_3" ; "dealloc#Bla#instance.febc9b8c0e8bc29905272eecbf85b31a_2" [label="2: Exit Bla.dealloc \n " color=yellow style=filled] "dealloc#Bla#instance.febc9b8c0e8bc29905272eecbf85b31a_3" [label="3: Call dealloc \n " shape="box"] "dealloc#Bla#instance.febc9b8c0e8bc29905272eecbf85b31a_3" -> "dealloc#Bla#instance.febc9b8c0e8bc29905272eecbf85b31a_2" ; "fooMethod#Bla#instance.d982e99c073f2d30dc24c41bb29add6a_1" [label="1: Start Bla.fooMethod\nFormals: self:Bla*\nLocals: \n " color=yellow style=filled] "fooMethod#Bla#instance.d982e99c073f2d30dc24c41bb29add6a_1" -> "fooMethod#Bla#instance.d982e99c073f2d30dc24c41bb29add6a_5" ; "fooMethod#Bla#instance.d982e99c073f2d30dc24c41bb29add6a_2" [label="2: Exit Bla.fooMethod \n " color=yellow style=filled] "fooMethod#Bla#instance.d982e99c073f2d30dc24c41bb29add6a_3" [label="3: + \n " ] "fooMethod#Bla#instance.d982e99c073f2d30dc24c41bb29add6a_3" -> "fooMethod#Bla#instance.d982e99c073f2d30dc24c41bb29add6a_4" ; "fooMethod#Bla#instance.d982e99c073f2d30dc24c41bb29add6a_4" [label="4: between_join_and_exit \n " shape="box"] "fooMethod#Bla#instance.d982e99c073f2d30dc24c41bb29add6a_4" -> "fooMethod#Bla#instance.d982e99c073f2d30dc24c41bb29add6a_2" ; "fooMethod#Bla#instance.d982e99c073f2d30dc24c41bb29add6a_5" [label="5: Message Call: conformsToProtocol: \n n$0=*&self:Bla* [line 23, column 8]\n n$1=_fun_NSObject.conformsToProtocol:(n$0:Bla*,\"Foo\":Protocol*) virtual [line 23, column 7]\n " shape="box"] "fooMethod#Bla#instance.d982e99c073f2d30dc24c41bb29add6a_5" -> "fooMethod#Bla#instance.d982e99c073f2d30dc24c41bb29add6a_6" ; "fooMethod#Bla#instance.d982e99c073f2d30dc24c41bb29add6a_5" -> "fooMethod#Bla#instance.d982e99c073f2d30dc24c41bb29add6a_7" ; "fooMethod#Bla#instance.d982e99c073f2d30dc24c41bb29add6a_6" [label="6: Prune (true branch, if) \n PRUNE(n$1, true); [line 23, column 7]\n " shape="invhouse"] "fooMethod#Bla#instance.d982e99c073f2d30dc24c41bb29add6a_6" -> "fooMethod#Bla#instance.d982e99c073f2d30dc24c41bb29add6a_8" ; "fooMethod#Bla#instance.d982e99c073f2d30dc24c41bb29add6a_7" [label="7: Prune (false branch, if) \n PRUNE(!n$1, false); [line 23, column 7]\n " shape="invhouse"] "fooMethod#Bla#instance.d982e99c073f2d30dc24c41bb29add6a_7" -> "fooMethod#Bla#instance.d982e99c073f2d30dc24c41bb29add6a_3" ; "fooMethod#Bla#instance.d982e99c073f2d30dc24c41bb29add6a_8" [label="8: Return Stmt \n " shape="box"] "fooMethod#Bla#instance.d982e99c073f2d30dc24c41bb29add6a_8" -> "fooMethod#Bla#instance.d982e99c073f2d30dc24c41bb29add6a_2" ; }
Graphviz (DOT)
4
JacobBarthelmeh/infer
infer/tests/codetoanalyze/objc/frontend/protocol/protocol.m.dot
[ "MIT" ]
<?Lassoscript // Last modified 9/15/09 by ECL, Landmann InterActive /* Tagdocs; {Tagname= OutputURL } {Description= Outputs the already-built $vURL } {Author= Eric Landmann } {AuthorEmail= support@iterate.ws } {ModifiedBy= } {ModifiedByEmail= } {Date= 9/15/09 } {Usage= OutputURL } {ExpectedResults= HTML for the URL } {Dependencies= $vURL must be defined, otherwise there will be no output } {DevelNotes= $vURL is defined in build_detail.inc This tag is merely a convenience to make it less awkward for a designer {ChangeNotes= 9/15/09 First implementation. } /Tagdocs; */ If: !(Lasso_TagExists:'OutputURL'); Define_Tag:'OutputURL', -Description='Outputs $vURL, if defined'; Local('Result') = null; // Check if var is defined If: (Var_Defined:'vURL'); #Result += '<!-- OutputURL -->\n'; #Result += '<div class="ContentPanelURL"><a href="'($vURL)'" target="_blank" class="ContentPanel">'($vURL)'</a></div><br>\n'; Return: (Encode_Smart:(#Result)); Else; // Output a comment that variable is not defined #Result = '<!-- OutputURL: URL is undefined -->\n'; Return: (Encode_Smart:(#Result)); /If; /Define_Tag; Log_Critical: 'Custom Tag Loaded - OutputURL'; /If; ?>
Lasso
4
subethaedit/SubEthaEd
Documentation/ModeDevelopment/Reference Files/LassoScript-HTML/itpage/LassoStartup/OutputURL.lasso
[ "MIT" ]
-- Script to merge all occurrences for one resource. -- These will be used later for indexing -- -- @param dir the directory where we find the part* files outputted by hadoop -- @author pablomendes SET job.name OccurrencesByTypeSortedByURI; ------ LOADING AND CLEANING ------ occurrences = LOAD '$dir/part*' USING PigStorage('\t') AS (id, uri, surfaceForm, context, offset); types = LOAD '/user/pablo/dbpa/ontology/instance_types_en.tsv.gz' AS (uri, type); cleaned = FILTER occurrences BY (surfaceForm is not null) AND (uri is not null); withtype = JOIN cleaned BY uri, types BY uri; reformat = FOREACH withtype GENERATE cleaned::uri, surfaceForm, context, offset, types::type; STORE reformat INTO '$dir/wikipediaOccurrences.ambiguous.withtype.tsv' USING PigStorage();
PigLatin
4
david-oggier/dbpedia-spotlight
index/src/main/pig/OccurrencesByType.pig
[ "Apache-2.0" ]
try display dialog "Are you sure you want to remove Karabiner?" buttons {"Cancel", "OK"} if the button returned of the result is "OK" then try do shell script "test -f '/Library/Application Support/org.pqrs/Karabiner/uninstall.sh'" try do shell script "sh '/Library/Application Support/org.pqrs/Karabiner/uninstall.sh'" with administrator privileges display alert "Karabiner has been uninstalled. Please restart OS X." do shell script "/usr/bin/killall Karabiner" on error display alert "Failed to uninstall Karabiner." end try on error display alert "Karabiner is not installed." end try end if on error display alert "Karabiner uninstallation was canceled." end try
AppleScript
2
liasica/Karabiner_CN
files/extra/uninstaller.applescript
[ "Unlicense" ]
config = require("lapis.config").get! if config.postgres require "lapis.db.postgres" elseif config.mysql require "lapis.db.mysql" else error "You have to configure either postgres or mysql"
MoonScript
4
tommy-mor/lapis
lapis/db.moon
[ "MIT", "Unlicense" ]
FORMAT: 1A # My API
API Blueprint
0
tomoyamachi/dredd
packages/dredd/test/fixtures/error-blueprint.apib
[ "MIT" ]
\require "i@~>0.3.1"
LilyPond
1
HolgerPeters/lyp
spec/package_setups/big/g@0.3.2/package.ly
[ "MIT" ]
package Math; import Complex::*; import FixedPoint::*; import NumberTypes::*; import Divide::*; import SquareRoot::*; import FloatingPoint::*; endpackage
Bluespec
0
sarman1998/vscode-verilog-hdl-support
syntaxes/bsc-lib/Math.bsv
[ "MIT" ]
<?Lassoscript // Last modified 7/23/09 by ECL, Landmann InterActive // FUNCTIONALITY // Used to modify categories nestedset data in the $svHeirarchyTable table // NOTES // Parameters passed by this form: // "DataType" Value of "Node" means that we are modifying the node table // "NodeID" Value of the existing node ID. Used to delete node or update name. // "AddNewNodeName" Name for a new node. // "Action" // Action = "Add New Root", means the request was an Add New Root node // Action = "Update", means the request was an Update the Name or content_id of an existing node // Action = "Delete", means the request was to Delete and all underlying nodes // Action = "Add (Same Level)", means the request was to add a node in the heirarchy // "UpdateName" Value of the name (for an existing record) // "NewRootName" Value of the NEW root name requested to be created // CHANGE NOTES // 10/5/07 // Moved "Add New Root" to bottom of form // 11/25/07 // Fixing HTML errors found when working on LI CMS - see /admin/manage_heirarchy.lasso // Removed ability to assign Content ID. We are doing this a different way now, // by assigning the heirarchy ID in the content page itself. // Added jQuery ToolTip // 4/30/08 // Added LI_CMSatend at bottom of page to set focus to login box // 7/23/09 // Added Robot Check Include:'/siteconfig.lasso'; // Debugging // Var:'svDebug' = 'Y'; // Robot check Include:($svLibsPath)'robotcheck.inc'; // Start the session Session_Start: -Name=$svSessionAdminName, -Expires=$svSessionTimeout; // Page head Include:($svLibsPath)'page_header_admin.inc'; // Defining the DataType Var:'vDataType' = 'Heirarchy'; // Convert action_params If: (Action_Param:'Error') != ''; Var:'vError' = (Action_Param:'Error'); /If; If: (Action_Param:'Option') != ''; Var:'vOption' = (Action_Param:'Option'); /If; // Security check If: (Var:'svUser_ID') != ''; // Initialize variables Var:'OutputCloseDiv' = boolean; // GROUP BY node.name // 11/15/07 // Removing Content_ID from query Var:'SQLSelectFullNode' = '/* Select full node */ SELECT node.id, node.name, (COUNT(parent.name) - 1) AS depth, node.lft, node.rgt, node.Active FROM ' $svHeirarchyTable ' AS node, ' $svHeirarchyTable ' AS parent WHERE node.lft BETWEEN parent.lft AND parent.rgt GROUP BY node.id ORDER BY node.lft'; // Output table header '<table width="80%" bgcolor="#FFFFFF">\n'; '\t<tr>\n'; '\t\t<td colspan="11"><h2>'(LI_ShowIconByDataType)'&nbsp;&nbsp;Manage Heirarchy <a class="jt" href="'($svToolTipsPath)'tt_heirarchymanage.html" rel="'($svToolTipsPath)'tt_heirarchymanage.html" title="How to Use the Heirarchy"><img src="'($svImagesPath)'question_small.gif" width="22" height="22" alt="question icon"></a></h2>\n'; // Standard Error Table If: ((Var:'vError') == '1004' && (Var:'vOption') >> 'new') || (Var:'vError') == '1003' || (Var:'vError') == '1021' || (Var:'vError') == '1013'; LI_ShowError3: -ErrNum=(Var:'vError'), -Option=(Var:'vOption'); /If; '\t\t</td>\n'; '\t</tr>\n'; // Table Header '\t<tr bgcolor="#F5F5F5">\n'; '\t\t<td width="25" class="ghost" valign="middle" align="center"><strong>ID<sup> </sup></strong></td>\n'; '\t\t<td width="35" class="ghost" valign="middle"><strong>Depth<sup> </sup></strong></td>\n'; '\t\t<td width="200" bgcolor="#FFFF99" valign="middle"><strong>Node Name<sup> </sup></strong></td>\n'; '<td width="45" bgcolor="#FFFF99" valign="middle" align="center"><strong>Active<sup> </sup></strong></td>'; '<td width="75" bgcolor="#FFFF99" valign="middle" align="center"><strong>Update<sup> </sup></strong></td>'; '<td width="70" bgcolor="#D4CDDC" valign="middle" align="center"><strong>Delete</strong><sup>(3)</sup></td>\n'; '<td width="260" bgcolor="#FFFFCC" valign="middle" align="center"><strong>Add</strong><sup>(1)(2)</sup></td>\n'; '<td width="175" bgcolor="#F0F0E1" valign="middle" align="center"><strong>Move to New Parent</strong><sup>(4)</sup></td>\n'; '<td width="80" bgcolor="#DEE4E8" valign="middle" align="center"><strong>Move Up</strong><sup>(5)</sup></td>\n'; '<td width="20" class="ghost" valign="middle" align="center"><strong>L<sup> </sup></strong></td>\n'; '<td width="20" class="ghost" valign="middle" align="center"><strong>R<sup> </sup></strong></td>\n'; '\t</tr>\n'; '\t<tr>\n'; '\t\t<td colspan="11"><hr></td>\n'; '\t</tr>\n'; '</table>\n'; Inline: $IV_Heirarchy, -SQL=$SQLSelectFullNode, -Table=$svHeirarchyTable; If: $svDebug == 'Y'; '<p class="debug">\n'; 'Found_Count = ' (Found_Count) '<br>\n'; 'Error_CurrentError = ' (Error_CurrentError) '<br>\n'; 'SQLSelectFullNode = ' ($SQLSelectFullNode) '<br>\n'; 'Records_Array = ' (Records_Array) '<br>\n'; '</p>\n'; /If; $OutputCloseDiv = false; Records; // Looking ahead to next record to see if we should output the closing div Var:'NextLoopCount' = (Math_Add:(Loop_Count),1); Protect; Var:'NextLoopDepthTemp' = (Records_Array->Get:$NextLoopCount); /Protect; Var:'NextLoopID' = ($NextLoopDepthTemp->Get:2); Var:'NextLoopID' = ($NextLoopDepthTemp->Get:1); Var:'NextLoopDepth' = (Integer($NextLoopDepthTemp->Get:3)); If: $NextLoopDepth == 0; $OutputCloseDiv = true; Else; $OutputCloseDiv = false; /If; // Copy depth to ThisNodeDepth Var:'ThisNodeDepth' = (Field:'depth'); If: $svDebug == 'Y'; '<tr><td colspan="11"><p class="debug">\n'; '56: Loop_Count = ' (Loop_Count) '<br>\n'; '56: NextLoopCount = ' ($NextLoopCount) '<br>\n'; '56: Records_Array->Get:$NextLoopCount = ' (Records_Array->Get:$NextLoopCount) '<br>\n'; '56: NextLoopID = ' ($NextLoopID) '<br>\n'; '56: ThisNodeDepth = ' ($ThisNodeDepth) '<br>\n'; '56: NextLoopDepth = ' ($NextLoopDepth) '<br>\n'; '56: OutputCloseDiv = ' ($OutputCloseDiv) '<br>\n'; '56: ID = ' (Field:'id') '<br>\n'; '</p></td></tr>\n'; /If; // Output a h2 head that is clickable to toggle panel on/off If: $ThisNodeDepth == 0; If: $NextLoopDepth != 0; '</table>\n'; /If; /If; If: $ThisNodeDepth == 0; '<div class="panelhead" onclick="exp_coll(\''(Field:'ID')'\')" title="Click to Toggle Panel">\n'; '\t<img src="/site/images/bullet_rightroundyellow.gif" width="20" height="24" id="image_'(Field:'ID')'" alt="icon" title="Click to Toggle Panel" align="bottom">\n'; '\t<strong>'(Field:'name')'</strong>\n'; '</div>\n'; // '<div id="sp_'(Field:'ID')'" style="display:block;">\n'; '<div id="sp_'(Field:'ID')'" style="display:none;">\n'; $OutputCloseDiv = true; /If; '\t<form action="/admin/setup_addresponse.lasso" method="post">\n'; '\t\t<input type="hidden" name="DataType" value="Node">\n'; '\t\t<input type="hidden" name="New" value="Y">\n'; '\t\t<input type="hidden" name="NodeID" value="' (Field:'ID') '">\n'; '<table width="80%" bgcolor="#FFFFFF">\n'; '\t<tr bgcolor="#F5F5F5">\n'; '\t\t<td width="25" class="ghost" valign="middle">' (Field:'ID') '</td>\n'; '\t\t<td width="35" class="ghost" valign="middle">'; If: (Field:'depth') == 0; 'root'; Else; (Field:'depth'); /If; '</td>\n'; '\t\t<td width="200" class="tabletext_11_black" bgcolor="#FFFF99" valign="middle">'; '<div align="left">'; // Output bullets to indicate level if not a root node If: (Field:'depth') != 0; Loop: (Field:'depth'); '<strong>&bull;&nbsp;</strong>'; /Loop; /If; '</div>\n'; // Bold the zero-level categories If: (Field:'depth') == 0; '<strong>\n'; /If; // Indent If: (Field:'depth') != 0; '&nbsp;&nbsp;\n'; /If; '\t\t\t<input type="text" name="UpdateName" value="' (Field:'name') '" size="22" maxlength="64">\n'; If: (Field:'depth') == 0; '</strong>\n'; /If; '\t\t</td>\n'; // Active '\t\t<td width="45" class="tabletext_11_black" bgcolor="#FFFF99" align="center" valign="middle">\n'; '\t\t\t\t<select name="Active">\n'; '\t\t\t\t<option value=""'; If: (Field:'Active') == ''; ' selected'; /If; '></option>\n'; '\t\t\t\t\t<option value="Y"'; If: (Field:'Active') == 'Y'; ' selected'; /If; '>Yes</option>\n'; '\t\t\t\t\t<option value="N"'; If: (Field:'Active') == 'N'; ' selected'; /If; '>No</option>\n'; '\t\t\t</select>\n'; '\t\t</td>\n'; // Update '\t\t<td width="75" class="tabletext_11_black" bgcolor="#FFFF99" align="center" valign="middle">\n'; '\t\t\t\t<input type="submit" name="Action" value="Update">'; '\t\t</td>\n'; // Delete '\t\t<td width="70" class="tabletext_11_black" bgcolor="#D4CDDC" align="center" valign="middle">\n'; '\t\t\t\t<input type="submit" name="Action" value="Delete">\n'; '\t\t</td>\n'; // Add (Same Level) '\t\t<td width="260" class="tabletext_11_black" bgcolor="#FFFFCC" valign="middle">\n'; '\t\t\t\tName <input type="text" name="AddNewNodeName" value="' (Var:'vAddNewNodeName') '" size="12" maxlength="64">\n'; '<input type="submit" name="Action" value="Add (Same Level)"><br>\n'; // Add (1 Level Lower) '\t\t\t\tName <input type="text" name="AddNewChildName" value="' (Var:'vAddNewChildName') '" size="12" maxlength="64">\n'; '<input type="submit" name="Action" value="Add (1 Level Lower)">\n'; '\t\t</td>\n'; // Move to New Parent '\t\t<td width="175" class="tabletext_11_black" bgcolor="#F0F0E1" valign="middle">\n'; '\t\t\t\tNew Parent <input type="text" name="NewParent" value="' (Var:'vNewParent') '" size="4" maxlength="6">'; '<input type="submit" name="Action" value="Move">\n'; '\t\t</td>\n'; // Move Up '\t\t<td width="80" class="tabletext_11_black" bgcolor="#DEE4E8" align="center" valign="middle">\n'; '\t\t\t\t<input type="submit" name="Action" value="Move Up">\n'; '\t\t</td>\n'; // Left and Right '\t\t<td width="20" class="ghost" valign="middle">' (Field:'lft') '</td>\n'; '\t\t<td width="20" class="ghost" valign="middle">' (Field:'rgt') '</td>\n'; '\t</tr>\n'; '</table><!-- 262 -->\n'; '\t</form>\n'; // Output closing div for root node If: (($NextLoopDepth) == '0') && ($OutputCloseDiv == true); '</div><!-- ID '(Field:'id')'-->\n'; $OutputCloseDiv = false; /If; If: $svDebug == 'Y'; '<tr><td colspan="11"><p class="debug">147: ThisNodeDepth = ' ($ThisNodeDepth) '<br>\n'; '147: NextLoopDepth = ' ($NextLoopDepth) '<br>\n'; '147: OutputCloseDiv = ' ($OutputCloseDiv) '</p>\n'; '</td></tr>\n'; /If; /Records; /Inline; // Add New Root Level '<table width="80%" bgcolor="#FFFFFF">\n'; '\t<tr>\n'; '\t\t<td colspan="11"><hr size="4"></td>\n'; '\t</tr>\n'; '\t<tr>\n'; '\t\t<td colspan="11"><h2>Add New Root Level</h2>\n'; // Standard Error Table If: (Var:'vError') == '1004' && (Var:'vOption') == 'root node'; LI_ShowError3: -ErrNum=(Var:'vError'), -Option=(Var:'vOption'); /If; '\t\t</td>\n'; '\t</tr>\n'; '\t<tr bgcolor="#F5F5F5">\n'; '\t\t<td class="tabletext_11_black" colspan="11">\n'; '\t\t\t<form action="/admin/setup_addresponse.lasso" method="post">\n'; '\t\t\t\t<input type="hidden" name="DataType" value="Node">\n'; '\t\t\t\t<input type="hidden" name="New" value="Y">\n'; '\t\t\t\t<strong>New Root Level</strong>: <input type="text" name="NewRootName" value="' (Var:'vNewRootName') '" size="12" maxlength="64">\n'; '\t\t\t\t<input type="submit" name="Action" value="Add New Root"> <strong>NOTE:</strong> This option is used infrequently, and only used if you want a new root level.\n'; '\t\t\t</form>\n'; '\t\t</td>\n'; '\t</tr>\n'; '\t<tr>\n'; '\t\t<td colspan="11"><hr size="4"></td>\n'; '\t</tr>\n'; '</table>\n'; // Security check Else; Var:'vError' = '6004'; // Cobble together a page; This is done like this because the Heirarchy page is a different format ?> <table width="780"> <tr> <td width="170"> [Include:($svLibsPath)'navbar_main.inc'] </td> <td> <div class="contentcontainerwhite"> <?Lassoscript // Standard Error Table LI_ShowError3: -ErrNum=(Var:'vError'), -Option=(Var:'vOption'); Include:'frm_login.inc'; ?> </td> </tr> </table> [/If] [Include:($svIncludesPath)'build_footer.inc'] [OutputFooter] </body> [LI_CMSatend] </html>
Lasso
4
subethaedit/SubEthaEd
Documentation/ModeDevelopment/Reference Files/LassoScript-HTML/itpage/admin/manage_heirarchy.lasso
[ "MIT" ]
//tab_size=4 // Copyright 2021 nickmqb // SPDX-License-Identifier: Apache-2.0 Compilation struct #RefType { unit CodeUnit symbols Map<string, SymbolInfo> constUsages Map<int, ConstInfo> } SymbolInfo struct #RefType { type SymbolType node Node opcode int } SymbolType enum { reserved opcode decl label } Error struct { span IntRange text string at(span IntRange, text string) { assert(span.from <= span.to) return Error { span: span, text: text } } atIndex(index int, text string) { return Error { span: IntRange(index, index), text: text } } } Node tagged_pointer { CodeUnit Decl Block NumberExpr ComboStatement Token } CodeUnit struct #RefType { sf SourceFile contents List<Node> lines List<LineInfo> } Decl struct #RefType { name string allNames List<string> valueExpr NumberExpr isVar bool numReads int numWrites int localIndex int } ConstInfo struct #RefType { value int pos bool neg bool numReads int localIndex int } Block struct #RefType { contents List<Node> } ComboStatement struct #RefType { nodes List<Node> } NumberExpr struct #RefType { token Token value int } Token struct #RefType { value string span IntRange type TokenType line int } TokenType enum { identifier operator openBrace closeBrace number end } LineInfo struct { span IntRange insSpan IntRange relevant bool } ParseState struct #RefType { comp Compilation text string index int token Token line int lineStart int lineRelevant bool lines List<LineInfo> varIndex int unresolvedLabels List<Token> labelSet Set<string> } Parser { parse(sf SourceFile) { s := new ParseState { text: sf.text, token: new Token{}, lines: new List<LineInfo>{}, unresolvedLabels: new List<Token>{}, labelSet: new Set.create<string>() } unit := new CodeUnit { sf: sf, contents: new List<Node>{}, lines: s.lines } s.comp = new Compilation { unit: unit, symbols: new Map.create<string, SymbolInfo>(), constUsages: new Map.create<int, ConstInfo>(), } OpcodeInfo.addDefaultSymbols(s.comp.symbols) readToken(s) while s.token.type != TokenType.end { topLevelNode(s, unit) } for lb in s.unresolvedLabels { if !s.labelSet.contains(lb.value) { errorAtRange(s, lb.span, "Undefined symbol") } } return s.comp } topLevelNode(s ParseState, unit CodeUnit) { if s.token.type == TokenType.identifier { unit.contents.add(decl(s)) } else if s.token.type == TokenType.openBrace { unit.contents.add(block(s)) } else if s.token.value == "@" { unit.contents.add(label(s)) } else { error(s, "Expected: decl") } } decl(s ParseState) { if s.comp.symbols.containsKey(s.token.value) { error(s, "A symbol with the same name has already been defined") } decl := new Decl { name: s.token.value, allNames: new List<string>{}, localIndex: -1 } si := new SymbolInfo { type: SymbolType.decl, node: decl } s.comp.symbols.add(decl.name, si) decl.allNames.add(decl.name) readToken(s) while s.token.value == "," { readToken(s) if s.token.type != TokenType.identifier { error(s, "Expected: identifier") } if s.comp.symbols.containsKey(s.token.value) { error(s, "A symbol with the same name has already been defined") } s.comp.symbols.add(s.token.value, si) decl.allNames.add(s.token.value) readToken(s) } if s.token.value == "var" { decl.isVar = true readToken(s) } if s.token.value == ":=" { readToken(s) decl.valueExpr = numberExpr(s) } else if s.varIndex == -1 { error(s, "Expected: var or :=") } return decl } block(s ParseState) Block { bl := new Block { contents: new List<Node>{} } readToken(s) while s.token.type != TokenType.closeBrace { if s.token.type == TokenType.openBrace { bl.contents.add(block(s)) } else if s.token.type == TokenType.identifier { name := s.token.value //Stdout.writeLine(format("name: {}", name)) bl.contents.add(statement(s)) } else if s.token.type == TokenType.operator { if s.token.value == "@" { bl.contents.add(label(s)) } else if s.token.value == "<<" || s.token.value == ">>s" || s.token.value == ">>u" { bl.contents.add(shift(s)) } else { bl.contents.add(operatorStatement(s)) } } else if s.token.type == TokenType.number { expr := numberExpr(s) recordConstUsage(s, expr.value) bl.contents.add(expr) } else if s.token.type == TokenType.end { error(s, "Expected: }") } } readToken(s) return bl } recordConstUsage(s ParseState, val int) { neg := val < 0 val &= 0xffff info := s.comp.constUsages.getOrDefault(val) if info == null { info = new ConstInfo { value: val, localIndex: -1 } s.comp.constUsages.add(val, info) } info.numReads += 1 info.pos ||= !neg info.neg ||= neg } statement(s ParseState) Node { sym := s.comp.symbols.getOrDefault(s.token.value) if sym == null { error(s, "Undefined symbol") } if s.token.value == "if" { return if_(s) } else if s.token.value == "out" || s.token.value == "in" { return in_out(s) } else if s.token.value == "goto" || s.token.value == "call" { st := new ComboStatement { nodes: new List<Node>{} } gotoTail(s, st) return st } else if s.token.value == "ret" { // OK } else if sym.type == SymbolType.reserved { error(s, "Invalid use of reserved symbol") } else if sym.type == SymbolType.label { error(s, "Expected: call or goto") } else if sym.type == SymbolType.decl { decl := sym.node.as(Decl) if decl.isVar { decl.numReads += 1 } else { recordConstUsage(s, decl.valueExpr.value) } } result := s.token readToken(s) return result } if_(s ParseState) { st := new ComboStatement { nodes: new List<Node>{} } st.nodes.add(s.token) readToken(s) if s.token.value == "z" || s.token.value == "nz" { // OK } else { error(s, "Expected: z or nz") } st.nodes.add(s.token) readToken(s) if s.token.type == TokenType.openBrace { st.nodes.add(block(s)) if s.token.value == "else" { st.nodes.add(s.token) readToken(s) if s.token.type == TokenType.openBrace { st.nodes.add(block(s)) } else { error(s, "Expected: {") } } } else if s.token.value == "goto" { gotoTail(s, st) } else { error(s, "Expected: goto or {") } return st } in_out(s ParseState) { st := new ComboStatement { nodes: new List<Node>{} } st.nodes.add(s.token) to := s.token.span.to readToken(s) if s.token.span.from != to { error(s, "Token must not have leading whitespace") } if s.token.value != ":" { error(s, "Expected: :") } st.nodes.add(s.token) to = s.token.span.to readToken(s) if s.token.span.from != to { error(s, "Token must not have leading whitespace") } port := numberExpr(s) if !(0 <= port.value && port.value < 256) { error(s, "Invalid port") } st.nodes.add(port) return st } shift(s ParseState) { st := new ComboStatement { nodes: new List<Node>{} } first := s.token st.nodes.add(s.token) to := s.token.span.to readToken(s) if s.token.span.from != to { error(s, "Token must not have leading whitespace") } if s.token.value != ":" { error(s, "Expected: :") } st.nodes.add(s.token) to = s.token.span.to readToken(s) if s.token.span.from != to { error(s, "Token must not have leading whitespace") } amount := numberExpr(s) maxAmount := first.value == ">>s" ? 12 : 15 if !(0 < amount.value && amount.value <= maxAmount) { error(s, "Invalid shift amount") } if first.value == "<<" { recordConstUsage(s, 1 << amount.value) } else if first.value == ">>s" { recordConstUsage(s, 1 << (12 - amount.value)) } else if first.value == ">>u" { recordConstUsage(s, 1 << (16 - amount.value)) } else { abandon() } st.nodes.add(amount) return st } gotoTail(s ParseState, st ComboStatement) { st.nodes.add(s.token) readToken(s) targetSym := s.comp.symbols.getOrDefault(s.token.value) if s.token.type != TokenType.identifier { error(s, "Expected: label") } else if s.token.value.startsWith("@") { error(s, "Expected: label (must not use @ prefix)") } else if targetSym == null { s.unresolvedLabels.add(s.token) } else if s.token.value == "begin" || s.token.value == "outer_begin" { // OK } else if targetSym.type == SymbolType.label { // OK } else { error(s, "Expected: label") } st.nodes.add(s.token) readToken(s) } operatorStatement(s ParseState) Node { if s.token.value == "=>" { st := new ComboStatement { nodes: new List<Node>{} } st.nodes.add(s.token) to := s.token.span.to readToken(s) if s.token.span.from != to { error(s, "Token must not have leading whitespace") } sym := s.comp.symbols.getOrDefault(s.token.value) if s.token.type != TokenType.identifier { error(s, "Expected: var") } else if sym == null { error(s, "Undefined symbol") } else if sym.type == SymbolType.decl && sym.node.as(Decl).isVar { // OK } else { error(s, "Expected: var") } sym.node.as(Decl).numWrites += 1 st.nodes.add(s.token) readToken(s) return st } if s.comp.symbols.containsKey(s.token.value) { // OK } else { error(s, "Invalid operator") } result := s.token readToken(s) return result } label(s ParseState) { st := new ComboStatement { nodes: new List<Node>{} } st.nodes.add(s.token) to := s.token.span.to readToken(s) if s.token.span.from != to { error(s, "Token must not have leading whitespace") } if s.token.type != TokenType.identifier { error(s, "Expected: label") } if s.comp.symbols.tryAdd(s.token.value, new SymbolInfo { type: SymbolType.label, node: s.token }) { // OK } else { error(s, "A symbol with the same name has already been defined") } st.nodes.add(s.token) s.labelSet.add(s.token.value) readToken(s) return st } numberExpr(s ParseState) { if s.token.type != TokenType.number { error(s, "Expected: number") } str := s.token.value pr := str.startsWith("0x") ? long.tryParseHex(str.slice(2, str.length)) : long.tryParse(str) if !pr.hasValue { error(s, "Expected: number") } val := pr.value if val < short.minValue || val > ushort.maxValue { error(s, "Value does not fit into 16 bits") } token := s.token readToken(s) return new NumberExpr { token: token, value: cast(val, int) } } readToken(s ParseState) { ch := s.text[s.index] while true { while ch == ' ' || ch == '\t' || ch == '\r' { s.index += 1 ch = s.text[s.index] } if ch == '\n' { s.lines.add(LineInfo { span: IntRange(s.lineStart, s.index), relevant: s.lineRelevant }) s.index += 1 s.lineStart = s.index s.lineRelevant = false s.line += 1 ch = s.text[s.index] } else if ch == '/' && s.text[s.index + 1] == '/' { s.index += 2 ch = s.text[s.index] while ch != '\n' && ch != '\0' { s.index += 1 ch = s.text[s.index] } } else { break } } if ch == '\0' { finishToken(s, TokenType.end, s.index) return } from := s.index if isIdentifierFirstChar(ch) { s.index += 1 ch = s.text[s.index] while isIdentifierChar(ch) { s.index += 1 ch = s.text[s.index] } finishToken(s, TokenType.identifier, from) return } if ch == '{' { s.lineRelevant = true s.index += 1 finishToken(s, TokenType.openBrace, from) return } if ch == '}' { s.lineRelevant = true s.index += 1 finishToken(s, TokenType.closeBrace, from) return } if isDigit(ch) || (ch == '-' && isDigit(s.text[s.index + 1])) { s.index += 1 ch = s.text[s.index] while isIdentifierChar(ch) { s.index += 1 ch = s.text[s.index] } finishToken(s, TokenType.number, from) return } if isOperatorFirstChar(ch) { s.lineRelevant ||= ch == '@' s.index += 1 ch = s.text[s.index] while isOperatorChar(ch) { s.index += 1 ch = s.text[s.index] } if ch == 's' || ch == 'u' { nextCh := s.text[s.index + 1] if isWhitespace(nextCh) || nextCh == '\0' || nextCh == ':' { s.index += 1 } } finishToken(s, TokenType.operator, from) return } errorAtRange(s, IntRange(from, from + 1), format("Invalid token (ch: {})", transmute(ch, int))) } finishToken(s ParseState, type TokenType, from int) { //Stdout.writeLine(format("%{}%", s.text.slice(from, s.index))) s.token = new Token { type: type, value: s.text.slice(from, s.index), span: IntRange(from, s.index), line: s.line } } error(s ParseState, text string) { errorAtRange(s, s.token.span, text) } errorAtRange(s ParseState, span IntRange, text string) { Stdout.writeLine(ErrorHelper.getErrorDesc(s.comp.unit.sf.path, s.comp.unit.sf.text, span, text)) exit(1) } isDigit(ch char) { return '0' <= ch && ch <= '9' } isWhitespace(ch char) { return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r' } isIdentifierFirstChar(ch char) { return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || ch == '_' } isIdentifierChar(ch char) { return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9') || ch == '_' } isOperatorFirstChar(ch char) { return isOperatorChar(ch) || ch == ':' } isOperatorChar(ch char) { return ch == '=' || ch == '^' || ch == '+' || ch == '-' || ch == '&' || ch == '|' || ch == '<' || ch == '>' || ch == '~' || ch == '!' || ch == '.' || ch == '@' || ch == ',' } }
mupad
5
nickmqb/fpga_craft
kasm/parser.mu
[ "Apache-2.0" ]