content
stringlengths
4
1.04M
lang
stringclasses
358 values
score
int64
0
5
repo_name
stringlengths
5
114
repo_path
stringlengths
4
229
repo_licenses
sequencelengths
1
8
%!PS-Adobe-3.0 Resource-Encoding %%Title: VIM-cp1250 %%Version: 1.0 0 %%EndComments /VIM-cp1250[ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quotesingle /parenleft /parenright /asterisk /plus /comma /minus /period /slash /zero /one /two /three /four /five /six /seven /eight /nine /colon /semicolon /less /equal /greater /question /at /A /B /C /D /E /F /G /H /I /J /K /L /M /N /O /P /Q /R /S /T /U /V /W /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore /grave /a /b /c /d /e /f /g /h /i /j /k /l /m /n /o /p /q /r /s /t /u /v /w /x /y /z /braceleft /bar /braceright /tilde /.notdef /Euro /.notdef /quotesinglbase /.notdef /quotedblbase /ellipsis /dagger /daggerdbl /.notdef /perthousand /Scaron /guilsinglleft /Sacute /Tcaron /Zcaron /Zacute /.notdef /quoteleft /quoteright /quotedblleft /quotedblright /bullet /endash /emdash /.notdef /trademark /scaron /guilsinglright /sacute /tcaron /zcaron /zacute /space /caron /breve /Lslash /currency /Aogonek /brokenbar /section /dieresis /copyright /Scedilla /guillemotleft /logicalnot /hyphen /registered /Zdotaccent /degree /plusminus /ogonek /lslash /acute /mu /paragraph /periodcentered /cedilla /aogonek /scedilla /guillemotright /Lcaron /hungarumlaut /lcaron /zdotaccent /Racute /Aacute /Acircumflex /Abreve /Adieresis /Lacute /Cacute /Ccedilla /Ccaron /Eacute /Eogonek /Edieresis /Ecaron /Iacute /Icircumflex /Dcaron /Dcroat /Nacute /Ncaron /Oacute /Ocircumflex /Ohungarumlaut /Odieresis /multiply /Rcaron /Uring /Uacute /Uhungarumlaut /Udieresis /Yacute /Tcedilla /germandbls /racute /aacute /acircumflex /abreve /adieresis /lacute /cacute /ccedilla /ccaron /eacute /eogonek /edieresis /ecaron /iacute /icircumflex /dcaron /dcroat /nacute /ncaron /oacute /ocircumflex /ohungarumlaut /odieresis /divide /rcaron /uring /uacute /uhungarumlaut /udieresis /yacute /tcedilla /dotaccent] /Encoding defineresource pop % vim:ff=unix: %%EOF
PostScript
0
uga-rosa/neovim
runtime/print/cp1250.ps
[ "Vim" ]
stocks load aapl fa fmp h help ? q fmp .. .. fa fmp quit fmp home stocks load aal fa fmp exit
Gosu
0
minhhoang1023/GamestonkTerminal
scripts/test_stocks_fa_fmp_base.gst
[ "MIT" ]
# Based on: # Configure paths for LIBXML2 # Toshio Kuratomi 2001-04-21 # Adapted from: # Configure paths for GLIB # Owen Taylor 97-11-3 # # Modified to work with libxslt by Thomas Schraitle 2002/10/25 # Fixed by Edward Rudd 2004/05/12 dnl AM_PATH_XSLT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for XML, and define XML_CFLAGS and XML_LIBS dnl AC_DEFUN([AM_PATH_XSLT],[ AC_ARG_WITH(xslt-prefix, [ --with-xslt-prefix=PFX Prefix where libxslt is installed (optional)], xslt_config_prefix="$withval", xslt_config_prefix="") AC_ARG_WITH(xslt-exec-prefix, [ --with-xslt-exec-prefix=PFX Exec prefix where libxslt is installed (optional)], xslt_config_exec_prefix="$withval", xslt_config_exec_prefix="") AC_ARG_ENABLE(xslttest, [ --disable-xslttest Do not try to compile and run a test LIBXSLT program],, enable_xslttest=yes) if test x$xslt_config_exec_prefix != x ; then xslt_config_args="$xslt_config_args --exec-prefix=$xslt_config_exec_prefix" if test x${XSLT_CONFIG+set} != xset ; then XSLT_CONFIG=$xslt_config_exec_prefix/bin/xslt-config fi fi if test x$xslt_config_prefix != x ; then xslt_config_args="$xslt_config_args --prefix=$xslt_config_prefix" if test x${XSLT_CONFIG+set} != xset ; then XSLT_CONFIG=$xslt_config_prefix/bin/xslt-config fi fi AC_PATH_PROG(XSLT_CONFIG, xslt-config, no) min_xslt_version=ifelse([$1], ,1.0.0,[$1]) AC_MSG_CHECKING(for libxslt - version >= $min_xslt_version) no_xslt="" if test "$XSLT_CONFIG" = "no" ; then no_xslt=yes else XSLT_CFLAGS=`$XSLT_CONFIG $xslt_config_args --cflags` XSLT_LIBS=`$XSLT_CONFIG $xslt_config_args --libs` xslt_config_major_version=`$XSLT_CONFIG $xslt_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` xslt_config_minor_version=`$XSLT_CONFIG $xslt_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` xslt_config_micro_version=`$XSLT_CONFIG $xslt_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_xslttest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $XSLT_CFLAGS" LIBS="$XSLT_LIBS $LIBS" dnl dnl Now check if the installed libxslt is sufficiently new. dnl (Also sanity checks the results of xslt-config to some extent) dnl rm -f conf.xslttest AC_TRY_RUN([ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <libxslt/xsltconfig.h> #include <libxslt/xslt.h> int main() { int xslt_major_version, xslt_minor_version, xslt_micro_version; int major, minor, micro; char *tmp_version; system("touch conf.xslttest"); /* Capture xslt-config output via autoconf/configure variables */ /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = (char *)strdup("$min_xslt_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) { printf("%s, bad version string from xslt-config\n", "$min_xslt_version"); exit(1); } free(tmp_version); /* Capture the version information from the header files */ tmp_version = (char *)strdup(LIBXSLT_DOTTED_VERSION); if (sscanf(tmp_version, "%d.%d.%d", &xslt_major_version, &xslt_minor_version, &xslt_micro_version) != 3) { printf("%s, bad version string from libxslt includes\n", "LIBXSLT_DOTTED_VERSION"); exit(1); } free(tmp_version); /* Compare xslt-config output to the libxslt headers */ if ((xslt_major_version != $xslt_config_major_version) || (xslt_minor_version != $xslt_config_minor_version) || (xslt_micro_version != $xslt_config_micro_version)) { printf("*** libxslt header files (version %d.%d.%d) do not match\n", xslt_major_version, xslt_minor_version, xslt_micro_version); printf("*** xslt-config (version %d.%d.%d)\n", $xslt_config_major_version, $xslt_config_minor_version, $xslt_config_micro_version); return 1; } /* Compare the headers to the library to make sure we match */ /* Less than ideal -- doesn't provide us with return value feedback, * only exits if there's a serious mismatch between header and library. */ /* copied from LIBXML_TEST_VERSION; */ xmlCheckVersion(LIBXML_VERSION); /* Test that the library is greater than our minimum version */ if ((xslt_major_version > major) || ((xslt_major_version == major) && (xslt_minor_version > minor)) || ((xslt_major_version == major) && (xslt_minor_version == minor) && (xslt_micro_version >= micro))) { return 0; } else { printf("\n*** An old version of libxslt (%d.%d.%d) was found.\n", xslt_major_version, xslt_minor_version, xslt_micro_version); printf("*** You need a version of libxslt newer than %d.%d.%d. The latest version of\n", major, minor, micro); printf("*** libxslt is always available from ftp://ftp.xmlsoft.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); printf("*** probably means that the wrong copy of the xslt-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of LIBXSLT, but you can also set the XSLT_CONFIG environment to point to the\n"); printf("*** correct copy of xslt-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } return 1; } ],, no_xslt=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_xslt" = x ; then AC_MSG_RESULT(yes (version $xslt_config_major_version.$xslt_config_minor_version.$xslt_config_micro_version)) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$XSLT_CONFIG" = "no" ; then echo "*** The xslt-config script installed by LIBXSLT could not be found" echo "*** If libxslt was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the XSLT_CONFIG environment variable to the" echo "*** full path to xslt-config." else if test -f conf.xslttest ; then : else echo "*** Could not run libxslt test program, checking why..." CFLAGS="$CFLAGS $XSLT_CFLAGS" LIBS="$LIBS $XSLT_LIBS" AC_TRY_LINK([ #include <libxslt/xslt.h> #include <stdio.h> ], [ LIBXSLT_TEST_VERSION; return 0;], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding LIBXSLT or finding the wrong" echo "*** version of LIBXSLT. If it is not finding LIBXSLT, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means LIBXSLT was incorrectly installed" echo "*** or that you have moved LIBXSLT since it was installed. In the latter case, you" echo "*** may want to edit the xslt-config script: $XSLT_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi XSLT_CFLAGS="" XSLT_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(XSLT_CFLAGS) AC_SUBST(XSLT_LIBS) rm -f conf.xslttest ])
M4
4
anivaros/libxslt
libxslt.m4
[ "MIT" ]
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>index.html</title> </head> <body> <script> function reqListener () { document.getElementById('result').innerHTML = this.responseText; } function test() { var oReq = new XMLHttpRequest(); oReq.addEventListener("load", reqListener); oReq.open("GET", "http://127.0.0.1:{port}/"); oReq.send(); } </script> <h1 id="result">node-main test</h1> <button onclick="test()">test</button> </body> </html>
Smarty
3
namaljayathunga/nw.js
test/remoting/node-main/index_html.tpl
[ "MIT" ]
.VRule { height: 20px; width: 1px; border-left: 1px solid var(--color-border); padding-left: 0.25rem; margin-left: 0.25rem; } /** * https://developer.mozilla.org/en-US/docs/Web/API/File/Using_files_from_web_applications */ .Input { position: absolute !important; height: 1px; width: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); } .ErrorMessage { margin: 0.5rem 0; color: var(--color-dim); font-family: var(--font-family-monospace); font-size: var(--font-size-monospace-normal); }
CSS
3
vegYY/react
packages/react-devtools-shared/src/devtools/views/Profiler/ProfilingImportExportButtons.css
[ "MIT" ]
import React from 'react'; import ReactDOM from 'react-dom'; import 'todomvc-common/base.css'; import 'todomvc-app-css/index.css'; import { inspect } from '@xstate/inspect'; inspect({ iframe: false }); import App from './App'; ReactDOM.render(<App />, document.getElementById('root'));
JSX
3
Shermayster/xstate
examples/todo-mvc-react/src/main.jsx
[ "MIT" ]
--TEST-- Bug #69084: Unclear error message when not implementing a renamed abstract trait function --FILE-- <?php trait Foo { abstract public function doStuff(); public function main() { $this->doStuff(); } } class Bar { use Foo { Foo::doStuff as doOtherStuff; } public function doStuff() { var_dump(__FUNCTION__); } } $b = new Bar(); $b->main(); ?> --EXPECTF-- Fatal error: Class Bar contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Bar::doOtherStuff) in %s on line %d
PHP
3
thiagooak/php-src
Zend/tests/bug69084.phpt
[ "PHP-3.01" ]
#!/bin/tcsh set nl=4 set M=8 set N=8 echo nl=$nl echo M=$M echo N=$N #compile fdtd-2d chpl --fast fdtd-2d.chpl -o fdtd-2d echo 'Cyclic (C)' ./fdtd-2d -nl $nl --dist=C --M=$M --N=$N --messages ./fdtd-2d -nl $nl --dist=C --M=$M --N=$N --timeit echo 'Cyclic with modulo unrolling (CM)' ./fdtd-2d -nl $nl --dist=CM --M=$M --N=$N --correct ./fdtd-2d -nl $nl --dist=CM --M=$M --N=$N --messages ./fdtd-2d -nl $nl --dist=CM --M=$M --N=$N --timeit echo 'Block (B)' ./fdtd-2d -nl $nl --dist=B --M=$M --N=$N --messages ./fdtd-2d -nl $nl --dist=B --M=$M --N=$N --timeit echo 'No distribution (NONE)' ./fdtd-2d -nl $nl --dist=NONE --M=$M --N=$N --timeit
Tcsh
4
jhh67/chapel
test/users/aroonsharma/Stencil/dofdtd2dbench.tcsh
[ "ECL-2.0", "Apache-2.0" ]
INTERFACE zif_abapgit_gui_hotkeys PUBLIC . TYPES: BEGIN OF ty_hotkey_with_descr, ui_component TYPE string, action TYPE string, hotkey TYPE string, description TYPE string, END OF ty_hotkey_with_descr . TYPES: ty_hotkeys_with_descr TYPE STANDARD TABLE OF ty_hotkey_with_descr WITH DEFAULT KEY WITH UNIQUE SORTED KEY action COMPONENTS ui_component action . METHODS get_hotkey_actions RETURNING VALUE(rt_hotkey_actions) TYPE ty_hotkeys_with_descr . ENDINTERFACE.
ABAP
4
Manny27nyc/abapGit
src/ui/core/zif_abapgit_gui_hotkeys.intf.abap
[ "MIT" ]
int main() { var test1 = new Test (); var test2 = new Subdir.Test (); var test3 = new Subdir2.Test (); var test4 = new Subdir.Subdir2.Test (); stdout.printf("Vala is working.\n"); return 0; }
Vala
1
kira78/meson
test cases/vala/22 same target in directories/prog.vala
[ "Apache-2.0" ]
// NOLINT(namespace-envoy) constexpr char TEST_NON_SPIFFE_SAN_CERT_256_HASH[] = "f47a053ad90243ec948df601d156911b0aaf75c9474c989fddd4f6bca44cf692"; constexpr char TEST_NON_SPIFFE_SAN_CERT_1_HASH[] = "846c80075e0bf5261709e34d9e429a55fb6fd2c3"; constexpr char TEST_NON_SPIFFE_SAN_CERT_SPKI[] = "Xv64COw0ddwG6Ht4kW+hqYcW8m+xnd4GlPeN8TphvcU="; constexpr char TEST_NON_SPIFFE_SAN_CERT_SERIAL[] = "6ac34617e0438a7efd7723cd4b806810e2c8e551"; constexpr char TEST_NON_SPIFFE_SAN_CERT_NOT_BEFORE[] = "Feb 3 14:51:23 2021 GMT"; constexpr char TEST_NON_SPIFFE_SAN_CERT_NOT_AFTER[] = "Feb 3 14:51:23 2023 GMT";
C
1
dcillera/envoy
test/extensions/transport_sockets/tls/test_data/non_spiffe_san_cert_info.h
[ "Apache-2.0" ]
# frozen_string_literal: true class UuidItem < ActiveRecord::Base end class UuidValidatingItem < UuidItem validates_uniqueness_of :uuid end
Ruby
4
mdesantis/rails
activerecord/test/models/uuid_item.rb
[ "MIT" ]
#include <ATen/ATen.h> #include <ATen/AccumulateType.h> #include <ATen/ceil_div.h> #include <ATen/NativeFunctions.h> #include <ATen/CUDAFunctions.h> #include <ATen/cuda/CUDAContext.h> #include <ATen/cuda/detail/KernelUtils.h> #include <ATen/native/UnaryOps.h> #include <ATen/native/cuda/LaunchUtils.h> #include <ATen/cuda/CUDAGraphsUtils.cuh> #include <ATen/native/cuda/block_reduce.cuh> #include <curand.h> #include <curand_kernel.h> #include <curand_philox4x32_x.h> namespace at { namespace native { namespace { template <typename T> inline __device__ bool _isinf(T x) { return ::isinf(x); } inline __device__ bool _isinf(c10::Half x) { return ::isinf(static_cast<float>(x)); } inline __device__ bool _isinf(c10::BFloat16 x) { return ::isinf(static_cast<float>(x)); } #define MAX_NUM_BLOCKS 200 // Normalizes the L1 norm of every row to 1; used by multinomial template <typename scalar_t> C10_LAUNCH_BOUNDS_1(cuda::detail::CUDA_NUM_THREADS) __global__ void renormRowsL1(scalar_t* dist, long rows, long cols) { extern __shared__ unsigned char my_smem[]; scalar_t *smem = reinterpret_cast<scalar_t *>(my_smem); scalar_t zero = static_cast<scalar_t>(0); scalar_t val; for (int64_t row = blockIdx.x; row < rows; row += gridDim.x) { scalar_t sum = static_cast<scalar_t>(0); for (int64_t col = threadIdx.x; col < cols; col += blockDim.x) { val = dist[row * cols + col]; CUDA_KERNEL_ASSERT(!(val < zero)); // ! < 0 for NaN handling sum = sum + val; } sum = cuda_utils::BlockReduceSum(sum, smem); if (threadIdx.x == 0) { CUDA_KERNEL_ASSERT(!(val < zero)); // ! < 0 for NaN handling smem[0] = sum; } __syncthreads(); sum = smem[0]; if (sum > zero) { for (int64_t col = threadIdx.x; col < cols; col += blockDim.x) { dist[row * cols + col] = dist[row * cols + col] / sum; } } } } void renormRows(Tensor& t) { TORCH_CHECK(t.dim() == 2); int64_t rows = t.size(0); int64_t cols = t.size(1); auto props = at::cuda::getCurrentDeviceProperties(); CUDA_KERNEL_ASSERT(props != NULL); int numSM = props->multiProcessorCount; const int64_t maxThreads = std::min( props->maxThreadsPerBlock, cuda_utils::kCUDABlockReduceMaxThreads); dim3 grid(rows < numSM * 4 ? rows : numSM * 4); dim3 block(std::min(maxThreads, C10_WARP_SIZE * ceil_div(cols, int64_t{C10_WARP_SIZE}))); AT_DISPATCH_FLOATING_TYPES_AND_HALF(t.scalar_type(), "renormRows_cuda", [&] { renormRowsL1<scalar_t> <<<grid, block, (block.x / C10_WARP_SIZE) * sizeof(scalar_t), at::cuda::getCurrentCUDAStream()>>>(t.data_ptr<scalar_t>(), rows, cols); C10_CUDA_KERNEL_LAUNCH_CHECK(); }); } template <typename scalar_t> __device__ int binarySearchForMultinomial(scalar_t* cumdist, scalar_t* dist, int size, scalar_t val) { int start = 0; int end = size; // cumdist[size - 1] = 0 => all zero prob dist CUDA_KERNEL_ASSERT(cumdist[size - 1] > static_cast<scalar_t>(0)); while (end - start > 0) { int mid = start + (end - start) / 2; scalar_t midVal = cumdist[mid]; if (midVal < val) { start = mid + 1; } else { end = mid; } } if (start == size) { // No probability mass or precision problems; just return the // first non-zero element by setting start to size-1 here, // the code below will move it to the last non-zero probability // this actually can happen when the random number is 1 // (github pytorch issue #4858). start = size - 1; } while(start >= 1 && dist[start] == 0) start--; return start; } template <typename scalar_t> __global__ void sampleMultinomialWithReplacement(PhiloxCudaState philox_args, int totalSamples, int64_t* dest, int64_t distributions, int categories, scalar_t* normDistPrefixSum, scalar_t* normDist) { // At the moment, each warp computes one sample value in the binary // search due to divergence. It seems possible to compute multiple // values and limit divergence though later on. auto seeds = at::cuda::philox::unpack(philox_args); // global index formula for 2D grid of 1D blocks int idx = blockIdx.y * gridDim.x * blockDim.x + blockIdx.x * blockDim.x + threadIdx.x; curandStatePhilox4_32_10_t state; curand_init(std::get<0>(seeds), idx, std::get<1>(seeds), &state); // The block determines the distribution for which we generate a point for (int64_t curDist = blockIdx.y; curDist < distributions; curDist += gridDim.y) { for (int sample = blockIdx.x*blockDim.x + threadIdx.x; sample < totalSamples; sample += blockDim.x*gridDim.x) { //we are losing 3 out of 4 generated numbers but it's ok //this kernel is not very efficient anyway auto rand = curand_uniform4(&state); scalar_t r = static_cast<scalar_t>(rand.x); // Find the bucket that a uniform sample lies in int choice = binarySearchForMultinomial<scalar_t>( normDistPrefixSum + curDist * categories, normDist + curDist * categories, categories, r); dest[curDist * totalSamples + sample] = choice; } } } template <typename scalar_t, typename accscalar_t> C10_LAUNCH_BOUNDS_1(cuda::detail::CUDA_NUM_THREADS) __global__ void sampleMultinomialOnce( int64_t* dest, int64_t distributions, int categories, scalar_t* sampled, scalar_t* dist, int stride_dist, // dist->stride(0) int stride_categories // dist->stride(1) ) { extern __shared__ unsigned char my_smem[]; __shared__ bool found; __shared__ unsigned foundPos; accscalar_t *smem = reinterpret_cast<accscalar_t *>(my_smem); accscalar_t accZero = static_cast<accscalar_t>(0); scalar_t zero = static_cast<scalar_t>(0); for (int64_t curDist = blockIdx.x; curDist < distributions; curDist += gridDim.x) { // Each block handles one distribution // First pass, find the total sum of the distribution accscalar_t sum = accZero; scalar_t val; for (int cat = threadIdx.x; cat < categories; cat += blockDim.x) { val = dist[curDist * stride_dist + cat * stride_categories]; CUDA_KERNEL_ASSERT(!at::_isnan(val)); CUDA_KERNEL_ASSERT(!_isinf(val)); CUDA_KERNEL_ASSERT(!(val < zero)); sum = sum + static_cast<accscalar_t>(val); } // threadIdx.x == 0 has the sum value from this sum = cuda_utils::BlockReduceSum(sum, smem); // Broadcast sum and sample value if (threadIdx.x == 0) { // Make sure the sum of our distribution didn't overflow CUDA_KERNEL_ASSERT(!_isinf(val)); CUDA_KERNEL_ASSERT(sum > accZero); foundPos = 0; smem[0] = sum; smem[1] = sampled[curDist]; } __syncthreads(); sum = smem[0]; scalar_t sample = static_cast<scalar_t>(smem[1]); __syncthreads(); if (sum == accZero) { // Choose the first element if (threadIdx.x == 0) { dest[curDist] = 0; } continue; } int chunks = (categories + (int)blockDim.x - 1) / blockDim.x; accscalar_t prevHighProb = accZero; found = false; for (int chunk = 0; chunk < chunks && !found; ++chunk) { // All threads in bounds load a value int cat = chunk * blockDim.x + threadIdx.x; accscalar_t dist_val = cat < categories ? static_cast<accscalar_t>(dist[curDist * stride_dist + cat * stride_categories]) / sum : accZero; smem[threadIdx.x] = dist_val; __syncthreads(); // Perform an inclusive prefix sum of the shared memory contents for (int offset = 1; offset < blockDim.x; offset *= 2) { accscalar_t val = accZero; if (threadIdx.x >= offset) { val = smem[threadIdx.x - offset] + smem[threadIdx.x]; } __syncthreads(); if (threadIdx.x >= offset) { smem[threadIdx.x] = val; } __syncthreads(); } // Each thread will check to see if the sample falls in its // bucket scalar_t curBucket = static_cast<scalar_t>(smem[threadIdx.x] + prevHighProb); scalar_t prevBucket = static_cast<scalar_t>( threadIdx.x == 0 ? prevHighProb : smem[threadIdx.x - 1] + prevHighProb); bool inBucket = (cat < categories) && (!(sample >= curBucket) && (sample >= prevBucket) && (dist_val > zero)); if (inBucket) { // We're done; we have the sample // Torch indices are 1-based atomicMax(&foundPos, cat); found = true; } // Store the previous scan's high value for future use prevHighProb = prevHighProb + smem[blockDim.x - 1]; __syncthreads(); } if (threadIdx.x == 0) { if (found) { dest[curDist] = foundPos; } else { // This should address a rare bug where we don't select a valid index. This likely occurs when // due to floating point arithmetic rounding errors, our cumulative sum does not add up to 1, but // and our uniform sample is greater than this value. In this case we likely have unitialized memory // in dest[curDist]. So basically we will loop through the distribution and pick the largest index // where the distribution is non-zero. This is obviously terribly inefficient, but due to the // rarity in which this occurs, this should not be an issue. for (int cat = categories - 1; cat >= 0; --cat) { if (dist[curDist * stride_dist + cat * stride_categories] > zero) { dest[curDist] = cat; break; } } } } } } void multinomial_with_replacement_kernel_impl( Tensor& result, const Tensor& self, const int64_t n_sample, c10::optional<Generator> generator) { auto gen = get_generator_or_default<CUDAGeneratorImpl>(generator, cuda::detail::getDefaultCUDAGenerator()); int inputSize = self.dim(); int64_t numDist = inputSize == 1 ? 1 : self.size(0); int numCategories = inputSize == 1 ? self.size(0) : self.size(1); // Restructure data for 2d auto self_v = inputSize == 1 ? self.view({numDist, numCategories}) : self; result.resize_({numDist, n_sample}); AT_DISPATCH_FLOATING_TYPES_AND_HALF(self_v.scalar_type(), "multinomial_kernel_cuda", [&] { using accscalar_t = at::acc_type<scalar_t, true>; auto props = at::cuda::getCurrentDeviceProperties(); CUDA_KERNEL_ASSERT(props != NULL); int numSM = props->multiProcessorCount; int maxThreads = props->maxThreadsPerBlock; int maxShared = props->sharedMemPerBlock; int requiredWarps = at::ceil_div(numCategories, C10_WARP_SIZE); int requiredThreads = std::min(maxThreads, requiredWarps * C10_WARP_SIZE); int requiredShared = requiredThreads * sizeof(accscalar_t); if (n_sample == 1 && maxShared >= requiredShared) { // Optimized allocation-free implementation // To exploit greater parallelism for the sampling, generate the // Uniform random samples in a separate kernel launch, into // temporarily allocated memory. The device RNG is thread-limited Tensor sampled = native::empty_cuda({numDist, n_sample}, optTypeMetaToScalarType(self_v.options().dtype_opt()), self_v.options().layout_opt(), self_v.options().device_opt(), self_v.options().pinned_memory_opt()); at::native::uniform_(sampled, 0.0, 1.0, generator); dim3 block(requiredThreads); dim3 grid(std::min(static_cast<int>(numDist), numSM * 4)); sampleMultinomialOnce<scalar_t, accscalar_t> <<<grid, block, requiredShared, at::cuda::getCurrentCUDAStream()>>>( result.data_ptr<int64_t>(), numDist, numCategories, sampled.data_ptr<scalar_t>(), self_v.data_ptr<scalar_t>(), self_v.stride(0), self_v.stride(1) ); C10_CUDA_KERNEL_LAUNCH_CHECK(); } else { // Generic, slow implementation with memory allocations // For sampling without replacement, we modify the distribution // for subsequent samples in this space Tensor origDist = native::empty_like( self_v, c10::nullopt /* dtype */, c10::nullopt /* layout */, c10::nullopt /* device */, c10::nullopt /* pin_memory */, LEGACY_CONTIGUOUS_MEMORY_FORMAT); origDist.copy_(self_v); Tensor normDist = native::empty_like( self_v, c10::nullopt /* dtype */, c10::nullopt /* layout */, c10::nullopt /* device */, c10::nullopt /* pin_memory */, LEGACY_CONTIGUOUS_MEMORY_FORMAT); Tensor prefixSum = native::empty_like( self_v, c10::nullopt /* dtype */, c10::nullopt /* layout */, c10::nullopt /* device */, c10::nullopt /* pin_memory */, LEGACY_CONTIGUOUS_MEMORY_FORMAT); // Renorm along rows normDist.copy_(origDist); renormRows(normDist); // Prefix sum along rows at::cuda::cumsum_out(prefixSum, normDist, 1); PhiloxCudaState rng_engine_inputs; // Binary search is warp divergent (so effectively we're running // with just a single thread), but for better utilization, // we need each block to have at least 4 warps. dim3 block(128); // Each block will generate a sample from one // distribution concurrently. int grid_y=std::min<int>(numDist, at::cuda::getCurrentDeviceProperties()->maxGridSize[1]); dim3 grid((n_sample-1)/block.x+1, grid_y); { // See Note [Acquire lock when using random generators] std::lock_guard<std::mutex> lock(gen->mutex_); // each thread generates a single sample for (numdist/numblocks.y) distributions, however, since we have to use // curand_uniform4 (See Note [Register spilling in curand call for CUDA < 10]), // offset is 4 times that. auto offset = ((numDist-1)/grid.y+1)*4; rng_engine_inputs = gen->philox_cuda_state(offset); } // Sample with replacement sampleMultinomialWithReplacement <<<grid, block, 0, at::cuda::getCurrentCUDAStream()>>>( rng_engine_inputs, n_sample, result.data_ptr<int64_t>(), numDist, numCategories, prefixSum.data_ptr<scalar_t>(), normDist.data_ptr<scalar_t>()); C10_CUDA_KERNEL_LAUNCH_CHECK(); } }); if (inputSize == 1) { result.resize_({n_sample}); } } } REGISTER_DISPATCH( multinomial_with_replacement_stub, &multinomial_with_replacement_kernel_impl); }}
Cuda
4
xiaohanhuang/pytorch
aten/src/ATen/native/cuda/MultinomialKernel.cu
[ "Intel" ]
// Package query provides functions meant to simplify common InfluxDB queries. // // The primary function in this package is `query.inBucket()`, which uses all // other functions in this package. // // introduced: 0.60.0 // package query // fromRange returns all data from a specified bucket within given time bounds. // // ## Parameters // - bucket: InfluxDB bucket name. // - start: Earliest time to include in results. // // Results include points that match the specified start time. // Use a relative duration, absolute time, or integer (Unix timestamp in seconds). // For example, `-1h`, `2019-08-28T22:00:00Z`, or `1567029600`. // Durations are relative to `now()`. // // - stop: Latest time to include in results. Default is `now()`. // // Results exclude points that match the specified stop time. // Use a relative duration, absolute time, or integer (Unix timestamp in seconds).For example, `-1h`, `2019-08-28T22:00:00Z`, or `1567029600`. // Durations are relative to `now()`. // // ## Examples // ### Query data from InfluxDB in a specified time range // ```no_run // import "experimental/query" // // query.fromRange(bucket: "example-bucket", start: -1h) // ``` // // tags: transformations,filters // fromRange = (bucket, start, stop=now()) => from(bucket: bucket) |> range(start: start, stop: stop) // filterMeasurement filters input data by measurement. // // ## Parameters // - measurement: InfluxDB measurement name to filter by. // - table: Input data. Default is piped-forward data (`<-`). // // ## Examples // ### Query data from InfluxDB in a specific measurement // ```no_run // import "experimental/query" // // query.fromRange(bucket: "example-bucket", start: -1h) // |> query.filterMeasurement(measurement: "example-measurement") // ``` // // tags: transformations,filters // filterMeasurement = (table=<-, measurement) => table |> filter(fn: (r) => r._measurement == measurement) // filterFields filters input data by field. // // ## Parameters // - fields: Fields to filter by. Default is `[]`. // - table: Input data. Default is piped-forward data (`<-`). // // ## Examples // ### Query specific fields from InfluxDB // ```no_run // import "experimental/query" // // query.fromRange(bucket: "telegraf", start: -1h) // |> query.filterFields(fields: ["used_percent", "available_percent"]) // ``` // // tags: transformations,filters // filterFields = (table=<-, fields=[]) => if length(arr: fields) == 0 then table else table |> filter(fn: (r) => contains(value: r._field, set: fields)) // inBucket queries data from a specified InfluxDB bucket within given time bounds, // filters data by measurement, field, and optional predicate expressions. // // ## Parameters // - bucket: InfluxDB bucket name. // - measurement: InfluxDB measurement name to filter by. // - start: Earliest time to include in results. // // Results include points that match the specified start time. // Use a relative duration, absolute time, or integer (Unix timestamp in seconds). // For example, `-1h`, `2019-08-28T22:00:00Z`, or `1567029600`. // Durations are relative to `now()`. // // - stop: Latest time to include in results. Default is `now()`. // // Results exclude points that match the specified stop time. // Use a relative duration, absolute time, or integer (Unix timestamp in seconds).For example, `-1h`, `2019-08-28T22:00:00Z`, or `1567029600`. // Durations are relative to `now()`. // // - fields: Fields to filter by. Default is `[]`. // - predicate: Predicate function that evaluates column values and returns `true` or `false`. // Default is `(r) => true`. // // Records (`r`) are passed to the function. // Those that evaluate to `true` are included in the output tables. // Records that evaluate to null or `false` are not included in the output tables. // // ## Examples // ### Query specific fields in a measurement from InfluxDB // ```no_run // import "experimental/query" // // query.inBucket( // bucket: "example-buckt", // start: -1h, // measurement: "mem", // fields: ["field1", "field2"], // predicate: (r) => r.host == "host1", // ) // ``` // // tags: inputs // inBucket = ( bucket, measurement, start, stop=now(), fields=[], predicate=(r) => true, ) => fromRange(bucket: bucket, start: start, stop: stop) |> filterMeasurement(measurement) |> filter(fn: predicate) |> filterFields(fields)
FLUX
5
geropl/flux
stdlib/experimental/query/from.flux
[ "MIT" ]
variable "server_instance_type" { # default = "c4.8xlarge" } variable "k3s_version" { default = "v0.9.1" type = string description = "Version of K3S to install" } variable "k3s_server_args" { default = "" } variable "prom_worker_node_count" { default = 0 type = number description = "The number of workers to create labeled for prometheus" } variable "k3s_cluster_secret" { type = string description = "Cluster secret for k3s cluster registration" } variable "name" { default = "k3s-loadtest" type = string description = "Name to identify this cluster" } variable "ssh_key_path" { default = "~/.ssh/id_rsa" type = string description = "Path of the private key to ssh to the nodes" } variable "extra_ssh_keys" { type = list default = [] description = "Extra ssh keys to inject into Rancher instances" } variable "server_ha" { default = 0 description = "Enable k3s in HA mode" } variable "etcd_count" { default = 3 } variable "db_engine" { default = "postgres" } variable "db_instance_type" { } variable "db_name" { default = "k3s" } variable "db_username" { default = "postgres" } variable "db_password" {} variable "db_version" {} variable "server_count" { default = 1 description = "Count of k3s master servers" } variable "debug" { default = 0 description = "Enable Debug log" } variable "prom_worker_instance_type" { default = "m5.large" description = "Prometheus instance type" } variable "domain_name" { description = "FQDN of the cluster" } variable "zone_id" { description = "route53 zone id to register the domain name" }
HCL
4
TReZ42/k3s
tests/perf/server/variables.tf
[ "Apache-2.0" ]
require "compress/deflate" require "digest/adler32" # The Compress::Zlib module contains readers and writers of zlib format compressed # data, as specified in [RFC 1950](https://www.ietf.org/rfc/rfc1950.txt). module Compress::Zlib NO_COMPRESSION = Compress::Deflate::NO_COMPRESSION BEST_SPEED = Compress::Deflate::BEST_SPEED BEST_COMPRESSION = Compress::Deflate::BEST_COMPRESSION DEFAULT_COMPRESSION = Compress::Deflate::DEFAULT_COMPRESSION class Error < Exception end end require "./*"
Crystal
4
mgomes/crystal
src/compress/zlib/zlib.cr
[ "Apache-2.0" ]
; Los estados serán agentes breed [estados estado] estados-own [ contenido ; Almecena el contenido del estado (el valor) explorado? ; Indica si ha sido explorado o no camino ; Almacena el camino para llegar a él ] ; Las transiciones se representarán como links directed-link-breed [transiciones transicion] transiciones-own [ regla ; Almacena la versión "representable" de la regla aplicada R ; Valor de recompensa para el algoritmo Q-learning Q ; Valor de aprendizaje para el algoritmo Q-learning desv ; Valor de variación en el aprendizaje para el algoritmo Q-learning ] globals [ M ; Número de torres, se calcula a partir de la longitud del estado inicial ; El número de discos viene determinado por los valores usados en el estado ; de entrada ] ;--------------- Funciones personalizables ------------------- ; Las reglas se representan por medio de pares [ "representación" f ] ; de forma que f permite pasar entre estados (es la función de transición) ; y "representación" es una cadena de texto que permite identificar qué ; regla se ha aplicado to-report transiciones-aplicables [c] let t-a [] let lista (n-values M [ ?1 -> ?1 ]) foreach lista [ i -> foreach lista [ j -> let t (list (word i "->" j) (list i j)) if transicion-valida? t c [set t-a lput t t-a] ] ] report t-a end ; Discos 1 < 2 < 3 < ... < N ; estado = [ [Palo1] [Palo2] [Palo3] ... [PaloM] ] ; Palo_i= [i_1 < i_2 < i_3], [i_1 < i_2], [i_1], [ ] to-report transicion-valida? [t s] let i first last t let j last last t if empty? (item i s) [report false] if empty? (item j s) [report true] let disco first (item i s) let cabeza first (item j s) if disco < cabeza [report true] report false end to-report aplica-transicion [t s] let i first last t let j last last t let disco first (item i s) set s replace-item i s (bf (item i s)) set s replace-item j s (fput disco (item j s)) report s end ; estado-final? ofrece un report de agente que identifica los estados finales to-report igual? [ob] report ( contenido = ob) end ;---------------- Algoritmo contrucción del grafo de transiciones ---------------- ; Esencialmente, el algoritmo va calculando los estados hijos de cada estado ; no explorado y los enlaza por medio de la transición que lo ha generado, hasta ; no disponer de más estados sin explorar. to grafo-completo [estado-inicial] ca ask patches [ set pcolor white ] set M length read-from-string Estado_Inicial ; Creamos el agente asociado al estado inicial create-estados 1 [ set shape "hanoi" set color green set size 2 set contenido read-from-string estado-inicial set label-color black set label contenido set camino (list self) set explorado? false ] ; Mientras halla estados no explorados (la verificación de haber encontrado ; el objetivo se hace dentro) while [any? estados with [not explorado?]] [ ask estados with [not explorado?] [ ; Calculamos los estados sucesores aplicando cada regla al estado actual foreach transiciones-aplicables contenido [ t -> let estado-aplicado aplica-transicion t contenido ; Solo consideramos los estados nuevos ifelse not any? estados with [contenido = estado-aplicado] [ ; Creamos un nuevo agente para cada estado nuevo hatch-estados 1 [ set contenido estado-aplicado set label contenido set explorado? false ; y lo enlazamos con su padre por medio de un link etiquetado create-transicion-from myself [set regla t set label first t set label-color black] set color white ; Formamos el camino desde el inicio hasta él set camino lput self camino ] ] [ let pasado one-of estados with [contenido = estado-aplicado] create-transicion-to pasado [set regla t set label first t set label-color black] ] ; Actualizamos la representación if layout? [repeat 10 [layout]] ] ; Cuando hemos calculado todos sus sucesores, marcamos el estado como explorado set explorado? true ] ] end ; Representación del grafo de forma más adecuada to layout ;layout-radial estados transiciones estado 0 if tam-estados != [size] of estado 0 [ask estados [set size tam-estados]] layout-spring estados transiciones elasticidad longitud repulsion end to ajusta ask estados [setxy (xcor * .9 + random-float 1) (ycor * .9 + random-float 1)] end ;; ;; Procedimientos asociados al algoritmo de Q-learning ;; ; Procedimiento de entrenamiento to Q-learning ; Reseteamos los ticks porque nos sevirán para contar el número de pasos reset-ticks ; Reiniciamos los valores de transiciones y estados ask transiciones [ set Q 0 set R 0 set label "" set thickness 0 set color grey set desv (Desv-maxima + 1) ] ask estados [ set label "" ] ; Las transiciones que llegan a los estados finales se ponen con recompensa máxima let ef one-of estados with [contenido = read-from-string Estado_Final] ask ef [ ask my-in-transiciones [set R 100] set color red ] ; Repetimos el proceso de aprendizaje de las transiciones hasta que la variación ; máxima está por debajo de la cota while [max [desv] of transiciones > Desv-maxima] [ ask transiciones [ let Q2 alpha * Q + (1 - alpha) * (R + gamma * max [Q] of ([my-out-transiciones] of end2)) set desv abs (Q2 - Q) set Q Q2 set label Q ] tick ] ; Normalizamos la bondad de las transiciones ; y las reflejamos en color y anchura de las aristas let MaxQ max [Q] of transiciones ask transiciones [ set Q Q / MaxQ set color scale-color color Q 1 0 set thickness Q / 4 set label "" ] end ; Para usar la información de Q en el cálculo de la solución del problema ; basta ir moviéndonos desde el estado inicial haciendo uso de las ; transiciones con más peso (Q) en cada estado. to Q-ejecuta ;ask transiciones [set thickness 0] ask estados [set label ""] let es one-of estados with [contenido = read-from-string Estado_Inicial] ask es [ set color green ] let ef one-of estados with [contenido = read-from-string Estado_Final] while [es != ef] [ ask es [ set label (word contenido " ") ;write contenido let accion max-one-of my-out-transiciones [Q] ask accion [ ; print (word " - " first regla " -> ") set color red set label first regla ] set es [end2] of accion ] ] ask ef [ set label (word contenido " ") set color red ] ;print "" end @#$#@#$#@ GRAPHICS-WINDOW 210 10 1085 580 -1 -1 17.0 1 16 1 1 1 0 0 0 1 -25 25 -16 16 0 0 1 ticks 30.0 BUTTON 110 560 200 593 NIL layout T 1 T OBSERVER NIL NIL NIL NIL 1 MONITOR 10 45 105 90 Estados: count turtles 17 1 11 INPUTBOX 10 95 200 155 Estado_Inicial [[1 2 3] [][]] 1 0 String INPUTBOX 10 155 200 215 Estado_final [[][][1 2 3]] 1 0 String BUTTON 10 10 107 43 Crea Grafo grafo-completo Estado_Inicial NIL 1 T OBSERVER NIL NIL NIL NIL 1 BUTTON 10 220 105 253 Q-Entrena Q-learning NIL 1 T OBSERVER NIL NIL NIL NIL 1 SWITCH 110 10 200 43 layout? layout? 0 1 -1000 BUTTON 110 220 200 253 NIL Q-ejecuta NIL 1 T OBSERVER NIL NIL NIL NIL 1 SLIDER 10 260 200 293 alpha alpha 0 1 0.0 .01 1 NIL HORIZONTAL SLIDER 10 295 200 328 gamma gamma 0 1 0.8 .01 1 NIL HORIZONTAL SLIDER 10 330 200 363 Desv-maxima Desv-maxima 0 1 0.1 .1 1 NIL HORIZONTAL MONITOR 10 365 200 410 Convergencia en pasos: ticks 17 1 11 SLIDER 10 420 200 453 Tam-estados Tam-estados 0 4 2.0 .1 1 NIL HORIZONTAL SLIDER 10 455 200 488 elasticidad elasticidad 0 1 0.4 .1 1 NIL HORIZONTAL SLIDER 10 490 200 523 longitud longitud 0 10 5.0 .5 1 NIL HORIZONTAL SLIDER 10 525 200 558 repulsion repulsion 0 2 1.1 .1 1 NIL HORIZONTAL @#$#@#$#@ ## WHAT IS IT? (a general understanding of what the model is trying to show or explain) ## HOW IT WORKS (what rules the agents use to create the overall behavior of the model) ## HOW TO USE IT (how to use the model, including a description of each of the items in the Interface tab) ## THINGS TO NOTICE (suggested things for the user to notice while running the model) ## THINGS TO TRY (suggested things for the user to try to do (move sliders, switches, etc.) with the model) ## EXTENDING THE MODEL (suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.) ## NETLOGO FEATURES (interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features) ## RELATED MODELS (models in the NetLogo Models Library and elsewhere which are of related interest) ## CREDITS AND REFERENCES (a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links) @#$#@#$#@ default true 0 Polygon -7500403 true true 150 5 40 250 150 205 260 250 airplane true 0 Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15 arrow true 0 Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150 box false 0 Polygon -7500403 true true 150 285 285 225 285 75 150 135 Polygon -7500403 true true 150 135 15 75 150 15 285 75 Polygon -7500403 true true 15 75 15 225 150 285 150 135 Line -16777216 false 150 285 150 135 Line -16777216 false 150 135 15 75 Line -16777216 false 150 135 285 75 bug true 0 Circle -7500403 true true 96 182 108 Circle -7500403 true true 110 127 80 Circle -7500403 true true 110 75 80 Line -7500403 true 150 100 80 30 Line -7500403 true 150 100 220 30 butterfly true 0 Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240 Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240 Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163 Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165 Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225 Circle -16777216 true false 135 90 30 Line -16777216 false 150 105 195 60 Line -16777216 false 150 105 105 60 car false 0 Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180 Circle -16777216 true false 180 180 90 Circle -16777216 true false 30 180 90 Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89 Circle -7500403 true true 47 195 58 Circle -7500403 true true 195 195 58 circle false 0 Circle -7500403 true true 0 0 300 circle 2 false 0 Circle -7500403 true true 0 0 300 Circle -16777216 true false 30 30 240 cow false 0 Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167 Polygon -7500403 true true 73 210 86 251 62 249 48 208 Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123 cylinder false 0 Circle -7500403 true true 0 0 300 dot false 0 Circle -7500403 true true 90 90 120 face happy false 0 Circle -7500403 true true 8 8 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240 face neutral false 0 Circle -7500403 true true 8 7 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Rectangle -16777216 true false 60 195 240 225 face sad false 0 Circle -7500403 true true 8 8 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183 fish false 0 Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166 Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165 Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60 Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166 Circle -16777216 true false 215 106 30 flag false 0 Rectangle -7500403 true true 60 15 75 300 Polygon -7500403 true true 90 150 270 90 90 30 Line -7500403 true 75 135 90 135 Line -7500403 true 75 45 90 45 flower false 0 Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135 Circle -7500403 true true 85 132 38 Circle -7500403 true true 130 147 38 Circle -7500403 true true 192 85 38 Circle -7500403 true true 85 40 38 Circle -7500403 true true 177 40 38 Circle -7500403 true true 177 132 38 Circle -7500403 true true 70 85 38 Circle -7500403 true true 130 25 38 Circle -7500403 true true 96 51 108 Circle -16777216 true false 113 68 74 Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218 Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240 hanoi false 0 Rectangle -7500403 true true 0 30 300 285 Rectangle -16777216 false false 0 30 300 285 Rectangle -6459832 true false 0 225 300 255 Rectangle -6459832 true false 45 45 75 225 Rectangle -6459832 true false 225 45 255 225 Rectangle -6459832 true false 135 45 165 225 Rectangle -14835848 true false 0 180 120 210 Rectangle -13791810 true false 15 135 105 165 Rectangle -955883 true false 30 90 90 120 Rectangle -11221820 true false 180 180 300 210 Rectangle -5825686 true false 210 135 270 165 house false 0 Rectangle -7500403 true true 45 120 255 285 Rectangle -16777216 true false 120 210 180 285 Polygon -7500403 true true 15 120 150 15 285 120 Line -16777216 false 30 120 270 120 leaf false 0 Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195 Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195 line true 0 Line -7500403 true 150 0 150 300 line half true 0 Line -7500403 true 150 0 150 150 pentagon false 0 Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120 person false 0 Circle -7500403 true true 110 5 80 Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90 Rectangle -7500403 true true 127 79 172 94 Polygon -7500403 true true 195 90 240 150 225 180 165 105 Polygon -7500403 true true 105 90 60 150 75 180 135 105 plant false 0 Rectangle -7500403 true true 135 90 165 300 Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285 Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285 Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210 Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135 Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135 Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60 Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90 sheep false 15 Circle -1 true true 203 65 88 Circle -1 true true 70 65 162 Circle -1 true true 150 105 120 Polygon -7500403 true false 218 120 240 165 255 165 278 120 Circle -7500403 true false 214 72 67 Rectangle -1 true true 164 223 179 298 Polygon -1 true true 45 285 30 285 30 240 15 195 45 210 Circle -1 true true 3 83 150 Rectangle -1 true true 65 221 80 296 Polygon -1 true true 195 285 210 285 210 240 240 210 195 210 Polygon -7500403 true false 276 85 285 105 302 99 294 83 Polygon -7500403 true false 219 85 210 105 193 99 201 83 square false 0 Rectangle -7500403 true true 30 30 270 270 square 2 false 0 Rectangle -7500403 true true 30 30 270 270 Rectangle -16777216 true false 60 60 240 240 star false 0 Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108 target false 0 Circle -7500403 true true 0 0 300 Circle -16777216 true false 30 30 240 Circle -7500403 true true 60 60 180 Circle -16777216 true false 90 90 120 Circle -7500403 true true 120 120 60 tree false 0 Circle -7500403 true true 118 3 94 Rectangle -6459832 true false 120 195 180 300 Circle -7500403 true true 65 21 108 Circle -7500403 true true 116 41 127 Circle -7500403 true true 45 90 120 Circle -7500403 true true 104 74 152 triangle false 0 Polygon -7500403 true true 150 30 15 255 285 255 triangle 2 false 0 Polygon -7500403 true true 150 30 15 255 285 255 Polygon -16777216 true false 151 99 225 223 75 224 truck false 0 Rectangle -7500403 true true 4 45 195 187 Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194 Rectangle -1 true false 195 60 195 105 Polygon -16777216 true false 238 112 252 141 219 141 218 112 Circle -16777216 true false 234 174 42 Rectangle -7500403 true true 181 185 214 194 Circle -16777216 true false 144 174 42 Circle -16777216 true false 24 174 42 Circle -7500403 false true 24 174 42 Circle -7500403 false true 144 174 42 Circle -7500403 false true 234 174 42 turtle true 0 Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210 Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105 Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105 Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87 Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210 Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99 wheel false 0 Circle -7500403 true true 3 3 294 Circle -16777216 true false 30 30 240 Line -7500403 true 150 285 150 15 Line -7500403 true 15 150 285 150 Circle -7500403 true true 120 120 60 Line -7500403 true 216 40 79 269 Line -7500403 true 40 84 269 221 Line -7500403 true 40 216 269 79 Line -7500403 true 84 40 221 269 wolf false 0 Polygon -16777216 true false 253 133 245 131 245 133 Polygon -7500403 true true 2 194 13 197 30 191 38 193 38 205 20 226 20 257 27 265 38 266 40 260 31 253 31 230 60 206 68 198 75 209 66 228 65 243 82 261 84 268 100 267 103 261 77 239 79 231 100 207 98 196 119 201 143 202 160 195 166 210 172 213 173 238 167 251 160 248 154 265 169 264 178 247 186 240 198 260 200 271 217 271 219 262 207 258 195 230 192 198 210 184 227 164 242 144 259 145 284 151 277 141 293 140 299 134 297 127 273 119 270 105 Polygon -7500403 true true -1 195 14 180 36 166 40 153 53 140 82 131 134 133 159 126 188 115 227 108 236 102 238 98 268 86 269 92 281 87 269 103 269 113 x false 0 Polygon -7500403 true true 270 75 225 30 30 225 75 270 Polygon -7500403 true true 30 75 75 30 270 225 225 270 @#$#@#$#@ NetLogo 6.0.4 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ default 1.0 -0.2 0 0.0 1.0 0.0 1 1.0 0.0 0.2 0 0.0 1.0 link direction true 0 Line -7500403 true 150 150 90 180 Line -7500403 true 150 150 210 180 @#$#@#$#@ 1 @#$#@#$#@
NetLogo
5
fsancho/IA
02. Uninformed Search/QLearning - Hanoi.nlogo
[ "MIT" ]
.new-comment, .inlined-form a.fa.fa-copy float: right position: relative top: 20px right: 6px
Stylus
3
Knitter/wekan
client/components/main/editor.styl
[ "MIT" ]
//##1. declare simple def decare() { a int: = 9 //Ref[int] a2 int: //Ref[int] b := 9 //Ref[int] //b2 : //Ref[Object] c int::=9 //Ref[Ref[int]] c2 int::=9 //Ref[Ref[int]] d ::=9 //Ref[Ref[int]] //d2 :: //Ref[Ref[Object]] } ~~~~~ //##1.b declare simple - check def decare() { a int: = 9 //Ref[int] b := 9 //Ref[int] c int::=9 //Ref[Ref[int]] d ::=9 //Ref[Ref[int]] a2 = a b2 = b c2 = c d2 = d a3 = a: b3 = b: c3 = c: d3 = d: a4 Integer = a b4 Integer = b c4 Integer: = c d4 Integer: = d a5 Integer: = a: b5 Integer: = b: c5 Integer:: = c: d5 Integer:: = d: a6 int: = a: b6 int: = b: c6 int:: = c: d6 int:: = d: a7 = a b7 = b c7 : = c//wrong? d7 : = d c72 :: = c d72 :: = d z = [a is int:, b is int:, c is int::, d is int::] //implicit... z2 = [a2 is Integer, b2 is Integer, c2 is int:, d2 is int:] z3 = [a3 is int:, b3 is int:, c3 is int::, d3 is int::] //explicit... z4 = [a4 is Integer, b4 is Integer, c4 is int:, d4 is int:] z5 = [a5 is int:, b5 is int:, c5 is int::, d5 is int::] z6 = [a6 is int:, b6 is int:, c6 is int::, d6 is int::] z7 = [a7 is int:, b7 is int:, c7 is int::, d7 is int::, c72 is int::, d72 is int::] } ~~~~~ //##2. array of ref cases fail def refFailCases(){ afail int:[] = 9//fail afail2 int:[] = [9 9]//fail } ~~~~~ //##3. array of ref cases ok //of array of ref --> Ref[int][] z := 9 x = [z,z] a Integer:[] = [z: z] a1 Integer[] = [z z] a2 int:[] ~~~~~ //##4. ref of array ok def ars(){ //ref of array --> Ref[int[]] a int[]: = [9 9] a2 int[]: b := [9] } ~~~~~ //##4.b ref of array fail c []: = [9,] //error consumes two lines.. doesnt matter this is invalid syntax anyway ~~~~~ //##5. ret from async function def fromFunc() { func = def () int { return 5} f = func()! f2 := func()! f3 int:= func()! //^all same } ~~~~~ //##5.a ret from async function - defined already fail def fromFunc() { func = def () int { return 5} f = func()! f := func()! //ok because we are replacing the ref itself f int:= func()! //^all same } ~~~~~ //##6. setting def setter(){ a := 7 a=6 a=9 //no listners so no history preserved } ~~~~~ //##7. useage def passes(){ a int: a=9 b = a //int -> a.get() c := a //int: -> a.get() - as ref again c2 int:= a //as above d = a: //d -> ref[int] - copy of pointer to a d2 int:= a: //as above d3 := a: //as above } ~~~~~ //##8. instanceof on refs is ok def doings() String{ a int:= 6 b = a //b is int b = a //b is int still d := a //d is int: d = a //d is still int: c = a: //c int: c = a //c is still int: return "" + [ a is int:, d is int:, c is int: ] } ~~~~~ //##9. lhs must be ref g = 5: //this is ok now as g is created as int: ~~~~~ //##10. more simple assignments a int: = 6 //int: b int = a //int c = a //int d int: = a: e int = a://error as forced by the : ~~~~~ //##11. as above but checking the types def doings() String{ a int: = 6 //int: b int = a //int c = a //int d int: = a: return "" + [ a is int:, d is int: ]//ok here, but real check is in bytecode } ~~~~~ //##12. some random stuff which should be ok a int: = 6 //int: b int = a //int c = a //int d := a //int: //e int = a: //ERROR f int:: = a! //ref to a ref ff = def () int{ return 6; } c2 = ff()! //int: //c3 = ff()!: //int: - ERROR ~~~~~ //##13. lhs no ref ax = [8!, 8!] z = ax[1]: ax[0] = 9 ax[0]: = 10! ///ok ~~~~~ //##14. this is permitted but i think it's weird... cannot really prevent it a := 7 b :=8 a = b a = b: ~~~~~ //##15. this is permitted but i think it's weird... cannot really prevent it def doings() String{ g = 6! //makes ref h = g return "" + [ g is int:, g: is int:] //int: is a problem? like int vs Integer } ~~~~~ //##16. autocast from float to int def doings() String{ g = 6! //makes ref g = 6. //can this be done? //Ref[Int], set a Ref[Float] to it... return "" + g } ~~~~~ //##17. use single ref as function argument and in currying def funcok(a int:) int{ return 4 } def funbroken(a :) int{ return 4 } def funbroken2(a ::) int{ return 4 } def doings() String{ a : = 8 b : =new Object() curry1 = funcok&(? int:) curry2 = funbroken&(:) return "" + [funcok(a:), funbroken(b:), funbroken2(b:), curry1(a:), curry2(b:)] } ~~~~~ //##18. ref logic checks getHC = def (a int:) int{ return System.identityHashCode(a:); } def doings() String{ ref1 := 5 //ref2 := 6 r1Orig = getHC(ref1:) child1 := 0 child2 := 0 c1Orig = getHC(child1:) c2Orig = getHC(child2:) //same ref but value changed child1 = ref1 c1AfterAssign = getHC(child1:) t1 = "" + [c1Orig == c1AfterAssign, child1 == 5] //diff ref and == 5 child2 = ref1: c2AfterAssign = getHC(child2:) t2 = "" + [c2Orig <> c2AfterAssign, c2Orig==r1Orig, child2 == 5] //new var should == to same referece newChild1 := ref1 nc1Orig = getHC(newChild1:) t3 = "" + [nc1Orig==r1Orig, newChild1 == 5] //new var, diff reference newChild2 := ref1 nc2Orig = getHC(newChild2:) t4 = "" + [nc2Orig <> r1Orig, newChild2 == 5] return "" + [t1, t2, t3, t4]; } ~~~~~ //##19. double ref to single def doings() String{ a:: = 9 c = a b = a: //b is int:: return "" + [b is int::, c is int:] } ~~~~~ //##20. ops on ref ok def doings() String{ a int: = 6 //int: res1 int = a:get() + 7 // where used, autoconvert to a.get() return "" + res1 } ~~~~~ //##21. ops on ref ok -fail def doings() String{ a int: = 6 //int: res1 int = a:getasdasd() + 7 //a fail return "" + res1 } ~~~~~ //##22. use, auto extract the get operation to unbox def plus1(a int) int { return a+1; } def doings() String{ a int: = 6 //int: //where used, autoconvert to a.get() r1 = plus1(a) r2 = a + 7 return "" + [r1, r2] } ~~~~~ //##23. async blocks def doings() String{ a int: //note that these are always initialized {a = 9}! return "" + a } ~~~~~ //##24. can assign to final as shell def doings() String{ val a int: = 99 a = 9 //ok a = (9)! //not allowed return "" } ~~~~~ //##24.b can assign to final as shell def doings() String{ val a int:: = 99 a = 9 //ok a = (9)! //ok a = ((9)!)! //not ok return "" } ~~~~~ //##25. ensure no ignore unboxing def doings() String{ a: = 9 c = a x = c as int return "" + x // + [b is int::, c is int:] } ~~~~~ //##26. more of prev case def doings() String{ a:: = 9 c int: = a c2 = a b int:: = a: //b is int:: b2 = a: //b is int:: x boolean = c is int: x2 boolean = c2 is int: x3 boolean = b is int:: x4 boolean = b2 is int:: return ""// + [b is int::, c is int:] } ~~~~~ //##27. instanceof moan def doings() String{ a double: return "" + [a is double:, a isnot int:] } ~~~~~ //##28. cast checks def doings() String{ ref1 := 5 cont Object = ref1: as Integer //cast has no respect for anything! :) cont2 Object = ref1 as Integer return "" } ~~~~~ //##29. cannot cast from ref to obj when locked in from com.concurnas.lang.precompiled.RefHelper import getIntegerRef, getIntegerRefAsObject def doings() String{ tg = 9 refasObj1 Object = getIntegerRefAsObject(7) refasObj1IntRef Integer = refasObj1 as Integer://no return "" } ~~~~~ //##30. math on locked refs is ok def doings() String{ a int: =9 //int: e = a: + 8//yeah this is ok return "" } ~~~~~ //##31. arrays of ref type must be init def doings() String{ a int:[] z = [a,a,a,a,a] //invalid as a has not been instsantiated return "" } ~~~~~ //##32.a ambigous - ambig case //correctly stated as being ambigious :) def xxx(a String, b String:){ } def xxx(a String:, b String ){ } def doings() String{ xxx("", "") return "" } ~~~~~ //##32.b ambigous - non ambig case def xxx(a Object){ } def xxx(a :){ } //these are not ambigious def doings() String{ xxx( "" ) return "" } ~~~~~ //##33. arrays of refs casting def doings() String{ //orig Number[] = [1 new Integer(2)] ok1 Integer:[] = [1! 2!] ok2 Number:[] = [1! 2!] fail1 Integer[] = [1! 2!] fail2 Number[] = [1! 2!] return "" } ~~~~~ //##33.b arrays of refs casting - part 2 def doings() String{ xxx = [1! 2!] as Object[] //ok no = [1! 2!] as Number[] //not ok return "" } ~~~~~ //##34. array of ref - some op fail more def doings() String{ asObj Object = [1! 2!] ok = asObj as Number:[] //type info not lost asObjAr Object[] = [1! 2!] fail = asObjAr as Number:[] //cannot do this as we've lost the type info return "" } ~~~~~ //##35. this should return a ref def okla( ) String: { "hi"! } def doingsa() { d=""+ okla() "" + d } def functo() int:{ return 454! } def doings() String{ xxx := functo() r = "" + [xxx:get(), doingsa()] assert r == "[454, hi]" return r } ~~~~~ //##36. check subtype def getRef() int:{ ret int: = [5 5 5 5]! //not good, it aint an array return ret } ~~~~~ //##36.b check subtype def getRef() int:{ return [5 5 5 5]! //not good, it aint an array } ~~~~~ //##37. inc on raw not ret copy respects refness def doings() String{ a := 5 c = (a:)++ //ok but pointless c = (a:#)++ //ok but pointless return "" +c //+ [b, c] } ~~~~~ //##38. index op not valid on ref def doings() String{ a := 5 x15 = [0 0 0 0 0 5 0 0][a:] return "" + x15 } ~~~~~ //##39 be careful with array ref types def getRef() int[]:{ f int[]: = [5! 5! 5! 5!] return f } def doings() String{ f int[]: = [5! 5! 5! 5!] return "" + f } ~~~~~ //##40 asyncrefref levels x = (8!)! def doings() String{ f1 = "" + x:: f2 = "" + x: f3 = "" + x::://used to blow up - but now ok return "" +[f1, f2] } ~~~~~ //##41. create an empty obj ref but not like this def doings() String{ a : //invalid syntax for declaration of an object ref return "" } ~~~~~ //##42. no refied types thus following cast is not possible from java.util import HashMap z = (new HashMap<String, Integer>())! o = (z as Object) def doings() String{ f = o is HashMap<String, Integer> //does not belong here but i wanted to test the formatting of the error message (i.e. does [?, ?] text now) return "" + f } ~~~~~ //##42.b no refied types thus following cast IS possible from java.util import HashMap z = (new HashMap<String, Integer>())! o = (z as Object) //extracted def doings() String{ f = o is HashMap<String, Integer>: //should return true at runtime (go via ref checker as rhs is a ref) f2 = o is not HashMap<String, String>: //should return false at runtime (go via ref checker as rhs is a ref) return "" + [f, f2] } ~~~~~ //##42.c no refied types thus following cast IS possible - null not ref from java.util import HashMap o = null def doings() String{ f = o is HashMap<String, Integer>: //should return true at runtime (go via ref checker as rhs is a ref) f2 = o is not HashMap<String, String>: //should return false at runtime (go via ref checker as rhs is a ref) return "" + [f, f2] } ~~~~~ //##42.d no refied types thus following cast IS possible - null from java.util import HashMap o = ('')! //double check created as Object: o2 := ('')! o3 Object:= ('')! def doings() String{ f = o is HashMap<String, Integer>: //should return true at runtime (go via ref checker as rhs is a ref) f2 = o is not HashMap<String, String>: //should return false at runtime (go via ref checker as rhs is a ref) f = o2 is HashMap<String, Integer>: //should return true at runtime (go via ref checker as rhs is a ref) f2 = o2 is not HashMap<String, String>: //should return false at runtime (go via ref checker as rhs is a ref) f = o3 is HashMap<String, Integer>: //should return true at runtime (go via ref checker as rhs is a ref) f2 = o3 is not HashMap<String, String>: //should return false at runtime (go via ref checker as rhs is a ref) return "" + [f, f2] } ~~~~~ //##43. cast checks -sac def takesO(arg Object:) {} def doings() String{ a := 9 //all these should fail: o Object: = a //ok o = a as Object: //ok takesO(a:)//ok (though just calling a return "" } ~~~~~ //##44. simple case def doings() String{ ok Object: = "" notok Object: = ""! //actually this is fine return "" } ~~~~~ //##45. asign exsiting ref levels x int:: def doings() String{ x ::=8//ok x :=8//ok x =8//ok x :::=8//should blow up return "" } ~~~~~ //##46. puzzle 1 def doings() String{ x Object: x = "newRef2" //this is ok because Stirng is a subtype of object x := "newRef2" //this is ok as well, we make an Object ref with the String as the arg to satify the lhs requirement x := "newRef2"! //this blows up because on the rhs we've made a String: (and that cannot goto an Object ref - no this is fine x = "newRef2"! //same as above but with implicit overwrite of Object ref (cos rhs is locked as ref) return "" + x: } ~~~~~ //##46.b puzzle 2 - a tricky one where ref is of type Object: class MyClas{ public var ~x Object: = "orig" //as Object - its ok override equals(o Object) boolean {return true;} override hashCode() int {return 6;} } mc = new MyClas() //orig := mc.x def doings() String{ mc.x := "newRef2"! //should blow up mc.x := "newRef2" //is fine return "" + mc.x: //+ [nomatch] + "" + mc.x: } ~~~~~ //##47. cannot ref assign something that is not a ref def doings() String{ z = ["initial"!] z := ["newValue"!] //this is a new ref return "" } ~~~~~ //##48. obj: arg defo not upcast from int: def fSame(x2 :) boolean { //this is not going to get entered into y Object:= x2 return (x2: &== y:) } def fSame2(x2 int:) boolean { //more complaints from this y Object:= x2 return (x2: &== y:) } def doings() String{ return "" + [fSame(7!), fSame2(7!)] //seems fine } ~~~~~ //##49. correct bevahour for ref creation x = 8! x2 = (8!)! def doings() String{ ok = 8: //explicit ish ref creation ok2 = 8:://upgraded to int:: ok3 = x: ok4 = x:: //upgraded to int:: ok5 = x2: //extracted to int: "" + [ok, ok2, ok3, ok4, ok5] } ~~~~~ //##50. this async ref syntax is not permitted def doings() { x = [1:1:] //-> [AsyncRef AsyncRef] //its fine "" } ~~~~~ //##51. cusr ref type must match import com.concurnas.runtime.ref.RefArray def checkIsA(arg int:RefArray) { xx int:RefArray = 12: //nope xx2 int:RefArray : = 12:: //nope2 xx is int:RefArray } def doings() => "hi" ~~~~~ //##52. cannot get from a raw Ref type class MyCls(an Object){} def ff(a Object) => "k" def doings() { xs = [1:, 1:] output := "" cnt:=0 every(xs){ h=999 stuff = changed.getChanged() got = stuff[0]: got2 = stuff[1] //not permitted stuff[1]++ //no ++stuff[1] //no ha = got * got //no f int = got //not permitted //f2 int = got2 output += "" + f output += "" + got //not permitted output += "" + ff(got) //-ok it can be extracted as object output += "" + MyCls(got) //not permitted cnt++ //this is fine because int:Local has set and get } trans{ xs[0] = 98 xs[1]:close() } await(cnt ; cnt == 1) "" + [output] } ~~~~~ //##52.b cannot get from a raw Ref type as above def doings() { xs = [1:, 1:] output :="" cnt :=0 onchange(xs){ h=999 stuff = changed.getChanged() got = stuff[0]: got2 = stuff[1]: k = {got -> got}//doesnt like this either output += "" + [stuff.length, got, //not permitted not(got:isClosed()), got2:isClosed()] cnt++ } trans{ //System.err.println("109.23") xs[0] = 98 xs[1]:close() //System.err.println("1.88") } await(cnt ; cnt == 1) "" + [output] } ~~~~~ //##52.c cannot get from a raw Ref type as above MORE from com.concurnas.lang.precompiled import RefHelper cc :::= "me not ref" def uppy1(a com.concurnas.runtime.ref.Local<com.concurnas.bootstrap.runtime.ref.Ref<Object>>) => a b com.concurnas.runtime.ref.Local<com.concurnas.bootstrap.runtime.ref.Ref<Object>> = 9 def doings() => "" + [b, uppy1(cc).getClass(), uppy1(cc):.getClass()]//this one is ok ~~~~~ //##52.d cannot get from a raw Ref type as above MORE MORE def xxx() => true cc ::= "me not ref" //returns Ref Ref in thes cases not Ref Local etc def uppy(a com.concurnas.runtime.ref.Local<com.concurnas.bootstrap.runtime.ref.Ref<Object>>, b com.concurnas.bootstrap.runtime.ref.Ref<com.concurnas.runtime.ref.Local<Object>>, c boolean) => (a) if xxx() else (b:)//this should complain ~~~~~ //##52.e cannot get from a raw Ref type as above MORE MORE MORE def xxx() => true cc ::= "me not ref" def uppy(a com.concurnas.runtime.ref.Local<com.concurnas.bootstrap.runtime.ref.Ref<Object>>, b com.concurnas.bootstrap.runtime.ref.Ref<com.concurnas.runtime.ref.Local<Object>>, c boolean) => (a:) if xxx() else (b:) //you cant do this once because we can't get from a ref def doings() =>"" ~~~~~ //##52.F MORE COMPLAINTS def xxx() => true cc ::= "me not ref" def uppy2(a com.concurnas.runtime.ref.Local<com.concurnas.bootstrap.runtime.ref.Ref<Object>>, b com.concurnas.bootstrap.runtime.ref.Ref<com.concurnas.runtime.ref.Local<Object>>, c boolean) => (a:) if xxx() else (b:) def doings() { z = uppy2&(cc, cc, ? boolean) //not its ok when refering to refs, cos types were being incorrectly set "" + [z(true), z(false)] } ~~~~~ //##52. g doesnt like this from com.concurnas.lang.precompiled import RefHelper b = RefHelper.getThingAsRef(12)//not permitted, as expected def doings() { "" } ~~~~~ //##53. more cases like the above from com.concurnas.lang.precompiled import RefHelper cc :::= "me not ref" //the next functions are expected to return the Object def uppy1(a com.concurnas.runtime.ref.Local<com.concurnas.runtime.ref.Local<Object>>) => a def uppy2(a com.concurnas.runtime.ref.Local<com.concurnas.bootstrap.runtime.ref.Ref<Object>>) => a //cannot do this def uppy3(a Object::) => a def doings() => "" + [uppy1(cc), //ok uppy2(cc), //moans uppy3(cc)] //add extra ref level on cast operation ~~~~~ //##54. can create local for ref type a int:com.concurnas.bootstrap.runtime.ref.Ref a=9 //fail - cost setting to a current one a := 9 //a ok - no set called so ok def doings() => "" + (a as int:) ~~~~~ //##55. some errs from com.concurnas.lang.precompiled import RefHelper cc ::= "me not ref" def xxx(a Object::) => a //ok, others fail def xxx2(a com.concurnas.bootstrap.runtime.ref.Ref<com.concurnas.bootstrap.runtime.ref.Ref<Object>>) => a def xxx3(a com.concurnas.runtime.ref.Local<com.concurnas.bootstrap.runtime.ref.Ref<Object>>) => a def xxx4(a com.concurnas.bootstrap.runtime.ref.Ref<com.concurnas.runtime.ref.Local<Object>>) => a def doings() => "" + [xxx(cc),//all ok RefHelper.actonref2(cc), xxx2(cc), xxx3(cc), xxx4(cc) ] ~~~~~ //##56. check ref type extraction errs in return statement def ran() => false def wally() int{ a int:com.concurnas.bootstrap.runtime.ref.Ref = 12: if(ran()){ return a //no, cannot get from above } else{ b=a as int: return b //yes this is fine } } def doings() { "" + wally() } ~~~~~ //##57. for while loop from Ref type not permitted from java.util import ArrayList ar = new ArrayList<Integer>() for(a in [1,2,3]){ ar.add(a) } def wally() { a int:com.concurnas.bootstrap.runtime.ref.Ref = 12: one = for(ab in [1,2,3]){ a//no! } two = for(ab in [1,2,3]){ break a//no! } one = for(ab in ar){ a//no! } two = for(ab in ar){ break a//no! } [one, two] } def whila(){ a int:com.concurnas.bootstrap.runtime.ref.Ref = 13: n1 = 0 one = while(n1++ < 3){ a//no } n2 = 0 two = while(n2++ < 3){ if(n2 == 1){ continue a//no } break a//no } "" + [one, two] } def doings() { "" + wally() }
Augeas
2
michaeldesu/Concurnas
tests/com/concurnas/compiler/scopeAndType/ref.conc.aug
[ "MIT" ]
20 5 0 1 3 1 2 3 [0] [0] [0] 1 1 4 14 7 5 4 [0] [6] [3] [5] 2 1 3 20 16 7 [6] [3] [-1] 3 1 4 20 16 4 8 [1] [8] [4] [11] 4 1 5 12 13 18 17 9 [4] [15] [4] [17] [-2] 5 1 2 18 15 [15] [-19] 6 1 2 8 19 [0] [-2] 7 1 6 2 20 1 10 9 11 [-7] [5] [-8] [8] [-2] [15] 8 1 4 13 10 9 12 [12] [-60] [7] [11] 9 1 4 19 3 17 5 [3] [-44] [-6] [5] 10 1 4 4 19 6 14 [1] [5] [-1] [-65] 11 1 3 4 14 6 [1] [-84] [0] 12 1 4 17 14 4 15 [1] [-47] [-34] [10] 13 1 6 17 5 11 18 3 16 [5] [3] [-65] [0] [-67] [-73] 14 1 4 10 16 11 20 [-1] [12] [-2] [0] 15 1 3 19 5 17 [28] [12] [-9] 16 1 2 13 19 [5] [-1] 17 1 1 21 [4] 18 1 3 21 5 15 [7] [-32] [-32] 19 1 1 21 [7] 20 1 1 21 [8] 21 1 0 0 1 0 0 0 0 0 1 1 -1 -1 -1 0 -1 2 1 1 0 2 1 2 3 1 0 0 0 2 0 4 1 -1 0 0 -1 -1 5 1 0 0 0 0 -2 6 1 -2 0 2 -1 -1 7 1 -1 1 -2 -2 1 8 1 0 0 1 2 -1 9 1 2 -2 0 1 2 10 1 -2 1 0 0 -2 11 1 -2 0 0 0 1 12 1 -2 0 0 0 0 13 1 2 0 -1 0 0 14 1 -1 0 1 0 -2 15 1 0 -1 -1 1 0 16 1 2 -1 0 -1 0 17 1 0 -1 0 2 2 18 1 -1 0 -2 1 2 19 1 1 0 0 1 -2 20 1 0 1 -2 0 0 21 1 0 0 0 0 0 -7 -3 -3 1 -4 0 1 2 6 0
Eagle
1
klorel/or-tools
examples/data/rcpsp/single_mode_consumer_producer/ubo20_cum_2/psp20_75.sch
[ "Apache-2.0" ]
#!/bin/bash git clone https://github.com/bazad/threadexec.git cd threadexec git checkout 7c255d0a0d63464b82315d93a27dddc1d51b42d6 patch -p1 --forward < ../threadexec.diff make
Shell
3
OsmanDere/metasploit-framework
external/source/exploits/CVE-2020-9850/payload/sbx/build-threadexec.sh
[ "BSD-2-Clause", "BSD-3-Clause" ]
(Please bear with me: I can't use any periods or commas or hyphens in this introduction) This is an implementation of CSS decryption in the Brainfuck programming language It consumes exactly 2053 bytes of input and produces exactly 2048 bytes of output: the input is the five byte title key followed by a 2048 byte sector to decrypt and the output is the decrypted sector (or the original sector if it wasn't encrypted) You can't decrypt more than one sector at a time because BF doesn't provide any way to detect the end of the input; rather than make an infinite loop I decided to stop after one iteration CSS is the encryption used on DVDs and Brainfuck is a Turing complete programming language which actually resembles a Turing machine to no small degree: in particular it uses a linear workspace accessed through a "read/write head" which can only move by one cell at a time It's a lot of fun to watch this program in action if you have a BF interpreter which shows the movement of the head (and if you don't have one write one: it takes about five minutes) Now on with the show ____________________________________________________________ read the key ,>,>,>,>,> copy the first 21 bytes of the sector unchanged +++[->+++++++[->,.<]<] convert the 21st byte to binary >>[->>[>]+<[-<]<] save bit 4 (the encryption bit); nuke the rest >>[-]>[-]>[-]>[-]>[-<<<<<<<+>>>>>>>]>[-]>[-]>[-]<<<<<<<<<< if it's set: <+>[- copy another 64 bytes <+++++++[->++++++++[->,.<]<] xor the most recent byte from input with the first key byte <<<<<[->>>>>>+<<<<<<]>>>>>> [->>>>[>>]+<<[-<<]<<]> [->>>>[>>]+<<[-<<]<<]> >>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]] >>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]] >>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]] >>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]] fill in the always set bits in the LFSRs >>>>>>>>>>+>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<< move the xor'ed byte to its final location (in the 17 bit LFSR) <[->>>>>>>>+<<<<<<<<]< <[->>>>>>>>>+<<<<<<<<<]< <[->>>>>>>>>>+<<<<<<<<<<]< <[->>>>>>>>>>>+<<<<<<<<<<<]< <[->>>>>>>>>>>>+<<<<<<<<<<<<]< <[->>>>>>>>>>>>>+<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>+<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<]< same thing for the next four bytes (yuck) <<<<<<<<<[->>>>>+<<<<<]>>>>>>,.< [->>>>[>>]+<<[-<<]<<]>[->>>>[>>]+<<[-<<]<<]> >>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]] >>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]] >>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]] >>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]] >[->>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<]< <<<<<<<<[->>>>+<<<<]>>>>>,.< [->>>>[>>]+<<[-<<]<<]>[->>>>[>>]+<<[-<<]<<]> >>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]] >>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]] >[->>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]< <<<<<<<[->>>+<<<]>>>>,.< [->>>>[>>]+<<[-<<]<<]>[->>>>[>>]+<<[-<<]<<]> >>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]] >>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]] >[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]< <<<<<<[->>+<<]>>>,.< [->>>>[>>]+<<[-<<]<<]>[->>>>[>>]+<<[-<<]<<]> >>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]] >>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]]>>[>[-<->]<[->+<]] >[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]< <[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]< <<<<<<<< copy the remaining 39 bytes of the header +++[->+++++++++++++[->,.<]<] << main decryption loop: for each of 1920 bytes: +++++[->++++++[->++++++++[->++++++++[-> read a byte and convert it to binary ,[->>>[>>]+<<[-<<]<] perform the mangling step (bit ordering is AaBbCcDdEeFfGgHh) >>>>>>+>>+>>>>+>>>>+> [-<<<<<->>>>>] <<[-<<<<<<<<<<<+>>>>>>>>>>>] F =!h; B = g; ++<<[->>->>+<<<<<<<<<<<->>>>>>>]<< [->>>>->>+<-<<<<<]<< C =!f; H =!e; g=2 minus e minus f; h=e plus f [-<<<<<<<+>>>>>>>]<< [->>>+<<<] A = d; E = c; ++<<[->>->-<<<]<< [->>>>->>>>>>>+<<<<<<<<<<<] D =!b; G = a; c=2 minus a minus b; >>>>[[-]<<<<+<[->-<]>[-<+>]>>>>>>+>[-<->]<[->+<]<<] A ^=!!c; E ^=!!c; (!!c == !(a&b)) >>>>>>>>[[-]<<<<<<<<<<+<[->-<]>[-<+>]>>>>>>>>>>] B ^=!!g; (!!g == !(e&f)) >>[[-]<<<<+<[->-<]>[-<+>]>>>>]<<<<<<<<<<<<<<< F ^=!!h; (!!h == (e|f)) [->>[->+>[-<->]<[->+<]>>+>[-<->]<[->+<]<<+<]>[-<+>]<<+<]>[-<+>] C ^= A&B; D ^= A&B; >>>>>>>>>>++<<<[->+>>->>+<<<<<]>[-<+>]>[-<+>>->>+<<<]<[->+<] f = 2 minus E minus F; g = E plus F; >>[[-]+>[-<->]<[->+<]]>>[[-]+>[-<->]<[->+<]] G ^=!!f; H ^=!!g; generate eight cipher bits >>++++++++[> clock the 17 bit LFSR and add end bit to previous carry >>+>> >>>>>>>>>>>>>>>> [-<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>]< [->+<]<[->+<]<[->+<]<[->+<]<[->+<]<[->+<]< [->+<]<[->+<]<[->+<]<[->+<]<[->+<]<[->+<]< [->+<]<[->+<<<<+>>>]<[->+<]<[->+<]< [->+<<->[->-<<+>]] clock the 25 bit LFSR and add end bit to total >>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>> [-<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>]< [->+<]<[->+<]< [->+<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>]< [->+<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>]< [->+<]<[->+<]<[->+<]<[->+<]<[->+<]<[->+<]<[->+<]< [->+<<<<<<<<<<<<<<+>>>>>>>>>>>>>]< [->+<]<[->+<]<[->+<]<[->+<]<[->+<]<[->+<]< [->+<]<[->+<]<[->+<]<[->+<]<[->+<]<[->+<]< [->+<<+>[->-<<->[->+<<+>[->-<<->]]]]< [-<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>]<<<<<<<<<<<<<<<<<<< split total into low bit (result) and high bit (new carry) [->+<]> [-<<[<]+>[->]>] <<<[->>+<<] shift in new result bit <<<<<<<<<<<<<<<<<[-] >>[-<<+>>]>>[-<<+>>]>>[-<<+>>]>>[-<<+>>] >>[-<<+>>]>>[-<<+>>]>>[-<<+>>]>>>>[-<<<<+>>>>] <<-] xor cipher byte with sector byte <[<[->-<]>[-<+>]]< <[<[->-<]>[-<+>]]< <[<[->-<]>[-<+>]]< <[<[->-<]>[-<+>]]< <[<[->-<]>[-<+>]]< <[<[->-<]>[-<+>]]< <[<[->-<]>[-<+>]]< <[<[->-<]>[-<+>]] combine bits into output byte > [-<<++>>] >>>> [-<<++>>] >>>> [-<<++>>] >>>> [-<<++>>] << [-<<<<++++>>>>] <<<<<<<< [-<<<<++++>>>>] >>>> [-<<<<<<<<++++++++++++++++>>>>>>>>] and write it out <<<<<<<<.[-] end of decryption loop <<]<]<]<] >>>>> end of decryption; if the encryption bit was clear: ]<[ then just copy the rest of the sector (2027 bytes) >+++++[->+++++[->+++++++++[->+++++++++[->,.<]<]<]<],.,.> end of plaintext copy ]
Brainfuck
4
RubenNL/brainheck
examples/css.bf
[ "Apache-2.0" ]
#pragma once #include "envoy/network/io_handle.h" #include "envoy/network/socket.h" #include "envoy/stream_info/filter_state.h" namespace Envoy { namespace Network { /** * Redirect records to be used in connections. */ class UpstreamSocketOptionsFilterState : public StreamInfo::FilterState::Object { public: UpstreamSocketOptionsFilterState() { upstream_options_ = std::make_shared<Network::Socket::Options>(); } const Network::Socket::OptionsSharedPtr value() const { return upstream_options_; } void addOption(Network::Socket::OptionsSharedPtr option) { Network::Socket::appendOptions(upstream_options_, option); } static const std::string& key(); private: Network::Socket::OptionsSharedPtr upstream_options_; }; } // namespace Network } // namespace Envoy
C
5
dcillera/envoy
source/common/network/upstream_socket_options_filter_state.h
[ "Apache-2.0" ]
<?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:import href="xslt-import-depth-general.xsl"/> <xsl:output method="html"/> <xsl:template match="/page"> <html> <head><title><xsl:value-of select="title"/></title></head> <body><xsl:apply-templates/></body> </html> </xsl:template> </xsl:stylesheet>
XSLT
4
zealoussnow/chromium
third_party/blink/web_tests/fast/xsl/resources/xslt-import-depth-page.xsl
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
0 train 1 test 2 test 3 train 4 train 5 train 6 test 7 train 8 eval 9 train 10 train 11 test 12 train 13 eval 14 train 15 test 16 train 17 test 18 train 19 test 20 train 21 eval 22 test 23 eval 24 train 25 train 26 train 27 train 28 test 29 train 30 eval 31 train 32 train 33 eval 34 eval 35 test 36 train 37 test 38 train 39 train 40 eval 41 train 42 train 43 eval 44 train 45 test 46 eval 47 train 48 train 49 train 50 train 51 test 52 train 53 train 54 test 55 train 56 train 57 train 58 test 59 train 60 train 61 train 62 train 63 test 64 test 65 train 66 test 67 eval 68 train 69 test 70 train 71 train 72 train 73 train 74 train 75 test 76 train 77 train 78 train 79 train 80 test 81 eval 82 test 83 eval 84 eval 85 train 86 train 87 train 88 train 89 eval 90 train 91 train 92 test 93 eval 94 eval 95 train 96 test 97 test 98 train 99 eval 100 train 101 train 102 train 103 eval 104 test 105 train 106 test 107 train 108 test 109 train 110 train 111 test 112 train 113 train 114 test 115 train 116 train 117 eval 118 train 119 eval 120 train 121 eval 122 train 123 test 124 test 125 train 126 train 127 train 128 eval 129 test 130 test 131 test 132 test 133 train 134 test 135 train 136 test 137 train 138 eval 139 train 140 eval 141 train 142 train 143 eval 144 train 145 eval 146 train 147 eval 148 eval 149 train 150 train 151 eval 152 test 153 train 154 eval 155 train 156 test 157 train 158 train 159 train 160 eval 161 eval 162 train 163 eval 164 train 165 train 166 train 167 train 168 train 169 train 170 train 171 train 172 test 173 test 174 train 175 train 176 test 177 train 178 eval 179 test 180 train 181 train 182 test 183 eval 184 train 185 test 186 train 187 train 188 eval 189 train 190 eval 191 test 192 train 193 train 194 eval 195 eval 196 train 197 train 198 eval 199 eval 200 test 201 train 202 train 203 train 204 train 205 eval 206 test 207 train 208 train 209 eval 210 eval 211 eval 212 eval 213 test 214 test 215 test 216 train 217 train 218 train 219 train 220 train 221 eval 222 train 223 train 224 train 225 train 226 train 227 eval 228 train 229 test 230 eval 231 train 232 train 233 train 234 test 235 test 236 train 237 train 238 eval 239 train 240 train 241 eval 242 eval 243 train 244 test 245 eval 246 train 247 train 248 train 249 train 250 train 251 train 252 train 253 train 254 eval 255 train 256 train 257 test 258 train 259 test 260 train 261 train 262 eval 263 test 264 train 265 eval 266 train 267 test 268 train 269 train 270 train 271 test 272 train 273 eval 274 eval 275 train 276 eval 277 train 278 train 279 train 280 train 281 train 282 train 283 train 284 train 285 train 286 eval 287 train 288 eval 289 test 290 eval 291 train 292 train 293 eval 294 train 295 train 296 test 297 test 298 train 299 train 300 train 301 train 302 test 303 train 304 test 305 test 306 train 307 test 308 eval 309 eval 310 test 311 train 312 eval 313 train 314 eval 315 eval 316 test 317 train 318 train 319 test 320 test 321 train 322 train 323 train 324 train 325 train 326 eval 327 eval 328 train 329 train 330 eval 331 train 332 train 333 test 334 train 335 eval 336 test 337 train 338 train 339 eval 340 train 341 train 342 train 343 eval 344 test 345 train 346 train 347 train 348 train 349 train 350 train 351 train 352 train 353 train 354 train 355 eval 356 train 357 train 358 eval 359 train 360 eval 361 train 362 train 363 train 364 eval 365 train 366 eval 367 test 368 train 369 train 370 train 371 train 372 eval 373 eval 374 train 375 test 376 train 377 train 378 train 379 train 380 eval 381 train 382 train 383 train 384 train 385 test 386 train 387 train 388 train 389 train 390 test 391 eval 392 train 393 train 394 train 395 test 396 train 397 train 398 train 399 eval 400 eval 401 eval 402 train 403 eval 404 eval 405 eval 406 test 407 eval 408 train 409 eval 410 train 411 train 412 train 413 eval 414 train 415 train 416 test 417 test 418 eval 419 eval 420 train 421 test 422 eval 423 test 424 eval 425 train 426 train 427 train 428 train 429 test 430 train 431 train 432 test 433 train 434 train 435 test 436 train 437 eval 438 test 439 eval 440 test 441 train 442 train 443 train 444 train 445 train 446 eval 447 test 448 train 449 eval 450 test 451 train 452 train 453 test 454 eval 455 train 456 eval 457 train 458 eval 459 train 460 train 461 train 462 test 463 eval 464 eval 465 train 466 train 467 train 468 eval 469 train 470 train 471 test 472 train 473 eval 474 eval 475 train 476 train 477 eval 478 train 479 train 480 test 481 train 482 eval 483 train 484 eval 485 eval 486 test 487 eval 488 train 489 train 490 train 491 train 492 eval 493 train 494 train 495 train 496 train 497 eval 498 test 499 train 500 train 501 train 502 train 503 test 504 train 505 train 506 train 507 eval 508 train 509 train 510 test 511 test 512 test 513 train 514 train 515 test 516 train 517 test 518 train 519 eval 520 train 521 eval 522 train 523 test 524 train 525 test 526 test 527 train 528 test 529 train 530 eval 531 eval 532 test 533 train 534 test 535 train 536 train 537 train 538 train 539 train 540 test 541 test 542 train 543 test 544 train 545 train 546 train 547 train 548 train 549 eval 550 train 551 eval 552 eval 553 train 554 train 555 train 556 train 557 train 558 test 559 eval 560 eval 561 test 562 train 563 train 564 test 565 test 566 test 567 train 568 eval 569 test 570 train 571 eval 572 test 573 eval 574 train 575 train 576 train 577 eval 578 train 579 test 580 eval 581 train 582 test 583 eval 584 test 585 train 586 train 587 eval 588 train 589 eval 590 eval 591 eval 592 train 593 eval 594 train 595 train 596 test 597 train 598 train 599 eval 600 train 601 eval 602 test 603 eval 604 eval 605 train 606 train 607 train 608 train 609 test 610 train 611 train 612 train 613 train 614 train 615 train 616 test 617 train 618 train 619 test 620 train 621 train 622 test 623 train 624 train 625 train 626 test 627 train 628 train 629 train 630 eval 631 train 632 train 633 test 634 test 635 train 636 train 637 eval 638 test 639 train 640 eval 641 train 642 eval 643 train 644 train 645 train 646 train 647 eval 648 test 649 train 650 test 651 train 652 test 653 train 654 test 655 eval 656 test 657 train 658 eval 659 train 660 test 661 train 662 test 663 train 664 eval 665 train 666 train 667 eval 668 train 669 train 670 train 671 train 672 train 673 train 674 train 675 train 676 eval 677 eval 678 train 679 eval 680 train 681 train 682 train 683 train 684 test 685 train 686 train 687 train 688 test 689 train 690 test 691 train 692 train 693 train 694 train 695 train 696 eval 697 test 698 train 699 train 700 eval 701 eval 702 train 703 train 704 train 705 test 706 test 707 train 708 test 709 train 710 train 711 train 712 train 713 eval 714 train 715 train 716 train 717 eval 718 test 719 test 720 train 721 train 722 train 723 eval 724 train 725 train 726 train 727 train 728 train 729 train 730 eval 731 train 732 train 733 train 734 train 735 train 736 eval 737 train 738 train 739 test 740 train 741 eval 742 eval 743 train 744 test 745 test 746 train 747 test 748 test 749 train 750 train 751 train 752 test 753 train 754 train 755 eval 756 train 757 train 758 train 759 test 760 eval 761 train 762 train 763 train 764 train 765 test 766 train 767 train 768 train 769 train 770 eval 771 train 772 train 773 test 774 train 775 train 776 train 777 train 778 eval 779 train 780 test 781 train 782 train 783 train 784 train 785 train 786 train 787 train 788 eval 789 test 790 train 791 eval 792 eval 793 train 794 train 795 train 796 train 797 eval 798 train 799 train 800 train 801 train 802 train 803 train 804 train 805 test 806 train 807 test 808 train 809 test 810 eval 811 eval 812 train 813 train 814 train 815 train 816 test 817 eval 818 eval 819 test 820 test 821 train 822 train 823 eval 824 train 825 eval 826 train 827 test 828 eval 829 train 830 train 831 train 832 eval 833 eval 834 test 835 train 836 test 837 train 838 eval 839 eval 840 train 841 eval 842 eval 843 train 844 train 845 train 846 eval 847 eval 848 test 849 test 850 test 851 train 852 test 853 train 854 train 855 train 856 train 857 train 858 train 859 eval 860 train 861 train 862 train 863 train 864 train 865 test 866 train 867 train 868 train 869 train 870 train 871 train 872 train 873 train 874 test 875 train 876 test 877 train 878 train 879 train 880 train 881 train 882 test 883 train 884 train 885 train 886 test 887 train 888 test 889 eval 890 train 891 eval 892 train 893 test 894 train 895 test 896 train 897 test 898 eval 899 test 900 train 901 train 902 train 903 test 904 train 905 train 906 train 907 train 908 train 909 test 910 train 911 train 912 train 913 train 914 train 915 test 916 test 917 train 918 train 919 train 920 eval 921 eval 922 train 923 train 924 test 925 train 926 eval 927 train 928 test 929 eval 930 train 931 train 932 train 933 train 934 eval 935 train 936 train 937 train 938 test 939 train 940 eval 941 train 942 train 943 train 944 test 945 test 946 test 947 test 948 eval 949 train 950 train 951 eval 952 train 953 eval 954 eval 955 eval 956 eval 957 train 958 train 959 test 960 train 961 test 962 eval 963 train 964 train 965 test 966 test 967 eval 968 test 969 test 970 train 971 test 972 train 973 train 974 eval 975 eval 976 train 977 train 978 test 979 train 980 test 981 eval 982 train 983 eval 984 eval 985 train 986 eval 987 test 988 train 989 train 990 train 991 train 992 train 993 train 994 test 995 train 996 train 997 test 998 train 999 train 1000 train 1001 train 1002 eval 1003 train 1004 train 1005 eval 1006 train 1007 test 1008 train 1009 train 1010 train 1011 train 1012 train 1013 test 1014 train 1015 train 1016 train 1017 train 1018 eval 1019 test 1020 train 1021 train 1022 train 1023 test 1024 train 1025 train 1026 train 1027 train 1028 train 1029 train 1030 test 1031 test 1032 eval 1033 eval 1034 train 1035 train 1036 test 1037 test 1038 train 1039 train 1040 train 1041 train 1042 train 1043 train 1044 eval 1045 test 1046 train 1047 train 1048 train 1049 train 1050 train 1051 test 1052 eval 1053 test 1054 train 1055 eval 1056 train 1057 train 1058 train 1059 train 1060 eval 1061 train 1062 train 1063 eval 1064 eval 1065 test 1066 train 1067 test 1068 train 1069 train 1070 eval 1071 train 1072 train 1073 train 1074 test 1075 test 1076 train 1077 eval 1078 eval 1079 train 1080 train 1081 train 1082 train 1083 train 1084 eval 1085 eval 1086 train 1087 train 1088 train 1089 train 1090 eval 1091 train 1092 test 1093 train 1094 train 1095 eval 1096 eval 1097 train 1098 train 1099 train 1100 eval 1101 test 1102 train 1103 train 1104 train 1105 test 1106 train 1107 eval 1108 test 1109 train 1110 train 1111 train 1112 train 1113 train 1114 train 1115 train 1116 train 1117 train 1118 train 1119 train 1120 train 1121 train 1122 eval 1123 eval 1124 eval 1125 train 1126 eval 1127 eval 1128 train 1129 test 1130 train 1131 eval 1132 train 1133 train 1134 train 1135 test 1136 train 1137 train 1138 test 1139 train 1140 test 1141 train 1142 train 1143 eval 1144 train 1145 eval 1146 train 1147 train 1148 train 1149 test 1150 eval 1151 test 1152 train 1153 test 1154 test 1155 train 1156 train 1157 test 1158 train 1159 train 1160 train 1161 test 1162 test 1163 eval 1164 train 1165 train 1166 test 1167 train 1168 train 1169 train 1170 train 1171 eval 1172 train 1173 train 1174 eval 1175 eval 1176 eval 1177 train 1178 train 1179 train 1180 eval 1181 train 1182 train 1183 train 1184 train 1185 train 1186 test 1187 train 1188 eval 1189 train 1190 eval 1191 train 1192 eval 1193 test 1194 train 1195 train 1196 train 1197 train 1198 train 1199 train 1200 train 1201 train 1202 eval 1203 train 1204 train 1205 test 1206 eval 1207 train 1208 train 1209 train 1210 train 1211 eval 1212 train 1213 eval 1214 train 1215 test 1216 eval 1217 train 1218 eval 1219 train 1220 train 1221 train 1222 train 1223 train 1224 test 1225 eval 1226 train 1227 eval 1228 eval 1229 train 1230 eval 1231 train 1232 train 1233 train 1234 test 1235 train 1236 eval 1237 train 1238 test 1239 train 1240 train 1241 train 1242 train 1243 test 1244 train 1245 test 1246 train 1247 train 1248 eval 1249 train 1250 train 1251 train 1252 train 1253 eval 1254 eval 1255 train 1256 eval 1257 train 1258 train 1259 eval 1260 train 1261 train 1262 train 1263 eval 1264 train 1265 eval 1266 train 1267 train 1268 test 1269 train 1270 eval 1271 train 1272 test 1273 train 1274 test 1275 train 1276 eval 1277 train 1278 train 1279 train 1280 train 1281 train 1282 test 1283 eval 1284 train 1285 test 1286 train 1287 train 1288 train 1289 train 1290 train 1291 eval 1292 train 1293 eval 1294 eval 1295 test 1296 train 1297 train 1298 train 1299 test 1300 eval 1301 train 1302 eval 1303 test 1304 train 1305 test 1306 eval 1307 train 1308 test 1309 test 1310 test 1311 train 1312 test 1313 train 1314 train 1315 train 1316 train 1317 test 1318 train 1319 train 1320 train 1321 test 1322 train 1323 train 1324 test 1325 train 1326 train 1327 test 1328 eval 1329 train 1330 test 1331 eval 1332 eval 1333 train 1334 train 1335 train 1336 train 1337 train 1338 eval 1339 eval 1340 train 1341 test 1342 train 1343 train 1344 train 1345 train 1346 train 1347 train 1348 train 1349 eval 1350 test 1351 test 1352 eval 1353 train 1354 train 1355 test 1356 train 1357 train 1358 train 1359 test 1360 eval 1361 train 1362 train 1363 eval 1364 train 1365 train 1366 train 1367 eval 1368 test 1369 train 1370 eval 1371 train 1372 eval 1373 train 1374 train 1375 train 1376 eval 1377 test 1378 train 1379 train 1380 test 1381 train 1382 eval 1383 train 1384 train 1385 train 1386 train 1387 train 1388 test 1389 train 1390 eval 1391 train 1392 test 1393 train 1394 train 1395 train 1396 test 1397 eval 1398 train 1399 train 1400 train 1401 train 1402 train 1403 train 1404 test 1405 eval 1406 train 1407 train 1408 test 1409 train 1410 test 1411 train 1412 train 1413 test 1414 eval 1415 train 1416 train 1417 train 1418 train 1419 test 1420 eval 1421 train 1422 train 1423 train 1424 train 1425 eval 1426 test 1427 train 1428 test 1429 train 1430 test 1431 train 1432 train 1433 train 1434 train 1435 train 1436 train 1437 eval 1438 test 1439 train 1440 eval 1441 train 1442 train 1443 train 1444 train 1445 test 1446 train 1447 train 1448 train 1449 eval 1450 train 1451 train 1452 eval 1453 train 1454 train 1455 test 1456 train 1457 train 1458 eval 1459 train 1460 test 1461 test 1462 train 1463 train 1464 train 1465 eval 1466 train 1467 train 1468 eval 1469 test 1470 train 1471 eval 1472 train 1473 train 1474 train 1475 eval 1476 test 1477 eval 1478 train 1479 eval 1480 eval 1481 train 1482 train 1483 train 1484 eval 1485 test 1486 eval 1487 train 1488 train 1489 eval 1490 train 1491 train 1492 train 1493 eval 1494 train 1495 test 1496 eval 1497 train 1498 train 1499 eval 1500 train 1501 test 1502 test 1503 eval 1504 test 1505 train 1506 test 1507 test 1508 train 1509 eval 1510 test 1511 train 1512 train 1513 test 1514 train 1515 train 1516 train 1517 train 1518 test 1519 eval 1520 eval 1521 train 1522 train 1523 test 1524 train 1525 train 1526 train 1527 train 1528 eval 1529 test 1530 train 1531 train 1532 train 1533 train 1534 train 1535 train 1536 train 1537 test 1538 train 1539 test 1540 eval 1541 eval 1542 eval 1543 train 1544 eval 1545 train 1546 test 1547 train 1548 train 1549 train 1550 train 1551 test 1552 train 1553 test 1554 train 1555 test 1556 eval 1557 eval 1558 train 1559 eval 1560 test 1561 train 1562 train 1563 train 1564 eval 1565 test 1566 test 1567 train 1568 test 1569 train 1570 train 1571 test 1572 eval 1573 train 1574 train 1575 eval 1576 test 1577 test 1578 train 1579 train 1580 train 1581 train 1582 train 1583 test 1584 eval 1585 train 1586 train 1587 eval 1588 train 1589 test 1590 eval 1591 train 1592 train 1593 train 1594 test 1595 train 1596 train 1597 train 1598 test 1599 train 1600 train 1601 eval 1602 test 1603 train 1604 train 1605 test 1606 train 1607 train 1608 train 1609 train 1610 test 1611 train 1612 train 1613 test 1614 test 1615 train 1616 train 1617 train 1618 train 1619 eval 1620 eval 1621 train 1622 train 1623 train 1624 train 1625 eval 1626 train 1627 eval 1628 train 1629 train 1630 train 1631 test 1632 train 1633 test 1634 train 1635 train 1636 train 1637 test 1638 train 1639 train 1640 train 1641 train 1642 train 1643 train 1644 eval 1645 train 1646 train 1647 train 1648 train 1649 train 1650 train 1651 train 1652 train 1653 train 1654 eval 1655 train 1656 train 1657 train 1658 train 1659 train 1660 eval 1661 train 1662 train 1663 train 1664 eval 1665 test 1666 train 1667 train 1668 train 1669 eval 1670 test 1671 test 1672 train 1673 train 1674 train 1675 train 1676 train 1677 test 1678 test 1679 test 1680 train 1681 eval 1682 train 1683 train 1684 train 1685 train 1686 train 1687 eval 1688 test 1689 train 1690 train 1691 train 1692 test 1693 test 1694 train 1695 test 1696 train 1697 train 1698 train 1699 train 1700 test 1701 train 1702 eval 1703 eval 1704 train 1705 train 1706 train 1707 test 1708 eval 1709 eval 1710 train 1711 train 1712 train 1713 eval 1714 train 1715 train 1716 eval 1717 test 1718 train 1719 test 1720 train 1721 train 1722 train 1723 train 1724 test 1725 train 1726 test 1727 train 1728 train 1729 train 1730 test 1731 test 1732 train 1733 test 1734 eval 1735 eval 1736 eval 1737 train 1738 test 1739 eval 1740 train 1741 train 1742 train 1743 train 1744 train 1745 test 1746 test 1747 train 1748 train 1749 train 1750 train 1751 train 1752 train 1753 train 1754 eval 1755 train 1756 eval 1757 train 1758 eval 1759 train 1760 eval 1761 test 1762 eval 1763 train 1764 train 1765 test 1766 train 1767 train 1768 test 1769 train 1770 train 1771 eval 1772 test 1773 train 1774 train 1775 train 1776 train 1777 eval 1778 train 1779 test 1780 train 1781 test 1782 train 1783 eval 1784 train 1785 train 1786 train 1787 train 1788 eval 1789 train 1790 train 1791 eval 1792 eval 1793 train 1794 train 1795 train 1796 train 1797 train 1798 train 1799 train 1800 train 1801 train 1802 train 1803 train 1804 train 1805 train 1806 train 1807 train 1808 train 1809 test 1810 eval 1811 eval 1812 train 1813 train 1814 test 1815 eval 1816 test 1817 train 1818 train 1819 test 1820 train 1821 train 1822 test 1823 train 1824 eval 1825 train 1826 train 1827 eval 1828 train 1829 train 1830 train 1831 test 1832 train 1833 train 1834 eval 1835 test 1836 test 1837 train 1838 eval 1839 train 1840 eval 1841 eval 1842 train 1843 test 1844 train 1845 eval 1846 train 1847 train 1848 train 1849 train 1850 eval 1851 test 1852 train 1853 test 1854 train 1855 eval 1856 eval 1857 train 1858 train 1859 train 1860 test 1861 train 1862 eval 1863 train 1864 test 1865 test 1866 eval 1867 test 1868 eval 1869 eval 1870 eval 1871 eval 1872 eval 1873 train 1874 train 1875 train 1876 train 1877 train 1878 train 1879 train 1880 test 1881 train 1882 train 1883 train 1884 train 1885 train 1886 eval 1887 train 1888 train 1889 train 1890 train 1891 test 1892 train 1893 train 1894 train 1895 train 1896 train 1897 train 1898 train 1899 train 1900 train 1901 train 1902 train 1903 eval 1904 train 1905 train 1906 train 1907 train 1908 train 1909 train 1910 eval 1911 train 1912 train 1913 eval 1914 train 1915 train 1916 train 1917 train 1918 train 1919 test 1920 train 1921 test 1922 train 1923 train 1924 train 1925 eval 1926 test 1927 test 1928 train 1929 train 1930 eval 1931 train 1932 train 1933 test 1934 eval 1935 train 1936 eval 1937 train 1938 eval 1939 train 1940 test 1941 eval 1942 test 1943 test 1944 test 1945 train 1946 eval 1947 train 1948 train 1949 train 1950 train 1951 train 1952 train 1953 eval 1954 test 1955 train 1956 test 1957 train 1958 train 1959 eval 1960 train 1961 train 1962 train 1963 test 1964 train 1965 train 1966 train 1967 eval 1968 train 1969 train 1970 train 1971 train 1972 train 1973 eval 1974 train 1975 train 1976 train 1977 train 1978 train 1979 test 1980 test 1981 eval 1982 train 1983 eval 1984 eval 1985 test 1986 test 1987 train 1988 train 1989 train 1990 train 1991 eval 1992 train 1993 test 1994 test 1995 test 1996 eval 1997 train 1998 train 1999 train 2000 test 2001 test 2002 test 2003 eval 2004 test 2005 test 2006 train 2007 eval 2008 train 2009 test 2010 test 2011 test 2012 eval 2013 test 2014 test 2015 test 2016 test 2017 train 2018 train 2019 test 2020 test 2021 eval 2022 test 2023 train 2024 test 2025 train 2026 train 2027 test 2028 train 2029 train 2030 train 2031 train 2032 train 2033 eval 2034 train 2035 train 2036 train 2037 train 2038 train 2039 test 2040 train 2041 test 2042 train 2043 eval 2044 train 2045 train 2046 train 2047 train 2048 train 2049 train 2050 train 2051 test 2052 train 2053 eval 2054 train 2055 test 2056 train 2057 train 2058 train 2059 eval 2060 eval 2061 test 2062 train 2063 train 2064 train 2065 train 2066 train 2067 train 2068 test 2069 train 2070 eval 2071 train 2072 train 2073 train 2074 train 2075 test 2076 eval 2077 test 2078 eval 2079 train 2080 eval 2081 eval 2082 eval 2083 eval 2084 eval 2085 train 2086 test 2087 train 2088 test 2089 train 2090 train 2091 train 2092 eval 2093 test 2094 test 2095 train 2096 train 2097 eval 2098 eval 2099 train 2100 train 2101 eval 2102 train 2103 train 2104 train 2105 train 2106 train 2107 test 2108 train 2109 train 2110 eval 2111 eval 2112 train 2113 eval 2114 eval 2115 train 2116 train 2117 train 2118 eval 2119 train 2120 test 2121 train 2122 test 2123 test 2124 train 2125 train 2126 train 2127 train 2128 train 2129 train 2130 train 2131 train 2132 eval 2133 test 2134 test 2135 test 2136 eval 2137 train 2138 train 2139 train 2140 train 2141 train 2142 eval 2143 test 2144 train 2145 test 2146 train 2147 eval 2148 train 2149 train 2150 eval 2151 test 2152 eval 2153 test 2154 train 2155 train 2156 train 2157 test 2158 eval 2159 train 2160 eval 2161 train 2162 train 2163 train 2164 train 2165 train 2166 test 2167 train 2168 train 2169 train 2170 train 2171 eval 2172 test 2173 train 2174 test 2175 train 2176 eval 2177 train 2178 eval 2179 train 2180 train 2181 train 2182 eval 2183 train 2184 eval 2185 test 2186 eval 2187 train 2188 train 2189 test 2190 train 2191 train 2192 train 2193 test 2194 train 2195 test 2196 train 2197 train 2198 train 2199 train 2200 eval 2201 train 2202 train 2203 train 2204 test 2205 train 2206 train 2207 train 2208 train 2209 test 2210 test 2211 eval 2212 test 2213 test 2214 train 2215 test 2216 train 2217 train 2218 train 2219 train 2220 train 2221 train 2222 train 2223 eval 2224 train 2225 train 2226 train 2227 test 2228 test 2229 test 2230 train 2231 train 2232 train 2233 eval 2234 train 2235 eval 2236 train 2237 train 2238 train 2239 train 2240 train 2241 train 2242 train 2243 train 2244 train 2245 train 2246 eval 2247 train 2248 test 2249 eval 2250 train 2251 train 2252 test 2253 train 2254 eval 2255 train 2256 train 2257 train 2258 eval 2259 train 2260 train 2261 train 2262 train 2263 train 2264 train 2265 train 2266 train 2267 train 2268 train 2269 test 2270 train 2271 test 2272 eval 2273 test 2274 eval 2275 train 2276 eval 2277 test 2278 test 2279 train 2280 train 2281 train 2282 test 2283 train 2284 train 2285 train 2286 train 2287 eval 2288 train 2289 train 2290 train 2291 train 2292 eval 2293 test 2294 test 2295 train 2296 train 2297 train 2298 eval 2299 test 2300 test 2301 train 2302 train 2303 train 2304 eval 2305 train 2306 eval 2307 test 2308 eval 2309 train 2310 train 2311 train 2312 train 2313 train 2314 test 2315 test 2316 eval 2317 train 2318 eval 2319 eval 2320 test 2321 eval 2322 train 2323 eval 2324 test 2325 train 2326 train 2327 train 2328 train 2329 train 2330 eval 2331 train 2332 test 2333 train 2334 test 2335 train 2336 test 2337 test 2338 train 2339 train 2340 train 2341 test 2342 train 2343 train 2344 train 2345 eval 2346 train 2347 eval 2348 train 2349 train 2350 train 2351 eval 2352 train 2353 test 2354 test 2355 eval 2356 eval 2357 train 2358 train 2359 train 2360 eval 2361 eval 2362 train 2363 train 2364 train 2365 train 2366 train 2367 train 2368 test 2369 test 2370 eval 2371 train 2372 train 2373 train 2374 train 2375 test 2376 eval 2377 test 2378 test 2379 eval 2380 train 2381 eval 2382 test 2383 train 2384 train 2385 train 2386 train 2387 train 2388 eval 2389 train 2390 eval 2391 eval 2392 train 2393 train 2394 train 2395 train 2396 train 2397 eval 2398 train 2399 train 2400 test 2401 train 2402 train 2403 train 2404 train 2405 train 2406 train 2407 train 2408 eval 2409 eval 2410 train 2411 eval 2412 test 2413 test 2414 train 2415 train 2416 train 2417 train 2418 eval 2419 train 2420 eval 2421 eval 2422 train 2423 train 2424 train 2425 eval 2426 test 2427 eval 2428 train 2429 eval 2430 train 2431 test 2432 train 2433 eval 2434 eval 2435 train 2436 train 2437 train 2438 test 2439 train 2440 eval 2441 eval 2442 train 2443 test 2444 test 2445 train 2446 eval 2447 train 2448 eval 2449 eval 2450 test 2451 eval 2452 test 2453 train 2454 train 2455 train 2456 train 2457 train 2458 eval 2459 train 2460 train 2461 train 2462 train 2463 test 2464 train 2465 train 2466 train 2467 test 2468 test 2469 train 2470 eval 2471 train 2472 train 2473 train 2474 train 2475 train 2476 test 2477 train 2478 train 2479 test 2480 train 2481 train 2482 eval 2483 train 2484 test 2485 train 2486 train 2487 train 2488 test 2489 train 2490 eval 2491 train 2492 train 2493 train 2494 test 2495 train 2496 train 2497 eval 2498 train 2499 train 2500 train 2501 train 2502 eval 2503 train 2504 train 2505 train 2506 test 2507 train 2508 train 2509 train 2510 train 2511 test 2512 train 2513 train 2514 eval 2515 train 2516 train 2517 test 2518 eval 2519 train 2520 train 2521 eval 2522 train 2523 train 2524 eval 2525 eval 2526 eval 2527 test 2528 eval 2529 train 2530 train 2531 train 2532 train 2533 eval 2534 eval 2535 train 2536 train 2537 test 2538 train 2539 test 2540 eval 2541 test 2542 train 2543 train 2544 test 2545 train 2546 train 2547 train 2548 train 2549 train 2550 test 2551 train 2552 train 2553 train 2554 test 2555 train 2556 eval 2557 train 2558 eval 2559 eval 2560 test 2561 eval 2562 train 2563 train 2564 train 2565 train 2566 train 2567 test 2568 eval 2569 eval 2570 train 2571 eval 2572 test 2573 test 2574 train 2575 train 2576 train 2577 train 2578 eval 2579 train 2580 eval 2581 test 2582 eval 2583 eval 2584 train 2585 train 2586 train 2587 train 2588 train 2589 train 2590 train 2591 test 2592 train 2593 test 2594 eval 2595 train 2596 eval 2597 train 2598 train 2599 eval 2600 train 2601 train 2602 eval 2603 train 2604 train 2605 train 2606 test 2607 test 2608 eval 2609 eval 2610 train 2611 eval 2612 eval 2613 train 2614 train 2615 eval 2616 train 2617 train 2618 eval 2619 train 2620 eval 2621 train 2622 eval 2623 train 2624 eval 2625 test 2626 test 2627 eval 2628 train 2629 eval 2630 eval 2631 eval 2632 train 2633 test 2634 train 2635 test 2636 train 2637 eval 2638 test 2639 train 2640 train 2641 train 2642 train 2643 eval 2644 test 2645 test 2646 test 2647 test 2648 train 2649 test 2650 eval 2651 train 2652 eval 2653 test 2654 train 2655 eval 2656 train 2657 train 2658 test 2659 eval 2660 train 2661 eval 2662 eval 2663 test 2664 test 2665 train 2666 train 2667 eval 2668 train 2669 train 2670 train 2671 train 2672 train 2673 test 2674 train 2675 train 2676 train 2677 eval 2678 eval 2679 test 2680 eval 2681 test 2682 eval 2683 test 2684 train 2685 test 2686 eval 2687 eval 2688 eval 2689 eval 2690 eval 2691 train 2692 test 2693 eval 2694 train 2695 train 2696 eval 2697 train 2698 train 2699 train 2700 eval 2701 test 2702 train 2703 train 2704 train 2705 train 2706 test 2707 train
Mask
0
Sanzo00/NeutronStarLite
data/cora.mask
[ "Apache-2.0" ]
zdrive debug level = 0 #Decomposition Method = hypergraph Zoltan Parameters = lb_approach=partition Zoltan Parameters = graph_package=phg File Name = matlab Parallel Disk Info = number=0
Matlab
1
jschueller/seacas
packages/zoltan/src/matlab/zdrive.matlab
[ "Python-2.0", "Zlib", "BSD-2-Clause", "MIT", "NetCDF", "BSL-1.0", "X11", "BSD-3-Clause" ]
query GetTeam($teamID: ID!) { team(teamID: $teamID) { id name teamMembers { membershipID user { uid email } role } } }
GraphQL
4
miily8310s/hoppscotch
packages/hoppscotch-app/helpers/backend/gql/queries/GetTeam.graphql
[ "MIT" ]
_phing () { if [ -f build.xml ]; then compadd $(phing -l|grep -v "\[property\]"|grep -v "Buildfile"|sed 1d|grep -v ":$" |grep -v "^\-*$"|grep -v "Warning:"|awk '{print $1}') fi } compdef _phing phing
Shell
3
chensanle/ohmyzsh
plugins/phing/phing.plugin.zsh
[ "MIT" ]
// REQUIRES: concurrency func simple(completion: @escaping (String?, Error?) -> Void) { } func mismatches() { // RUN: not %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):3 simple() // RUN: not %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):3 simple(10) { res, err in print("call mismatch") } // RUN: not %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):3 simple { res in print("closure mismatch") } } // RUN: not %refactor -add-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 func missingBody(complete: @escaping (Int?, Error?) -> Void)
Swift
3
gandhi56/swift
test/refactoring/ConvertAsync/errors.swift
[ "Apache-2.0" ]
<style> .demo-textfield__textfield-numeric .mdl-textfield { width: 100px; } </style> {% include "textfield-numeric.html" %}
HTML
2
greatwqs/staffjoy
frontend/third_party/node/material_design_lite/textfield/snippets/textfield-numeric-demo.html
[ "MIT" ]
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ #include "src/model.h" #include "src/data/yes.c" #include "src/data/no.c" #include "src/data/unknown.c" #include "src/data/silence.c" void performInference(int8_t input_data[1960], char *data_name) { int8_t output_data[4]; unsigned long start_time = micros(); TVMExecute(input_data, output_data); unsigned long end_time = micros(); Serial.print(data_name); Serial.print(","); Serial.print(end_time - start_time); Serial.print(","); for (int i = 0; i < 4; i++) { Serial.print(output_data[i]); Serial.print(","); } Serial.println(); } void setup() { TVMInitialize(); Serial.begin(115200); } void loop() { Serial.println(); Serial.println("category,runtime,yes,no,silence,unknown"); performInference((int8_t*) input_yes, "yes"); performInference((int8_t*) input_no, "no"); performInference((int8_t*) input_silence, "silence"); performInference((int8_t*) input_unknown, "unknown"); }
Arduino
4
XiaoSong9905/tvm
tests/micro/arduino/testdata/project.ino
[ "Apache-2.0" ]
/** * Copyright (c) 2021 OpenLens Authors * * 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. */ @import "colors", "media"; // Dimensions $unit: 8px; $padding: $unit; $margin: $unit; $radius: var(--border-radius); // Fonts $font-main: var(--font-main); $font-monospace: var(--font-monospace); $font-size-small: var(--font-size-small); $font-size: var(--font-size); $font-size-big: var(--font-size-big); $font-weight-thin: var(--font-weight-thin); $font-weight-normal: var(--font-weight-normal); $font-weight-bold: var(--font-weight-bold); // Z-index correlations $zIndex-sidebar-hover: 500; $zIndex-select-portal: 300; $zIndex-dialog: 200; $zIndex-drawer: 100; // Animation timing functions $animation-curve-fast-out-slow-in: cubic-bezier(0.4, 0, 0.2, 1); $animation-curve-linear-out-slow-in: cubic-bezier(0, 0, 0.2, 1); $animation-curve-fast-out-linear-in: cubic-bezier(0.4, 0, 1, 1); // Import other common vars & mixins @import "mixins";
SCSS
4
pjsoni/lens
src/renderer/components/vars.scss
[ "MIT" ]
#include "colors.inc" #include "stones.inc" #include "skies.inc" background { color rgb 1 } camera { location <-3, 3, -8> look_at < -.3, .5, 0 > angle 25 } light_source { <500,500,-1000> White } difference { box { <-2.0, -.5, 0.1>, <2.0, .8, 1> texture { T_Stone10 } } text { ttf "timrom.ttf" "Features" 0.15, 0 pigment { BrightGold } finish { reflection.25 specular 1 } translate -1.7*x } } sky_sphere { S_Cloud5 }
POV-Ray SDL
4
frederic-tingaud-sonarsource/xania
html/gfx/features.pov
[ "BSD-2-Clause" ]
import processing.video.*; // Movie cam; Capture cam; // PImage bot; int scl = 8; int w, h; PImage[] history; int historyIndex = 0; int offset = 0; void setup() { size(640, 480); String[] cameras = Capture.list(); cam = new Capture(this, 640, 480,cameras[1]); cam.start(); w = width/scl; h = height/scl; history = new PImage[scl*scl]; for (int i = 0; i < history.length; i++) { history[i] = createImage(width, height, RGB); } background(0); } void captureEvent(Capture cam) { cam.read(); } float angle = 0; void draw() { int count = 0; for (int i = 0; i < scl; i++) { for (int j = 0; j < scl; j++) { int currentIndex = (count + offset) % history.length; image(history[currentIndex], i*w, j*h, w, h); count++; } } offset++; history[historyIndex].copy(cam, 0, 0, width, height, 0, 0, width, height); historyIndex = (historyIndex + 1) % history.length; }
Processing
3
vinnyI-afk/website
CodingChallenges/CC_164_Slitscan/Processing/Time_Grid/Time_Grid.pde
[ "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="M9.83,8l1.17,0l0,6l2,0l0,-6l1.17,0l-2.17,-2.17z" android:strokeAlpha="0.3" android:fillAlpha="0.3"/> <path android:fillColor="@android:color/white" android:pathData="M5,18h14v2h-14z"/> <path android:fillColor="@android:color/white" android:pathData="M5,10h4v6h6v-6h4l-7,-7L5,10zM13,8v6h-2V8H9.83L12,5.83L14.17,8H13z"/> </vector>
XML
3
semoro/androidx
compose/material/material/icons/generator/raw-icons/twotone/file_upload.xml
[ "Apache-2.0" ]
namespace OpenAPI open OpenAPI.Model.User open UserApiHandlerParams open UserApiServiceInterface open System.Collections.Generic open System open Giraffe module UserApiServiceImplementation = //#region Service implementation type UserApiServiceImpl() = interface IUserApiService with member this.CreateUser ctx args = let content = "successful operation" CreateUserDefaultStatusCode { content = content } member this.CreateUsersWithArrayInput ctx args = let content = "successful operation" CreateUsersWithArrayInputDefaultStatusCode { content = content } member this.CreateUsersWithListInput ctx args = let content = "successful operation" CreateUsersWithListInputDefaultStatusCode { content = content } member this.DeleteUser ctx args = if true then let content = "Invalid username supplied" DeleteUserStatusCode400 { content = content } else let content = "User not found" DeleteUserStatusCode404 { content = content } member this.GetUserByName ctx args = if true then let content = "successful operation" :> obj :?> User // this cast is obviously wrong, and is only intended to allow generated project to compile GetUserByNameStatusCode200 { content = content } else if true then let content = "Invalid username supplied" GetUserByNameStatusCode400 { content = content } else let content = "User not found" GetUserByNameStatusCode404 { content = content } member this.LoginUser ctx args = if true then let content = "successful operation" :> obj :?> string // this cast is obviously wrong, and is only intended to allow generated project to compile LoginUserStatusCode200 { content = content } else let content = "Invalid username/password supplied" LoginUserStatusCode400 { content = content } member this.LogoutUser ctx = let content = "successful operation" LogoutUserDefaultStatusCode { content = content } member this.UpdateUser ctx args = if true then let content = "Invalid user supplied" UpdateUserStatusCode400 { content = content } else let content = "User not found" UpdateUserStatusCode404 { content = content } //#endregion let UserApiService = UserApiServiceImpl() :> IUserApiService
F#
4
JigarJoshi/openapi-generator
samples/server/petstore/fsharp-giraffe/OpenAPI/src/impl/UserApiService.fs
[ "Apache-2.0" ]
Strict Import mojo Class Tween Private Field active:Bool Field target:Float Field ease:EaseFunction Field t:Float Field lastTime:Int Field time:Int Public Method New(duration:Float, ease:EaseFunction = Null) target = duration Self.ease = ease t = 0 End Method Method Update:Void() If ( Not active) Return time += (Millisecs() -lastTime) lastTime = Millisecs() t = time / target If (ease <> Null) t = ease.Ease(t) If (time >= target) Then t = 1 time = target active = False End If End Method Method Start:Void() time = 0 lastTime = Millisecs() active = True End Method Method Cancel:Void() active = False End Method Method Scale:Float() Property Return t End Method End Class Class Ease Global QuadIn:EaseFunction = New EaseQuadIn() Global QuadOut:EaseFunction = New EaseQuadOut() Global QuadInOut:EaseFunction = New EaseQuadInOut() Global CubeIn:EaseFunction = New EaseCubeIn() Global CubeOut:EaseFunction = New EaseCubeOut() Global CubeInOut:EaseFunction = New EaseCubeInOut() Global QuartIn:EaseFunction = New EaseQuartIn() Global QuartOut:EaseFunction = New EaseQuartOut() Global QuartInOut:EaseFunction = New EaseQuartInOut() Global QuintIn:EaseFunction = New EaseQuintIn() Global QuintOut:EaseFunction = New EaseQuintOut() Global QuintInOut:EaseFunction = New EaseQuintInOut() Global SineIn:EaseFunction = New EaseSineIn() Global SineOut:EaseFunction = New EaseSineOut() Global SineInOut:EaseFunction = New EaseSineInOut() Global BounceIn:EaseFunction = New EaseBounceIn() Global BounceOut:EaseFunction = New EaseBounceOut() Global BounceInOut:EaseFunction = New EaseBounceInOut() Global CircIn:EaseFunction = New EaseCircIn() Global CircOut:EaseFunction = New EaseCircOut() Global CircInOut:EaseFunction = New EaseCircInOut() Global ExpoIn:EaseFunction = New EaseExpoIn() Global ExpoOut:EaseFunction = New EaseExpoOut() Global ExpoInOut:EaseFunction = New EaseExpoInOut() Global BackIn:EaseFunction = New EaseBackIn() Global BackOut:EaseFunction = New EaseBackOut() Global BackInOut:EaseFunction = New EaseBackInOut() End Class Interface EaseFunction Method Ease:Float(t:Float) End Interface Private Const B1:Float = 1 / 2.75 Const B2:Float = 2 / 2.75 Const B3:Float = 1.5 / 2.75 Const B4:Float = 2.5 / 2.75 Const B5:Float = 2.25 / 2.75 Const B6:Float = 2.625 / 2.75 Class EaseQuadIn Implements EaseFunction Method Ease:Float(t:Float) Return t * t End Method End Class Class EaseQuadOut Implements EaseFunction Method Ease:Float(t:Float) Return -t * (t - 2) End Method End Class Class EaseQuadInOut Implements EaseFunction Method Ease:Float(t:Float) If (t <= 0.5) Return t * t * 2 t -= 1 Return 1 - t * t * 2 End Method End Class Class EaseCubeIn Implements EaseFunction Method Ease:Float(t:Float) Return t * t * t End Method End Class Class EaseCubeOut Implements EaseFunction Method Ease:Float(t:Float) t -= 1 Return 1 + t * t * t End Method End Class Class EaseCubeInOut Implements EaseFunction Method Ease:Float(t:Float) If (t <= 0.5) Return t * t * t * 4 t -= 1 Return 1 + t * t * t * 4 End Method End Class Class EaseQuartIn Implements EaseFunction Method Ease:Float(t:Float) Return t * t * t * t End Method End Class Class EaseQuartOut Implements EaseFunction Method Ease:Float(t:Float) t -= 1 Return 1 - t * t * t * t End Method End Class Class EaseQuartInOut Implements EaseFunction Method Ease:Float(t:Float) If (t <= 0.5) Return t * t * t * t * 8 t = t * 2 - 2 Return(1 - t * t * t * t) / 2 + 0.5 End Method End Class Class EaseQuintIn Implements EaseFunction Method Ease:Float(t:Float) Return t * t * t * t * t End Method End Class Class EaseQuintOut Implements EaseFunction Method Ease:Float(t:Float) t -= 1 Return t * t * t * t * t + 1 End Method End Class Class EaseQuintInOut Implements EaseFunction Method Ease:Float(t:Float) t *= 2 If (t < 1) Return(t * t * t * t * t) / 2 t -= 2 Return(t * t * t * t * t + 2) / 2 End Method End Class Class EaseSineIn Implements EaseFunction Method Ease:Float(t:Float) Return -Cosr(HALFPI * t) + 1 End Method End Class Class EaseSineOut Implements EaseFunction Method Ease:Float(t:Float) Return Sinr(HALFPI * t) End Method End Class Class EaseSineInOut Implements EaseFunction Method Ease:Float(t:Float) Return -Cosr(PI * t) / 2 + 0.5 End Method End Class Class EaseBounceIn Implements EaseFunction Method Ease:Float(t:Float) t = 1 - t If (t < B1) Return 1 - 7.5625 * t * t If (t < B2) Return 1 - (7.5625 * (t - B3) * (t - B3) + 0.75) If (t < B4) Return 1 - (7.5625 * (t - B5) * (t - B5) + 0.9375) Return 1 - (7.5625 * (t - B6) * (t - B6) + 0.984375) End Method End Class Class EaseBounceOut Implements EaseFunction Method Ease:Float(t:Float) If (t < B1) Return 7.5625 * t * t If (t < B2) Return 7.5625 * (t - B3) * (t - B3) + 0.75 If (t < B4) Return 7.5625 * (t - B5) * (t - B5) + 0.9375 Return 7.5625 * (t - B6) * (t - B6) + 0.984375 End Method End Class Class EaseBounceInOut Implements EaseFunction Method Ease:Float(t:Float) If (t < 0.5) Then t = 1 - t * 2 If (t < B1) Return(1 - 7.5625 * t * t) / 2 If (t < B2) Return(1 - (7.5625 * (t - B3) * (t - B3) + 0.75)) / 2 If (t < B4) Return(1 - (7.5625 * (t - B5) * (t - B5) + 0.9375)) / 2 Return(1 - (7.5625 * (t - B6) * (t - B6) + 0.984375)) / 2 End If t = t * 2 - 1 If (t < B1) Return(7.5625 * t * t) / 2 + 0.5 If (t < B2) Return(7.5625 * (t - B3) * (t - B3) + 0.75) / 2 + 0.5 If (t < B4) Return(7.5625 * (t - B5) * (t - B5) + 0.9375) / 2 + 0.5 Return(7.5625 * (t - B6) * (t - B6) + 0.984375) / 2 + 0.5 End Method End Class Class EaseCircIn Implements EaseFunction Method Ease:Float(t:Float) Return - (Sqrt(1 - t * t) - 1) End Method End Class Class EaseCircOut Implements EaseFunction Method Ease:Float(t:Float) Return Sqrt(1 - (t - 1) * (t - 1)) End Method End Class Class EaseCircInOut Implements EaseFunction Method Ease:Float(t:Float) If (t <= 0.5) Return(Sqrt(1 - t * t * 4) - 1) / -2 Return(Sqrt(1 - (t * 2 - 2) * (t * 2 - 2)) + 1) / 2 End Method End Class Class EaseExpoIn Implements EaseFunction Method Ease:Float(t:Float) Return Pow(2, 10 * (t - 1)) End Method End Class Class EaseExpoOut Implements EaseFunction Method Ease:Float(t:Float) Return -Pow(2, -10 * t) + 1 End Method End Class Class EaseExpoInOut Implements EaseFunction Method Ease:Float(t:Float) If (t < 0.5) Return Pow(2, 10 * (t * 2 - 1)) / 2 Return(-Pow(2, -10 * (t * 2 - 1)) + 2) / 2 End Method End Class Class EaseBackIn Implements EaseFunction Method Ease:Float(t:Float) Return t * t * (2.70158 * t - 1.70158) End Method End Class Class EaseBackOut Implements EaseFunction Method Ease:Float(t:Float) t -= 1 Return 1 - t * t * (-2.70158 * t - 1.70158) End Method End Class Class EaseBackInOut Implements EaseFunction Method Ease:Float(t:Float) t *= 2 If (t < 1) Return t * t * (2.70158 * t - 1.70158) / 2 t -= 2 Return(1 - t * t * (-2.70158 * t - 1.70158)) / 2 + 0.5 End Method End Class
Monkey
4
blitz-research/monkey
bananas/devolonter/matchup/src/tweening.monkey
[ "Zlib" ]
CREATE TABLE `tb_ctxyxxbpqn` ( `col_mpmyypobxf` longblob, `col_vdicnalzyn` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`col_vdicnalzyn`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `tb_uasvccezbb` ( `col_mpmyypobxf` longblob, `col_vdicnalzyn` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`col_vdicnalzyn`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SQL
2
yuanweikang2020/canal
parse/src/test/resources/ddl/table/mysql_3.sql
[ "Apache-2.0" ]
- page_title _("Applications") = render 'shared/doorkeeper/applications/index', oauth_applications_enabled: user_oauth_applications?, oauth_authorized_applications_enabled: true, form_url: doorkeeper_submit_path(@application), application_url: ->(application) { oauth_application_path(application) }, edit_application_url: ->(application) { edit_oauth_application_path(application) }
Haml
3
glimmerhq/glimmerhq
app/views/doorkeeper/applications/index.html.haml
[ "MIT" ]
"""Tests for the folder_watcher component."""
Python
0
domwillcode/home-assistant
tests/components/folder_watcher/__init__.py
[ "Apache-2.0" ]
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon")); var _jsxRuntime = require("react/jsx-runtime"); var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", { d: "M22 14c0-1.95-1.4-3.57-3.25-3.92L17.4 6.05C17 4.82 15.85 4 14.56 4H9.44C8.15 4 7 4.82 6.6 6.05L5.81 8.4 4.41 7l.29-.29c.39-.39.39-1.02 0-1.41a.9959.9959 0 0 0-1.41 0l-2 2c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0l.3-.3 1.79 1.79C3.18 10.72 2 12.22 2 14c0 1.5.83 2.79 2.05 3.48C4.28 18.9 5.51 20 7 20c1.3 0 2.4-.84 2.82-2h4.37c.41 1.16 1.51 2 2.82 2 1.49 0 2.72-1.1 2.95-2.52C21.17 16.79 22 15.5 22 14zM7 18c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm4-8H7.41l-.02-.02 1.1-3.3c.14-.41.52-.68.95-.68H11v4zm2-4h1.56c.43 0 .81.27.95.68l1.1 3.32H13V6zm4 12c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1z" }), 'ToysRounded'); exports.default = _default;
JavaScript
4
good-gym/material-ui
packages/material-ui-icons/lib/ToysRounded.js
[ "MIT" ]
# aliases alias hga='hg add' alias hgc='hg commit' alias hgca='hg commit --amend' alias hgci='hg commit --interactive' alias hgb='hg branch' alias hgba='hg branches' alias hgbk='hg bookmarks' alias hgco='hg checkout' alias hgd='hg diff' alias hged='hg diffmerge' alias hgp='hg push' alias hgs='hg status' alias hgsl='hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|person}: {desc|strip|firstline}\n" ' alias hgun='hg resolve --list' # pull and update alias hgi='hg incoming' alias hgl='hg pull -u' alias hglr='hg pull --rebase' alias hgo='hg outgoing' alias hglg='hg log --stat -v' alias hglgp='hg log --stat -p -v' function hgic() { hg incoming "$@" | grep "changeset" | wc -l } function hgoc() { hg outgoing "$@" | grep "changeset" | wc -l } # functions function hg_root() { local dir="$PWD" while [[ "$dir" != "/" ]]; do if [[ -d "$dir/.hg" ]]; then echo "$dir" return 0 fi dir="${dir:h}" done return 1 } function in_hg() { hg_root >/dev/null } function hg_get_branch_name() { local dir if ! dir=$(hg_root); then return fi if [[ ! -f "$dir/.hg/branch" ]]; then echo default return fi echo "$(<"$dir/.hg/branch")" } function hg_get_bookmark_name() { local dir if ! dir=$(hg_root); then return fi if [[ ! -f "$dir/.hg/bookmarks.current" ]]; then return fi echo "$(<"$dir/.hg/bookmarks.current")" } function hg_prompt_info { local dir branch dirty if ! dir=$(hg_root); then return fi if [[ ! -f "$dir/.hg/branch" ]]; then branch=default else branch="$(<"$dir/.hg/branch")" fi dirty="$(hg_dirty)" echo "${ZSH_THEME_HG_PROMPT_PREFIX}${branch:gs/%/%%}${dirty}${ZSH_THEME_HG_PROMPT_SUFFIX}" } function hg_dirty { # Do nothing if clean / dirty settings aren't defined if [[ -z "$ZSH_THEME_HG_PROMPT_DIRTY" && -z "$ZSH_THEME_HG_PROMPT_CLEAN" ]]; then return fi # Check if there are modifications local hg_status if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" = true ]]; then if ! hg_status="$(hg status -q 2>/dev/null)"; then return fi else if ! hg_status="$(hg status 2>/dev/null)"; then return fi fi # grep exits with 0 when dirty if command grep -Eq '^\s*[ACDIMR!?L].*$' <<< "$hg_status"; then echo $ZSH_THEME_HG_PROMPT_DIRTY return fi echo $ZSH_THEME_HG_PROMPT_CLEAN }
Shell
3
residwi/ohmyzsh
plugins/mercurial/mercurial.plugin.zsh
[ "MIT" ]
-- name: create-table-logs CREATE TABLE IF NOT EXISTS logs ( log_id SERIAL PRIMARY KEY ,log_data BYTEA );
SQL
3
sthagen/drone-drone
store/shared/migrate/postgres/files/007_create_table_logs.sql
[ "Apache-2.0" ]
pub main coginit(0, @entry, 0) dat org 0 entry _dummy _dummy_ret ret COG_BSS_START fit 496 org COG_BSS_START fit 496
Parrot Assembly
1
archivest/spin2cpp
Test/Expect/stest001.pasm
[ "MIT" ]
# NOTE: This class is auto generated by the swagger code generator program. # https://github.com/swagger-api/swagger-codegen.git # Do not edit the class manually. defmodule SwaggerPetstore.Model.EnumTest do @moduledoc """ """ @derive [Poison.Encoder] defstruct [ :"enum_string", :"enum_string_required", :"enum_integer", :"enum_number", :"outerEnum" ] @type t :: %__MODULE__{ :"enum_string" => String.t, :"enum_string_required" => String.t, :"enum_integer" => integer(), :"enum_number" => float(), :"outerEnum" => OuterEnum } end defimpl Poison.Decoder, for: SwaggerPetstore.Model.EnumTest do import SwaggerPetstore.Deserializer def decode(value, options) do value |> deserialize(:"outerEnum", :struct, SwaggerPetstore.Model.OuterEnum, options) end end
Elixir
4
Nirostar/swagger-codegen
samples/client/petstore/elixir/lib/swagger_petstore/model/enum_test.ex
[ "Apache-2.0" ]
configuration AccelReadStreamP { provides { interface ReadStream<uint16_t> as ReadStreamX[uint8_t client]; interface ReadStream<uint16_t> as ReadStreamY[uint8_t client]; } uses { interface ReadStream<uint16_t> as ActualX[uint8_t client]; interface ReadStream<uint16_t> as ActualY[uint8_t client]; } } implementation { enum { NACCEL_CLIENTS = uniqueCount(UQ_ACCEL_RESOURCE) }; components AccelConfigP, new ArbitratedReadStreamC(NACCEL_CLIENTS, uint16_t) as MultiplexX, new ArbitratedReadStreamC(NACCEL_CLIENTS, uint16_t) as MultiplexY; ReadStreamX = MultiplexX; MultiplexX.Resource -> AccelConfigP; MultiplexX.Service = ActualX; ReadStreamY = MultiplexY; MultiplexY.Resource -> AccelConfigP; MultiplexY.Service = ActualY; }
nesC
4
mtaghiza/tinyos-main-1
tos/sensorboards/mts300/AccelReadStreamP.nc
[ "BSD-3-Clause" ]
INSERT INTO BAR(id, name) VALUES (1, 'bar'); INSERT INTO BAR(id, name) VALUES (2, 'ばー');
SQL
3
yiou362/spring-boot-2.2.9.RELEASE
spring-boot-project/spring-boot-autoconfigure/src/test/resources/org/springframework/boot/autoconfigure/jdbc/encoding-data.sql
[ "Apache-2.0" ]
Module: environment-protocols Synopsis: Protocol-level abstract descriptions of restarts and their invocation. Author: Paul Howard (Not the owner of this library!) Copyright: Original Code is Copyright (c) 1995-2004 Functional Objects, Inc. All rights reserved. License: See License.txt in this distribution for details. Warranty: Distributed WITHOUT WARRANTY OF ANY KIND ///// <RESTART-OBJECT> // An application-only object. // Provides an abstract handle on a restart that can be signalled on a // thread. Via this handle, a printable description of the restart can // be obtained, and the restart itself can be signalled on the thread // prepared to handle it. define sealed class <restart-object> (<application-object>) end class; // Exported operations on <restart-object> define open generic application-thread-restarts (server :: <server>, thread :: <thread-object>) => (sequence-of-restart-objects :: <sequence>); define open generic application-restart-message (server :: <server>, rst :: <restart-object>) => (printable-string :: <string>); define open generic application-restart-abort? (server :: <server>, rst :: <restart-object>) => (is-abort? :: <boolean>); define open generic invoke-application-restart (server :: <server>, thread :: <thread-object>, rst :: <restart-object>) => (); /// /// Methods at the project level. /// (These just dispatch to the application server, which implements them) /// define method application-thread-restarts (project :: <project-object>, thread :: <thread-object>) => (sequence-of-restart-objects :: <sequence>) let server = choose-server(project, thread, error?: #t); application-thread-restarts(server, thread) end method; define method application-restart-message (project :: <project-object>, rst :: <restart-object>) => (printable-string :: <string>) let server = choose-server(project, rst, error?: #t); application-restart-message(server, rst) end method; define method application-restart-abort? (project :: <project-object>, rst :: <restart-object>) => (is-abort? :: <boolean>) let server = choose-server(project, rst, error?: #t); application-restart-abort?(server, rst) end method; define method invoke-application-restart (project :: <project-object>, thread :: <thread-object>, rst :: <restart-object>) => () let server = choose-server(project, rst, error?: #t); invoke-application-restart(server, thread, rst) end method; define method environment-object-type-name (object :: <restart-object>) => (name :: <string>) "Restart" end method environment-object-type-name;
Dylan
5
kryptine/opendylan
sources/environment/protocols/restart-objects.dylan
[ "BSD-2-Clause" ]
#region DEFINES STATIC DEFINE VIEWERDLG_BTNOK := 101 STATIC DEFINE VIEWERDLG_INFO := 100 STATIC DEFINE VIEWERDLG_SIZER := 102 #endregion CLASS MailIDsDialog INHERIT ViewerDlg METHOD PostInit(oParent,uExtra) SUPER:PostInit() SELF:Size := Dimension{250,300} SELF:Caption := "Mail IDs" SELF:TextValue := uExtra RETURN SELF END CLASS CLASS MessageSourceDialog INHERIT ViewerDlg METHOD PostInit(oParent,uExtra) SUPER:PostInit() SELF:Size := Dimension{500, 300} SELF:Caption := "Message Source" SELF:TextLimit := 1000000L SELF:TextValue := uExtra RETURN SELF END CLASS class ViewerDlg inherit DIALOGWINDOW protect oDCInfo as MULTILINEEDIT protect oCCBtnOK as PUSHBUTTON protect oDCSizer as VERTICALSCROLLBAR //{{%UC%}} USER CODE STARTS HERE (do NOT remove this line) METHOD BtnOK( ) SELF:EndDialog(IDOK) RETURN SELF CONSTRUCTOR(oParent,uExtra) local dim aFonts[1] AS OBJECT self:PreInit(oParent,uExtra) SUPER(oParent,ResourceID{"ViewerDlg",_GetInst()},TRUE) aFonts[1] := Font{,8,"Courier New"} oDCInfo := MultiLineEdit{self,ResourceID{VIEWERDLG_INFO,_GetInst()}} oDCInfo:HyperLabel := HyperLabel{#Info,NULL_STRING,NULL_STRING,NULL_STRING} oDCInfo:OwnerAlignment := OA_WIDTH_HEIGHT oDCInfo:Font(aFonts[1], FALSE) oCCBtnOK := PushButton{self,ResourceID{VIEWERDLG_BTNOK,_GetInst()}} oCCBtnOK:HyperLabel := HyperLabel{#BtnOK,"OK",NULL_STRING,NULL_STRING} oCCBtnOK:OwnerAlignment := OA_X_Y oDCSizer := VerticalScrollBar{self,ResourceID{VIEWERDLG_SIZER,_GetInst()}} oDCSizer:HyperLabel := HyperLabel{#Sizer,NULL_STRING,NULL_STRING,NULL_STRING} oDCSizer:OwnerAlignment := OA_X_Y self:Caption := "" self:HyperLabel := HyperLabel{#ViewerDlg,NULL_STRING,NULL_STRING,NULL_STRING} self:PostInit(oParent,uExtra) return self METHOD PostInit(oParent,uExtra) //Put your PostInit additions here SELF:Icon := Aap_Email_Icon{} oDCSizer:SetStyle(SBS_SIZEGRIP, TRUE) RETURN NIL ASSIGN TextLimit(nBytes) LOCAL liCount as DWORD IF IsNumeric(nBytes) .and. nBytes > 0 liCount := nBytes SendMessage(oDCInfo:Handle(), EM_LIMITTEXT, liCount, 0L) ENDIF RETURN nBytes ASSIGN TextValue(cValue) RETURN oDCInfo:TextValue := cValue END CLASS
xBase
4
JohanNel/XSharpPublic
Samples/VOExporterExamples/Before/Email/WINDOW Viewer.prg
[ "Apache-2.0" ]
struct LLVM::ParameterCollection include Indexable(LLVM::Value) def initialize(@function : Function) end def size @function.function_type.params_size end def to_a param_size = size() Array(LLVM::Value).build(param_size) do |buffer| LibLLVM.get_params(@function, buffer.as(LibLLVM::ValueRef*)) param_size end end def unsafe_fetch(index : Int) Value.new LibLLVM.get_param(@function, index) end def types @function.function_type.params_types end end
Crystal
4
jessedoyle/crystal
src/llvm/parameter_collection.cr
[ "Apache-2.0" ]
(module (type $none_=>_none (func)) (memory $0 1) (data (i32.const 1036) ",") (data (i32.const 1048) "\01\00\00\00\1a\00\00\00r\00e\00t\00a\00i\00n\00-\00i\003\002\00.\00t\00s") (export "memory" (memory $0)) (start $~start) (func $~start (local $0 i32) i32.const -128 local.set $0 loop $for-loop|0 local.get $0 i32.const 255 i32.le_s if local.get $0 i32.const 1 i32.add local.set $0 br $for-loop|0 end end i32.const 0 i32.load8_s drop ) )
WebAssembly
3
romdotdog/assemblyscript
tests/compiler/retain-i32.optimized.wat
[ "Apache-2.0" ]
extends ImageEffect onready var type_option_button : OptionButton = $VBoxContainer/HBoxContainer2/TypeOptionButton onready var angle_hslider : HSlider = $VBoxContainer/AngleOptions/AngleHSlider onready var angle_spinbox : SpinBox = $VBoxContainer/AngleOptions/AngleSpinBox onready var wait_apply_timer = $WaitApply onready var wait_time_spinbox = $VBoxContainer/WaitSettings/WaitTime var live_preview :bool = true func _ready() -> void: type_option_button.add_item("Rotxel") type_option_button.add_item("Upscale, Rotate and Downscale") type_option_button.add_item("Nearest neighbour") func set_nodes() -> void: preview = $VBoxContainer/AspectRatioContainer/Preview selection_checkbox = $VBoxContainer/OptionsContainer/SelectionCheckBox affect_option_button = $VBoxContainer/OptionsContainer/AffectOptionButton func _about_to_show() -> void: ._about_to_show() wait_apply_timer.wait_time = wait_time_spinbox.value/1000.0 angle_hslider.value = 0 func commit_action(_cel : Image, _project : Project = Global.current_project) -> void: var angle : float = deg2rad(angle_hslider.value) # warning-ignore:integer_division # warning-ignore:integer_division var pivot = Vector2(_cel.get_width() / 2, _cel.get_height() / 2) var image := Image.new() image.copy_from(_cel) if _project.has_selection and selection_checkbox.pressed: var selection_rectangle : Rect2 = _project.get_selection_rectangle() pivot = selection_rectangle.position + ((selection_rectangle.end - selection_rectangle.position) / 2) image.lock() _cel.lock() for x in _project.size.x: for y in _project.size.y: var pos := Vector2(x, y) if !_project.can_pixel_get_drawn(pos): image.set_pixelv(pos, Color(0, 0, 0, 0)) else: _cel.set_pixelv(pos, Color(0, 0, 0, 0)) image.unlock() _cel.unlock() match type_option_button.text: "Rotxel": DrawingAlgos.rotxel(image, angle, pivot) "Nearest neighbour": DrawingAlgos.nn_rotate(image, angle, pivot) "Upscale, Rotate and Downscale": DrawingAlgos.fake_rotsprite(image, angle, pivot) if _project.has_selection and selection_checkbox.pressed: _cel.blend_rect(image, Rect2(Vector2.ZERO, image.get_size()), Vector2.ZERO) else: _cel.blit_rect(image, Rect2(Vector2.ZERO, image.get_size()), Vector2.ZERO) func _confirmed() -> void: ._confirmed() angle_hslider.value = 0 func _on_HSlider_value_changed(_value : float) -> void: angle_spinbox.value = angle_hslider.value if live_preview: update_preview() else: wait_apply_timer.start() func _on_SpinBox_value_changed(_value : float) -> void: angle_hslider.value = angle_spinbox.value func _on_TypeOptionButton_item_selected(_id : int) -> void: update_preview() func _on_WaitApply_timeout() -> void: update_preview() func _on_WaitTime_value_changed(value: float) -> void: wait_apply_timer.wait_time = value/1000.0 func _on_LiveCheckbox_toggled(button_pressed: bool) -> void: live_preview = button_pressed wait_time_spinbox.editable = !live_preview wait_time_spinbox.get_parent().visible = !live_preview
GDScript
4
alicerunsonfedora/Pixelorama
src/UI/Dialogs/ImageEffects/RotateImage.gd
[ "MIT" ]
// test-ping-userlevel.click // This configuration tests the FromDevice and ToDevice elements by sending // pings to host 8.8.8.8 (Google Public DNS) via 'eth0'. Change the // 'define' statement to use another device or address, or run e.g. "click // test-ping.click DEV=eth1" to change a parameter at the command line. // You will need to run the configuration as root. You may also need to update // the gateway address used for the ping packets (by default $DEV:gw). // // FromDevice's "SNIFFER false" option tells Click to install kernel // firewall rules that prevent the host kernel from processing received // packets. Thus, all other network traffic on $DEV will be ignored until // the configuration stops. This will only work on a host that supports // iptables. // // You should see, printed to standard error, a sequence of "icmp echo" // printouts intermixed with "ping :: ICMPPingSource" receive reports. define($DEV eth0, $DADDR 8.8.8.8, $GW $DEV:gw, $METHOD PCAP, $LIMIT -1, $INTERVAL 1) FromDevice($DEV, SNIFFER false, METHOD $METHOD) -> c :: Classifier(12/0800, 12/0806 20/0002) -> CheckIPHeader(14) -> ip :: IPClassifier(icmp echo-reply) -> ping :: ICMPPingSource($DEV, $DADDR, INTERVAL $INTERVAL, LIMIT $LIMIT, STOP true) -> SetIPAddress($GW) -> arpq :: ARPQuerier($DEV) -> IPPrint -> q :: Queue -> ToDevice($DEV); arpq[1] -> q; c[1] -> [1] arpq;
Click
5
MacWR/Click-changed-for-ParaGraph
conf/test-ping-userlevel.click
[ "Apache-2.0" ]
#!/bin/bash Uhost="localhost" Udata="cms_db"$RANDOM Uname="cms_u"$RANDOM Upawd="cms_p"$RANDOM Uinitpj="no" Uinitdb="no" Uinitht="no" while getopts "h:n:u:p:edi" opt do case $opt in h) Uhost=$OPTARG;; n) Udata=$OPTARG;; u) Uname=$OPTARG;; p) Upawd=$OPTARG;; e) Uinitpj="yes";; d) Uinitdb="yes";; i) Uinitht="yes";; ?) echo "unkonw option" grep 'version' module/libs/config.php exit 1 ;; esac done Urepstr="s/localost/$Uhost/g;s/cms_db/$Udata/g;s/cms_user/$Uname/g;s/cms_pawd/$Upawd/g" function getdir(){ for element in `ls $1` do dir_or_file=$1"/"$element if [ -d $dir_or_file ] ; then create_file=${dir_or_file}"/"${my_file} if [ ! -f "$create_file" ] ; then touch "$create_file" echo "$create_file" fi getdir $dir_or_file fi done } # need root to run this script function needroot() { if [ ! `whoami` = "root" ] ; then echo "Running the file must be root user" exit; fi } if [ ! $1 ]; then cat << EOF ================================================================ Options -e, initialling the project environment. -d, initialling the database. -h, hostname -n, database -u, username -p, password -i, increarsing the index.html file for each directory. -v, check the version of current release. For example if you want to initial the project. # sh .myt -ed EOF fi # create the index.html for each dir if [ $Uinitht = "yes" ] ; then echo "initialing index page for each directory." my_path=$(cd `dirname $0`; pwd) my_file="index.html" getdir $my_path fi # initial database if [ $Uinitdb = "yes" ] ; then needroot echo "initialing database with -h$Uhost, -n$Udata, -u$Uname, -p$Upawd." sed $Urepstr "module/libs/initdb.sql" > "others/initdb.sql" mysql -h localhost -u root < "others/initdb.sql" rm -f "others/initdb.sql" fi # initial running environment of server if [ $Uinitpj = "yes" ] ; then needroot echo "initialing project environment." my_file="/usr/sbin/httpd" if [ ! -f "$my_file" ] ; then yum -y install httpd service httpd start chkconfig httpd on fi my_file="/usr/bin/mysql" if [ ! -f "$my_file" ] ; then yum -y install mysql mysql-server # yum -y install mysql mysql-server mysql-devel service mysqld start chkconfig mysqld on fi my_file="/usr/bin/php" if [ ! -f "$my_file" ] ; then yum -y install php php-mysql fi # install the php-mbstring my_file="/etc/php.d/mbstring.ini" if [ ! -f "$my_file" ] ; then yum -y install php-mbstring fi # install the php-gd my_file="/etc/php.d/gd.ini" if [ ! -f "$my_file" ] ; then yum -y install php-gd fi my_file="/etc/php.d/custom.ini" if [ ! -f "$my_file" ] ; then echo 'short_open_tag=On' > $my_file echo 'upload_max_filesize=3M' >> $my_file echo "${my_file} is created" fi # copy the cfg.php my_file="others/cfg.php" if [ ! -f "$my_file" ] ; then sed $Urepstr "module/libs/cfg.php" > $my_file chmod 777 $my_file echo "file ${my_file} is created" fi # create upload dir my_dir="others/upload" if [ ! -d "$my_dir" ] ; then mkdir $my_dir chmod -R 777 $my_dir echo "dir ${my_dir} is created" fi # create logo file my_file="others/upload/logo.jpg" if [ ! -f "$my_file" ] ; then touch $my_file echo "${my_file} is created" fi echo "Notice: you need to restart those servers if this is first time to install, such as '/etc/init.d/httpd restart'..." fi
Myghty
4
simrb/cms2
.myt
[ "MIT" ]
# just an example of transpilation w/ sourcemap - # `test.coffee` is not directly transpiled/executed by any test code # regenerate JS + sourcemap with `coffee -c -m test.coffee` setTimeout -> window foo = "#{window.top.foo}" , 1000
CoffeeScript
4
mm73628486283/cypress
packages/rewriter/test/fixtures/test.coffee
[ "MIT" ]
// This previously triggered an ICE. pub(in crate::r#mod) fn main() {} //~^ ERROR failed to resolve: maybe a missing crate `r#mod`
Rust
1
Eric-Arellano/rust
src/test/rustdoc-ui/issue-61732.rs
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
/* Old-style comment. */ // New-style comment. typedef float foo_t; #ifndef ZERO #define ZERO (0.0) #endif #define FOO(x) ((x) + \ ZERO) __kernel void foo(__global const foo_t * x, __local foo_t y, const uint n) { barrier(CLK_LOCAL_MEM_FENCE); if (n > 42) { *x += y; } }
OpenCL
4
JavascriptID/sourcerer-app
src/test/resources/samples/langs/OpenCL/sample.cl
[ "MIT" ]
@0x9bbc59b4f632f2e3; struct Bar {}
Cap'n Proto
1
bbqsrc/capnproto-rust
capnpc/test/schema-with-src-prefix/test-in-src-prefix-dir.capnp
[ "MIT" ]
/*M/////////////////////////////////////////////////////////////////////////////////////// // // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, // copy or use the software. // // // License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved. // Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // @Authors // Dachuan Zhao, [email protected] // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // * Redistribution's of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors as is and // any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation 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. // //M*/ #ifdef DOUBLE_SUPPORT #ifdef cl_amd_fp64 #pragma OPENCL EXTENSION cl_amd_fp64:enable #elif defined (cl_khr_fp64) #pragma OPENCL EXTENSION cl_khr_fp64:enable #endif #endif #if defined BORDER_REPLICATE // aaaaaa|abcdefgh|hhhhhhh #define EXTRAPOLATE(x, maxV) clamp((x), 0, (maxV)-1) #elif defined BORDER_WRAP // cdefgh|abcdefgh|abcdefg #define EXTRAPOLATE(x, maxV) ( (x) + (maxV) ) % (maxV) #elif defined BORDER_REFLECT // fedcba|abcdefgh|hgfedcb #define EXTRAPOLATE(x, maxV) clamp(min(((maxV)-1)*2-(x)+1, max((x),-(x)-1) ), 0, (maxV)-1) #elif defined BORDER_REFLECT_101 || defined BORDER_REFLECT101 // gfedcb|abcdefgh|gfedcba #define EXTRAPOLATE(x, maxV) clamp(min(((maxV)-1)*2-(x), max((x),-(x)) ), 0, (maxV)-1) #else #error No extrapolation method #endif #if cn != 3 #define loadpix(addr) *(__global const T*)(addr) #define storepix(val, addr) *(__global T*)(addr) = (val) #define PIXSIZE ((int)sizeof(T)) #else #define loadpix(addr) vload3(0, (__global const T1*)(addr)) #define storepix(val, addr) vstore3((val), 0, (__global T1*)(addr)) #define PIXSIZE ((int)sizeof(T1)*3) #endif #define SRC(_x,_y) convertToFT(loadpix(srcData + mad24(_y, src_step, PIXSIZE * _x))) #if kercn == 4 #define SRC4(_x,_y) convert_float4(vload4(0, srcData + mad24(_y, src_step, PIXSIZE * _x))) #endif #ifdef INTEL_DEVICE #define MAD(x,y,z) fma((x),(y),(z)) #else #define MAD(x,y,z) mad((x),(y),(z)) #endif #define LOAD_LOCAL(col_gl, col_lcl) \ sum0 = co3* SRC(col_gl, EXTRAPOLATE_(src_y - 2, src_rows)); \ sum0 = MAD(co2, SRC(col_gl, EXTRAPOLATE_(src_y - 1, src_rows)), sum0); \ temp = SRC(col_gl, EXTRAPOLATE_(src_y, src_rows)); \ sum0 = MAD(co1, temp, sum0); \ sum1 = co3 * temp; \ temp = SRC(col_gl, EXTRAPOLATE_(src_y + 1, src_rows)); \ sum0 = MAD(co2, temp, sum0); \ sum1 = MAD(co2, temp, sum1); \ temp = SRC(col_gl, EXTRAPOLATE_(src_y + 2, src_rows)); \ sum0 = MAD(co3, temp, sum0); \ sum1 = MAD(co1, temp, sum1); \ smem[0][col_lcl] = sum0; \ sum1 = MAD(co2, SRC(col_gl, EXTRAPOLATE_(src_y + 3, src_rows)), sum1); \ sum1 = MAD(co3, SRC(col_gl, EXTRAPOLATE_(src_y + 4, src_rows)), sum1); \ smem[1][col_lcl] = sum1; #if kercn == 4 #define LOAD_LOCAL4(col_gl, col_lcl) \ sum40 = co3* SRC4(col_gl, EXTRAPOLATE_(src_y - 2, src_rows)); \ sum40 = MAD(co2, SRC4(col_gl, EXTRAPOLATE_(src_y - 1, src_rows)), sum40); \ temp4 = SRC4(col_gl, EXTRAPOLATE_(src_y, src_rows)); \ sum40 = MAD(co1, temp4, sum40); \ sum41 = co3 * temp4; \ temp4 = SRC4(col_gl, EXTRAPOLATE_(src_y + 1, src_rows)); \ sum40 = MAD(co2, temp4, sum40); \ sum41 = MAD(co2, temp4, sum41); \ temp4 = SRC4(col_gl, EXTRAPOLATE_(src_y + 2, src_rows)); \ sum40 = MAD(co3, temp4, sum40); \ sum41 = MAD(co1, temp4, sum41); \ vstore4(sum40, col_lcl, (__local float*) &smem[0][2]); \ sum41 = MAD(co2, SRC4(col_gl, EXTRAPOLATE_(src_y + 3, src_rows)), sum41); \ sum41 = MAD(co3, SRC4(col_gl, EXTRAPOLATE_(src_y + 4, src_rows)), sum41); \ vstore4(sum41, col_lcl, (__local float*) &smem[1][2]); #endif #define noconvert __kernel void pyrDown(__global const uchar * src, int src_step, int src_offset, int src_rows, int src_cols, __global uchar * dst, int dst_step, int dst_offset, int dst_rows, int dst_cols) { const int x = get_global_id(0)*kercn; const int y = 2*get_global_id(1); __local FT smem[2][LOCAL_SIZE + 4]; __global uchar * dstData = dst + dst_offset; __global const uchar * srcData = src + src_offset; FT sum0, sum1, temp; FT co1 = 0.375f; FT co2 = 0.25f; FT co3 = 0.0625f; const int src_y = 2*y; int col; if (src_y >= 2 && src_y < src_rows - 4) { #undef EXTRAPOLATE_ #define EXTRAPOLATE_(val, maxVal) val #if kercn == 1 col = EXTRAPOLATE(x, src_cols); LOAD_LOCAL(col, 2 + get_local_id(0)) #else if (x < src_cols-4) { float4 sum40, sum41, temp4; LOAD_LOCAL4(x, get_local_id(0)) } else { for (int i=0; i<4; i++) { col = EXTRAPOLATE(x+i, src_cols); LOAD_LOCAL(col, 2 + 4 * get_local_id(0) + i) } } #endif if (get_local_id(0) < 2) { col = EXTRAPOLATE((int)(get_group_id(0)*LOCAL_SIZE + get_local_id(0) - 2), src_cols); LOAD_LOCAL(col, get_local_id(0)) } else if (get_local_id(0) < 4) { col = EXTRAPOLATE((int)((get_group_id(0)+1)*LOCAL_SIZE + get_local_id(0) - 2), src_cols); LOAD_LOCAL(col, LOCAL_SIZE + get_local_id(0)) } } else // need extrapolate y { #undef EXTRAPOLATE_ #define EXTRAPOLATE_(val, maxVal) EXTRAPOLATE(val, maxVal) #if kercn == 1 col = EXTRAPOLATE(x, src_cols); LOAD_LOCAL(col, 2 + get_local_id(0)) #else if (x < src_cols-4) { float4 sum40, sum41, temp4; LOAD_LOCAL4(x, get_local_id(0)) } else { for (int i=0; i<4; i++) { col = EXTRAPOLATE(x+i, src_cols); LOAD_LOCAL(col, 2 + 4*get_local_id(0) + i) } } #endif if (get_local_id(0) < 2) { col = EXTRAPOLATE((int)(get_group_id(0)*LOCAL_SIZE + get_local_id(0) - 2), src_cols); LOAD_LOCAL(col, get_local_id(0)) } else if (get_local_id(0) < 4) { col = EXTRAPOLATE((int)((get_group_id(0)+1)*LOCAL_SIZE + get_local_id(0) - 2), src_cols); LOAD_LOCAL(col, LOCAL_SIZE + get_local_id(0)) } } barrier(CLK_LOCAL_MEM_FENCE); #if kercn == 1 if (get_local_id(0) < LOCAL_SIZE / 2) { const int tid2 = get_local_id(0) * 2; const int dst_x = (get_group_id(0) * get_local_size(0) + tid2) / 2; if (dst_x < dst_cols) { for (int yin = y, y1 = min(dst_rows, y + 2); yin < y1; yin++) { #if cn == 1 #if fdepth <= 5 FT sum = dot(vload4(0, (__local float*) (&smem) + tid2 + (yin - y) * (LOCAL_SIZE + 4)), (float4)(co3, co2, co1, co2)); #else FT sum = dot(vload4(0, (__local double*) (&smem) + tid2 + (yin - y) * (LOCAL_SIZE + 4)), (double4)(co3, co2, co1, co2)); #endif #else FT sum = co3 * smem[yin - y][2 + tid2 - 2]; sum = MAD(co2, smem[yin - y][2 + tid2 - 1], sum); sum = MAD(co1, smem[yin - y][2 + tid2 ], sum); sum = MAD(co2, smem[yin - y][2 + tid2 + 1], sum); #endif sum = MAD(co3, smem[yin - y][2 + tid2 + 2], sum); storepix(convertToT(sum), dstData + yin * dst_step + dst_x * PIXSIZE); } } } #else int tid4 = get_local_id(0) * 4; int dst_x = (get_group_id(0) * LOCAL_SIZE + tid4) / 2; if (dst_x < dst_cols - 1) { for (int yin = y, y1 = min(dst_rows, y + 2); yin < y1; yin++) { FT sum = co3* smem[yin - y][2 + tid4 + 2]; sum = MAD(co3, smem[yin - y][2 + tid4 - 2], sum); sum = MAD(co2, smem[yin - y][2 + tid4 - 1], sum); sum = MAD(co1, smem[yin - y][2 + tid4 ], sum); sum = MAD(co2, smem[yin - y][2 + tid4 + 1], sum); storepix(convertToT(sum), dstData + mad24(yin, dst_step, dst_x * PIXSIZE)); dst_x ++; sum = co3* smem[yin - y][2 + tid4 + 4]; sum = MAD(co3, smem[yin - y][2 + tid4 ], sum); sum = MAD(co2, smem[yin - y][2 + tid4 + 1], sum); sum = MAD(co1, smem[yin - y][2 + tid4 + 2], sum); sum = MAD(co2, smem[yin - y][2 + tid4 + 3], sum); storepix(convertToT(sum), dstData + mad24(yin, dst_step, dst_x * PIXSIZE)); dst_x --; } } else if (dst_x < dst_cols) { for (int yin = y, y1 = min(dst_rows, y + 2); yin < y1; yin++) { FT sum = co3* smem[yin - y][2 + tid4 + 2]; sum = MAD(co3, smem[yin - y][2 + tid4 - 2], sum); sum = MAD(co2, smem[yin - y][2 + tid4 - 1], sum); sum = MAD(co1, smem[yin - y][2 + tid4 ], sum); sum = MAD(co2, smem[yin - y][2 + tid4 + 1], sum); storepix(convertToT(sum), dstData + mad24(yin, dst_step, dst_x * PIXSIZE)); } } #endif }
OpenCL
5
thisisgopalmandal/opencv
modules/imgproc/src/opencl/pyr_down.cl
[ "BSD-3-Clause" ]
<!-- Copyright 2010 WebDriver committers Copyright 2010 Google Inc. 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. --> <?xml version="1.0"?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>locator_test.html</title> <script src="test_bootstrap.js"></script> <script type="text/javascript"> goog.require('bot'); goog.require('bot.ErrorCode'); goog.require('bot.locators'); goog.require('webdriver.ie'); goog.require('goog.testing.jsunit'); </script> <script type="text/javascript"> function testFindingElementsWithInvalidClassNameThrows() { try { webdriver.ie.findElements("className", "!@#$%^&*"); fail('Should not have succeeded because the class contained ' + 'invalid characters'); } catch (ex) { // We expect an exception because class name contained an // invalid character. assertEquals(bot.ErrorCode.INVALID_SELECTOR_ERROR, ex.code); } } </script> </head> <body> <p id="x" name="para">Para</p> <div name="after" id="wrong" class="feline cats">nope</div> <div name="right" id="after" class="dogs">yup</div> <div name="lion" class="cats">simba</div> <div name="tiger" class="cats">shere khan</div> <div id="dotted_1" class="name.with.dots">dotted class</div> <div id="dotted_2" class="name.with.dots">another dotted class</div> <form action="#"> <input name="after" /><br /> <input name="foo" /> </form> <!-- This comment should be ignored --> <span name="foo">Furrfu</span> <ul> <li id="illegal">item <li id="illegal">item <li id="illegal">item <li id="illegal">item </ul> <a id="link" href="#">this is a link</a> <a name="fishsticks">this is a link</a> <a href="#">this is a link</a> <a href="#">this is a link</a> <a href="#">this is a link</a> <a href="#">unrelated</a> <a href="#" id="empty-link"></a> <a href="#" id="comma-in-alt" alt="has, a comma">has, a comma</a> </body> </html>
HTML
4
weilandia/selenium
javascript/ie-driver/test/locator_test.html
[ "Apache-2.0" ]
<foo>
Latte
0
timfel/netbeans
php/php.latte/test/unit/data/testfiles/lexer/top/ws-not-error.latte
[ "Apache-2.0" ]
user@host:~/path$ ls -a . .. a b c user@host:~/path$ diff -u a b --- a 2008-07-26 17:10:07.000000000 -0700 +++ b 2008-07-26 17:10:10.000000000 -0700 @@ -1,3 +1,3 @@ a -b +x c user@host:~/path$ echo \ > a a user@host:~/path$ su root@host:~# sh-3.1$ # on hardy sh$ # on etch (virtualenv-name)user@host:~$ ls -a
ShellSession
3
drnic/gitlabhq
vendor/cache/pygments.rb-2cada028da50/vendor/pygments-main/tests/examplefiles/example.sh-session
[ "MIT" ]
// This file is part of OpenCV project. // It is subject to the license terms in the LICENSE file found in the top-level directory // of this distribution and at http://opencv.org/license.html. // Copyright (C) 2014, Itseez, Inc., all rights reserved. // Third party copyrights are property of their respective owners. #define ACCUM(ptr) *((__global int*)(ptr)) #ifdef MAKE_POINTS_LIST __kernel void make_point_list(__global const uchar * src_ptr, int src_step, int src_offset, int src_rows, int src_cols, __global uchar * list_ptr, int list_step, int list_offset, __global int* global_offset) { int x = get_local_id(0); int y = get_group_id(1); __local int l_index, l_offset; __local int l_points[LOCAL_SIZE]; __global const uchar * src = src_ptr + mad24(y, src_step, src_offset); __global int * list = (__global int*)(list_ptr + list_offset); if (x == 0) l_index = 0; barrier(CLK_LOCAL_MEM_FENCE); if (y < src_rows) { y <<= 16; for (int i=x; i < src_cols; i+=GROUP_SIZE) { if (src[i]) { int val = y | i; int index = atomic_inc(&l_index); l_points[index] = val; } } } barrier(CLK_LOCAL_MEM_FENCE); if (x == 0) l_offset = atomic_add(global_offset, l_index); barrier(CLK_LOCAL_MEM_FENCE); list += l_offset; for (int i=x; i < l_index; i+=GROUP_SIZE) { list[i] = l_points[i]; } } #elif defined FILL_ACCUM_GLOBAL __kernel void fill_accum_global(__global const uchar * list_ptr, int list_step, int list_offset, __global uchar * accum_ptr, int accum_step, int accum_offset, int total_points, float irho, float theta, int numrho, int numangle) { int theta_idx = get_global_id(1); int count_idx = get_global_id(0); int glob_size = get_global_size(0); float cosVal; float sinVal = sincos(theta * ((float)theta_idx), &cosVal); sinVal *= irho; cosVal *= irho; __global const int * list = (__global const int*)(list_ptr + list_offset); __global int* accum = (__global int*)(accum_ptr + mad24(theta_idx + 1, accum_step, accum_offset)); const int shift = (numrho - 1) / 2; if (theta_idx < numangle) { for (int i = count_idx; i < total_points; i += glob_size) { const int val = list[i]; const int x = (val & 0xFFFF); const int y = (val >> 16) & 0xFFFF; int r = convert_int_rte(mad((float)x, cosVal, y * sinVal)) + shift; atomic_inc(accum + r + 1); } } } #elif defined FILL_ACCUM_LOCAL __kernel void fill_accum_local(__global const uchar * list_ptr, int list_step, int list_offset, __global uchar * accum_ptr, int accum_step, int accum_offset, int total_points, float irho, float theta, int numrho, int numangle) { int theta_idx = get_group_id(1); int count_idx = get_local_id(0); __local int l_accum[BUFFER_SIZE]; if (theta_idx > 0 && theta_idx < numangle + 1) { float cosVal; float sinVal = sincos(theta * (float) (theta_idx-1), &cosVal); sinVal *= irho; cosVal *= irho; for (int i=count_idx; i<BUFFER_SIZE; i+=LOCAL_SIZE) l_accum[i] = 0; barrier(CLK_LOCAL_MEM_FENCE); __global const int * list = (__global const int*)(list_ptr + list_offset); const int shift = (numrho - 1) / 2; for (int i = count_idx; i < total_points; i += LOCAL_SIZE) { const int point = list[i]; const int x = (point & 0xFFFF); const int y = point >> 16; int r = convert_int_rte(mad((float)x, cosVal, y * sinVal)) + shift; atomic_inc(l_accum + r + 1); } barrier(CLK_LOCAL_MEM_FENCE); __global int* accum = (__global int*)(accum_ptr + mad24(theta_idx, accum_step, accum_offset)); for (int i=count_idx; i<BUFFER_SIZE; i+=LOCAL_SIZE) accum[i] = l_accum[i]; } else if (theta_idx < numangle + 2) { __global int* accum = (__global int*)(accum_ptr + mad24(theta_idx, accum_step, accum_offset)); for (int i=count_idx; i<BUFFER_SIZE; i+=LOCAL_SIZE) accum[i] = 0; } } #elif defined GET_LINES __kernel void get_lines(__global uchar * accum_ptr, int accum_step, int accum_offset, int accum_rows, int accum_cols, __global uchar * lines_ptr, int lines_step, int lines_offset, __global int* lines_index_ptr, int linesMax, int threshold, float rho, float theta) { int x0 = get_global_id(0); int y = get_global_id(1); int glob_size = get_global_size(0); if (y < accum_rows-2) { __global uchar* accum = accum_ptr + mad24(y+1, accum_step, mad24(x0+1, (int) sizeof(int), accum_offset)); __global float2* lines = (__global float2*)(lines_ptr + lines_offset); __global int* lines_index = lines_index_ptr + 1; for (int x=x0; x<accum_cols-2; x+=glob_size) { int curVote = ACCUM(accum); if (curVote > threshold && curVote > ACCUM(accum - sizeof(int)) && curVote >= ACCUM(accum + sizeof(int)) && curVote > ACCUM(accum - accum_step) && curVote >= ACCUM(accum + accum_step)) { int index = atomic_inc(lines_index); if (index < linesMax) { float radius = (x - (accum_cols - 3) * 0.5f) * rho; float angle = y * theta; lines[index] = (float2)(radius, angle); } } accum += glob_size * (int) sizeof(int); } } } #elif GET_LINES_PROBABOLISTIC __kernel void get_lines(__global const uchar * accum_ptr, int accum_step, int accum_offset, int accum_rows, int accum_cols, __global const uchar * src_ptr, int src_step, int src_offset, int src_rows, int src_cols, __global uchar * lines_ptr, int lines_step, int lines_offset, __global int* lines_index_ptr, int linesMax, int threshold, int lineLength, int lineGap, float rho, float theta) { int x = get_global_id(0); int y = get_global_id(1); if (y < accum_rows-2) { __global const uchar* accum = accum_ptr + mad24(y+1, accum_step, mad24(x+1, (int) sizeof(int), accum_offset)); __global int4* lines = (__global int4*)(lines_ptr + lines_offset); __global int* lines_index = lines_index_ptr + 1; int curVote = ACCUM(accum); if (curVote >= threshold && curVote > ACCUM(accum - accum_step - sizeof(int)) && curVote > ACCUM(accum - accum_step) && curVote > ACCUM(accum - accum_step + sizeof(int)) && curVote > ACCUM(accum - sizeof(int)) && curVote > ACCUM(accum + sizeof(int)) && curVote > ACCUM(accum + accum_step - sizeof(int)) && curVote > ACCUM(accum + accum_step) && curVote > ACCUM(accum + accum_step + sizeof(int))) { const float radius = (x - (accum_cols - 2 - 1) * 0.5f) * rho; const float angle = y * theta; float cosa; float sina = sincos(angle, &cosa); float2 p0 = (float2)(cosa * radius, sina * radius); float2 dir = (float2)(-sina, cosa); float2 pb[4] = { (float2)(-1, -1), (float2)(-1, -1), (float2)(-1, -1), (float2)(-1, -1) }; float a; if (dir.x != 0) { a = -p0.x / dir.x; pb[0].x = 0; pb[0].y = p0.y + a * dir.y; a = (src_cols - 1 - p0.x) / dir.x; pb[1].x = src_cols - 1; pb[1].y = p0.y + a * dir.y; } if (dir.y != 0) { a = -p0.y / dir.y; pb[2].x = p0.x + a * dir.x; pb[2].y = 0; a = (src_rows - 1 - p0.y) / dir.y; pb[3].x = p0.x + a * dir.x; pb[3].y = src_rows - 1; } if (pb[0].x == 0 && (pb[0].y >= 0 && pb[0].y < src_rows)) { p0 = pb[0]; if (dir.x < 0) dir = -dir; } else if (pb[1].x == src_cols - 1 && (pb[1].y >= 0 && pb[1].y < src_rows)) { p0 = pb[1]; if (dir.x > 0) dir = -dir; } else if (pb[2].y == 0 && (pb[2].x >= 0 && pb[2].x < src_cols)) { p0 = pb[2]; if (dir.y < 0) dir = -dir; } else if (pb[3].y == src_rows - 1 && (pb[3].x >= 0 && pb[3].x < src_cols)) { p0 = pb[3]; if (dir.y > 0) dir = -dir; } dir /= max(fabs(dir.x), fabs(dir.y)); float2 line_end[2]; int gap; bool inLine = false; if (p0.x < 0 || p0.x >= src_cols || p0.y < 0 || p0.y >= src_rows) return; for (;;) { if (*(src_ptr + mad24(p0.y, src_step, p0.x + src_offset))) { gap = 0; if (!inLine) { line_end[0] = p0; line_end[1] = p0; inLine = true; } else { line_end[1] = p0; } } else if (inLine) { if (++gap > lineGap) { bool good_line = fabs(line_end[1].x - line_end[0].x) >= lineLength || fabs(line_end[1].y - line_end[0].y) >= lineLength; if (good_line) { int index = atomic_inc(lines_index); if (index < linesMax) lines[index] = (int4)(line_end[0].x, line_end[0].y, line_end[1].x, line_end[1].y); } gap = 0; inLine = false; } } p0 = p0 + dir; if (p0.x < 0 || p0.x >= src_cols || p0.y < 0 || p0.y >= src_rows) { if (inLine) { bool good_line = fabs(line_end[1].x - line_end[0].x) >= lineLength || fabs(line_end[1].y - line_end[0].y) >= lineLength; if (good_line) { int index = atomic_inc(lines_index); if (index < linesMax) lines[index] = (int4)(line_end[0].x, line_end[0].y, line_end[1].x, line_end[1].y); } } break; } } } } } #endif
OpenCL
4
artun3e/opencv
modules/imgproc/src/opencl/hough_lines.cl
[ "BSD-3-Clause" ]
/**************************************************************************** * * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> * * QGroundControl is licensed according to the terms in the file * COPYING.md in the root of the source code directory. * ****************************************************************************/ import QtQuick 2.12 import QGroundControl 1.0 import QGroundControl.ScreenTools 1.0 //------------------------------------------------------------------------- //-- Toolbar Indicators Row { id: indicatorRow anchors.top: parent.top anchors.bottom: parent.bottom anchors.margins: _toolIndicatorMargins spacing: ScreenTools.defaultFontPixelWidth * 1.5 property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property real _toolIndicatorMargins: ScreenTools.defaultFontPixelHeight * 0.66 Repeater { id: appRepeater model: QGroundControl.corePlugin.toolBarIndicators Loader { anchors.top: parent.top anchors.bottom: parent.bottom source: modelData visible: item.showIndicator } } Repeater { model: _activeVehicle ? _activeVehicle.toolIndicators : [] Loader { anchors.top: parent.top anchors.bottom: parent.bottom source: modelData visible: item.showIndicator } } Repeater { model: _activeVehicle ? _activeVehicle.modeIndicators : [] Loader { anchors.top: parent.top anchors.bottom: parent.bottom source: modelData visible: item.showIndicator } } }
QML
4
vincentdavoust/qgroundcontrol
src/ui/toolbar/MainToolBarIndicators.qml
[ "Apache-2.0" ]
module B (module B, module A) where import A y = 1
PureScript
1
andys8/purescript
tests/purs/failing/ImportHidingModule/B.purs
[ "BSD-3-Clause" ]
integer isSitting = FALSE; key botID; default { state_entry() { //This creates a bot in the sim with the given name, outfit at the given start position. botID = botCreateBot("Test", "Bot", "", llGetPos(), BOT_CREATE_DEFAULT); } touch_start(integer n) { if(!isSitting) { //The key of the object to sit on key objectID = llGetKey(); //Have the bot sit on this object botSitObject(botID, objectID); } else { //Causes the bot to stand up if the bot is sitting on something botStandUp(botID); } isSitting = !isSitting; } }
LSL
4
Asterionworld/ether
doc/bot LSL Functions/Examples/bot Sitting on Objects.lsl
[ "BSD-3-Clause" ]
#!/bin/sh /usr/share/dpatch/dpatch-run ## 07-cdrkit-code.dpatch by Daniel Baumann <[email protected]> ## ## DP: Update any cdrtools related information in the code to cdrkit. @DPATCH@ diff -Naurp dvd+rw-tools-7.1.orig/growisofs.c dvd+rw-tools-7.1/growisofs.c --- dvd+rw-tools-7.1.orig/growisofs.c 2008-04-01 09:08:58.000000000 +0000 +++ dvd+rw-tools-7.1/growisofs.c 2008-04-01 09:14:01.000000000 +0000 @@ -2724,7 +2724,7 @@ void pipe_mkisofs_up (char *mkisofs_argv perror (":-( unable to create pipe"), exit(FATAL_START(errno)); if ((mkisofs_pid=fork ()) == (pid_t)-1) - perror (":-( unable to fork mkisofs"), exit(FATAL_START(errno)); + perror (":-( unable to fork genisoimage"), exit(FATAL_START(errno)); else if (mkisofs_pid == 0) { dup2 (fildes[1],1); close (fildes[0]); @@ -2844,7 +2844,7 @@ void pipe_mkisofs_up (char *mkisofs_argv { DWORD ret; if (GetExitCodeProcess (pi.hProcess,&ret) && ret) - fprintf (stderr,":-( mkisofs has failed: %d\n",ret), + fprintf (stderr,":-( genisoimage has failed: %d\n",ret), exit (1); else perror (":-( GetExitCodeProcess failed"), exit(errno); @@ -2963,8 +2963,8 @@ int main (int argc, char *argv[]) perror (NULL), exit (FATAL_START(errno)); #if defined(__unix) || defined(__unix__) - env = getenv ("MKISOFS"); - mkisofs_argv[0] = (env?env:"mkisofs"); + env = getenv ("GENISOIMAGE"); + mkisofs_argv[0] = (env?env:"genisoimage"); #elif defined(_WIN32) /* * On Windows I insist on mkisofs.exe to reside in very same @@ -3151,8 +3151,8 @@ int main (int argc, char *argv[]) else if (argv[i][1] == '?' || !strcmp(opt,"-help")) { PRINT_VERSION (argv[0]); printf ("- usage: %s [-dvd-compat] [-overburn] [-speed=1] \\\n" - " -[ZM] /dev/dvd <mkisofs options>\n",argv[0]); - printf (" for <mkisofs options> see 'mkisofs %s'\n",opt); + " -[ZM] /dev/dvd <genisoimage options>\n",argv[0]); + printf (" for <genisoimage options> see 'genisoimage %s'\n",opt); exit (FATAL_START(EINVAL)); } else if (strstr (opt,"-version")) @@ -3320,12 +3320,12 @@ int main (int argc, char *argv[]) if (imgfd<0) { if (mkisofs_argc==1 && dev_found!='F') - fprintf (stderr,"%s: no mkisofs options specified, " + fprintf (stderr,"%s: no genisoimage options specified, " "aborting...\n",argv[0]), exit (FATAL_START(EINVAL)); } else if ((mkisofs_argc-growisofs_argc)>1) - fprintf (stderr,"%s: no mkisofs options are permitted with =, " + fprintf (stderr,"%s: no genisoimage options are permitted with =, " "aborting...\n",argv[0]), exit (FATAL_START(EINVAL)); @@ -3576,7 +3576,7 @@ int main (int argc, char *argv[]) if (saved_descriptors[i].type[0] != descr[i].type[0]) { fprintf (stderr,":-? volume descriptor mismatch, did you " - "use same mkisofs options?\n"); + "use same genisoimage options?\n"); break; } memcpy (descr+i,&saved_descriptors[i],sizeof(*descr));
Darcs Patch
3
mtdcr/opendreambox
meta-opendreambox/recipes-multimedia/dvd+rw-tools/files/08-cdrkit-code.dpatch
[ "MIT" ]
{ "Version" : 0.2, "ModuleName" : "Test3D", "Options" : { "Warnings" : "All", "MemoryGuard" : false, "Profile" : false, "StrictNameSpaces" : false, "TargetType" : "Executable", "TargetFileName" : "Test3D", "Libraries" : [ "ecere" ], "Console" : false }, "Configurations" : [ { "Name" : "Debug", "Options" : { "Debug" : true, "FastMath" : false } }, { "Name" : "Release", "Options" : { "Optimization" : "Speed", "FastMath" : true } }, { "Name" : "Android", "Options" : { "Optimization" : "Speed", "TargetType" : "SharedLibrary", "TargetFileName" : "Test3D", "FastMath" : true, "PostbuildCommands" : [ "$(call mkdir,$(OBJ)apk/lib/x86)", "$(call mkdir,$(OBJ)apk/lib/armeabi)", "$(call cp,../../../ecere/obj/android.linux.$(COMPILER)/libecere.so,$(OBJ)apk/lib/armeabi)", "$(call cp,$(TARGET),$(OBJ)apk/lib/armeabi)", "aapt package -v -f -m -M android/AndroidManifest.xml -F $(OBJ)$(MODULE)-unsigned.apk -I C:/android-sdk/platforms/android-20/android.jar -S android/res $(OBJ)apk", "jarsigner -storepass android -sigalg MD5withRSA -digestalg SHA1 $(OBJ)$(MODULE)-unsigned.apk androiddebugkey -keystore c:/users/jerome/debug.keystore -signedjar $(OBJ)$(MODULE).apk", "adb uninstall com.ecere.$(MODULE)", "adb install $(OBJ)$(MODULE).apk", "adb shell am start -a android.intent.action.MAIN -n com.ecere.$(MODULE)/android.app.NativeActivity" ] } } ], "Files" : [ { "Folder" : "android", "Files" : [ { "Folder" : "res", "Files" : [ { "Folder" : "drawable", "Files" : [ "icon.png" ] }, { "Folder" : "drawable-xhdpi", "Files" : [ ] }, { "Folder" : "values", "Files" : [ "strings.xml" ] } ] }, "AndroidManifest.xml" ] }, "Test3D.ec" ], "ResourcesPath" : "", "Resources" : [ ] }
Ecere Projects
2
N-eil/ecere-sdk
samples/3D/Test3D/Test3D.epj
[ "BSD-3-Clause" ]
#!/usr/bin/env wisp (def express (require "express")) (def expressws (require "express-ws")) (def fs (require "fs")) (let [app (express) ews (expressws app) port (or (aget process.env "PORT") 8000) host (or (aget process.env "BIND_ADDRESS") "127.0.0.1")] (app.get "/" (fn [req res] (res.sendFile (+ __dirname "/index.html")))) (app.ws "/ws" (fn [ws req] (ws.on "message" (fn [msg] (console.log "Got message:" msg) (.map (.-clients (ews.getWss)) (fn [c] (c.send msg))))) (ws.on "close" (fn [] (console.log "WebSocket was closed"))))) (app.listen port host (fn [] (console.log "App launched."))))
wisp
4
namsral/piku
examples/nodejs-wisp/index.wisp
[ "MIT" ]
// Copyright 2010-2015 RethinkDB, all rights reserved. #include "clustering/immediate_consistency/remote_replicator_metadata.hpp" RDB_IMPL_SERIALIZABLE_2_FOR_CLUSTER( remote_replicator_client_intro_t, streaming_begin_timestamp, ready_mailbox); RDB_IMPL_SERIALIZABLE_6_FOR_CLUSTER( remote_replicator_client_bcard_t, server_id, intro_mailbox, write_async_mailbox, write_sync_mailbox, dummy_write_mailbox, read_mailbox); RDB_IMPL_SERIALIZABLE_3_FOR_CLUSTER( remote_replicator_server_bcard_t, branch, region, registrar);
C++
2
zadcha/rethinkdb
src/clustering/immediate_consistency/remote_replicator_metadata.cc
[ "Apache-2.0" ]
# Based on the "Example Storage Allocator" from chapter 8 of K&R Second Edition var malloc; var free; var realloc; include "stdio.sl"; include "stdlib.sl"; include "sys.sl"; # return a pointer to "sz" words of unused memory var sbrk = func(sz) { var oldtop = TOP; var newtop = TOP + sz; if (newtop ge osbase() || newtop lt oldtop) return 0; TOP = newtop; return oldtop; }; # The "free list" is a circularly linked list of free blocks. Each block header # is 2 words: the first word is a pointer to the next item in the list, the # second element is the size of the block. # # foo[0] -> next block # foo[1] -> size of block, including header # foo[2..] -> free space # # start off with a list of 1 element of 0 size var freep = [0, 0]; *freep = freep; free = func(ap) { if (ap == 0) return 0; # TODO: [bug] this test is ~broken now that _TOP is in head.s instead of foot.s if (ap lt &TOP) { fprintf(2, "free'd static pointer: 0x%x\n", [ap]); exit(1); }; var bp = ap-2; # point to block header var p = freep; while (!((bp gt p) && (bp lt p[0]))) { if (p ge p[0]) # next block wraps around to start if ((bp gt p) || (bp lt p[0])) # freed block at start or end of arena break; p = p[0]; }; if ((bp + bp[1]) == p[0]) { # join to upper neighbour bp[1] = bp[1] + p[0][1]; *bp = p[0][0]; } else { *bp = p[0]; }; if ((p + p[1]) == bp) { # join to lower neighbour p[1] = p[1] + bp[1]; *p = bp[0]; } else { *p = bp; }; freep = p; }; var morecore = func(needsz) { var sz = needsz; if (sz lt 1024) sz = 1024; var p = sbrk(sz); if (!p) { # not enough space for 1024? try just what we need sz = needsz; p = sbrk(sz); }; if (!p) { # oom # TODO: [nice] can we print a call stack? or at least the return # address of malloc()? fputs(2, "out of memory\n"); exit(1); }; p[1] = sz; free(p+2); return freep; }; malloc = func(sz) { var p; var prevp; var origsz = sz; # sz needs to include block header, and align on 2-word boundaries sz = sz + 2 + (sz&1); prevp = freep; p = freep[0]; while (1) { if (p[1] ge sz) { # big enough if (p[1] == sz) { # exactly *prevp = p[0]; } else { # allocate tail end p[1] = p[1]-sz; # block size gets shorter by the size of the new block p = p+p[1]; # point to new block p[1] = sz; # set size of new block }; freep = prevp; return p+2; # return pointer to new space }; if (p == freep) # wrapped around free list p = morecore(sz); prevp = p; p = p[0]; }; }; realloc = func(p, sz) { var bp = p-2; var oldsz = bp[1]; # if we can grow in-place, do so var bpnext = *bp; var sznext; if (bpnext == p+oldsz) { sznext = bp[1]; # TODO: [nice] also support shrinking in-place if ((sz gt oldsz) && (oldsz+sznext le sz)) { bpnext = p+sz; bpnext[1] = sznext-(sz-oldsz); *bp = bpnext; bp[1] = sz; return p; }; }; var newp = malloc(sz); var copysz = oldsz; if (sz < oldsz) copysz = sz; var dest = newp; var src = p; while (copysz--) *(dest++) = *(src++); free(p); return newp; }; var cons = func(a,b) { var tuple = malloc(2); *tuple = a; tuple[1] = b; return tuple; }; var zmalloc = func(sz) { var p = malloc(sz); while (sz--) *(p+sz) = 0; return p; }; # vector zmalloc, for example: # var p = vzmalloc([10,5,3]); # the final element is p[9][4][2]; var vzmalloc = func(szs) { if (!szs[0]) return 0; if (!szs[1]) return zmalloc(szs[0]); var i = 0; var p = malloc(szs[0]); while (i != szs[0]) p[i++] = vzmalloc(szs+1); return p; }; # free memory allocated with vzmalloc var vfree = func(p, szs) { if (!szs[0]) return 0; if (!szs[1]) return free(p); var i = 0; while (i != szs[0]) vfree(p[i++]); free(p); return 0; };
Slash
5
jes/scamp-cpu
sys/lib/malloc.sl
[ "Unlicense" ]
--IMPORT parse-schema-string.sql
SQL
0
kesavanvt/spark
sql/core/src/test/resources/sql-tests/inputs/ansi/parse-schema-string.sql
[ "BSD-2-Clause", "Apache-2.0", "CC0-1.0", "MIT", "MIT-0", "ECL-2.0", "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
Rebol [ Title: "Test HTTPD Scheme" Date: 02-Jul-2020 Author: "Oldes" File: %test-httpd.r3 Version: 0.6.0 Note: { To test POST method from Rebol console, try this: ``` write http://localhost:8081 {msg=hello} write http://localhost:8081 [post [user-agent: "bla"] "hello"] ``` } ] secure [%../modules/ allow] do %../modules/httpd.reb system/options/log/httpd: 3 ; for verbose output ; make sure that there is the directory for logs make-dir/deep %httpd-root/logs/ http-server/config/actor 8081 [ ;- Main server configuration root: %httpd-root/ server-name: "nginx" ;= it's possible to hide real server name keep-alive: [15 100] ;= [timeout max-requests] or FALSE to turn it off log-access: %httpd-root/logs/test-access.log log-errors: %httpd-root/logs/test-errors.log list-dir?: #[true] ] [ ;- Server's actor functions On-Accept: func [info [object!]][ ; allow only connections from localhost ; TRUE = accepted, FALSE = refuse find [ 127.0.0.1 ] info/remote-ip ] On-Header: func [ctx [object!]][ switch ctx/inp/target/file [ %form/ [ ; path rewrite... ; http://localhost:8081/form/ is now same like http://localhost:8081/form.html ctx/inp/target/file: %form.html ; request processing will continue ] %form.htm %form.html [ ctx/out/status: 301 ;= Moved Permanently ctx/out/header/Location: %/form/ ; request processing will stop with redirection response ] %plain/ [ ctx/out/status: 200 ctx/out/header/Content-Type: "text/plain; charset=UTF-8" ctx/out/content: "hello" ; request processing will stop with response 200 serving the plain text content ] ] ] On-Post-Received: func [ctx [object!]][ ctx/out/content: ajoin [ "<br/>Request header:<pre>" mold ctx/inp/header </pre> "Received <code>" ctx/inp/header/Content-Type/1 "</code> data:<pre>" mold ctx/inp/content </pre> ] ] ]
Rebol
5
0branch/r3
src/tests/test-httpd.r3
[ "Apache-2.0" ]
unit bzlib; { Inno Setup Copyright (C) 1997-2010 Jordan Russell Portions by Martijn Laan For conditions of distribution and use, see LICENSE.TXT. Declarations for some bzlib2 functions & structures $jrsoftware: issrc/Projects/bzlib.pas,v 1.14 2010/09/07 03:09:36 jr Exp $ } interface uses Windows, SysUtils, Compress; function BZInitCompressFunctions(Module: HMODULE): Boolean; function BZInitDecompressFunctions(Module: HMODULE): Boolean; type TBZAlloc = function(AppData: Pointer; Items, Size: Cardinal): Pointer; stdcall; TBZFree = procedure(AppData, Block: Pointer); stdcall; TBZStreamRec = record next_in: Pointer; avail_in: Integer; total_in: Integer; total_in_hi: Integer; next_out: Pointer; avail_out: Integer; total_out: Integer; total_out_hi: Integer; State: Pointer; zalloc: TBZAlloc; zfree: TBZFree; AppData: Pointer; end; TBZCompressor = class(TCustomCompressor) private FCompressionLevel: Integer; FInitialized: Boolean; FStrm: TBZStreamRec; FBuffer: array[0..65535] of Byte; procedure EndCompress; procedure FlushBuffer; procedure InitCompress; protected procedure DoCompress(const Buffer; Count: Longint); override; procedure DoFinish; override; public constructor Create(AWriteProc: TCompressorWriteProc; AProgressProc: TCompressorProgressProc; CompressionLevel: Integer; ACompressorProps: TCompressorProps); override; destructor Destroy; override; end; TBZDecompressor = class(TCustomDecompressor) private FInitialized: Boolean; FStrm: TBZStreamRec; FReachedEnd: Boolean; FBuffer: array[0..65535] of Byte; FHeapBase, FHeapNextFree: Pointer; function Malloc(Bytes: Cardinal): Pointer; public constructor Create(AReadProc: TDecompressorReadProc); override; destructor Destroy; override; procedure DecompressInto(var Buffer; Count: Longint); override; procedure Reset; override; end; implementation var BZ2_bzCompressInit: function(var strm: TBZStreamRec; blockSize100k, verbosity, workFactor: Integer): Integer; stdcall; BZ2_bzCompress: function(var strm: TBZStreamRec; action: Integer): Integer; stdcall; BZ2_bzCompressEnd: function(var strm: TBZStreamRec): Integer; stdcall; BZ2_bzDecompressInit: function(var strm: TBZStreamRec; verbosity, small: Integer): Integer; stdcall; BZ2_bzDecompress: function(var strm: TBZStreamRec): Integer; stdcall; BZ2_bzDecompressEnd: function(var strm: TBZStreamRec): Integer; stdcall; const BZ_RUN = 0; BZ_FLUSH = 1; BZ_FINISH = 2; BZ_OK = 0; BZ_RUN_OK = 1; BZ_FLUSH_OK = 2; BZ_FINISH_OK = 3; BZ_STREAM_END = 4; BZ_SEQUENCE_ERROR = (-1); BZ_PARAM_ERROR = (-2); BZ_MEM_ERROR = (-3); BZ_DATA_ERROR = (-4); BZ_DATA_ERROR_MAGIC = (-5); BZ_IO_ERROR = (-6); BZ_UNEXPECTED_EOF = (-7); BZ_OUTBUFF_FULL = (-8); BZ_CONFIG_ERROR = (-9); SBzlibDataError = 'bzlib: Compressed data is corrupted'; SBzlibInternalError = 'bzlib: Internal error. Code %d'; SBzlibAllocError = 'bzlib: Too much memory requested'; function BZInitCompressFunctions(Module: HMODULE): Boolean; begin BZ2_bzCompressInit := GetProcAddress(Module, 'BZ2_bzCompressInit'); BZ2_bzCompress := GetProcAddress(Module, 'BZ2_bzCompress'); BZ2_bzCompressEnd := GetProcAddress(Module, 'BZ2_bzCompressEnd'); Result := Assigned(BZ2_bzCompressInit) and Assigned(BZ2_bzCompress) and Assigned(BZ2_bzCompressEnd); if not Result then begin BZ2_bzCompressInit := nil; BZ2_bzCompress := nil; BZ2_bzCompressEnd := nil; end; end; function BZInitDecompressFunctions(Module: HMODULE): Boolean; begin BZ2_bzDecompressInit := GetProcAddress(Module, 'BZ2_bzDecompressInit'); BZ2_bzDecompress := GetProcAddress(Module, 'BZ2_bzDecompress'); BZ2_bzDecompressEnd := GetProcAddress(Module, 'BZ2_bzDecompressEnd'); Result := Assigned(BZ2_bzDecompressInit) and Assigned(BZ2_bzDecompress) and Assigned(BZ2_bzDecompressEnd); if not Result then begin BZ2_bzDecompressInit := nil; BZ2_bzDecompress := nil; BZ2_bzDecompressEnd := nil; end; end; function BZAllocMem(AppData: Pointer; Items, Size: Cardinal): Pointer; stdcall; begin try GetMem(Result, Items * Size); except { trap any exception, because zlib expects a NULL result if it's out of memory } Result := nil; end; end; procedure BZFreeMem(AppData, Block: Pointer); stdcall; begin FreeMem(Block); end; function Check(const Code: Integer; const ValidCodes: array of Integer): Integer; var I: Integer; begin if Code = BZ_MEM_ERROR then OutOfMemoryError; Result := Code; for I := Low(ValidCodes) to High(ValidCodes) do if ValidCodes[I] = Code then Exit; raise ECompressInternalError.CreateFmt(SBzlibInternalError, [Code]); end; procedure InitStream(var strm: TBZStreamRec); begin FillChar(strm, SizeOf(strm), 0); with strm do begin zalloc := BZAllocMem; zfree := BZFreeMem; end; end; { TBZCompressor } constructor TBZCompressor.Create(AWriteProc: TCompressorWriteProc; AProgressProc: TCompressorProgressProc; CompressionLevel: Integer; ACompressorProps: TCompressorProps); begin inherited; FCompressionLevel := CompressionLevel; InitCompress; end; destructor TBZCompressor.Destroy; begin EndCompress; inherited; end; procedure TBZCompressor.InitCompress; begin if not FInitialized then begin InitStream(FStrm); FStrm.next_out := @FBuffer; FStrm.avail_out := SizeOf(FBuffer); Check(BZ2_bzCompressInit(FStrm, FCompressionLevel, 0, 0), [BZ_OK]); FInitialized := True; end; end; procedure TBZCompressor.EndCompress; begin if FInitialized then begin FInitialized := False; BZ2_bzCompressEnd(FStrm); end; end; procedure TBZCompressor.FlushBuffer; begin if FStrm.avail_out < SizeOf(FBuffer) then begin WriteProc(FBuffer, SizeOf(FBuffer) - FStrm.avail_out); FStrm.next_out := @FBuffer; FStrm.avail_out := SizeOf(FBuffer); end; end; procedure TBZCompressor.DoCompress(const Buffer; Count: Longint); begin InitCompress; FStrm.next_in := @Buffer; FStrm.avail_in := Count; while FStrm.avail_in > 0 do begin Check(BZ2_bzCompress(FStrm, BZ_RUN), [BZ_RUN_OK]); if FStrm.avail_out = 0 then FlushBuffer; end; if Assigned(ProgressProc) then ProgressProc(Count); end; procedure TBZCompressor.DoFinish; begin InitCompress; FStrm.next_in := nil; FStrm.avail_in := 0; { Note: This assumes FStrm.avail_out > 0. This shouldn't be a problem since Compress always flushes when FStrm.avail_out reaches 0. } while Check(BZ2_bzCompress(FStrm, BZ_FINISH), [BZ_FINISH_OK, BZ_STREAM_END]) <> BZ_STREAM_END do FlushBuffer; FlushBuffer; EndCompress; end; { TBZDecompressor } { Why does TBZDecompressor use VirtualAlloc instead of GetMem? It IS 4.0.1 it did use GetMem and allocate blocks on demand, but thanks to Delphi's flawed memory manager this resulted in crippling memory fragmentation when Reset was called repeatedly (e.g. when an installation contained thousands of files and solid decompression was disabled) while Setup was allocating other small blocks (e.g. FileLocationFilenames[]), and eventually caused Setup to run out of virtual address space. So, it was changed to allocate only one chunk of virtual address space for the entire lifetime of the TBZDecompressor instance. It divides this chunk into smaller amounts as requested by bzlib. As IS only creates one instance of TBZDecompressor, this change should completely eliminate the fragmentation issue. } const DecompressorHeapSize = $600000; { 6 MB should be more than enough; the most I've seen bzlib 1.0.2's bzDecompress* allocate is 64116 + 3600000 bytes, when decompressing data compressed at level 9 } function DecompressorAllocMem(AppData: Pointer; Items, Size: Cardinal): Pointer; stdcall; begin Result := TBZDecompressor(AppData).Malloc(Items * Size); end; procedure DecompressorFreeMem(AppData, Block: Pointer); stdcall; begin { Since bzlib doesn't repeatedly deallocate and allocate blocks during a decompression run, we don't have to handle frees. } end; constructor TBZDecompressor.Create(AReadProc: TDecompressorReadProc); begin inherited Create(AReadProc); FHeapBase := VirtualAlloc(nil, DecompressorHeapSize, MEM_RESERVE, PAGE_NOACCESS); if FHeapBase = nil then OutOfMemoryError; FHeapNextFree := FHeapBase; FStrm.AppData := Self; FStrm.zalloc := DecompressorAllocMem; FStrm.zfree := DecompressorFreeMem; FStrm.next_in := @FBuffer; FStrm.avail_in := 0; Check(BZ2_bzDecompressInit(FStrm, 0, 0), [BZ_OK]); FInitialized := True; end; destructor TBZDecompressor.Destroy; begin if FInitialized then BZ2_bzDecompressEnd(FStrm); if Assigned(FHeapBase) then VirtualFree(FHeapBase, 0, MEM_RELEASE); inherited Destroy; end; function TBZDecompressor.Malloc(Bytes: Cardinal): Pointer; begin { Round up to dword boundary if necessary } if Bytes mod 4 <> 0 then Inc(Bytes, 4 - Bytes mod 4); { Did bzlib request more memory than we reserved? This shouldn't happen unless this unit is used with a different version of bzlib that allocates more memory. Note: The funky Cardinal casts are there to convince Delphi (2) to do an unsigned compare. } if Cardinal(Cardinal(FHeapNextFree) - Cardinal(FHeapBase) + Bytes) > Cardinal(DecompressorHeapSize) then raise ECompressInternalError.Create(SBzlibAllocError); if VirtualAlloc(FHeapNextFree, Bytes, MEM_COMMIT, PAGE_READWRITE) = nil then Result := nil else begin Result := FHeapNextFree; Inc(Cardinal(FHeapNextFree), Bytes); end; end; procedure TBZDecompressor.DecompressInto(var Buffer; Count: Longint); begin FStrm.next_out := @Buffer; FStrm.avail_out := Count; while FStrm.avail_out > 0 do begin if FReachedEnd then { unexpected EOF } raise ECompressDataError.Create(SBzlibDataError); if FStrm.avail_in = 0 then begin FStrm.next_in := @FBuffer; FStrm.avail_in := ReadProc(FBuffer, SizeOf(FBuffer)); { Unlike zlib, bzlib does not return an error when avail_in is zero and it still needs input. To avoid an infinite loop, check for this and consider it a data error. } if FStrm.avail_in = 0 then raise ECompressDataError.Create(SBzlibDataError); end; case Check(BZ2_bzDecompress(FStrm), [BZ_OK, BZ_STREAM_END, BZ_DATA_ERROR, BZ_DATA_ERROR_MAGIC]) of BZ_STREAM_END: FReachedEnd := True; BZ_DATA_ERROR, BZ_DATA_ERROR_MAGIC: raise ECompressDataError.Create(SBzlibDataError); end; end; end; procedure TBZDecompressor.Reset; begin FStrm.next_in := @FBuffer; FStrm.avail_in := 0; { bzlib doesn't offer an optimized 'Reset' function like zlib } BZ2_bzDecompressEnd(FStrm); FHeapNextFree := FHeapBase; { discard previous allocations } Check(BZ2_bzDecompressInit(FStrm, 0, 0), [BZ_OK]); FReachedEnd := False; end; end.
Pascal
5
Patriccollu/issrc
Projects/bzlib.pas
[ "FSFAP" ]
open util/ordering[State] open util/integer /*Define Players*/ abstract sig Prisoner {} sig OtherPrisoner extends Prisoner{} one sig CounterPrisoner extends Prisoner {} one sig NULL{} fact { Prisoner = OtherPrisoner + CounterPrisoner } fact { #Prisoner > 1 } /*Define Boolean*/ abstract sig Bool{} one sig True extends Bool {} one sig False extends Bool {} /*Define Switches*/ abstract sig Switches{} one sig SwitcheA extends Switches{} one sig SwitcheB extends Switches{} fact { Switches = SwitcheA + SwitcheB } /*Define Status*/ abstract sig Status{} one sig Up extends Status {} one sig Down extends Status {} /*Define State*/ sig State {announced:Bool, SwitchesStatus: Switches->one Status, count:Int, timesSwitched: OtherPrisoner ->one Int, currentPrisoner: one (Prisoner+NULL) } /*Define initial state*/ pred TineSwichedSetToZero{all p:OtherPrisoner{ p->0 in first.timesSwitched}} pred CountSetToZero{first.count=0} pred SwitchesInBoolean{all s:Switches{ (s->Down in first.SwitchesStatus) or (s->Up in first.SwitchesStatus)}} pred AnnouncedSetToFalse{ first.announced = False} pred CurrentPlayerSetToNull {first.currentPrisoner = NULL} fact Init{TineSwichedSetToZero and CountSetToZero and SwitchesInBoolean and AnnouncedSetToFalse and CurrentPlayerSetToNull} pred NonCounterStep[game, game': State,p:Prisoner]{ p in OtherPrisoner game'.currentPrisoner = p game'.announced = game.announced game'.count = game.count (game.announced= True => game'.SwitchesStatus = game.SwitchesStatus and game'.timesSwitched = game.timesSwitched else ((game.SwitchesStatus[SwitcheA] = Down and p.(game.timesSwitched) <2) => SwitcheA.(game'.SwitchesStatus) = Up and SwitcheB.(game'.SwitchesStatus) = SwitcheB.(game.SwitchesStatus) and game'.timesSwitched = game.timesSwitched - p->p.(game.timesSwitched) + p->(p.(game.timesSwitched)+1) else game'.timesSwitched = game.timesSwitched and SwitcheA.(game'.SwitchesStatus) = SwitcheA.(game.SwitchesStatus) and (SwitcheB.(game.SwitchesStatus) = Up=> SwitcheB.(game'.SwitchesStatus) = Down else SwitcheB.(game'.SwitchesStatus) = Up))) } pred CounterStep[game, game': State, p:Prisoner]{ p = CounterPrisoner game'.currentPrisoner = p game'.timesSwitched = game.timesSwitched (game.announced= True => game'.SwitchesStatus = game.SwitchesStatus and game'.announced = game.announced and game'.count =game.count else (SwitcheA.(game.SwitchesStatus) = Up => SwitcheA.(game'.SwitchesStatus) = Down and SwitcheB.(game'.SwitchesStatus) = SwitcheB.(game.SwitchesStatus) and game'.count =game.count +1 and (game'.count = 2.mul[(#Prisoner-1)] => game'.announced = True else game'.announced = game.announced) else game'.count = game.count and game'.announced = game.announced and SwitcheA.(game'.SwitchesStatus) = SwitcheA.(game.SwitchesStatus) and (SwitcheB.(game.SwitchesStatus) = Up=> SwitcheB.(game'.SwitchesStatus) = Down else SwitcheB.(game'.SwitchesStatus) = Up))) } fact Steps{ all s: State, s': s.next { (one p:OtherPrisoner | NonCounterStep[s, s',p]) or (one p:CounterPrisoner | CounterStep[s, s',p]) } } /*Checking types*/ assert TypeOK {all s:State{ s.count >=0 and s.count<= 2.mul[(#Prisoner-1)] and (all p:OtherPrisoner| p.(s.timesSwitched) <=2) } } check TypeOK for 3 Prisoner, 12 State /*Checking safety*/ pred StateDone[s:State]{s.count = 2.mul[(#Prisoner-1)]} pred Announced[s:State]{s.announced = True} /*(*************************************************************************) (* This formula asserts that safety condition: that Done true implies *) (* that every prisoner other than the counter has flipped switch A at *) (* least once--and hence has been in the room at least once. Since the *) (* counter increments the count only when in the room, and Done implies *) (* count > 0, it also implies that the counter has been in the room.*) (*This is also checks the counter's announcement that all the prisoners was in the room if and only if it is true (means Done) *) (*************************************************************************)*/ assert Safety{all s:State{ (StateDone[s] => (all p:OtherPrisoner| p.(s.timesSwitched)>0)) and (Announced[s] iff StateDone[s]) } } check Safety for 3 Prisoner, 10 State /* Count always eaqual to the sum of timesSwitched of all OtherPrisoners(+-1)*/ assert CountInvariant{all s:State { (let totalSwitched = (sum p:OtherPrisoner | p.(s.timesSwitched)) | (SwitcheA.(s.SwitchesStatus) = Up => ((s.count = totalSwitched -1) or (s.count = totalSwitched)) else ((s.count = totalSwitched) or (s.count = totalSwitched +1)))) } } check CountInvariant for 3 Prisoner, 10 State /*Checking fairness*/ pred AfterNonCounterPlayerEventaullyCounterPlayertEnterTheRoom{ all s: State| ((s.currentPrisoner in OtherPrisoner) => (some s': s.^next | s'.currentPrisoner = CounterPrisoner)) } pred PrisonerComesImmediatelyAfterCounter[s: State, p:OtherPrisoner]{ s.currentPrisoner = CounterPrisoner and s.next.currentPrisoner = p } pred Fairness {(all p:OtherPrisoner{ some s,s':State {s' in s.^next and PrisonerComesImmediatelyAfterCounter[s,p] and PrisonerComesImmediatelyAfterCounter[s',p] } }) AfterNonCounterPlayerEventaullyCounterPlayertEnterTheRoom } pred Done{some s:State | Announced[s]} assert Theorem{Fairness => Done} check Theorem for 3 Prisoner, 12 State run {} for 4 int, exactly 3 Prisoner, 12 State
Alloy
5
c-luu/alloy-specs
puzzles/prisoner-room-visit/prisoner.als
[ "Apache-2.0" ]
package com.baeldung.hibernate.criteriaquery; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "students") public class Student { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int id; @Column(name = "first_name") private String firstName; @Column(name = "last_name") private String lastName; @Column(name = "grad_year") private int gradYear; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public int getGradYear() { return gradYear; } public void setGradYear(int gradYear) { this.gradYear = gradYear; } }
Java
4
DBatOWL/tutorials
persistence-modules/hibernate-queries/src/main/java/com/baeldung/hibernate/criteriaquery/Student.java
[ "MIT" ]
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ .monaco-workbench .timeline-tree-view { position: relative; } .monaco-workbench .timeline-tree-view .message.timeline-subtle { opacity: 0.5; padding: 10px 22px 0 22px; position: absolute; pointer-events: none; z-index: 1; } .timeline-tree-view .monaco-list .monaco-list-row .custom-view-tree-node-item .monaco-icon-label { flex: 1; text-overflow: ellipsis; overflow: hidden; } .timeline-tree-view .monaco-list .monaco-list-row .custom-view-tree-node-item .timeline-timestamp-container { margin-left: 2px; margin-right: 4px; opacity: 0.5; overflow: hidden; text-overflow: ellipsis; } .timeline-tree-view .monaco-list .monaco-list-row .custom-view-tree-node-item .timeline-timestamp-container.timeline-timestamp--duplicate::before { content: ' '; position: absolute; right: 10px; border-right: 1px solid currentColor; display: block; height: 100%; width: 1px; opacity: 0.25; } .timeline-tree-view .monaco-list .monaco-list-row:hover .custom-view-tree-node-item .timeline-timestamp-container.timeline-timestamp--duplicate::before, .timeline-tree-view .monaco-list .monaco-list-row.selected .custom-view-tree-node-item .timeline-timestamp-container.timeline-timestamp--duplicate::before, .timeline-tree-view .monaco-list .monaco-list-row.focused .custom-view-tree-node-item .timeline-timestamp-container.timeline-timestamp--duplicate::before { display: none; } .timeline-tree-view .monaco-list .monaco-list-row .custom-view-tree-node-item .timeline-timestamp-container .timeline-timestamp { display: inline-block; } .timeline-tree-view .monaco-list .monaco-list-row .custom-view-tree-node-item .timeline-timestamp-container.timeline-timestamp--duplicate .timeline-timestamp { visibility: hidden; width: 10px; } .timeline-tree-view .monaco-list .monaco-list-row:hover .custom-view-tree-node-item .timeline-timestamp-container.timeline-timestamp--duplicate .timeline-timestamp, .timeline-tree-view .monaco-list .monaco-list-row.selected .custom-view-tree-node-item .timeline-timestamp-container.timeline-timestamp--duplicate .timeline-timestamp, .timeline-tree-view .monaco-list .monaco-list-row.focused .custom-view-tree-node-item .timeline-timestamp-container.timeline-timestamp--duplicate .timeline-timestamp { visibility: visible !important; width: initial; }
CSS
3
sbj42/vscode
src/vs/workbench/contrib/timeline/browser/media/timelinePane.css
[ "MIT" ]
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <process.h> #include "_cgo_export.h" __stdcall static unsigned int addThread(void *p) { int i, max; max = *(int*)p; for(i=0; i<max; i++) Add(i); return 0; } void doAdd(int max, int nthread) { enum { MaxThread = 20 }; int i; uintptr_t thread_id[MaxThread]; if(nthread > MaxThread) nthread = MaxThread; for(i=0; i<nthread; i++) thread_id[i] = _beginthreadex(0, 0, addThread, &max, 0, 0); for(i=0; i<nthread; i++) { WaitForSingleObject((HANDLE)thread_id[i], INFINITE); CloseHandle((HANDLE)thread_id[i]); } }
C
4
Havoc-OS/androidprebuilts_go_linux-x86
misc/cgo/test/cthread_windows.c
[ "BSD-3-Clause" ]
(:~ : The user interface module, containing most of the code that deals : with user requests and responses served to the user. :) module namespace ui="de/bottlecaps/railroad/xq/user-interface.xq"; import module namespace c="de/bottlecaps/railroad/xq/color.xq"; import module namespace style="de/bottlecaps/railroad/xq/style.xq"; import module namespace e="de/bottlecaps/railroad/xq/html-to-ebnf.xq"; import module namespace a="de/bottlecaps/railroad/xq/cst-to-ast.xq"; import module namespace s="de/bottlecaps/railroad/xq/ast-to-svg.xq"; import module namespace t="de/bottlecaps/railroad/xq/transform-ast.xq"; import module namespace m="de/bottlecaps/railroad/xq/xhtml-to-md.xq"; declare namespace p="Parser"; declare namespace webapp="http://bottlecaps.de/webapp"; declare namespace http-client="http://expath.org/ns/http-client"; declare namespace math="http://www.w3.org/2005/xpath-functions/math"; declare namespace xhtml="http://www.w3.org/1999/xhtml"; declare namespace xlink="http://www.w3.org/1999/xlink"; declare namespace svg="http://www.w3.org/2000/svg"; declare namespace g="http://www.w3.org/2001/03/XPath/grammar"; (: HTTP parameter names :) (:~ : The "name" HTTP parameter name. :) declare variable $ui:NAME := "name"; (:~ : The "task" HTTP parameter name. :) declare variable $ui:TASK := "task"; (: tab names :) (:~ : The "WELCOME" tab name. :) declare variable $ui:WELCOME := "WELCOME"; (:~ : The "GET" tab name. :) declare variable $ui:GET := "GET"; (:~ : The "EDIT" tab name. :) declare variable $ui:EDIT := "EDIT"; (:~ : The "VIEW" tab name. :) declare variable $ui:VIEW := "VIEW"; (:~ : The "OPTIONS" tab name. :) declare variable $ui:OPTIONS := "OPTIONS"; (:~ : The "ABOUT" tab name. :) declare variable $ui:ABOUT := "ABOUT"; (: task names :) (:~ : The "LOAD" task name. :) declare variable $ui:LOAD := "LOAD"; (:~ : The "SAVE" task name. :) declare variable $ui:SAVE := "SAVE"; (:~ : The "XHTML" task name. :) declare variable $ui:XHTML := "XHTML"; (:~ : The "XHTML" task name. :) declare variable $ui:MD := "MD"; (:~ : The "ZIP" task name. :) declare variable $ui:ZIP := "ZIP"; (: option names :) (:~ : The "showebnf" option name. :) declare variable $ui:SHOWEBNF := "showebnf"; (:~ : The "eliminaterecursion" option name. :) declare variable $ui:ELIMINATERECURSION := "eliminaterecursion"; (:~ : The "factoring" option name. :) declare variable $ui:FACTORING := "factoring"; (:~ : The "inline" option name. :) declare variable $ui:INLINE := "inline"; (:~ : The "keep" option name. :) declare variable $ui:KEEP := "keep"; (:~ : The handler function for the Railroad Diagram Generator. : : Dispatch request based on the http "task" parameter. : @return depending on the request, either an XHTML page, : or a text attachment for download. :) declare function ui:ui() as item()* { let $request-parameters := webapp:parameter-names() let $task := ( webapp:parameter-values($ui:TASK), $ui:VIEW[$request-parameters = ("text", "ebnf")], $ui:EDIT[$request-parameters = "uri"], $ui:WELCOME )[1] return if ($task = $ui:SAVE) then ui:save() else if ($task = $ui:LOAD) then ui:load(ui:color()) else if ($task = $ui:XHTML) then ui:download-xhtml() else if ($task = $ui:MD) then ui:download-md() else if ($task = $ui:ZIP) then ui:download-zip() else ui:process($task, ui:color()) }; (:~ : Check whether the user agent is Internet Explorer before : version 9. These versions cannot handle XHTML or inline SVG, : so we will have to send a notification. : : @return true, if the user agent is MSIE version 3 to 8. :) declare function ui:is-IE-pre9() { matches(webapp:user-agent(), "^[^\(]*\(compatible; MSIE [3-8]") }; (:~ : Send a blank page with a javascript alert, indicating that : we are not going to handle Internet Explorers before version : 9. : : @return an html element, along with a matching Content-Type : setting. :) declare function ui:unsupported() as element(html) { webapp:set-content-type("text/html"), <html> <head> <meta http-equiv="Content-Type" content="text/html"/> <title>Not supported</title> </head> <body> <script type="text/javascript"> alert ( "Browser does not support XHTML.\n" + "\n" + "The Railroad Diagram Generator sends XHTML with inline SVG,\n" + "so it requires a browser supporting this. Internet Explorer starts\n" + "to support XHTML and inline SVG in version 9.\n" + "\n" + "Please use another browser, e.g. Mozilla Firefox.\n" ) </script> </body> </html> }; (:~ : Create the basic XHTML page, containing tab navigation and : user content. : : @param $tab the id of the tab to be shown when the page is loaded. : @param $text the contents of the editor's textArea. : @param $modified the modification flag. Indicates whether a click : on the "VIEW" button requires an extra server request. : @param $errorlog the error log to be shown on the the "VIEW" tab, if any. : @param $view-uri the uri of the page tp be shown on the "VIEW" tab's iframe. : @param $color the color code. : @return an HTML or XHTML page, along with appropriate http header settings. :) declare function ui:html($tab as xs:string, $text as xs:string?, $modified as xs:boolean, $errorlog as node()*, $view-uri as xs:string?, $color as xs:string) as element() { let $width := xs:integer(ui:parameter-values("width", string($s:page-width))) return if (ui:is-IE-pre9()) then ui:unsupported() else ( ui:xhtml(true()), webapp:set-header("Cache-Control", "no-cache"), <html xmlns="http://www.w3.org/1999/xhtml"> { if (webapp:parameter-values("frame") = "diagram") then ( <head>{s:head($color, $width)}</head>, <body>{$errorlog}</body> ) else ( <head> {s:head($color, $width)} <link href="favicon.ico" rel="shortcut icon"/>, <title>Railroad Diagram Generator</title>, </head>, <body onresize="resize()" onscroll="resize()" onload="onLoad()"> {ui:logo()} <div id="download" class="download"> <table border="0"> <tr> <td colspan="3"><b>Download diagram</b></td> </tr> <tr> <td><input type="radio" name="download-type" value="svg" checked="true"/></td> <td style="font-size: 14px;">XHTML+SVG&#xA0;</td> <td style="font-size: 9px; line-height: 11px;"> single XHTML page with<br/> inline SVG graphics </td> </tr> <tr> <td><input type="radio" name="download-type" value="png"/></td> <td style="font-size: 14px;">HTML+PNG&#xA0;</td> <td style="font-size:9px; line-height: 11px;"> zip file containing HTML<br/> and linked PNG images </td> </tr> <!-- <tr> <td><input type="radio" name="download-type" value="md"/></td> <td style="font-size: 14px;">MD+SVG&#xA0;</td> <td style="font-size:9px; line-height: 11px;"> single Markdown file with <br/> inline SVG graphics </td> </tr> --> <tr> <td colspan="3"><small>&#xA;</small></td> </tr> <tr> <td colspan="3"><small>&#xA;</small></td> </tr> <tr> <td colspan="3"><a class="button" href="javascript:downld()">Download</a></td> </tr> </table> </div> <form name="data" method="POST" enctype="multipart/form-data" onsubmit="return false;"> <input type="hidden" name="tz" value="0"/> <input type="hidden" name="{$ui:TASK}" id="{$ui:TASK}"/> <input type="hidden" name="frame" id="frame"/> <input type="hidden" name="{$ui:NAME}" id="{$ui:NAME}" value="{ui:name((), ())}"/> <input type="hidden" name="time" id="time" value="{webapp:parameter-values("time")}"/> <input type="hidden" name="color" value="{ui:color()}" style="width: 32px"/> <script type="text/javascript">var {$ui:WELCOME} = 0;</script> <script type="text/javascript">var {$ui:GET} = 1;</script> <script type="text/javascript">var {$ui:EDIT} = 2;</script> <script type="text/javascript">var {$ui:VIEW} = 3;</script> <script type="text/javascript">var {$ui:OPTIONS} = 4;</script> <script type="text/javascript">var {$ui:ABOUT} = 5;</script> <ul id="tabs"> <li><a name="tab" href="javascript:tab({$ui:WELCOME})">Welcome</a>&#32;</li ><li><a name="tab" href="javascript:tab({$ui:GET})">Get Grammar</a>&#32;</li ><li><a name="tab" href="javascript:tab({$ui:EDIT})">Edit Grammar</a>&#32;</li ><li><a name="tab" href="javascript:tab({$ui:VIEW})">View Diagram</a>&#32;</li ><li><a name="tab" href="javascript:tab({$ui:OPTIONS})">Options</a>&#32;</li > </ul> <div id="divs"> <div name="div">{ui:welcome-tab()}</div> <div name="div"> <table border="0"> <tr colspan="3"></tr> <tr> <td colspan="3" align="center"> <p><b>From this website:</b></p> </td> </tr> <tr> <td align="right">EBNF Notation</td> <td> <input id="myUri0" type="hidden" name="myUri0" value=""/> <input id="myUri1" type="radio" name="spec" onclick="setUri(this.value)" value=""/> </td> <td> <span id="myUri2"></span> <script type="text/javascript"> function myUrl() {{ return document.location.href; }}; document.getElementById("myUri0").value = myUrl(); document.getElementById("myUri1").value = myUrl(); document.getElementById("myUri2").innerHTML = myUrl(); </script> </td> </tr> <tr> <td colspan="3" align="center"> <p><b>From W3C specifications:</b></p> </td> </tr> { let $specs := ( "xml", "xml-names", "1999/REC-xpath-19991116", "xpath20", "xpath-30", "2010/REC-xquery-20101214", "xquery-30", "xquery-31", "xquery-update-10", "xquery-update-30", "xquery-sx-10", "rdf-sparql-query", "sparql11-query", "turtle" ) let $descriptions := ( "Extensible Markup Language (XML) 1.0", "Namespaces in XML 1.0", "XML Path Language (XPath) 1.0", "XML Path Language (XPath) 2.0", "XML Path Language (XPath) 3.0", "XQuery 1.0: An XML Query Language (Second Edition)", "XQuery 3.0: An XML Query Language", "XQuery 3.1: An XML Query Language", "XQuery Update Facility 1.0", "XQuery Update Facility 3.0", "XQuery Scripting Extension 1.0", "SPARQL Query Language for RDF", "SPARQL 1.1 Query Language", "Turtle Terse RDF Triple Language" ) for $spec at $i in $specs return <tr> <td align="right">{$descriptions[$i]}</td> <td><input type="radio" name="spec" onclick="setUri(this.value)" value="http://www.w3.org/TR/{$spec}/"/></td> <td>http://www.w3.org/TR/{$spec}/</td> </tr> } <tr> <td align="right">other</td> <td><input id="other" type="radio" name="spec" onclick="setUri(this.value)" value="" checked=""/></td> <td><small>enter URL below</small></td> </tr> <tr><td colspan="3" align="center">&#xA0;</td></tr> <tr> <td align="right">URL</td> <td>&#xA0;</td> <td><input type="text" id="uri" name="uri" size="50" onclick="other.checked = true;"/></td> </tr> </table> </div> <div name="div" style="overflow:hidden"> <textarea id="text" name="text" onchange="changeText();" style="width:100%" spellcheck="false">{$text}</textarea> <input id="textChanged" name="textChanged" type="hidden" value="{$modified[.]}"/> <table> <tr> <td> <a class="button" href="javascript:clear()[0]">Clear</a> &#32; <a class="button" href="javascript:save()[0]">Save</a> </td> <td style="width: 60px;">&#160;</td> <td> <input type="file" size="42" id="file" name="file"/> &#32; <a class="button" href="javascript:load()">Load</a> </td> </tr> </table> </div> <div name="div" style="overflow:hidden"> <div id="errorlog" style="display:block;">{$errorlog}</div> <iframe frameborder="0" name="diagram" id="diagram" width="100%" height="100%" onload="diagramLoaded();"> { attribute src {$view-uri}[$view-uri != ""] } </iframe> </div> <div name="div"> <div style="display:block; max-width: 768px; overflow: hidden;"> { let $options := ui:options() let $previewAst := <g:grammar xmlns:g="http://www.w3.org/2001/03/XPath/grammar"> <g:production name="Preview"> <g:choice> <g:string>terminal</g:string> <g:ref name="nonterminal"/> <g:subtract><g:ref name="EBNF"/><g:ref name="expression"/></g:subtract> </g:choice> </g:production> </g:grammar> let $preview-color := s:color-1($style:default-color) let $hsl := c:rgb-to-hsl($preview-color) let $previewHtml := ( <style type="text/css"> #preview div {{ display: block; }} #preview div.ebnf, .ebnf code {{ padding-right: 0px; width: 94%; }} </style>, s:svg($previewAst, true(), $s:page-width, $preview-color, 0, "/")[position() <= 5] ) let $palette-width := 18 let $previewEbnf := for $x at $i in $previewHtml where $x//@class = "ebnf" return $i return <table> <tr> <td valign="top"> <table> <tr class="option-line"> <td align="right" style="height: 1;"> <input type="hidden" name="preview-html-1" id="preview-html-1" value="{ui:serialize($previewHtml[position() < $previewEbnf])}"/> <input type="hidden" name="preview-html-2" id="preview-html-2" value="{ui:serialize($previewHtml[position() = $previewEbnf])}"/> <input type="hidden" name="preview-html-3" id="preview-html-3" value= "{ ui:serialize (( (: $previewHtml[position() > $previewEbnf], :) if ($c:debug) then <table>{ for $rgb in (s:color-1($preview-color), c:relative-color($color, 1.0, 0.04), s:color-nonterminal($preview-color, 0), c:relative-color($color, 1.0, 0.05), s:color-regexp($preview-color, 0), c:relative-color($color, 1.0, 0.06), style:color-background($preview-color), style:color-bg-hilite($preview-color) ) let $r-g-b := for $x in c:r-g-b($rgb) return string($x) let $h-s-l := for $x in c:rgb-to-hsl($rgb) return string(round($x * 100) div 100) let $title := concat($rgb, " rgb(", $r-g-b[1], ",", $r-g-b[2], ",", $r-g-b[3], ")") return <tr><td style="background-color: {$rgb}" class="palette"><a title="{$title}">&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</a></td><td>{$rgb}</td></tr> }</table> else () )) }"/> { comment {$options}, element input { attribute type {"checkbox"}, attribute name {"options"}, attribute id {$ui:SHOWEBNF}, attribute value {$ui:SHOWEBNF}, attribute onclick {"changeText();preview();"}, if ($options = $ui:SHOWEBNF) then attribute checked {true()} else () } } </td> <td style="height: 1;" colspan="4"><b>Show EBNF</b></td> </tr> <tr> <td style="height: 1;">&#xA0;</td> <td style="height: 1;" colspan="4"> The corresponding EBNF will be shown next to generated diagrams. If this option is unchecked, the EBNF display will be suppressed. </td> </tr> <tr> <td>&#xA0;</td> </tr> <tr> <td align="right" style="height: 1;"> <input type="text" name="rgb" onchange="setRgb(this.value, true);" style="width: 67px; text-align:right"/> </td> <td/> <td style="height: 1;"><b>Color</b></td> <td colspan="2"> { <table cellpadding="0" cellspacing="0" class="palette"> <tr class="palette"> { let $angle := 360 div $palette-width for $i in (0 to $palette-width - 1) let $h := $angle * $i let $s := 1.0 let $l := $c:default-lightness let $rgb := c:rgb(c:hsl-to-rgb($h, $s, $l)) let $r-g-b := for $x in c:r-g-b($rgb) return string($x) let $h-s-l := for $x in c:rgb-to-hsl($rgb) return string(round($x * 100) div 100) let $title := concat($rgb, " rgb(", $r-g-b[1], ",", $r-g-b[2], ",", $r-g-b[3], ") hsl(", $h-s-l[1], ",", $h-s-l[2], ",", $h-s-l[3], ")") return <td style="background-color: {$rgb}" class="palette"> <a href="javascript:setRgb('{$rgb}', true)" title="{$title}" class="palette"><small>&#160;</small></a> </td> } </tr> </table> } </td> </tr> <tr> <td align="right" style="height: 1;"><input type="text" name="hue" onchange="setRgbFromHsl('hue', 0, 0, 359);" style="width: 24px; text-align:right"/></td> <td>&#xBA;</td> <td><b>Hue</b></td> <td> <nobr> <a href="javascript:" class="button" onmousedown="scheduleIncrement('hue', -1, 0, 359)" onmouseout="cancelIncrement()" onmouseup="cancelIncrement()"><b>&lt;</b></a>&#32; <a href="javascript:" class="button" onmousedown="scheduleIncrement('hue', +1, 0, 359)" onmouseout="cancelIncrement()" onmouseup="cancelIncrement()"><b>&gt;</b></a> </nobr> </td> <td rowspan="4" style="vertical-align: top; padding-left: 10px;"> Select base color from the palette above, or enter color data into the fields on the left. Adjust hue, saturation, or lightness by clicking, or holding their respective controls. Arrange other colors by setting hue offset, 0 is for a monochromatic color scheme. </td> </tr> <tr> <td align="right" style="height: 1;"><input type="text" name="saturation" onchange="setRgbFromHsl('saturation', 0, 0, 100);" style="width: 24px; text-align:right"/></td> <td>%</td> <td><b>Saturation</b></td> <td> <nobr> <a href="javascript:" class="button" onmousedown="scheduleIncrement('saturation', -1, 0, 100)" onmouseout="cancelIncrement()" onmouseup="cancelIncrement()"><b>&lt;</b></a>&#32; <a href="javascript:" class="button" onmousedown="scheduleIncrement('saturation', +1, 0, 100)" onmouseout="cancelIncrement()" onmouseup="cancelIncrement()"><b>&gt;</b></a> </nobr> </td> </tr> <tr> <td align="right" style="height: 1;"><input type="text" name="lightness" onchange="setRgbFromHsl('lightness', 0, 0, 100);" style="width: 24px; text-align:right"/></td> <td>%</td> <td><b>Lightness</b></td> <td> <nobr> <a href="javascript:" class="button" onmousedown="scheduleIncrement('lightness', -1, 0, 100)" onmouseout="cancelIncrement()" onmouseup="cancelIncrement()"><b>&lt;</b></a>&#32; <a href="javascript:" class="button" onmousedown="scheduleIncrement('lightness', +1, 0, 100)" onmouseout="cancelIncrement()" onmouseup="cancelIncrement()"><b>&gt;</b></a> </nobr> </td> </tr> <tr> <td align="right" style="height: 1;"> <input type="text" id="spread" name="spread" onfocus="this.oldvalue = this.value" onchange="checkSpread();" style="width: 24px; text-align:right" value="{ui:parameter-values("spread", "0")}"/> </td> <td>&#xBA;</td> <td><b>Hue offset</b></td> <td> <nobr> <a href="javascript:" class="button" onmousedown="scheduleIncrement('spread', -1, 0, 359)" onmouseout="cancelIncrement()" onmouseup="cancelIncrement()"><b>&lt;</b></a>&#32; <a href="javascript:" class="button" onmousedown="scheduleIncrement('spread', +1, 0, 359)" onmouseout="cancelIncrement()" onmouseup="cancelIncrement()"><b>&gt;</b></a> </nobr> </td> </tr> <tr> <td colspan="5">&#xA0;</td> </tr> <tr class="option-line"> <td> <input type="text" id="width" name="width" onfocus="this.oldvalue = this.value" onchange="checkWidth();" style="width: 40px; text-align:right;" value="{ui:parameter-values("width", string($s:page-width))}"/> </td> <td><small>px</small></td> <td colspan="3"><b>Graphics width</b></td> </tr> <tr class="option-text"> <td>&#xA0;</td> <td colspan="4"> When the graphics exceeds this width, attempts will be made to break it and start a continuation line. </td> </tr> <div style="display: none;"> <tr class="option-line"> <td> <input type="text" id="padding" name="padding" onfocus="this.oldvalue = this.value" onchange="checkWidth();" style="width: 40px; text-align:right;" value="{ui:parameter-values("padding", string($s:padding))}"/> </td> <td><small>px</small></td> <td colspan="3"><b>Padding</b></td> </tr> <tr class="option-text"> <td>&#xA0;</td> <td colspan="4"> The number of pixels between text and the surrounding box. </td> </tr> <tr class="option-line"> <td> <input type="text" id="strokewidth" name="strokewidth" onfocus="this.oldvalue = this.value" onchange="checkWidth();" style="width: 40px; text-align:right;" value="{ui:parameter-values("strokewidth", string($s:stroke-width))}"/> </td> <td><small>px</small></td> <td colspan="3"><b>Stroke width</b></td> </tr> <tr class="option-text"> <td>&#xA0;</td> <td colspan="4"> The width of lines and frames in pixels. </td> </tr> </div> <tr class="option-line"> <td> { element input { attribute type {"checkbox"}, attribute name {"options"}, attribute id {$ui:ELIMINATERECURSION}, attribute value {$ui:ELIMINATERECURSION}, attribute onclick {"changeText();preview();"}, if ($options = $ui:ELIMINATERECURSION) then attribute checked {true()} else () } } </td> <td colspan="4"><b>Direct recursion elimination</b></td> </tr> <tr class="option-text"> <td>&#xA0;</td> <td colspan="4"> Unless disabled, direct recursion will be replaced by repetition. This applies to nonterminals, whose directly recursive references are either left- or right-recursive only. Upon success, productions are inlined, when a single reference remains. </td> </tr> <tr class="option-line"> <td> { element input { attribute type {"checkbox"}, attribute name {"options"}, attribute id {$ui:FACTORING}, attribute value {$ui:FACTORING}, attribute onclick {"changeText();preview();"}, if ($options = $ui:FACTORING) then attribute checked {true()} else () } } </td> <td colspan="4"><b>Factoring</b></td> </tr> <tr class="option-text"> <td>&#xA0;</td> <td colspan="4"> When checked, left and right factoring will be applied to right-hand sides of all productions individually, in order to achieve more compact diagrams. </td> </tr> <tr class="option-line"> <td> { element input { attribute type {"checkbox"}, attribute name {"options"}, attribute id {$ui:INLINE}, attribute value {$ui:INLINE}, attribute onclick {"changeText();preview();"}, if ($options = $ui:INLINE) then attribute checked {true()} else () } } </td> <td colspan="4"><b>Inline literals</b></td> </tr> <tr class="option-text"> <td>&#xA0;</td> <td colspan="4"> Replace nonterminal references by their definition, when they derive to a single string literal. </td> </tr> <tr class="option-line"> <td> { element input { attribute type {"checkbox"}, attribute name {"options"}, attribute id {$ui:KEEP}, attribute value {$ui:KEEP}, attribute onclick {"changeText();preview();"}, if ($options = $ui:KEEP) then attribute checked {true()} else () } } </td> <td colspan="4"><b>Keep epsilon nonterminals</b></td> </tr> <tr class="option-text"> <td>&#xA0;</td> <td colspan="4"> Keep references to nonterminals, that derive to epsilon only. When unchecked, they will be removed. </td> </tr> </table> <div style="display:none;"> <input type="checkbox" name="options" id="sendoptions" value="sendoptions" checked="true"/> </div> </td> <td style="vertical-align: top"> <table> <tr> <td align="right" style="vertical-align: top; padding-top: 4px; padding-bottom: 10px;"> <a href="javascript:reset(false)" class="button" onclick="reset(false)" title="Reset to previous values that are currently in effect"><b>Cancel</b></a> &#xA0; <a href="javascript:reset(true)" class="button" onclick="reset(true)" title="Reset to default values"><b>Defaults</b></a> </td> </tr> <tr> <td id="preview" style="vertical-align: top; border: 1px dotted; padding-left: 6px; padding-right: 6px; padding-bottom: 6px; width: 270px; height: 280px"/> </tr> </table> </td> </tr> </table> } </div> </div> <div name="div" style="overflow:hidden;"> <iframe frameborder="0" id="frameset" width="100%" height="100%"/> </div> </div> <div style="display:none;"> <textarea id="xhtml" name="xhtml"></textarea> </div> </form> { ui:spinner($color), if ($tab = $ui:VIEW and not($view-uri != "") and $text != "" and not($errorlog != "")) then ui:javascript($ui:EDIT, true()) else ui:javascript($tab, false()) } </body> ) } </html> ) }; (:~ : Return javascript code for the user interface XHTML page. : : @param $tab the id of the tab to be shown after loading the page. : @param $submit-on-load whether to submit a view request after loading : @return the script element containing the javascript code. :) declare function ui:javascript($tab as xs:string, $submit-on-load as xs:boolean) as element(xhtml:script) { let $colors := string-join ( ( for $n at $i in $c:css3-colors//name return (", "[$i ne 1], """", $n, """: """, $n/../@rgb/string(.), """") ), "" ) return <script type="text/javascript" xmlns="http://www.w3.org/1999/xhtml" > var task = document.getElementById("task"); var name = document.getElementById("name"); var text = document.getElementById("text"); var other = document.getElementById("other"); var view = document.getElementById("view"); var textChanged = document.getElementById("textChanged"); var oldColor = document.getElementsByName("color")[0].value; var oldSpread = document.getElementsByName("spread")[0].value; var tabs = document.getElementsByName("tab"); var divs = getElementChildren(document.getElementById("divs")); var uri = document.getElementById("uri"); var file = document.getElementById("file"); var frameset = document.getElementById("frameset"); var errorlog = document.getElementById("errorlog"); var diagram = document.getElementById("diagram"); var download = document.getElementById("download"); var active = {$tab}; var css3colors = {{{$colors}}}; function okToClear() {{ return text.value == "" || confirm("OK to clear current grammar?"); }} function clear() {{ if (okToClear()) {{ text.value = ""; name.value = ""; changeText(); return true; }} else {{ return false; }} }} function save() {{ if (text.value != "") {{ task.value = "{$ui:SAVE}"; document.forms.data.target = ""; document.forms.data.submit(); }} }} function resizeEditor() {{ if (active == {$ui:EDIT}) {{ var height = "innerHeight" in window ? window.innerHeight : document.documentElement.offsetHeight; text.style.height = (height - text.offsetTop - 55) + "px"; }} }} function resizeDivs() {{ for (var i = 0; i &lt; divs.length; ++i) {{ divs[i].style.height = (window.innerHeight - divs[i].offsetTop - 10) + "px"; }} }} function resize() {{ resizeDivs(); resizeEditor(); resizeSpinner(); }} function tab(t) {{ var colorChanged = oldColor != document.getElementsByName("color")[0].value || oldSpread != document.getElementsByName("spread")[0].value; var next = t == active ? null : t == {$ui:EDIT} ? "{$ui:EDIT}" : t == {$ui:VIEW} ? "{$ui:VIEW}" : (uri.value == "" &amp;&amp; ! colorChanged) ? null : t == {$ui:WELCOME} ? "{$ui:WELCOME}" : t == {$ui:GET} ? "{$ui:GET}" : t == {$ui:OPTIONS} ? "{$ui:OPTIONS}" : t == {$ui:ABOUT} ? "{$ui:ABOUT}" : null; if (next != null &amp;&amp; uri.value != "") {{ if (okToClear()) {{ submit(next, ""); }} else {{ setUri(""); }} }} else if (next != null &amp;&amp; colorChanged) {{ errorlog.style.display = "none"; submit(next, ""); }} else if (next == "{$ui:VIEW}" &amp;&amp; textChanged.value != "") {{ errorlog.style.display = "none"; submit(next, "diagram"); }} else {{ tabs[active].className = ""; divs[active].className = ""; active = t; tabs[active].className = "active"; divs[active].className = "active"; if (active == {$ui:ABOUT} &amp;&amp; frameset.src == "") {{ frameset.src = "doc-frameset{ui:color-arg("?")}"; }} resize(); }} if (active == {$ui:VIEW}) {{ var diagramBody = diagram.contentDocument.getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "body")[0]; var isEmpty = diagramBody.childNodes.length == 0; var isDiagram = diagramBody.getElementsByTagNameNS("http://www.w3.org/2000/svg", "svg").length != 0; if (isDiagram) {{ download.style.display = "block"; }} else {{ download.style.display = "none"; if (! isEmpty) {{ changeText(); }} }} }} else {{ download.style.display = "none"; }} }} function load() {{ if (file.value != "" &amp;&amp; okToClear()) {{ submit("{$ui:LOAD}", ""); }} }} function setUri(input) {{ if (input == "") other.checked = true; uri.value = input; return true; }} function selfDescribe() {{ if (okToClear()) {{ setUri(myUrl()); submit("{$ui:VIEW}", ""); }} }} function changeText() {{ if (text.value == "") {{ var diagramBody = diagram.contentDocument.getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "body")[0]; diagramBody.innerHTML = ""; textChanged.value = null; }} else {{ textChanged.value = true; }} return true; }} function submit(t, f) {{ task.value = t; document.forms.data.target = f; document.forms.data.frame.value = f; document.forms.data.time.value = new Date().getTime(); document.forms.data.submit(); startSpinning(); }} function resubmit() {{ var t = document.forms.data.time.value; submit("{$ui:VIEW}", "diagram"); document.forms.data.time.value = t; }} function onLoad() {{ document.forms.data.tz.value = new Date().getTimezoneOffset(); tab({$tab}); {if ($submit-on-load) then "resubmit" else "showResponseTime"}(); }} function showResponseTime() {{ var t = document.getElementById("time"); var s = document.getElementById("timeDisplay"); if (t.value !== "") {{ s.innerHTML = ((new Date().getTime() - parseInt(t.value)) / 1000.0) + " sec"; }} setRgb(colorCode(document.getElementsByName("color")[0].value), false); preview(); }} function diagramLoaded() {{ if (spinning) {{ stopSpinning(); textChanged.value = ""; showResponseTime(); tab({$ui:VIEW}); }} resize(); }} function getElementChildren(node) {{ var children = []; for (var child = node.firstChild; child; child = child.nextSibling) {{ if (child.nodeType === 1) children.push(child); }} return children; }} function downld() {{ var type = "svg"; var inputs = document.getElementsByName("download-type"); for (var i = 0; i &lt; inputs.length; ++i) {{ if (inputs[i].checked) {{ type = inputs[i].value; break; }} }} if (type === "svg") {{ document.getElementById("xhtml").value = new XMLSerializer().serializeToString(diagram.contentDocument); task.value = "{$ui:XHTML}"; document.forms.data.target = ""; document.forms.data.frame.value = ""; document.forms.data.submit(); }} else if (type === "md") {{ document.getElementById("xhtml").value = new XMLSerializer().serializeToString(diagram.contentDocument); task.value = "{$ui:MD}"; document.forms.data.target = ""; document.forms.data.frame.value = ""; document.forms.data.submit(); }} else if (type === "png") {{ document.getElementById("xhtml").value = new XMLSerializer().serializeToString(diagram.contentDocument); task.value = "{$ui:ZIP}"; document.forms.data.target = "_blank"; document.forms.data.frame.value = "diagram"; document.forms.data.submit(); }} }} function setColor() {{ var rgb = document.getElementsByName("rgb")[0]; document.getElementsByName("color")[0].value = rgb.value; preview(); }} function colorCode(colorSpec) {{ colorSpec = colorSpec.trim(); var code = css3colors[colorSpec.toLowerCase()]; return typeof code == "undefined" ? colorSpec : code; }} function setRgb(colorSpec, propagate) {{ colorSpec = colorSpec.trim(); var code = colorCode(colorSpec); if (code.match(/^#[0-9a-f]{{6}}($|[^0-9a-f])/i)) {{ document.getElementsByName("rgb")[0].value = code != colorSpec ? colorSpec.toLowerCase() : colorSpec.substring(0, 7); var hue = document.getElementsByName("hue")[0]; if (propagate || hue.value.trim() === "") {{ var hsl = colorToHsl(code); hue.value = hsl[0]; document.getElementsByName("saturation")[0].value = Math.round(hsl[1] * 100); document.getElementsByName("lightness")[0].value = Math.round(hsl[2] * 100); }} setColor(); }} else {{ alert("invalid value: " + colorSpec); colorSpec = document.getElementsByName("color")[0].value; document.getElementsByName("rgb")[0].value = colorSpec; }} }} function checkSpread() {{ var input = document.getElementsByName("spread")[0]; var value = input.value.trim(); if (isNaN(value) || ! (value &gt;= 0 &amp;&amp; value &lt;= 359)) {{ alert("invalid value: " + input.value); input.value = input.oldvalue; }} else {{ input.oldvalue = input.value; setRgbFromHsl('spread', 0, 0, 359); }} }} function checkWidth() {{ var input = document.getElementById("width"); var value = input.value.trim(); if (isNaN(value) || ! (value &gt;= 0)) {{ alert("invalid value: " + input.value); input.value = input.oldvalue; }} else {{ input.oldvalue = input.value; setCookies(); changeText(); }} }} var incrementInterval = null; function scheduleIncrement(name, inc, min, max) {{ cancelIncrement(); var time = new Date().getTime() + 500; increment = function() {{ if (new Date().getTime() &gt;= time) {{ setRgbFromHsl(name, inc, min, max); }} }}; setRgbFromHsl(name, inc, min, max); incrementInterval = setInterval(increment, 100); }} function cancelIncrement() {{ if (incrementInterval != null) {{ clearInterval(incrementInterval); incrementInterval = null; }} }} function setRgbFromHsl(name, increment, min, max) {{ var node = document.getElementsByName(name)[0]; var value = Number(node.value) if (value !== "NaN" &amp;&amp; value + increment &gt;= min &amp;&amp; value + increment &lt;= max) {{ node.value = increment == 0 ? value + increment : Math.round(value + increment); var h = document.getElementsByName("hue")[0].value; var s = document.getElementsByName("saturation")[0].value / 100; var l = document.getElementsByName("lightness")[0].value / 100; setRgb(rgb(hslToRgb(h, s, l))); }} else if (increment == 0) {{ alert("invalid value: " + node.value); setRgb(document.getElementsByName("color")[0].value, true); }} else {{ cancelIncrement(); }} }} function colorToHsl(color) {{ var c = parseInt(color.substring(1), 16); var r = c >> 16; var g = (c >> 8) &amp; 0xff; var b = c &amp; 0xff; return rgbToHsl(r, g, b); }} function preview() {{ var color = colorCode(document.getElementsByName("color")[0].value); var html = document.getElementById("preview-html-1").value; if (document.getElementById("{$ui:SHOWEBNF}").checked) {{ html += document.getElementById("preview-html-2").value; }} html += document.getElementById("preview-html-3").value; document.getElementById("preview").innerHTML = replaceColors(html, colorToHsl(color)); setCookies(); }} function setCookies() {{ var optionsString = ""; var options = document.getElementsByName("options"); for (var i = 0; i &lt; options.length; ++i) {{ if (options[i].checked) {{ if (optionsString !== "") {{ optionsString += "+"; }} optionsString += options[i].value; }} }} var date = new Date(); date.setTime(date.getTime() + (30 * 24 * 60 * 60 * 1000)); var expires = "; expires=" + date.toGMTString() + "; path={replace(webapp:request-uri(), '/+', '/')}"; document.cookie = "options=" + optionsString + expires; var color = document.getElementsByName("rgb")[0].value; document.cookie = "color=" + color + expires; var width = document.getElementById("width").value; document.cookie = "width=" + width + expires; var spread = document.getElementById("spread").value; document.cookie = "spread=" + spread + expires; }} function rgbToHsl(r, g, b) {{ r /= 255, g /= 255, b /= 255; var max = Math.max(r, g, b), min = Math.min(r, g, b); var h, s, l = (max + min) / 2; if (max == min) {{ h = s = 0; }} else {{ var d = max - min; s = l > 0.5 ? d / (2 - max - min) : d / (max + min); switch(max) {{ case r: h = (g - b) / d + (g &lt; b ? 6 : 0); break; case g: h = (b - r) / d + 2; break; case b: h = (r - g) / d + 4; break; }} h *= 60; }} return [Math.round(h), Math.round(s * 100) / 100, Math.round(l * 100) / 100]; }} function hue2rgb(p, q, t) {{ if (t &lt; 0) t += 1; if (t > 1) t -= 1; if (t &lt; 1/6) return p + (q - p) * 6 * t; if (t &lt; 1/2) return q; if (t &lt; 2/3) return p + (q - p) * (2/3 - t) * 6; return p; }} function hslToRgb(h, s, l) {{ var r, g, b; if (s == 0) {{ r = g = b = l; }} else {{ h /= 360; var q = l &lt; 0.5 ? l * (1 + s) : l + s - l * s; var p = 2 * l - q; r = hue2rgb(p, q, h + 1/3); g = hue2rgb(p, q, h); b = hue2rgb(p, q, h - 1/3); }} return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)]; }} function convertColor(oldColor, newHsl) {{ var spread = Number(document.getElementsByName("spread")[0].value); if (spread !== 0) {{ if (oldColor === "{s:color-regexp($style:default-color, 0)}") {{ newHsl = [(newHsl[0] + 2 * spread) % 360, newHsl[1], newHsl[2]]; oldColor = "{$style:default-color}"; }} else if (oldColor === "{s:color-text-regexp($style:default-color, 0)}") {{ newHsl = [(newHsl[0] + 2 * spread) % 360, newHsl[1], newHsl[2]]; oldColor = "{s:color-text-terminal($style:default-color)}"; }} else if (oldColor === "{s:color-nonterminal($style:default-color, 0)}") {{ newHsl = [(newHsl[0] + spread) % 360, newHsl[1], newHsl[2]]; oldColor = "{$style:default-color}"; }} else if (oldColor === "{s:color-text-nonterminal($style:default-color, 0)}") {{ newHsl = [(newHsl[0] + spread) % 360, newHsl[1], newHsl[2]]; oldColor = "{s:color-text-terminal($style:default-color)}"; }} }} var c = parseInt(oldColor.substring(1), 16); var r = c >> 16; var g = (c >> 8) &amp; 0xff; var b = c &amp; 0xff; var oldHsl = rgbToHsl(r, g, b); var h = newHsl[0]; var s = newHsl[1] * oldHsl[1]; if (oldHsl[2] &lt; 0.061 &amp;&amp; oldHsl[2] &gt; 0.039) {{ var backgroundLightness = oldHsl[2] &gt; 0.055 ? 0.89 : oldHsl[2] &gt; 0.045 ? 0.81 : {$c:default-lightness} var backgroundBrightness = brightness(hslToRgb(h, s, convertLightness(backgroundLightness, newHsl[2], 0, 1))); var dark = hslToRgb(h, s, oldHsl[2]); var light = hslToRgb(h, s, 0.94); return Math.abs(brightness(dark) - backgroundBrightness) > Math.abs(brightness(light) - backgroundBrightness) ? rgb(dark) : rgb(light); }} else {{ var l = oldHsl[2] &lt; 0.5 ? convertLightness(oldHsl[2], newHsl[2], oldHsl[2] - 0.01, oldHsl[2] + 0.05) : oldHsl[2] &gt; 0.9 || oldHsl[1] &lt; 0.9 ? convertLightness(oldHsl[2], newHsl[2], oldHsl[2] - 0.07, oldHsl[2] + 0.03) : convertLightness(oldHsl[2], newHsl[2], 0, 1); return rgb(hslToRgb(h, s, l)); }} }} function convertLightness(oldL, newL, min, max) {{ var factor = max - min; oldL = (oldL - min) / factor; var result = newL &lt;= {$c:default-lightness} ? oldL / {$c:default-lightness} * newL : newL + (oldL - {$c:default-lightness}) / (1 - {$c:default-lightness}) * (1 - newL); return min + result * factor; }} function rgb(rgb) {{ var r = rgb[0]; var g = rgb[1]; var b = rgb[2]; var hsl = rgbToHsl(r, g, b); var h = hsl[0]; var s = hsl[1]; var l = hsl[2]; return "#" + (0x1000000 | (r &lt;&lt; 16) | (g &lt;&lt; 8) | b).toString(16).substring(1).toUpperCase(){ if ($c:debug) then ' + " /* hsl(" + h + "," + Math.round(s * 100) / 100 + "," + Math.round(l * 100) / 100 + ") */"' else () }; }} function replaceColors(string, newHsl) {{ var newString = null; var parts = string.split(/#/); for (var i in parts) {{ var part = parts[i]; if (newString == null) newString = part; else if (! part.match(/^[0-9a-f]{{6}}/i)) newString += "#" + part; else newString += convertColor("#" + part.substring(0, 6), newHsl) + part.substring(6); }} return newString; }} function brightness(rgb) {{ return (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000; }} function colorDifference(rgb1, rgb2) {{ return (Math.max(rgb1[0], rgb2[0]) - Math.min(rgb1[0], rgb2[0])) + (Math.max(rgb1[1], rgb2[1]) - Math.min(rgb1[1], rgb2[1])) + (Math.max(rgb1[2], rgb2[2]) - Math.min(rgb1[2], rgb2[2])); }} function reset(toDefault) {{ var changed = false; if (toDefault) {{ document.getElementById("{$ui:SHOWEBNF}").checked = true; document.getElementById("{$ui:ELIMINATERECURSION}").checked = true; document.getElementById("{$ui:FACTORING}").checked = true; document.getElementById("{$ui:INLINE}").checked = true; setRgb("{$style:default-color}", true); document.getElementById("width").value = {$s:page-width}; document.getElementsByName("spread")[0].value = 0; }} else {{ document.getElementById("{$ui:SHOWEBNF}").checked = {ui:options() = $ui:SHOWEBNF}; document.getElementById("{$ui:ELIMINATERECURSION}").checked = {ui:options() = $ui:ELIMINATERECURSION}; document.getElementById("{$ui:FACTORING}").checked = {ui:options() = $ui:FACTORING}; document.getElementById("{$ui:INLINE}").checked = {ui:options() = $ui:INLINE}; setRgb(oldColor, true); document.getElementById("width").value = {ui:parameter-values("width", string($s:page-width))}; document.getElementsByName("spread")[0].value = oldSpread; }} setCookies(); changeText(); }} </script> }; (:~ : Return content of WELCOME tab : : @return the div element containing the WELCOME tab content. :) declare function ui:welcome-tab() as element(xhtml:div) { <div style="display:block; max-width: 768px; overflow: hidden;" xmlns="http://www.w3.org/1999/xhtml"> <p> <b>Welcome to Railroad Diagram Generator!</b> </p> <p> This is a tool for creating <a target="_blank" href="http://en.wikipedia.org/wiki/Syntax_diagram">syntax diagrams</a>, also known as railroad diagrams, from <a target="_blank" href="http://en.wikipedia.org/wiki/Context-free_grammar">context-free grammars</a> specified in <a target="_blank" href="http://en.wikipedia.org/wiki/EBNF">EBNF</a>. Syntax diagrams have been used for decades now, so the concept is well-known, and some tools for diagram generation are in existence. The features of this one are <ul> <li>usage of the <a target="_blank" href="http://www.w3.org/">W3C</a>'s EBNF notation,</li> <li>web-scraping of grammars from W3C specifications,</li> <li>online editing of grammars,</li> <li>diagram presentation in <a target="_blank" href="http://www.w3.org/Graphics/SVG/">SVG</a>,</li> <li> and it was completely written in web languages (<a target="_blank" href="http://en.wikipedia.org/wiki/XQuery">XQuery</a>, <a target="_blank" href="http://en.wikipedia.org/wiki/XHTML">XHTML</a>, <a target="_blank" href="http://en.wikipedia.org/wiki/Cascading_Style_Sheets">CSS</a>, <a target="_blank" href="http://en.wikipedia.org/wiki/JavaScript">JavaScript</a>). </li> </ul> </p> <b>Notation</b> <p> For the original description of the EBNF notation as it is used here, please refer to "<a target="_blank" href="http://www.w3.org/TR/2010/REC-xquery-20101214/#EBNFNotation">A.1.1 Notation</a>" in the <a target="_blank" href="http://www.w3.org/TR/2010/REC-xquery-20101214/">XQuery recommendation</a>. The <a target="_blank" href="http://www.w3.org/TR/xml/">XML recommendation</a> contains a similar section, "<a target="_blank" href="http://www.w3.org/TR/xml/#sec-notation">6 Notation</a>". Below is a self-describing grammar for the EBNF notation. </p> <p><div class="grammar">{e:notation()}</div></p> <p> For viewing railroad diagrams of this very grammar, either <ul> <li>select "EBNF Notation" from the "Get Grammar" tab,</li> <li>or copy and paste the above grammar to the "Edit Grammar" tab,</li> </ul> and then proceed to the "View Diagram" tab. Or just click <a href="javascript:selfDescribe()">here</a> for a shortcut. </p> <b>Download</b> <p> This application can be run offline, both browser-based, and as a command-line application. It comes as a Java executable archive and can be run with Java {$s:java-version} (or higher). </p> <p> This is the download link: <a href="download/rr-{$s:version}-java{$s:java-version}.zip"><span id="download-link"></span></a> <script type="text/javascript"> var url = document.location.href; var link = document.getElementById("download-link"); link.innerHTML = url.substring(0, url.lastIndexOf("/") + 1) + "download/rr-{$s:version}-java{$s:java-version}.zip"; </script> </p> <b>Source Code</b> <p> The source code of this application is available on GitHub: <a href="https://github.com/GuntherRademacher/rr">https://github.com/GuntherRademacher/rr</a> </p> </div> }; (:~ : Return spinner to be shown while waiting for server requests. : : @param $color the color code. : @return a sequence of XHTML and SVG elements making up the spinner. :) declare function ui:spinner($color as xs:string) { let $svg-width := 100 let $svg-height := 100 let $sectors := 36 let $colors := $sectors idiv 3 * 2 let $l0 := 0.2 let $l1 := 0.90 let $l2 := ($l1 - $l0) div $colors let $sector-color := for $i in 1 to $sectors let $sector := $sectors + 1 - $i return if ($sector > $colors) then c:relative-color($color, 0.7, $l1) else c:relative-color($color, 0.7, $l0 + ($sector - 1) * $l2) let $r1 := ($svg-width - 2) div 2 let $r2 := ($svg-width - 2) div 5 let $x0 := 1 + $r1 let $y0 := 1 + $r1 let $angle := 360 div $sectors let $stroke := $angle * 0.25 return ( <div id="greyout" xmlns="http://www.w3.org/1999/xhtml" style="display:none" onclick="this.style.display = 'none'"/>, <svg id="spinner" xmlns="http://www.w3.org/2000/svg" width="{$svg-width}" height="{$svg-height}" style="display:none"> { for $sector in 1 to $sectors let $a1 := (($sector - 1) * $angle + $stroke) div 180 * math:pi() let $a2 := ($sector * $angle - $stroke) div 180 * math:pi() let $s1 := math:sin($a1) let $c1 := math:cos($a1) let $s2 := math:sin($a2) let $c2 := math:cos($a2) let $x1 := $x0 + $r1 * $s1 let $y1 := $y0 - $r1 * $c1 let $x2 := $x0 + $r1 * $s2 let $y2 := $y0 - $r1 * $c2 let $x3 := $x0 + $r2 * $s2 let $y3 := $y0 - $r2 * $c2 let $x4 := $x0 + $r2 * $s1 let $y4 := $y0 - $r2 * $c1 return <path id="sector" d="M {$x1},{$y1} A {$r1},{$r1} 0 0 1 {$x2},{$y2} L {$x3},{$y3} A {$r2},{$r2} 0 0 0 {$x4},{$y4} Z" style="fill: {$sector-color[$sector]}; stroke: none;"/> } </svg>, <script type="text/javascript" xmlns="http://www.w3.org/1999/xhtml"> var colors = ["{string-join($sector-color, """, """)}"]; var sectors = document.getElementById("spinner").getElementsByTagNameNS("http://www.w3.org/2000/svg", "path"); var spinning = 0; var greyout = document.getElementById("greyout"); var spinner = document.getElementById("spinner"); function resizeSpinner() {{ if (spinning &gt; 0) {{ var height = window.innerHeight; greyout.setAttribute("style", "background-color: {c:relative-color($color, 1.0, 0.91)}; opacity: 0.7; height: " + height + "px; width: 100%; position:absolute; top: 0px; left: 0px;"); var left = Math.round(window.pageXOffset + (window.innerWidth - {$svg-width}) / 2); var top = Math.round(window.pageYOffset + (window.innerHeight - {$svg-height}) / 2); spinner.style.position = "absolute"; spinner.style.top = top + "px"; spinner.style.left = left + "px"; spinner.style.display = ""; }} }} function startSpinning() {{ if (spinning == 0) {{ spin(0); }} }} function stopSpinning() {{ if (spinning) {{ spinning = -1; }} }} function spin(color) {{ if (spinning &lt; 0) {{ spinning = 0; spinner.style.display = "none"; greyout.style.display = "none"; }} else {{ if (spinning == 0) {{ spinning = 1; resizeSpinner(); }} for (var s = {$sectors - 1}; s >= 0; --s) {{ sectors[(color + s) % {$sectors}].setAttribute("style", "fill:" + colors[s] + "; opacity: 0.6"); }} window.setTimeout("spin((" + (color + 1) + ") % {$sectors})", {40}); }} }} </script> ) }; (:~ : Perform the "SAVE" task. : : @return the exitor text content as a plain text result, along with : appropriate HTTP header settings identifying it as an attachment. :) declare function ui:save() as xs:string { webapp:set-content-type("text/plain"), webapp:set-header("Content-Disposition", concat("attachment; filename=", ui:name("grammar", ".ebnf"))), webapp:set-serialization-parameters ( <output:serialization-parameters xmlns:output="http://www.w3.org/2010/xslt-xquery-serialization"> <output:encoding value="UTF-8"/> <output:indent value="no"/> <output:method value="text"/> <output:omit-xml-declaration value="yes"/> <output:version value="1.0"/> </output:serialization-parameters> ), webapp:parameter-values("text") }; (:~ : Process an "EDIT" or "VIEW" task. If there is a non-empty HTTP "uri" : parameter, extract grammar from that URI. Get syntax diagram, when : processing a "VIEW" task. Return user interface page equipped appropriately. : : @param $task the task to be processed. : @param $color the color code. : @return the user interface XHTML page containing the required : information. :) declare function ui:process($task, $color) as element() { let $uri := webapp:parameter-values("uri") let $ebnf := if (not($uri != "")) then text {(webapp:parameter-values("text"), webapp:parameter-values("ebnf"))[1]} else if (ends-with(replace($uri, "[#?].*$", ""), replace(webapp:request-uri(), '/+', '/'))) then e:extract($uri, e:notation(), xs:integer(webapp:parameter-values("tz"))) else let $response := http-client:send-request((), $uri) return if (not($response[1]/@status = 200)) then (: check HTTP OK status :) ( element xhtml:pre { "error: received response", data($response[1]/@status), "from HTTP GET request (URI:", concat($uri, "):") }, for $r in $response return ( <br/>, element xhtml:code { if ($r instance of node()) then ui:serialize($r) else $r } ) ) else if (not($response[2] instance of node())) then element xhtml:pre { "error: there is no XML or HTML document at", $uri, '&#xA;For processing a plain grammar link, proceed to the "Edit Grammar" tab and use "Load".' } else e:extract($uri, $response[2], xs:integer(webapp:parameter-values("tz"))) let $precomputed := if ($ebnf/self::xhtml:pre) then () else () let $svg := if ($ebnf/self::xhtml:pre) then $ebnf else if (exists($precomputed)) then () else if ($task != $ui:VIEW) then () else if (not(webapp:parameter-values("frame") = "diagram")) then () else ui:parse($ebnf, $color) return if ($svg/self::xhtml:pre) then ui:html($ui:VIEW, $ebnf[not($ebnf/self::xhtml:pre)], false(), $svg, $precomputed, $color) else ui:html($task[1], $ebnf, $ebnf != "" and empty($svg) and empty($precomputed), $svg, $precomputed, $color) }; (:~ : Determine name of current grammar from the "uri" parameter, : the "file" parameter, or the "name" parameter, in this order, : whichever is found non-empty first. : : @return the name. :) declare function ui:name($default-name, $forced-extension) as xs:string? { let $name := ( let $uri := webapp:parameter-values("uri") where $uri != "" return replace($uri, "^.*/([^/]+)/?$", "$1"), if (webapp:method-get()) then () else if (webapp:part-names() = "file") then tokenize(translate(webapp:part("file")/webapp:body/@webapp:filename, "\", "/"), "/")[last()] else (), webapp:parameter-values($ui:NAME), $default-name )[. != ""][1] return if ($forced-extension) then concat(replace($name, "\.[^.]*$", ""), $forced-extension) else $name }; (:~ : Parse grammar, convert concrete syntax tree to AST, and AST : to SVG. : : @param $ebnf the grammar as a string. : @param $color the color code. : @return the SVG result, or an xhtml:pre node in case of any errors. :) declare function ui:parse($ebnf as xs:string, $color as xs:string) as node()+ { let $parse-tree := p:parse-Grammar($ebnf) return if ($parse-tree instance of element(Grammar)) then let $options := ui:options() let $grammar := t:transform ( a:ast($parse-tree), if ($options = $ui:ELIMINATERECURSION) then "full" else "none", if ($options = $ui:FACTORING) then "full-left" else "none", $options = $ui:INLINE, $options = $ui:KEEP ) return s:svg (: convert to AST, then to SVG :) ( $grammar, $options = $ui:SHOWEBNF, xs:integer(webapp:parameter-values("width")), $color, xs:integer((webapp:parameter-values("spread"), "0")[.][1]), ( webapp:parameter-values("myUri0")[.], "https://www.bottlecaps.de/rr/ui" )[1] ) else element xhtml:pre (: report error :) { "error:"[not($parse-tree instance of element(ERROR))], data($parse-tree) } }; (:~ : Perform the "LOAD" task. Get content of "file" HTTP : parameter, check for valid encoding and return the user : interface page with the content installed in the : editor. : : @param $color the color code. : @return the uses interface XHTML page. :) declare function ui:load($color as xs:string) as element(xhtml:html) { let $filename := string(webapp:part("file")/webapp:body/@webapp:filename) let $text := ui:decode-base64(webapp:binary-file($filename)) return if (ui:has-valid-encoding($text)) then ui:html($ui:EDIT, ui:strip-bom($text), true(), (), (), $color) else ui:html($ui:VIEW, (), false(), <xhtml:pre>error: unsupported encoding</xhtml:pre>, (), $color) }; (:~ : Check whether a given string has all valid codepoints. : : @param $content the string. : @return true, if the string has only valid codepoints. :) declare function ui:has-valid-encoding($content as xs:string) as xs:boolean { empty(string-to-codepoints($content)[not(. = (9, 10, 13) or . >= 20 and . <= 55295 or . >= 57344 and . <= 65533 or . >= 65536 and . <= 1114111)]) }; (:~ : Strip an UTF-16 byte order mark from the beginning of a string. A byte : order mark may result from uploading some file (most probably from : a Windows client). : : @param $s the string. : @return the string, freed from a leading byte order mark, if one was : present. :) declare function ui:strip-bom($s as xs:string) as xs:string { if (starts-with($s, "&#xFEFF;")) then substring($s, 2) else $s }; (:~ : Construct this application's logo. : : @return an xhtml:div element containing the logo. :) declare function ui:logo() as element(xhtml:div) { <div style="position:absolute; right:5px; top:0px;" xmlns="http://www.w3.org/1999/xhtml"> <table border="0"> <tr> <td class="small"><span class="hidden">response time</span><br/><span id="timeDisplay" class="hidden">will be shown here</span></td> <td style="font-weight:bold; font-family:Arial, Sans-serif; line-height:130%; padding-top: 2px;"> <span style="font-size: 25px;">Railroad</span><br/> <span style="font-size: 25px;">Diagram</span><br/> <span style="font-size: 21px;">Generator</span> </td> <td>{s:traffic-sign(70)}</td> <td class="small"> v{$s:version} <br />built {$s:date} <br /> <br />written by <br />Gunther Rademacher <br /><a href="mailto:[email protected]" title="[email protected]">[email protected]</a> </td> </tr> </table> </div> }; (:~ : Get base color from http parameter or cookie. : : @return the base color. :) declare function ui:color() as xs:string { let $color := normalize-space(ui:parameter-values("color", ())[1]) return if (exists(c:color-code($color))) then $color else $style:default-color }; (:~ : The color argument for get URIs. : : @param $delimiter the delimiter to be prepended to the result string. : @return the color argument string. :) declare function ui:color-arg($delimiter as xs:string) as xs:string? { let $color := ui:color() where not($color eq $style:default-color) return if (starts-with($color, "#")) then concat($delimiter, "color=%23", substring($color, 2)) else concat($delimiter, "color=", string($color)) }; (:~ : Set content-type of response to XHTML. : : @return empty. :) declare function ui:xhtml($indent as xs:boolean) as item()* { webapp:set-content-type("application/xhtml+xml"), webapp:set-serialization-parameters ( <output:serialization-parameters xmlns:output="http://www.w3.org/2010/xslt-xquery-serialization"> <output:encoding value="UTF-8"/> <output:indent value="{if ($indent) then "yes" else "no"}"/> <output:method value="xhtml"/> <output:omit-xml-declaration value="yes"/> <output:version value="1.0"/> <output:doctype-system value="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/> <output:doctype-public value="-//W3C//DTD XHTML 1.0 Transitional//EN"/> </output:serialization-parameters> ) }; (:~ : Download diagram as XHTML. The diagram is passed in HTTP parameter xhtml in : unparsed XHTML. : : @return the diagram as parsed XHTML. :) declare function ui:download-xhtml() as xs:string { webapp:set-serialization-parameters ( <output:serialization-parameters xmlns:output="http://www.w3.org/2010/xslt-xquery-serialization"> <output:encoding value="UTF-8"/> <output:method value="text"/> </output:serialization-parameters> ), webapp:set-content-type("application/xhtml+xml"), webapp:set-header("Content-Disposition", concat("attachment; filename=", ui:name("diagram", ".xhtml"))), webapp:parameter-values("xhtml") }; (:~ : Download diagram as Markdown. The diagram is passed in HTTP parameter xhtml as : unparsed XHTML. : : @return the diagram as Markdown with inline SVG. :) declare function ui:download-md() as xs:string { webapp:set-serialization-parameters ( <output:serialization-parameters xmlns:output="http://www.w3.org/2010/xslt-xquery-serialization"> <output:encoding value="UTF-8"/> <output:method value="text"/> </output:serialization-parameters> ), webapp:set-content-type("text/markdown; charset=UTF-8"), webapp:set-header("Content-Disposition", concat("attachment; filename=", ui:name("diagram", ".md"))), m:transform(ui:parse-xml(webapp:parameter-values("xhtml")[1])) }; (:~ : Download zipped PNG diagrams. The diagram is passed in HTTP parameter xhtml in : unparsed XHTML. : : @return the zip file. :) declare function ui:download-zip() { webapp:set-content-type("application/zip"), webapp:set-header("Content-Disposition", concat("attachment; filename=", ui:name("diagram", ".zip"))), ui:xhtml-to-zip(webapp:parameter-values("xhtml")[1]) }; (:~ : Serialize node sequence to string. : : @param $nodes the node sequence. : @return the string. :) declare function ui:serialize($nodes as node()*) as xs:string { string-join ( for $node in $nodes return typeswitch ($node) case document-node() return ("<?xml version=""1.0""?>", ui:serialize($node/node())) case element() return ( "<", string(node-name($node)), for $p in in-scope-prefixes($node) let $parent := $node/parent::* where $p != "xml" and (empty($parent) or not(namespace-uri-for-prefix($p, $node) eq namespace-uri-for-prefix($p, $parent))) order by $p return ( " xmlns", ":"[$p], $p[.], "=""", namespace-uri-for-prefix($p, $node), """" ), ui:serialize($node/@*), if (empty($node/node())) then "/>" else (">", ui:serialize($node/node()), "</", string(node-name($node)), ">") ) case attribute() return (" ", string(node-name($node)), "=""", replace(string($node), """", "&amp;quot:"), """") case processing-instruction() return ("<?", local-name($node), if (string($node) = "") then () else (" ", string($node)), "?>") case comment() return ("<!--", string($node), "-->") default return replace(replace($node, "<", "&amp;lt;"), ">", "&amp;gt;"), "" ) }; (:~ : Get options parameter values from HTTP servlet request or cookie. : : @param $name the parameter name. : @return the parameter values. :) declare function ui:options() as xs:string* { ui:parameter-values("options", ($ui:SHOWEBNF, $ui:ELIMINATERECURSION, $ui:FACTORING, $ui:INLINE, $ui:KEEP)) }; (:~ : Get parameter values from HTTP servlet request or cookie. : : @param $name the parameter name. : @param $default the default value. : @return the parameter values. :) declare function ui:parameter-values($name as xs:string, $default as xs:string*) as xs:string* { let $values := webapp:parameter-values($name) return if (exists($values)) then $values (: else if (not(webapp:method-get())) then $default :) else let $values := webapp:get-cookie($name)[1] return if (exists($values)) then tokenize($values, "\+") else $default };
XQuery
5
bannmann/rr
src/main/resources/de/bottlecaps/railroad/xq/user-interface.xq
[ "Apache-2.0" ]
/* * "streamable kanji code filter and converter" * Copyright (c) 1998-2002 HappySize, Inc. All rights reserved. * * LICENSE NOTICES * * This file is part of "streamable kanji code filter and converter", * which is distributed under the terms of GNU Lesser General Public * License (version 2) as published by the Free Software Foundation. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with "streamable kanji code filter and converter"; * if not, write to the Free Software Foundation, Inc., 59 Temple Place, * Suite 330, Boston, MA 02111-1307 USA * * The author of this file: * */ #ifndef CP932_TABLE_H #define CP932_TABLE_H /* * cp932 table */ static const unsigned short cp932ext3_eucjp_table[] = { /* ku 115 */ 0xF3F3,0xF3F4,0xF3F5,0xF3F6,0xF3F7,0xF3F8,0xF3F9,0xF3FA, 0xF3FB,0xF3FC,0xF3FD,0xF3FE,0xF4A1,0xF4A2,0xF4A3,0xF4A4, 0xF4A5,0xF4A6,0xF4A7,0xF4A8,0x224C,0xA2C3,0xF4A9,0xF4AA, 0xF4AB,0xF4AC,0xF4AD,0x2268,0xD4E3,0xDCDF,0xE4E9,0xE3F8, 0xD9A1,0xB1BB,0xF4AE,0xC2AD,0xC3FC,0xE4D0,0xC2BF,0xBCF4, 0xB0A9,0xB0C8,0xF4AF,0xB0D2,0xB0D4,0xB0E3,0xB0EE,0xB1A7, 0xB1A3,0xB1AC,0xB1A9,0xB1BE,0xB1DF,0xB1D8,0xB1C8,0xB1D7, 0xB1E3,0xB1F4,0xB1E1,0xB2A3,0xF4B0,0xB2BB,0xB2E6,0xB2ED, 0xB2F5,0xB2FC,0xF4B1,0xB3B5,0xB3D8,0xB3DB,0xB3E5,0xB3EE, 0xB3FB,0xF4B2,0xF4B3,0xB4C0,0xB4C7,0xB4D0,0xB4DE,0xF4B4, 0xB5AA,0xF4B5,0xB5AF,0xB5C4,0xB5E8,0xF4B6,0xB7C2,0xB7E4, 0xB7E8,0xB7E7,0xF4B7,0xF4B8,0xF4B9,0xB8CE, /* ku 116 */ 0xB8E1,0xB8F5,0xB8F7,0xB8F8,0xB8FC,0xB9AF,0xB9B7,0xBABE, 0xBADB,0xCDAA,0xBAE1,0xF4BA,0xBAEB,0xBBB3,0xBBB8,0xF4BB, 0xBBCA,0xF4BC,0xF4BD,0xBBD0,0xBBDE,0xBBF4,0xBBF5,0xBBF9, 0xBCE4,0xBCED,0xBCFE,0xF4BE,0xBDC2,0xBDE7,0xF4BF,0xBDF0, 0xBEB0,0xBEAC,0xF4C0,0xBEB3,0xBEBD,0xBECD,0xBEC9,0xBEE4, 0xBFA8,0xBFC9,0xC0C4,0xC0E4,0xC0F4,0xC1A6,0xF4C1,0xC1F5, 0xC1FC,0xF4C2,0xC1F8,0xC2AB,0xC2A1,0xC2A5,0xF4C3,0xC2B8, 0xC2BA,0xF4C4,0xC2C4,0xC2D2,0xC2D7,0xC2DB,0xC2DE,0xC2ED, 0xC2F0,0xF4C5,0xC3A1,0xC3B5,0xC3C9,0xC3B9,0xF4C6,0xC3D8, 0xC3FE,0xF4C7,0xC4CC,0xF4C8,0xC4D9,0xC4EA,0xC4FD,0xF4C9, 0xC5A7,0xC5B5,0xC5B6,0xF4CA,0xC5D5,0xC6B8,0xC6D7,0xC6E0, 0xC6EA,0xC6E3,0xC7A1,0xC7AB,0xC7C7,0xC7C3, /* ku 117 */ 0xC7CB,0xC7CF,0xC7D9,0xF4CB,0xF4CC,0xC7E6,0xC7EE,0xC7FC, 0xC7EB,0xC7F0,0xC8B1,0xC8E5,0xC8F8,0xC9A6,0xC9AB,0xC9AD, 0xF4CD,0xC9CA,0xC9D3,0xC9E9,0xC9E3,0xC9FC,0xC9F4,0xC9F5, 0xF4CE,0xCAB3,0xCABD,0xCAEF,0xCAF1,0xCBAE,0xF4CF,0xCBCA, 0xCBE6,0xCBEA,0xCBF0,0xCBF4,0xCBEE,0xCCA5,0xCBF9,0xCCAB, 0xCCAE,0xCCAD,0xCCB2,0xCCC2,0xCCD0,0xCCD9,0xF4D0,0xCDBB, 0xF4D1,0xCEBB,0xF4D2,0xCEBA,0xCEC3,0xF4D3,0xCEF2,0xB3DD, 0xCFD5,0xCFE2,0xCFE9,0xCFED,0xF4D4,0xF4D5,0xF4D6,0xF4D7, 0xD0E5,0xF4D8,0xD0E9,0xD1E8,0xF4D9,0xF4DA,0xD1EC,0xD2BB, 0xF4DB,0xD3E1,0xD3E8,0xD4A7,0xF4DC,0xF4DD,0xD4D4,0xD4F2, 0xD5AE,0xF4DE,0xD7DE,0xF4DF,0xD8A2,0xD8B7,0xD8C1,0xD8D1, 0xD8F4,0xD9C6,0xD9C8,0xD9D1,0xF4E0,0xF4E1, /* ku 118 */ 0xF4E2,0xF4E3,0xF4E4,0xDCD3,0xDDC8,0xDDD4,0xDDEA,0xDDFA, 0xDEA4,0xDEB0,0xF4E5,0xDEB5,0xDECB,0xF4E6,0xDFB9,0xF4E7, 0xDFC3,0xF4E8,0xF4E9,0xE0D9,0xF4EA,0xF4EB,0xE1E2,0xF4EC, 0xF4ED,0xF4EE,0xE2C7,0xE3A8,0xE3A6,0xE3A9,0xE3AF,0xE3B0, 0xE3AA,0xE3AB,0xE3BC,0xE3C1,0xE3BF,0xE3D5,0xE3D8,0xE3D6, 0xE3DF,0xE3E3,0xE3E1,0xE3D4,0xE3E9,0xE4A6,0xE3F1,0xE3F2, 0xE4CB,0xE4C1,0xE4C3,0xE4BE,0xF4EF,0xE4C0,0xE4C7,0xE4BF, 0xE4E0,0xE4DE,0xE4D1,0xF4F0,0xE4DC,0xE4D2,0xE4DB,0xE4D4, 0xE4FA,0xE4EF,0xE5B3,0xE5BF,0xE5C9,0xE5D0,0xE5E2,0xE5EA, 0xE5EB,0xF4F1,0xF4F2,0xF4F3,0xE6E8,0xE6EF,0xE7AC,0xF4F4, 0xE7AE,0xF4F5,0xE7B1,0xF4F6,0xE7B2,0xE8B1,0xE8B6,0xF4F7, 0xF4F8,0xE8DD,0xF4F9,0xF4FA,0xE9D1,0xF4FB, /* ku 119 */ 0xE9ED,0xEACD,0xF4FC,0xEADB,0xEAE6,0xEAEA,0xEBA5,0xEBFB, 0xEBFA,0xF4FD,0xECD6,0xF4FE }; static const int cp932ext3_eucjp_table_size = (sizeof (cp932ext3_eucjp_table) / sizeof (unsigned short)); #endif /* CP932_TABLE_H */
C
4
thiagooak/php-src
ext/mbstring/libmbfl/filters/cp932_table.h
[ "PHP-3.01" ]
# Copyright (c) 2019 The Fyde OS Authors. All rights reserved. # Distributed under the terms of the BSD EAPI="5" inherit appid DESCRIPTION="empty project" HOMEPAGE="https://fydeos.io" LICENSE="BSD" SLOT="0" KEYWORDS="*" IUSE="" RDEPEND="" DEPEND="${RDEPEND}" S="${WORKDIR}" src_install() { doappid "{AAE6576A-210F-45B2-ACF4-F00C21E886E7}" "CHROMEBOX" }
Gentoo Ebuild
3
rovinyu/chromium_os_for_raspberry_pi
overlay-rpi4-fydeos/chromeos-base/device-appid/device-appid-0.0.2.ebuild
[ "BSD-2-Clause" ]
#include "clustering/administration/main/path.hpp" #include "errors.hpp" #include <boost/tokenizer.hpp> static const char *const unix_path_separator = "/"; path_t parse_as_path(const std::string &path) { path_t res; res.is_absolute = (path[0] == unix_path_separator[0]); typedef boost::tokenizer<boost::char_separator<char> > tokenizer; boost::char_separator<char> sep(unix_path_separator); tokenizer tokens(path, sep); res.nodes.assign(tokens.begin(), tokens.end()); return res; } std::string render_as_path(const path_t &path) { std::string res; for (std::vector<std::string>::const_iterator it = path.nodes.begin(); it != path.nodes.end(); ++it) { if (it != path.nodes.begin() || path.is_absolute) { res += unix_path_separator; } res += *it; } return res; }
C++
4
zadcha/rethinkdb
src/clustering/administration/main/path.cc
[ "Apache-2.0" ]
# DO NOT EDIT THIS FILE. This file will be overwritten when re-running go-raml. @0xadb1cec69aebda21; struct Animal { colours @0 :List(Text); name @1 :Text; }
Cap'n Proto
4
mrpotes/go-raml
codegen/capnp/fixtures/struct/vanilla/Animal.capnp
[ "BSD-2-Clause" ]
import { generateUtilityClasses, generateUtilityClass } from '@mui/base'; export interface FilledInputClasses { /** Styles applied to the root element. */ root: string; /** Styles applied to the root element if color secondary. */ colorSecondary: string; /** Styles applied to the root element unless `disableUnderline={true}`. */ underline: string; /** State class applied to the root element if the component is focused. */ focused: string; /** State class applied to the root element if `disabled={true}`. */ disabled: string; /** Styles applied to the root element if `startAdornment` is provided. */ adornedStart: string; /** Styles applied to the root element if `endAdornment` is provided. */ adornedEnd: string; /** State class applied to the root element if `error={true}`. */ error: string; /** Styles applied to the input element if `size="small"`. */ sizeSmall: string; /** Styles applied to the root element if `multiline={true}`. */ multiline: string; /** Styles applied to the root element if `hiddenLabel={true}`. */ hiddenLabel: string; /** Styles applied to the input element. */ input: string; /** Styles applied to the input element if `size="small"`. */ inputSizeSmall: string; /** Styles applied to the `input` if in `<FormControl hiddenLabel />`. */ inputHiddenLabel: string; /** Styles applied to the input element if `multiline={true}`. */ inputMultiline: string; /** Styles applied to the input element if `startAdornment` is provided. */ inputAdornedStart: string; /** Styles applied to the input element if `endAdornment` is provided. */ inputAdornedEnd: string; } export type FilledInputClassKey = keyof FilledInputClasses; export function getFilledInputUtilityClass(slot: string): string { return generateUtilityClass('MuiFilledInput', slot); } const filledInputClasses: FilledInputClasses = generateUtilityClasses('MuiFilledInput', [ 'root', 'colorSecondary', 'underline', 'focused', 'disabled', 'adornedStart', 'adornedEnd', 'error', 'sizeSmall', 'multiline', 'hiddenLabel', 'input', 'inputSizeSmall', 'inputHiddenLabel', 'inputMultiline', 'inputAdornedStart', 'inputAdornedEnd', ]); export default filledInputClasses;
TypeScript
5
qwaszx7003/material-ui
packages/mui-material/src/FilledInput/filledInputClasses.ts
[ "MIT" ]
#!/bin/bash # Copyright 2020 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. set -e set -x cd "${KOKORO_ROOT}/" sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 PYTHON_BINARY="/usr/bin/python3.9" "${PYTHON_BINARY}" -m venv venv source venv/bin/activate # Check the python version python --version python3 --version cd "src/github/keras" # Keep pip version at 20.1.1 to avoid the slow resolver issue. pip install -U pip==20.1.1 setuptools pip install -r requirements.txt # Uninstall the keras-nightly package so that we will only test the version of # keras code from local workspace. pip uninstall -y keras-nightly export LD_LIBRARY_PATH="/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64" export TF_CUDA_COMPUTE_CAPABILITIES=6.0 TF_CUDA_CONFIG_REPO="@ubuntu16.04-py3-gcc7_manylinux2010-cuda10.1-cudnn7-tensorrt6.0_config_cuda" tag_filters="gpu,-no_gpu,-nogpu,-benchmark-test,-no_oss,-oss_serial,-no_gpu_presubmit" # There are only 4 GPU available on the local test machine. TF_GPU_COUNT=4 TF_TESTS_PER_GPU=8 LOCAL_TEST_JOBS=32 # TF_GPU_COUNT * TF_TESTS_PER_GPU # TODO(scottzhu): Using --define=use_fast_cpp_protos=false to suppress the # protobuf build issue for now. We should have a proper solution for this. bazel test --test_timeout 300,600,1200,3600 --test_output=errors --keep_going \ --define=use_fast_cpp_protos=false \ --build_tests_only \ --action_env=TF_CUDA_COMPUTE_CAPABILITIES="${TF_CUDA_COMPUTE_CAPABILITIES}" \ --action_env=TF_CUDA_CONFIG_REPO="${TF_CUDA_CONFIG_REPO}" \ --action_env=TF_CUDA_VERSION=10 \ --action_env=TF_CUDNN_VERSION=7 \ --test_env=TF_GPU_COUNT=${TF_GPU_COUNT} \ --test_env=TF_TESTS_PER_GPU=${TF_TESTS_PER_GPU} \ --build_tag_filters="${tag_filters}" \ --test_tag_filters="${tag_filters}" \ --run_under=@org_keras//keras/tools/gpu_build:parallel_gpu_execute \ --local_test_jobs=${LOCAL_TEST_JOBS} \ --nodistinct_host_configuration \ -- //keras/...
Shell
4
tsheaff/keras
keras/kokoro/github/ubuntu/gpu/build.sh
[ "Apache-2.0" ]
require go-cross.inc require go-${PV}.inc
BitBake
0
cmonr/meta-pelion-edge
recipes-devtools/go/go-cross_1.14.bb
[ "Apache-2.0" ]
stocks options load aapl exp 0 payoff list pick long add 20 add 15 add 10 -p sop plot exit
Gosu
1
minhhoang1023/GamestonkTerminal
scripts/test_stocks_options_payoff.gst
[ "MIT" ]
[Exposed=Window, HTMLConstructor] interface HTMLPreElement : HTMLElement { // also has obsolete members }; partial interface HTMLPreElement { [CEReactions, Reflect] attribute long width; };
WebIDL
3
corsarstl/Learn-Vue-2
vue-testing/node_modules/jsdom/lib/jsdom/living/nodes/HTMLPreElement.webidl
[ "MIT" ]
public org.apache.skywalking.oap.server.core.storage.StorageData storage2Entity(java.util.Map dbMap) { ${metricsClassPackage}${metricsName}Metrics metrics = new ${metricsClassPackage}${metricsName}Metrics(); <#list fieldsFromSource as field> <#if field.typeName == "long" || field.typeName == "int" || field.typeName == "double" || field.typeName == "float"> metrics.${field.fieldSetter}(((Number)dbMap.get("${field.columnName}")).${field.typeName}Value()); <#elseif field.typeName == "java.lang.String"> metrics.${field.fieldSetter}((String)dbMap.get("${field.columnName}")); <#else> metrics.${field.fieldSetter}(new ${field.typeName}((String)dbMap.get("${field.columnName}"))); </#if> </#list> <#list persistentFields as field> <#if field.typeName == "long" || field.typeName == "int" || field.typeName == "double" || field.typeName == "float"> metrics.${field.fieldSetter}(((Number)dbMap.get("${field.columnName}")).${field.typeName}Value()); <#elseif field.typeName == "java.lang.String"> metrics.${field.fieldSetter}((String)dbMap.get("${field.columnName}")); <#else> metrics.${field.fieldSetter}(new ${field.typeName}((String)dbMap.get("${field.columnName}"))); </#if> </#list> return metrics; }
FreeMarker
3
iIdiomatic/skywalking
oap-server/oal-rt/src/main/resources/code-templates/metrics-builder/storage2Entity.ftl
[ "Apache-2.0", "BSD-3-Clause" ]
browserify = require 'browserify' b = browserify(extensions: ['.pogo']) b.transform 'pogoify' glob = require 'glob' specs = glob './test/*Spec.*' ^!.concat (glob './test/parser/*Spec.*' ^!) for each @(spec) in (specs) b.add (spec) b.bundle().pipe(process.stdout)
PogoScript
2
featurist/pogoscript
tools/bundlePogoTests.pogo
[ "BSD-2-Clause" ]
// compile // Copyright 2015 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Issue 10654: Failure to use generated temps // for function calls etc. in boolean codegen. package main var s string func main() { if (s == "this") != (s == "that") { } }
Go
3
Havoc-OS/androidprebuilts_go_linux-x86
test/fixedbugs/issue10654.go
[ "BSD-3-Clause" ]
{ "name": "nw", "main": "index.html", "nodejs": true, "node-remote": [ "http://localhost:{port}/" ], "window": { "width": 1280, "height": 720, "resizable": true, "fullscreen": false } }
Smarty
3
frank-dspeed/nw.js
test/sanity/issue7182-cors/package.json.tpl
[ "MIT" ]
/****************************************************************************** Copyright (c) 2015 by SAS Institute Inc., Cary, NC 27513 USA 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. ******************************************************************************/ *******************************************************************************; * VARIOUS SAS AND PYTHON ROUTINES FOR MNIST DATA: ; * CALL PYTHON TO NORMALIZE THE DIGITS ; * VISUALIZE INPUT DIGITS WITH TRANSFORMATIONS ; * CLASSIFY DIGITS WITH A DEEP NEURAL NET ; * CHECK PREDICTIONS ; *******************************************************************************; *** SET WORKING DIRECTORY TO REPO DOWNLOADED FROM GIT; %let git_repo_dir= ; *** SET SYSTEM DIRECTORY SEPARATOR; %let _SYSSCP= %index(&SYSSCP, WIN); data _null_; if &_SYSSCP then call symput('dsep', '\'); else call symput('dsep', '/'); run; *** SET CPU COUNT; %let cpu_count= ; *** SET THE PYTHON COMMAND; %let python_exec_command= ; *** SYSTEM OPTIONS ***********************************************************; %let git_repo_data_dir= &git_repo_dir.&dsep.data; libname l "&git_repo_data_dir"; %let train_set= Digits_train_sample; *** OUTPUT OPTIONS; ods listing close; ods html close; ods html; *** IMAGE PREPROCESSING ******************************************************; *** ESTABLISH FILENAME AND MACRO VAR FOR JAVA CONNECTION TO PYTHON; filename pysubmit "&git_repo_dir.&dsep.digit_preprocess_py.py"; *** EXECUTE PYTHON PREPROCESSING; data _null_; length rtn_val 8; python_script= "%sysfunc(pathname(pysubmit))"; python_call= cat('"', trim(python_script), '" "', trim("&git_repo_data_dir"), '"'); declare javaobj j("dev.SASJavaExec", "&python_exec_command", python_call); j.callIntMethod("executeProcess", rtn_val); run; *** IMPORT PYTHON PREPROCESSED DIGITS INTO SAS FORMAT; proc import out= &train_set datafile= "&git_repo_data_dir.&dsep.digits_train_sample_processed.csv" dbms= csv replace; getnames= yes; datarow= 2; run; data &train_set.; set &train_set.; pic_ID= _n_; run; *** MACROS USED TO VIEW RANDOM DIGITS ****************************************; *** GTL TEMPLATE; ods path show; ods path(prepend) work.templat(update); proc template; /* DEFINE A GRAPH TEMPLATE */ define statgraph contour; dynamic _title; begingraph; entrytitle _title; layout overlayequated / equatetype= square commonaxisopts= (viewmin= 0 viewmax= 26 tickvaluelist= (0 5 10 15 20 25)) xaxisopts= (offsetmin= 0 offsetmax= 0) yaxisopts= (offsetmin= 0 offsetmax= 0); contourplotparm x= x y= y z= z / contourtype= gradient nlevels= 255 colormodel= twocolorramp; endlayout; endgraph; end; run; *** MACROS FOR VEIWING DIGITS; %global _length _nobs _seed; %let _length= 10; %let _nobs= 2000; %let _seed= %sysfunc(floor(%sysfunc(time()))); data _r; length r 8; do i= 1 to &_length; r= floor(&_nobs*ranuni(&_seed)+1); output; end; run; proc sort data= _r; by r; run; data _null_; set _r; call symput(left(compress('rand'||_n_)), r); run; %macro random_digit_string(_length, _nobs); %sysfunc(compress( %do i= 1 %to %eval(&_length - 1); &&rand&i %str(,) %end; &&rand&i )) %mend random_digit_string; %macro view_inputs(DS, DIM); %global _length; %global _nobs; data _xyz; do i= %random_digit_string(&_length, &_nobs); obs= i; set &DS point= obs; array pixels pixel: ; do i= 1 to %eval(&dim*&dim); x= (i-&dim*floor((i-1)/&dim))-1; y= (%eval(&dim+1)-ceil(i/&dim))-1; z= pixels[i]; output; keep pic_ID x y z; end; end; stop; run; proc sgrender data= _xyz template= contour; dynamic _title= "Digit Image"; by pic_ID; run; %mend; %view_inputs(&train_set., 27); *********************************************************************; * RUN TO HERE TO SEE PREPROCESSING RESULTS *; *********************************************************************; %macro view_results(DS, DIM); %global _length; %global _nobs; %let random_digit_string= %random_digit_string(&_length, &_nobs); %let random_digit_string= %sysfunc(tranwrd(%quote(&random_digit_string),%str(,), )); %do i= 1 %to &_length; %let j= %scan(&random_digit_string, &i); data _xyz; set &DS (where= (pic_ID= &j)); array pixels pixel: ; do i= 1 to %eval(&dim*&dim); x= (i-&dim*floor((i-1)/&dim))-1; y= (%eval(&dim+1)-ceil(i/&dim))-1; z= pixels[i]; output; keep pic_ID x y z; end; run; proc sgrender data= _xyz template= contour; dynamic _title= "Input Image"; run; data _p; set &DS (where= (pic_ID= &j) keep= p_: pic_ID); run; proc transpose data= _p (keep= p_:) out= _pt (drop= _name_); run; proc sort data= _pt; by descending col1; run; data _pt; set _pt(obs= 1); label _LABEL_= 'Digit Value'; keep _LABEL_; run; title 'Top Prediction'; proc print data= _pt noobs label; run; title; %end; %mend; *** METADATA PREP FOR TRAINING ***********************************************; *** CREATE MACROS FOR VAR NAMES; *** DROP PIXELS THAT ARE ALWAYS ZERO; proc means data= &train_set (keep= pixel:) noprint; var pixel:; output out= o (keep= _STAT_ pixel: where= (_STAT_= 'MAX')); run; proc transpose data= o out= ot; run; proc sql noprint; select _NAME_ into :inputs separated by ' ' from ot where col1 ne 0; select count(_NAME_) into :n_inputs from ot where col1 ne 0; quit; %let inputs= &inputs; %put inputs= &inputs; %put n_inputs= &n_inputs; *** TRAIN DEEP NEURAL NETWORK ************************************************; *** REQUIRED CATALOG FOR PROC NEURAL; proc dmdb data= &train_set dmdbcat= work.cat_&train_set.; var &inputs; class label; id pic_ID; run; *** REDIRECT LONG LIST OF PARAMETERS; ods html close; ods listing; filename out "%sysfunc(pathname(WORK))\clusterout%sysfunc(compress(%sysfunc(datetime(), datetime23.),:)).txt"; proc printto print= out; run; *** TRAIN DENOISING AUTOENCODER; proc neural data= &train_set dmdbcat= work.cat_&train_set. random= 12345; performance compile details cpucount= &cpu_count threads= yes; netoptions decay= 0.1; /* L2 PENALTY */ archi MLP hidden= 3; hidden &n_inputs / id= h1; hidden %eval(&n_inputs/2) / id= h2; hidden 10 / id= h3; input &inputs / std= no id= i level= int; target label / std= no id= t level= nom; initial infan= 1; prelim 10 preiter= 10; /* TRAIN LAYERS SEPARATELY */ freeze h1->h2; freeze h2->h3; train maxtime= 10000 maxiter= 5000; freeze i->h1; thaw h1->h2; train maxtime= 10000 maxiter= 5000; freeze h1->h2; thaw h2->h3; train maxtime= 10000 maxiter= 5000; /* RETRAIN ALL LAYERS SIMULTANEOUSLY */ thaw i->h1; thaw h1->h2; train maxtime= 10000 maxiter= 5000; score data= &train_set. outfit= &train_set._fit out= &train_set._score role= TRAIN; run; *** RECAPTURE HTML OUTPUT; proc printto; run; ods listing close; ods html; *** PRINT FITTING RESULTS; proc print data= &train_set._fit noobs; run; *** SEE A FEW PREDICTIONS ****************************************************; data &train_set._samp; do i= %random_digit_string(&_length, &_nobs); obs= i; set &train_set._score point= obs; output; end; stop; run; options mprint; %view_results(&train_set._samp, 27);
SAS
5
mikiec84/enlighten-apply
SAS_Neural_PatternRecognition/digit_classifier_advanced.sas
[ "Apache-2.0" ]
'reach 0.1'; 'use strict'; const f = (x, y, ...args) => { return (x + y + args.length); }; assert(f(1,2) == 3); assert(f(1,2,3) == 4); assert(f(1,2,3,4) == 5);
RenderScript
3
chikeabuah/reach-lang
hs/t/y/rest-empty.rsh
[ "Apache-2.0" ]
--TEST-- Bug #65236 (heap corruption in xml parser) --EXTENSIONS-- xml --FILE-- <?php xml_parse_into_struct(xml_parser_create_ns(), str_repeat("<blah>", 1000), $a); echo "Done\n"; ?> --EXPECTF-- Warning: xml_parse_into_struct(): Maximum depth exceeded - Results truncated in %s on line %d Done
PHP
1
NathanFreeman/php-src
ext/xml/tests/bug65236.phpt
[ "PHP-3.01" ]
extends /templates/base block content div ol.breadcrumb li a(href="/editor", data-i18n="editor.main_title") CodeCombat Editors li a(href="/editor/course", data-i18n="editor.course_title") Course Editor li.active | #{view.course.get('name')} - var authorized = !me.get('anonymous'); button.course-tool-button(data-i18n="common.save", disabled=authorized === true ? undefined : "true").btn.btn-primary#save-button Save h3(data-i18n="course.edit_course_title") Edit Course span |: "#{view.course.attributes.name}" .alert.alert-warning Can only edit translations currently #course-treema h3(data-i18n="resources.patches") Patches .patches-view hr
Jade
3
cihatislamdede/codecombat
app/templates/editor/course/edit.jade
[ "CC-BY-4.0", "MIT" ]
new class BitonicSort { new classmethod greaterPowerOfTwoLessThan(n) { for k = 1; k < n; k <<= 1 {} return k >> 1; } new classmethod compare(array, a, b, dir) { if dir { if array[a] > array[b] { array[a].swap(array[b]); } } else { if array[a] < array[b] { array[a].swap(array[b]); } } } new classmethod merge(array, a, l, dir) { if l > 1 { new int m = this.greaterPowerOfTwoLessThan(l); for i = a; i < a + l - m; i++ { this.compare(array, i, i + m, dir); } this.merge(array, a, m, dir); this.merge(array, a + m, l - m, dir); } } new classmethod sort(array, a, l, dir) { if l > 1 { new int m = l // 2; this.sort(array, a, m, not dir); this.sort(array, a + m, l - m, dir); this.merge(array, a, l, dir); } } } @Sort( "Concurrent Sorts", "Bitonic Sort", "Bitonic Sort" ); new function bitonicSortRun(array) { BitonicSort.sort(array, 0, len(array), True); }
Opal
4
thatsOven/sorting-visualizer
sorts/BitonicSort.opal
[ "MIT" ]
fileFormatVersion: 2 guid: 566745c65b224919bb9886aba499be67 timeCreated: 1606459889
Unity3D Asset
0
samisuleman10/open-project-1
UOP1_Project/Assets/Scripts/EditorTools/Editor/ReplaceObject_ContextualHierarchy/ReplacePrefabSearchPopup.cs.meta
[ "Apache-2.0" ]
{ json5A: 5, // some comment d: { json5e: 1, }, }
JSON5
1
MDemetrio/style-dictionary
__tests__/__json_files/shallow/3.json5
[ "Apache-2.0" ]
// check-pass fn check(list: &[u8]) { match list { &[] => {}, &[_u1, _u2, ref _next @ ..] => {}, &[_u1] => {}, } } fn main() {}
Rust
4
Eric-Arellano/rust
src/test/ui/issues/issue-37598.rs
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]