content stringlengths 4 1.04M | lang stringclasses 358
values | score int64 0 5 | repo_name stringlengths 5 114 | repo_path stringlengths 4 229 | repo_licenses listlengths 1 8 |
|---|---|---|---|---|---|
! Copyright 2007, 2008 Ryan Murphy, Slava Pestov
! See http://factorcode.org/license.txt for BSD license.
USING: arrays kernel math namespaces tools.test
heaps heaps.private math.parser random assocs sequences sorting
accessors math.order locals ;
IN: heaps.tests
[ <min-heap> heap-pop ] must-fail
[ <max-heap> heap-pop ] must-fail
{ t } [ <min-heap> heap-empty? ] unit-test
{ f } [ <min-heap> 1 t pick heap-push heap-empty? ] unit-test
{ t } [ <max-heap> heap-empty? ] unit-test
{ f } [ <max-heap> 1 t pick heap-push heap-empty? ] unit-test
! Binary Min Heap
{ 1 2 3 4 5 6 } [ 0 left 0 right 1 left 1 right 2 left 2 right ] unit-test
{ t } [ t 5 f <entry> t 3 f <entry> T{ min-heap } heap-compare ] unit-test
{ f } [ t 5 f <entry> t 3 f <entry> T{ max-heap } heap-compare ] unit-test
{ t 2 } [ <min-heap> t 300 pick heap-push t 200 pick heap-push t 400 pick heap-push t 3 pick heap-push t 2 pick heap-push heap-pop ] unit-test
{ t 1 } [ <min-heap> t 300 pick heap-push t 200 pick heap-push t 400 pick heap-push t 3 pick heap-push t 2 pick heap-push t 1 pick heap-push heap-pop ] unit-test
{ t 400 } [ <max-heap> t 300 pick heap-push t 200 pick heap-push t 400 pick heap-push t 3 pick heap-push t 2 pick heap-push t 1 pick heap-push heap-pop ] unit-test
{ 0 } [ <max-heap> heap-size ] unit-test
{ 1 } [ <max-heap> t 1 pick heap-push heap-size ] unit-test
DEFER: (assert-heap-invariant)
: heapdata-compare ( m n heap -- ? )
[ data>> [ nth ] curry bi@ ] keep heap-compare ; inline
: ((assert-heap-invariant)) ( parent child heap heap-size -- )
pick over < [
[ [ heapdata-compare f assert= ] 2keep ] dip
(assert-heap-invariant)
] [ 4drop ] if ;
: (assert-heap-invariant) ( n heap heap-size -- )
[ dup left dup 1 + ] 2dip
[ ((assert-heap-invariant)) ] 2curry bi-curry@ bi ;
: assert-heap-invariant ( heap -- )
dup heap-empty? [ drop ]
[ 0 swap dup heap-size (assert-heap-invariant) ] if ;
: heap-sort ( alist heap -- keys )
[ heap-push-all ] keep dup assert-heap-invariant heap-pop-all ;
: random-alist ( n -- alist )
<iota> [
drop 32 random-bits dup number>string
] H{ } map>assoc >alist ;
:: test-heap-sort ( n heap reverse? -- ? )
n random-alist
[ sort-keys reverse? [ reverse ] when ] keep
heap heap-sort = ;
: test-minheap-sort ( n -- ? )
<min-heap> f test-heap-sort ;
: test-maxheap-sort ( n -- ? )
<max-heap> t test-heap-sort ;
14 [
[ t ] swap [ 2^ <min-heap> f test-heap-sort ] curry unit-test
] each-integer
14 [
[ t ] swap [ 2^ <max-heap> t test-heap-sort ] curry unit-test
] each-integer
: test-entry-indices ( n -- ? )
random-alist
<min-heap> [ heap-push-all ] keep
dup assert-heap-invariant
data>> dup length <iota> swap [ index>> ] map sequence= ;
14 [
[ t ] swap [ 2^ test-entry-indices ] curry unit-test
] each-integer
: delete-test ( n -- obj1 obj2 )
[
random-alist
<min-heap> [ heap-push-all ] keep
dup data>> clone swap
] keep 3 /i [ 2dup [ delete-random ] dip heap-delete ] times
dup assert-heap-invariant
data>>
[ [ key>> ] map ] bi@
[ natural-sort ] bi@ ;
11 [
[ t ] swap [ 2^ delete-test sequence= ] curry unit-test
] each-integer
[| |
<min-heap> :> heap
t 1 heap heap-push* :> entry
heap heap-pop 2drop
t 2 heap heap-push
entry heap heap-delete ] [ bad-heap-delete? ] must-fail-with
[| |
<min-heap> :> heap
t 1 heap heap-push* :> entry
t 2 heap heap-push
heap heap-pop 2drop
entry heap heap-delete ] [ bad-heap-delete? ] must-fail-with
[| |
<min-heap> :> heap
t 1 heap heap-push* :> entry
t 2 heap heap-push
entry heap heap-delete
entry heap heap-delete ] [ bad-heap-delete? ] must-fail-with
[| |
<min-heap> :> heap
t 0 heap heap-push
t 1 heap heap-push* :> entry
entry heap heap-delete
entry heap heap-delete ] [ bad-heap-delete? ] must-fail-with
| Factor | 5 | alex-ilin/factor | basis/heaps/heaps-tests.factor | [
"BSD-2-Clause"
] |
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// This shader converts an NCHW FLOAT Tensor (BGR/RGB/GRAY) into a DX texture with channel order BGRA/BGRX/RGBA/GRAY
//
#ifdef FP16
Buffer<float> input : register(t0); // SRV
#else
StructuredBuffer<float> input : register(t0); // SRV
#endif
RWTexture2D<float4> output : register(u0); // UAV
cbuffer cbCS : register(b0)
{
uint height;
uint width;
};
[numthreads(16, 4, 1)]
void TensorBGR8ToSurface(uint3 globalThreadId : SV_DispatchThreadId)
{
if (globalThreadId.x < width && globalThreadId.y < height)
{
float4 pixel;
uint blockSize = height * width;
uint threadOffset = width * globalThreadId.y + globalThreadId.x;
pixel.b = input[threadOffset] / 255.0;
pixel.g = input[threadOffset + blockSize] / 255.0;
pixel.r = input[threadOffset + blockSize * 2] / 255.0;
pixel.a = 1.0f;
output[globalThreadId.xy] = pixel;
}
}
[numthreads(16, 4, 1)]
void TensorRGB8ToSurface(uint3 globalThreadId : SV_DispatchThreadId)
{
if (globalThreadId.x < width && globalThreadId.y < height)
{
float4 pixel;
uint blockSize = height * width;
uint threadOffset = width * globalThreadId.y + globalThreadId.x;
pixel.r = input[threadOffset] / 255.0;
pixel.g = input[threadOffset + blockSize] / 255.0;
pixel.b = input[threadOffset + blockSize * 2] / 255.0;
pixel.a = 1.0f;
output[globalThreadId.xy] = pixel;
}
}
[numthreads(16, 4, 1)]
void TensorGRAY8ToSurface(uint3 globalThreadId : SV_DispatchThreadId)
{
if (globalThreadId.x < width && globalThreadId.y < height)
{
float4 pixel;
uint threadOffset = width * globalThreadId.y + globalThreadId.x;
pixel.b = input[threadOffset] / 255.0;
pixel.g = pixel.b;
pixel.r = pixel.b;
pixel.a = 1.0;
output[globalThreadId.xy] = pixel;
}
}
[numthreads(16, 4, 1)]
void TensorBGR8ToSurfaceGRAY8(uint3 globalThreadId : SV_DispatchThreadId)
{
if (globalThreadId.x < width && globalThreadId.y < height)
{
float4 pixel;
uint blockSize = height * width;
uint threadOffset = width * globalThreadId.y + globalThreadId.x;
pixel.b = input[threadOffset] / 255.0;
pixel.g = input[threadOffset + blockSize] / 255.0;
pixel.r = input[threadOffset + blockSize * 2] / 255.0;
float grayValue = 0.2126 * pixel.r + 0.7152 * pixel.g + 0.0722 * pixel.b;
output[globalThreadId.xy] = float4(grayValue, 0.0, 0.0, 0.0);
}
}
[numthreads(16, 4, 1)]
void TensorRGB8ToSurfaceGRAY8(uint3 globalThreadId : SV_DispatchThreadId)
{
if (globalThreadId.x < width && globalThreadId.y < height)
{
float4 pixel;
uint blockSize = height * width;
uint threadOffset = width * globalThreadId.y + globalThreadId.x;
pixel.r = input[threadOffset] / 255.0;
pixel.g = input[threadOffset + blockSize] / 255.0;
pixel.b = input[threadOffset + blockSize * 2] / 255.0;
float grayValue = 0.2126 * pixel.r + 0.7152 * pixel.g + 0.0722 * pixel.b;
output[globalThreadId.xy] = float4(grayValue, 0.0, 0.0, 0.0);
}
}
[numthreads(16, 4, 1)]
void TensorGRAY8ToSurfaceGRAY8(uint3 globalThreadId : SV_DispatchThreadId)
{
if (globalThreadId.x < width && globalThreadId.y < height)
{
float4 pixel;
uint threadOffset = width * globalThreadId.y + globalThreadId.x;
float grayValue = input[threadOffset] / 255.0;
output[globalThreadId.xy] = float4(grayValue, 0.0, 0.0, 0.0);
}
} | HLSL | 5 | dennyac/onnxruntime | winml/lib/Api.Image/shaders/TensorFloatToSurface.hlsl | [
"MIT"
] |
query GetCollectionTitle($collectionID: ID!) {
collection(collectionID: $collectionID) {
title
}
}
| GraphQL | 3 | miily8310s/hoppscotch | packages/hoppscotch-app/helpers/backend/gql/queries/GetCollectionTitle.graphql | [
"MIT"
] |
dnl Shamelessly stolen from Heimdal
AC_DEFUN([upcase],[`echo $1 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`])dnl
| M4 | 3 | aakropotkin/jq | config/m4/misc.m4 | [
"CC-BY-3.0"
] |
<pigbehavior language="JScript">
//imagotrigger@gmail.com 10/14 imago.pig originally from manuel.pig and mark.pig Microsoft
// These files provide an intellisense bridge to COM. Use PigJSDocGenerator to update the intellisense if you modify an IDL file. -->
<script src="include\IDL.js"/>
// Helper functions to make your pig go.
<script src="include\common.js"/>
<script src="include\imago.js"/>
<script src="include\AutoStartCustomGame.js"/>
// The main logic of the pig lives in this file.
<script src="aaa.js"/>
<script>
<![CDATA[
// Refer to aaa.js for the core logic.
]]>
</script>
</pigbehavior>
| PigLatin | 3 | FreeAllegiance/AllegianceDX7 | src/Pigs/Piglets/aaa.pig | [
"MIT"
] |
##appName-/Users/hubiqing/Documents/github-workspace/publishx-cli##
server {
listen 8102;
server_name $host;
set $appName "/Users/hubiqing/Documents/github-workspace/publishx-cli";
root /export/local/www/$appName;
#access_log /export/logs/$appName/access.log main;
#error_log /export/logs/$appName/error.log warn;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
location / {
try_files $uri $uri/ /index.html;
}
location ^~ /api/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1/;
}
location ~ ^(.*).(js|css|png|jpg|jpeg|ttf|eot|svg|woff|ico) {
rewrite ^(.*) /$1 break;
}
}
##appName-/Users/hubiqing/Documents/github-workspace/publishx-cli-end##
| Nginx | 3 | githbq/publishx-cli | .nginxconf | [
"MIT"
] |
; ModuleID = 'bpftrace'
source_filename = "bpftrace"
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
target triple = "bpf-pc-linux"
%helper_error_t = type <{ i64, i64, i32 }>
; Function Attrs: nounwind
declare i64 @llvm.bpf.pseudo(i64 %0, i64 %1) #0
define i64 @"kprobe:f"(i8* %0) section "s_kprobe:f_1" {
entry:
%helper_error_t3 = alloca %helper_error_t, align 8
%"@_newval" = alloca i64, align 8
%helper_error_t = alloca %helper_error_t, align 8
%lookup_elem_val = alloca i64, align 8
%"@_key" = alloca i64, align 8
%1 = bitcast i64* %"@_key" to i8*
call void @llvm.lifetime.start.p0i8(i64 -1, i8* %1)
store i64 0, i64* %"@_key", align 8
%pseudo = call i64 @llvm.bpf.pseudo(i64 1, i64 0)
%lookup_elem = call i8* inttoptr (i64 1 to i8* (i64, i64*)*)(i64 %pseudo, i64* %"@_key")
%2 = bitcast i64* %lookup_elem_val to i8*
call void @llvm.lifetime.start.p0i8(i64 -1, i8* %2)
%map_lookup_cond = icmp ne i8* %lookup_elem, null
br i1 %map_lookup_cond, label %lookup_success, label %lookup_failure
lookup_success: ; preds = %entry
%cast = bitcast i8* %lookup_elem to i64*
%3 = load i64, i64* %cast, align 8
store i64 %3, i64* %lookup_elem_val, align 8
br label %lookup_merge
lookup_failure: ; preds = %entry
store i64 0, i64* %lookup_elem_val, align 8
%4 = bitcast %helper_error_t* %helper_error_t to i8*
call void @llvm.lifetime.start.p0i8(i64 -1, i8* %4)
%5 = getelementptr %helper_error_t, %helper_error_t* %helper_error_t, i64 0, i32 0
store i64 30006, i64* %5, align 8
%6 = getelementptr %helper_error_t, %helper_error_t* %helper_error_t, i64 0, i32 1
store i64 0, i64* %6, align 8
%7 = getelementptr %helper_error_t, %helper_error_t* %helper_error_t, i64 0, i32 2
store i32 0, i32* %7, align 4
%pseudo1 = call i64 @llvm.bpf.pseudo(i64 1, i64 1)
%perf_event_output = call i64 inttoptr (i64 25 to i64 (i8*, i64, i64, %helper_error_t*, i64)*)(i8* %0, i64 %pseudo1, i64 4294967295, %helper_error_t* %helper_error_t, i64 20)
%8 = bitcast %helper_error_t* %helper_error_t to i8*
call void @llvm.lifetime.end.p0i8(i64 -1, i8* %8)
br label %lookup_merge
lookup_merge: ; preds = %lookup_failure, %lookup_success
%9 = load i64, i64* %lookup_elem_val, align 8
%10 = bitcast i64* %lookup_elem_val to i8*
call void @llvm.lifetime.end.p0i8(i64 -1, i8* %10)
%11 = bitcast i64* %"@_newval" to i8*
call void @llvm.lifetime.start.p0i8(i64 -1, i8* %11)
%12 = add i64 %9, 1
store i64 %12, i64* %"@_newval", align 8
%pseudo2 = call i64 @llvm.bpf.pseudo(i64 1, i64 0)
%update_elem = call i64 inttoptr (i64 2 to i64 (i64, i64*, i64*, i64)*)(i64 %pseudo2, i64* %"@_key", i64* %"@_newval", i64 0)
%13 = trunc i64 %update_elem to i32
%14 = icmp sge i32 %13, 0
br i1 %14, label %helper_merge, label %helper_failure
helper_failure: ; preds = %lookup_merge
%15 = bitcast %helper_error_t* %helper_error_t3 to i8*
call void @llvm.lifetime.start.p0i8(i64 -1, i8* %15)
%16 = getelementptr %helper_error_t, %helper_error_t* %helper_error_t3, i64 0, i32 0
store i64 30006, i64* %16, align 8
%17 = getelementptr %helper_error_t, %helper_error_t* %helper_error_t3, i64 0, i32 1
store i64 1, i64* %17, align 8
%18 = getelementptr %helper_error_t, %helper_error_t* %helper_error_t3, i64 0, i32 2
store i32 %13, i32* %18, align 4
%pseudo4 = call i64 @llvm.bpf.pseudo(i64 1, i64 1)
%perf_event_output5 = call i64 inttoptr (i64 25 to i64 (i8*, i64, i64, %helper_error_t*, i64)*)(i8* %0, i64 %pseudo4, i64 4294967295, %helper_error_t* %helper_error_t3, i64 20)
%19 = bitcast %helper_error_t* %helper_error_t3 to i8*
call void @llvm.lifetime.end.p0i8(i64 -1, i8* %19)
br label %helper_merge
helper_merge: ; preds = %helper_failure, %lookup_merge
%20 = bitcast i64* %"@_newval" to i8*
call void @llvm.lifetime.end.p0i8(i64 -1, i8* %20)
%21 = bitcast i64* %"@_key" to i8*
call void @llvm.lifetime.end.p0i8(i64 -1, i8* %21)
ret i64 0
}
; Function Attrs: argmemonly nofree nosync nounwind willreturn
declare void @llvm.lifetime.start.p0i8(i64 immarg %0, i8* nocapture %1) #1
; Function Attrs: argmemonly nofree nosync nounwind willreturn
declare void @llvm.lifetime.end.p0i8(i64 immarg %0, i8* nocapture %1) #1
attributes #0 = { nounwind }
attributes #1 = { argmemonly nofree nosync nounwind willreturn }
| LLVM | 3 | casparant/bpftrace | tests/codegen/llvm/runtime_error_check_lookup.ll | [
"Apache-2.0"
] |
/**
* @file strand_sort.cpp
* @brief Implementation of [Strand Sort](https://en.wikipedia.org/wiki/Strand_sort) algorithm.
*
* @details
* Strand Sort is a sorting algorithm that works in \f$O(n)\f$ time if list is already sorted and works in \f$O(n^2)\f$ in worst case.
*
* It is passed over the array to be sorted once and the ascending (sequential) numbers are taken.
* After the first iteration, the sequential sub-array is put on the empty sorted array.
* The main sequence is passed over again and a new sub-sequence is created in order.
* Now that the sorted array is not empty, the newly extracted substring is merged with the sorted array.
* Repeat types 3 and 4 until the sub-sequence and main sequence are empty.
*
* @author [Mertcan Davulcu](https://github.com/mertcandav)
*/
#include <iostream>
#include <list>
/**
* @namespace sorting
* @brief Sorting algorithms
*/
namespace sorting {
/**
* @namespace strand
* @brief Functions for [Strand Sort](https://en.wikipedia.org/wiki/Strand_sort) algorithm
*/
namespace strand {
/**
* @brief Apply sorting
* @tparam element type of list
* @param lst List to be sorted
* @returns Sorted list<T> instance
*/
template <typename T>
std::list<T> strand_sort(std::list<T> lst) {
if (lst.size() < 2) { // Returns list if empty or contains only one element
return lst; // Returns list
}
std::list<T> result; // Define new "result" named list instance.
std::list<T> sorted; // Define new "sorted" named list instance.
while(!lst.empty()) /* if lst is not empty */ {
sorted.push_back(lst.front()); // Adds the first element of "lst" list to the bottom of the "sorted" list.
lst.pop_front(); // Remove first element of "lst" list.
for (auto it = lst.begin(); it != lst.end(); ) { // Return the loop as long as the current iterator is not equal to the last literator of the "lst" list.
if (sorted.back() <= *it) { // If the last reference of the "sorted" list is less than or equal to the current iterator reference.
sorted.push_back(*it); // Adds the iterator retrieved in the loop under the "sorted" list.
it = lst.erase(it); // Deletes the element with the current iterator and assigns the deleted element to the iterator.
} else {
it++; // Next iterator.
}
}
result.merge(sorted); // Merge "result" list with "sorted" list.
}
return result; // Returns sorted list
}
} // namespace strand
} // namespace sorting
/**
* @brief Function for testing
* @return N/A
*/
static void test() {
std::list<int> lst = { -333, 525, 1, 0, 94, 52, 33 };
std::cout << "Before: ";
for(auto item: lst) {
std::cout << item << " ";
}
lst = sorting::strand::strand_sort(lst); // Sort list.
std::cout << "\nAfter: ";
for(auto item: lst) {
std::cout << item << " ";
}
}
/**
* @brief Main function
* @returns 0 on exit
*/
int main() {
test();
return 0;
}
| C++ | 5 | icbdubey/C-Plus-Plus | sorting/strand_sort.cpp | [
"MIT"
] |
# Task: Ackermann function
#
# A simple straightforward recursive implementation.
module ackermann_function
fun ack(m, n: Int): Int
do
if m == 0 then return n + 1
if n == 0 then return ack(m-1,1)
return ack(m-1, ack(m, n-1))
end
for m in [0..3] do
for n in [0..6] do
print ack(m,n)
end
print ""
end
| Nit | 4 | LaudateCorpus1/RosettaCodeData | Task/Ackermann-function/Nit/ackermann-function.nit | [
"Info-ZIP"
] |
Strict
Rem
bbdoc: Audio/OGG loader
about:
The OGG loader module provides the ability to load OGG format #{audio samples}.
End Rem
Module BRL.OGGLoader
ModuleInfo "Version: 1.04"
ModuleInfo "Author: Simon Armstrong"
ModuleInfo "License: zlib/libpng"
ModuleInfo "Copyright: Blitz Research Ltd"
ModuleInfo "Modserver: BRL"
ModuleInfo "History: 1.04 Release"
ModuleInfo "History: Moved SaveOgg to module axe.saveogg"
ModuleInfo "History: 1.03 Release"
ModuleInfo "History: Added Function SaveOgg"
ModuleInfo "History: 1.02 Release"
ModuleInfo "History: Fixed reading past end of stream with some short files"
Import Pub.OggVorbis
Import BRL.AudioSample
Private
Function readfunc( buf@Ptr,size,nmemb,src:Object )
Local bytes=TStream(src).Read(buf,size*nmemb)
Return bytes/size
End Function
Function seekfunc( src_obj:Object,off0,off1,whence )
Local off
Local src:TStream=TStream(src_obj)
?X86
off=off0
?PPC
off=off1
?
Local res=-1
Select whence
Case 0
res=src.Seek(off) 'SEEK_SET
Case 1
res=src.Seek(src.Pos()+off) 'SEEK_CUR
Case 2
res=src.Seek(src.Size()+off) 'SEEK_END
End Select
If res>=0 Return 0
Return -1
End Function
Function closefunc( src:Object )
End Function
Function tellfunc( src:Object )
Return TStream(src).Pos()
End Function
Type TAudioSampleLoaderOGG Extends TAudioSampleLoader
Method LoadAudioSample:TAudioSample( stream:TStream )
Local samples,channels,freq
Local ogg:Byte Ptr=Decode_Ogg(stream,readfunc,seekfunc,closefunc,tellfunc,samples,channels,freq)
If Not ogg Return
Local format
?PPC
If channels=1 format=SF_MONO16BE Else format=SF_STEREO16BE
?X86
If channels=1 format=SF_MONO16LE Else format=SF_STEREO16LE
?
Local size=samples*2*channels
Local sample:TAudioSample=TAudioSample.Create( samples,freq,format )
Local err=Read_Ogg( ogg,sample.samples,size )
Read_Ogg( ogg,Null,0 )
If err Return
Return sample
End Method
End Type
AddAudioSampleLoader New TAudioSampleLoaderOGG
| BlitzMax | 4 | jabdoa2/blitzmax | mod/brl.mod/oggloader.mod/oggloader.bmx | [
"Zlib"
] |
{
"trustedPhoneNumbers": [{
"numberWithDialCode": "+49 •••• •••••85",
"pushMode": "sms",
"obfuscatedNumber": "•••• •••••85",
"id": 1
}, {
"numberWithDialCode": "+49 ••••• •••••81",
"pushMode": "sms",
"obfuscatedNumber": "••••• •••••81",
"id": 2
}, {
"numberWithDialCode": "+49 ••••• •••••80",
"pushMode": "voice",
"obfuscatedNumber": "••••• •••••80",
"id": 3
}],
"securityCode": {
"length": 6,
"tooManyCodesSent": false,
"tooManyCodesValidated": false,
"securityCodeLocked": false
},
"authenticationType": "hsa2",
"recoveryUrl": "https://iforgot.apple.com/phone/add?prs_account_nm=email@example.org&autoSubmitAccount=true&appId=142",
"cantUsePhoneNumberUrl": "https://iforgot.apple.com/iforgot/phone/add?context=cantuse&prs_account_nm=email@example.org&autoSubmitAccount=true&appId=142",
"recoveryWebUrl": "https://iforgot.apple.com/password/verify/appleid?prs_account_nm=email@example.org&autoSubmitAccount=true&appId=142",
"repairPhoneNumberUrl": "https://gsa.apple.com/appleid/account/manage/repair/verify/phone",
"repairPhoneNumberWebUrl": "https://appleid.apple.com/widget/account/repair?#!repair",
"aboutTwoFactorAuthenticationUrl": "https://support.apple.com/kb/HT204921",
"autoVerified": false,
"showAutoVerificationUI": false,
"managedAccount": false,
"trustedPhoneNumber": {
"numberWithDialCode": "+49 •••• •••••85",
"pushMode": "sms",
"obfuscatedNumber": "•••• •••••85",
"id": 1
},
"hsa2Account": true,
"supportsRecovery": true
} | JSON | 3 | flufff42/fastlane | spaceship/spec/fixtures/client_appleauth_auth_2fa_response.json | [
"MIT"
] |
#!/bin/bash
#
# Helper script to get GDB running against an executable and a core dump.
# Feel free to modify this file to suit your needs
#
# Usage:
# run-gdb.sh <path to core dump> [path to executable]
#
set -e
help() {
echo
echo "run-gdb.sh <path to core dump> [path to executable]"
echo
echo "MIX_TARGET=$MIX_TARGET"
echo "MIX_ENV=$MIX_ENV"
exit 1
}
CORE=$1
[ -f "$CORE" ] || (echo "Error: no core dump provided."; help)
NERVES_SYSTEM="${NERVES_SYSTEM:=<%= @nerves_system %>}"
[ -n "$NERVES_SYSTEM" ] || (echo "Error: missing environment variable $NERVES_SYSTEM"; help)
[ -f "$NERVES_SYSTEM/nerves-env.sh" ] || (echo "Error: $NERVES_SYSTEM/nerves-env.sh not found"; help)
source $NERVES_SYSTEM/nerves-env.sh
EXE=$2
[ -f $EXE ] || EXE="$ERTS_INCLUDE_DIR/../bin/beam.smp"
[ -n "$NERVES_SDK_SYSROOT" ] || (echo "Error: missing environment variable $NERVES_SDK_SYSROOT"; help)
[ -n "$ERTS_INCLUDE_DIR" ] || (echo "Error: missing environment variable $ERTS_INCLUDE_DIR"; help)
[ -n "$CROSSCOMPILE" ] || (echo "Warning: missing environment variable $CROSSCOMPILE")
GDB=$CROSSCOMPILE-gdb
[ -f "$GDB" ] || (echo "Error: gdb is not available in this toolchain"; help)
$GDB --core="$CORE" \
--nx \
--init-eval-command="set sysroot $NERVES_SDK_SYSROOT" \
$EXE
| HTML+EEX | 4 | amclain/nerves | priv/templates/script.run-gdb.sh.eex | [
"Apache-2.0"
] |
--TEST--
Bug #25707 (html_entity_decode over-decodes &lt;)
--FILE--
<?php
var_dump(html_entity_decode("&lt;", ENT_COMPAT, 'ISO-8859-1'));
var_dump(html_entity_decode("&#38;", ENT_COMPAT, 'ISO-8859-1'));
var_dump(html_entity_decode("&#38;lt;", ENT_COMPAT, 'ISO-8859-1'));
?>
--EXPECT--
string(4) "<"
string(5) "&"
string(8) "&lt;"
| PHP | 3 | guomoumou123/php5.5.10 | ext/standard/tests/strings/bug25707.phpt | [
"PHP-3.01"
] |
-- Macro Scripts File
-- Created: Nov 17 1998
-- Modified: Jan 10 1999
-- Author: Frank DeLise
-- MODIFY THIS AT YOUR OWN RISK
--
-- Macro Scripts for Cameras
--***********************************************************************************************
macroScript Free_Camera
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
tooltip:"Free Camera"
buttontext:"Free Camera"
Icon:#("Cameras",2)
(
on execute do StartObjectCreation FreeCamera
on isChecked return (mcrUtils.IsCreating FreeCamera)
)
macroScript Target_Camera
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
tooltip:"Target Camera"
buttontext:"Target Camera"
Icon:#("Cameras",1)
(
on execute do StartObjectCreation TargetCamera
on isChecked return (mcrUtils.IsCreating TargetCamera)
)
MacroScript Camera_SelectTarget
ButtonText:"Select Target"
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
Tooltip:"Select Target (Cameras)"
(
On IsVisible Return Filters.Is_Camera $
On Execute Do Try(select $.Target) Catch()
)
| MAXScript | 3 | 89096000/MaxScript | Modelling/softinstance/treeview/icons/Macro_Cameras.mcr | [
"MIT"
] |
(= algolia-app-id* "DMX77CEFW8"
algolia-key-ro* "0e7e64491733b975977b6d1229a3620b"
algolia-key* "../algolia.json"
algolia-write* (no (readenv "DEV")))
(defcache algolia-key 600
(when (file-exists algolia-key*)
(w/infile i algolia-key*
(aand (read-json i) (if (isa it 'string) it it!key)))))
(def algolia-set (index value (o auth algolia-write*))
(withs (app algolia-app-id*
key (and auth (algolia-key))
idx (clean-url index)
id (aand value!objectID (string it) (trim it)))
(when key
(if (blank id)
(err "algolia-set: value must have objectID attribute")
(thread
(fromstring (tostring:write-json value)
(shell 'curl '-fsSL '-X 'PUT '-d (string #\@ "-")
'-H (+ "X-Algolia-API-Key: " key)
'-H (+ "X-Algolia-Application-Id: " app)
(+ "https://" app ".algolia.net/1/indexes/" idx "/" id))))))))
| Arc | 2 | SoloBSD/QuantumNews | algolia.arc | [
"MIT"
] |
discard """
output: ''''''
"""
import system
type Bar[T] = ref object
value: T
type types = int32|int64 # if I change this to just int32 or int64 it works (compiles)
# if I replace Bar everywhere with seq it also compiles fine
proc Foo[T: Bar[types]](): T =
when T is Bar: nil
discard Foo[Bar[int32]]()
#bug #6073
# bug #11479
import tables
proc test() =
discard readfile("temp.nim")
echo "ho"
const
map = {
"test": test,
}.toTable
#map["test"]()
#-------------------------------------------------------------------
# bug
const val = 10
type
t = object
when val >= 10:
a: int
| Nimrod | 3 | JohnAD/Nim | tests/types/tyet_another_generic_regression.nim | [
"MIT"
] |
coclass 'TestBase'
NB. Assert left-hand verb evaluates the right-hand
NB. noun's first argument to match the right-hand
NB. noun's second argument.
NB. Example:
NB. > *: assertEquals (2;4)
assertEquals=: 2 : '((u&.>)0{n) -: (1{n)'
NB. Asserts that the left-hand verb evaluating the
NB. right-hand noun returns 1 (true).
NB. Example:
NB. > (1&<@:+:) assertTrue 2
NB.
NB. Following example fails:
NB. > (1&<@:+:) assertTrue _2
assertTrue=: 2 : '1-:"(0 0) u n'
NB. Asserts that the left-hand verb evaluating the
NB. right-hand noun returns 0 (false).
NB. Example:
NB. > (1&<@:+:) assertFalse _2
NB.
NB. Following example fails:
NB. > (1&<@:+:) assertFalse 2
assertFalse=: 2 : '0-:"(0 0) u n'
NB. Asserts that the left-hand verb, will throw an
NB. exception when evaluating the right-hand noun.
NB. Returns 1 if an exception is thrown and false otherwise.
NB. Example:
NB. > M =: 2 2 $ 1 NB. a singular matrix
NB. > %. assertThrow M NB. cannot invert
assertThrow=: 1 : 0
a=. 0
try.
k=. u y
catch.
a=. 1
catcht.
a=. 1
catchd.
a=. 1
end.
a=1
)
assertNoThrow=: 1 : 0
-. u assertThrow y
)
NB. Wraps the test verbs. Runs the given test, which should be
NB. an argument-less verb. The right-hand noun should be an
NB. identifier (e.g. a number, or name) to identify the test,
NB. in case it fails.
NB. Example:
NB. > myTest testWrapper 'Matrix inverse test'
testWrapper=: 1 : 0
res=. u ''
smoutput res
if. -. res do.
smoutput 'Failed test ', ":y
else.
smoutput 'Test success ', ":y
end.
res
)
create=: destroy=: codestroy
run=: 3 : 0
1
)
| J | 4 | jonghough/jlearn | test/testbase.ijs | [
"MIT"
] |
ruleset id.trinsic.redir {
global {
prefix = re#^id.streetcred://launch/[?]c_i=.+#
}
//
// convert trinsic invitation into one acceptable to ACA-Pico
//
rule accept_trinsic_invitation {
select when didcomm message
uri re#(https://redir.trinsic.id/.+)# setting(uri)
pre {
res = http:get(uri,dontFollowRedirect=true)
ok = res{"status_code"} == 302
location = ok => res{["headers","location"]} | null
}
if location && location.match(prefix) then noop()
fired {
raise didcomm event "message"
attributes event:attrs.put("uri","http://"+location)
} else {
ent:location := location
}
}
}
| KRL | 4 | Picolab/aries-cloudagent-pico | krl/id.trinsic.redir.krl | [
"MIT"
] |
/tmp/vimrc:
file.append:
- sources:
- salt://test/files/vimrc.stub
| SaltStack | 2 | byteskeptical/salt | tests/integration/files/file/base/issue-51208.sls | [
"Apache-2.0"
] |
(
// Send the ar message to the SinOsc class. This means make an audio rate instance (calculate
// a signal value for each sample in the block).
{
// Open the function
SinOsc.ar( // Make an audio rate SinOsc
440, // frequency of 440 Hz
0, // initial phase in radians
0.2) // multiply amplitude by 0.2
}.play; // close the Function and send the 'play' message to it, which means evaluate yourself and play the results on the server, which if not specified, is the default server that is stored in the variable 's'.
)
(
// An example of polymorphism that plugs the a control rate SinOsc into the mul parameter for the audio rate SinOsc.
{ var ampOsc;
ampOsc = SinOsc.kr(0.5, 1.5pi, 0.5, 0.5);
SinOsc.ar(440, 0, ampOsc);
}.play;
) | SuperCollider | 4 | drichardson/examples | SuperCollider/FunctionsAndSound.scd | [
"Unlicense"
] |
`abc${0}abc`.indexOf(`abc`); | TypeScript | 2 | nilamjadhav/TypeScript | tests/cases/conformance/es6/templates/templateStringWithPropertyAccess.ts | [
"Apache-2.0"
] |
(*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
module Translate (Impl : Translator_intf.S) : sig
type t
val token : Offset_utils.t -> Parser_env.token_sink_result -> t
val token_list : Offset_utils.t -> Parser_env.token_sink_result list -> t
end
with type t = Impl.t = struct
type t = Impl.t
let token offset_table { Parser_env.token_loc; token; token_context } =
Loc.(
Impl.obj
[
("type", Impl.string (Token.token_to_string token));
( "context",
Impl.string
Parser_env.Lex_mode.(
match token_context with
| NORMAL -> "normal"
| TYPE -> "type"
| JSX_TAG -> "jsxTag"
| JSX_CHILD -> "jsxChild"
| TEMPLATE -> "template"
| REGEXP -> "regexp"
)
);
( "loc",
Impl.obj
[
( "start",
Impl.obj
[
("line", Impl.number (float token_loc.start.line));
("column", Impl.number (float token_loc.start.column));
]
);
( "end",
Impl.obj
[
("line", Impl.number (float token_loc._end.line));
("column", Impl.number (float token_loc._end.column));
]
);
]
);
( "range",
Impl.array
[
Impl.number (float (Offset_utils.offset offset_table token_loc.start));
Impl.number (float (Offset_utils.offset offset_table token_loc._end));
]
);
("value", Impl.string (Token.value_of_token token));
]
)
let token_list offset_table tokens =
Impl.array (List.rev_map (token offset_table) tokens |> List.rev)
end
| OCaml | 5 | zhangmaijun/flow | src/parser/token_translator.ml | [
"MIT"
] |
bodywidth = dxf_dim(file = "example009.dxf", name = "bodywidth");
fanwidth = dxf_dim(file = "example009.dxf", name = "fanwidth");
platewidth = dxf_dim(file = "example009.dxf", name = "platewidth");
fan_side_center = dxf_cross(file = "example009.dxf", layer = "fan_side_center");
fanrot = dxf_dim(file = "example009.dxf", name = "fanrot");
% linear_extrude(height = bodywidth, center = true, convexity = 10)
import(file = "example009.dxf", layer = "body");
% for (z = [+(bodywidth/2 + platewidth/2),
-(bodywidth/2 + platewidth/2)])
{
translate([0, 0, z])
linear_extrude(height = platewidth, center = true, convexity = 10)
import(file = "example009.dxf", layer = "plate");
}
intersection()
{
linear_extrude(height = fanwidth, center = true, convexity = 10, twist = -fanrot)
import(file = "example009.dxf", layer = "fan_top");
// NB! We have to use the deprecated module here since the "fan_side"
// layer contains an open polyline, which is not yet supported
// by the import() module.
rotate_extrude(file = "example009.dxf", layer = "fan_side",
origin = fan_side_center, convexity = 10);
}
| OpenSCAD | 4 | heristhesiya/OpenJSCAD.org | packages/io/scad-deserializer/tests/examples/example009.scad | [
"MIT"
] |
__STACKSIZE__ = 4096; | Linker Script | 0 | Davidfind/rt-thread | bsp/k210/link_stacksize.lds | [
"Apache-2.0"
] |
# Copyright (c) 2018-2021, Carnegie Mellon University
# See LICENSE for details
# NOTE: find a better place for these! What about a single standard drop tag rule?
NewRulesFor(TRC, rec(
TRC_tag := rec(
forTransposition := false,
applicable := (self, nt) >>
(nt.isTag(1, spiral.paradigms.smp.AParSMP) or not nt.hasTags())
# AVecReg is taken from a namespace that is NOT YET LOADED
# hence the fully qualified name
and not nt.hasTag(spiral.paradigms.vector.AVecReg)
and not nt.hasTag(spiral.paradigms.vector.AVecRegCx),
children := nt -> [[ nt.params[1].withTags(nt.getTags()) ]],
apply := (nt, c, cnt) -> RC(c[1])
)
));
NewRulesFor(TDiag, rec(
TDiag_tag := rec(
forTransposition := false,
# YSV: Below limits applicability to the cases where diag size is divisible by vlen
# which is a safe thing to do. Because VectorCodegen, can't generated code
# for VDiags of size non-divisible by vlen. HOWEVER, if VDiag is propagate
# past any kind of VGath, this problem goes away. So having no restriction,
# will work MOST of the time, but not all the time.
#
# applicable := (self, nt) >> let(
# vtags := [spiral.paradigms.vector.AVecReg, spiral.paradigms.vector.AVecRegCx],
# dom := nt.params[1].domain(),
# not nt.hasAnyTag(vtags) or (dom mod nt.getAnyTag(vtags).v) = 0
# ),
apply := (t, C, Nonterms) -> let(
vtags := [spiral.paradigms.vector.AVecReg, spiral.paradigms.vector.AVecRegCx],
Cond(t.hasAnyTag(vtags),
spiral.paradigms.vector.sigmaspl.VDiag(t.params[1], t.getAnyTag(vtags).v),
Diag(t.params[1])
)
)
)
));
RulesFor(TRCDiag, rec(
TRCDiag_tag := rec(
forTransposition := false,
applicable := (self, nt) >> not nt.transposed,
rule := (P, C) -> RC(Diag(P[1])))
));
RulesFor(TId, rec(
TId_tag := rec(
forTransposition := false,
switch := false,
rule := (P, C) -> P[1])
));
NewRulesFor(TRaderMid, rec(
TRaderMid_tag := rec(
forTransposition := false,
apply := (t, C, Nonterms) -> t.raderMid(t.params[1], t.params[2], t.params[3])
)
));
NewRulesFor(TRDiag, rec(
TRDiag_RT_Diag := rec(
forTransposition := true,
apply := (t, C, Nonterms) -> t.terminate()
)
));
NewRulesFor(TCompose, rec(
TCompose_tag := rec(
forTransposition := false,
applicable := (self, nt) >> true,
children := nt -> [ List(nt.params[1], e -> e.withTags(nt.getTags())) ],
apply := (nt, c, nt) -> Grp(Compose(c))
)
));
NewRulesFor(TCond, rec(
TCond_tag := rec(
forTransposition := false,
applicable := (self, nt) >> true,
children := nt -> [[
nt.params[2].withTags(nt.getTags()), nt.params[3].withTags(nt.getTags()) ]],
apply := (t, C, Nonterms) -> COND(t.params[1], C[1], C[2])
)
));
NewRulesFor(TGrp, rec(
TGrp_tag := rec(
forTransposition := false,
children := nt -> [[ nt.params[1].withTags(nt.getTags()) ]],
apply := (nt, c, cnt) -> Grp(c[1])
)
));
NewRulesFor(TInplace, rec(
TInplace_tag := rec(
forTransposition := false,
children := nt -> [[ nt.params[1].withTags(nt.getTags()) ]],
apply := (nt, c, cnt) -> Inplace(c[1])
)
));
NewRulesFor(TICompose, rec(
TICompose_tag := rec(
forTransposition := false,
children := nt -> [[ nt.params[3].withTags(nt.getTags()) ]],
apply := (nt, c, cnt) -> ICompose(nt.params[1], nt.params[2], c[1])
)
));
########################################################################
# (A + B) rules
NewRulesFor(TDirectSum, rec(
# (A + B) terminate
A_dirsum_B := rec(
forTransposition := false,
children := (self, t) >> let( tags := t.getTags(),
[[ t.params[1].withTags(tags), t.params[2].setTags(tags) ]]
),
apply := (t, C, Nonterms) -> DirectSum(C)
#D children := (self, t) >> let (tags:=GetTags(t),
#D [[ AddTag(t.params[1], tags), SetTag(t.params[2], tags) ]]),
)
));
########################################################################
# (A x B) rules
NewRulesFor(TTensor, rec(
# (A x B) -> (A x I)(I x B)
AxI_IxB := rec(
info := "(A x B) -> (A x I)(I x B)",
forTransposition := false,
applicable := nt -> true,
inplace := false,
children := (self, nt) >> let(inp := When(self.inplace, TInplace, x->x),
[[ TCompose([
inp(TTensorI(nt.params[1], nt.params[2].dims()[1], AVec, AVec)),
TTensorI(nt.params[2], nt.params[1].dims()[2], APar, APar)
]).withTags(nt.getTags()) ]]),
apply := (nt, c, cnt) -> c[1],
#D isApplicable := P -> true,
#D allChildren := P -> [[TCompose([TTensorI(P[1], P[2].dims()[1], AVec, AVec), TTensorI(P[2], P[1].dims()[2], APar, APar)], P[3])]],
#D rule := (P, C) -> C[1]
),
# (A x B) -> (I x B)(A x I)
IxB_AxI := rec(
info := "(A x B) -> (I x B)(A x I)",
forTransposition := false,
applicable := nt -> true,
inplace := false,
children := (self, nt) >> let(inp := When(self.inplace, TInplace, x->x),
[[ TCompose([
inp(TTensorI(nt.params[2], nt.params[1].dims()[1], APar, APar)),
TTensorI(nt.params[1], nt.params[2].dims()[2], AVec, AVec)
]).withTags(nt.getTags()) ]]),
apply := (nt, c, cnt) -> c[1]
#D isApplicable := P -> true,
#D allChildren := P -> [[TCompose([TTensorI(P[2], P[1].dims()[1], APar, APar), TTensorI(P[1], P[2].dims()[2], AVec, AVec)], P[3])]],
#D rule := (P, C) -> C[1]
),
# (A x B) -> (L(B x I))(L(A x I))
L_BxI__L_AxI := rec(
info := "(A x B) -> (L(B x I))(L(A x I))",
forTransposition := false,
applicable := nt -> true,
children := nt -> [[ TCompose([
TTensorI(nt.params[2], nt.params[1].dims()[1], APar, AVec),
TTensorI(nt.params[1], nt.params[2].dims()[2], APar, AVec)
]).withTags(nt.getTags()) ]],
apply := (nt, c, cnt) -> c[1]
#D isApplicable := P -> true,
#D allChildren := P -> [[TCompose([TTensorI(P[2], P[1].dims()[1], APar, AVec), TTensorI(P[1], P[2].dims()[2], APar, AVec)], P[3])]],
#D rule := (P, C) -> C[1]
),
# (A x B) -> ((A x I)L)((B x I)L)
AxI_L__BxI_L := rec(
info := "(A x B) -> ((A x I)L)((B x I)L)",
forTransposition := false,
applicable := nt -> true,
children := nt -> [[ TCompose([
TTensorI(nt.params[1], nt.params[2].dims()[1], AVec, APar),
TTensorI(nt.params[2], nt.params[1].dims()[2], AVec, APar)
]).withTags(nt.getTags()) ]],
apply := (nt, c, cnt) -> c[1],
#D isApplicable := P -> true,
#D allChildren := P -> [[TCompose([TTensorI(P[1], P[2].dims()[1], AVec, APar), TTensorI(P[2], P[1].dims()[2], AVec, APar)], P[3])]],
#D rule := (P, C) -> C[1]
),
));
########################################################################
# rules for A x I, I x A, (A x I)L, (I x A)L
NewRulesFor(TTensorI, rec(
TTensorI_toGT := rec(
applicable := t -> true,
freedoms := t -> [], # no degrees of freedom
child := (t, fr) -> [ GT_TTensorI(t) ], # fr will be an empty list
apply := (t, C, Nonterms) -> C[1]
)
));
NewRulesFor(TTensorI, rec(
# base cases
# I x A
IxA_base := rec(
info := "IxA base",
forTransposition := false,
applicable := nt -> (not nt.hasTags() or nt.firstTag() = ANoTag) and IsParPar(nt.params),
children := nt -> [[ nt.params[1].withTags(nt.getTags()) ]],
apply := (nt, c, cnt) -> When(nt.params[2] > 1,
Tensor(I(nt.params[2]), c[1]),
c[1]
)
#D isApplicable := (self, P) >> PUntagged(self.nonTerminal, P) and IsParPar(P),
#D allChildren := P -> [[P[1]]],
#D rule := (P, C) -> When(P[2]>1,Tensor(I(P[2]),C[1]),C[1])
),
# A x I
AxI_base := rec(
info := "AxI base",
forTransposition := false,
applicable := nt -> (not nt.hasTags() or nt.firstTag() = ANoTag) and IsVecVec(nt.params),
children := nt -> [[ nt.params[1].withTags(nt.getTags()) ]],
apply := (nt, c, cnt) -> When( nt.params[2] > 1,
Tensor(c[1], I(nt.params[2])),
c[1]
),
#D isApplicable := (self, P) >> PUntagged(self.nonTerminal, P) and IsVecVec(P),
#D allChildren := P -> [[P[1]]],
#D rule := (P, C) -> When(P[2]>1,Tensor(C[1], I(P[2])),C[1])
),
# (I x A)L
IxA_L_base := rec(
info := "(IxA)L base",
forTransposition := false,
applicable := nt -> (not nt.hasTags() or nt.firstTag() = ANoTag) and IsParVec(nt.params),
children := nt -> [[ nt.params[1].withTags(nt.getTags()) ]],
apply := (nt, c, cnt) -> Tensor(I(nt.params[2]), c[1]) * L(c[1].dims()[2] * nt.params[2], nt.params[2]),
#D isApplicable := (self, P) >> PUntagged(self.nonTerminal, P) and IsParVec(P),
#D allChildren := P -> [[P[1]]],
#D rule := (P, C) -> Tensor(I(P[2]), C[1])*L(C[1].dims()[2]*P[2], P[2])
),
# L(I x A)
L_IxA_base := rec(
info := "L(IxA) base",
forTransposition := false,
applicable := nt -> (not nt.hasTags() or nt.firstTag() = ANoTag) and IsVecPar(nt.params),
children := nt -> [[ nt.params[1].withTags(nt.getTags()) ]],
apply := (nt, c, cnt) -> L(c[1].dims()[1] * nt.params[2], c[1].dims()[1]) * Tensor(I(nt.params[2]), c[1])
#D isApplicable := (self, P) >> PUntagged(self.nonTerminal, P) and IsVecPar(P),
#D allChildren := P -> [[P[1]]],
#D rule := (P, C) -> L(C[1].dims()[1]*P[2], C[1].dims()[1]) * Tensor(I(P[2]), C[1])
),
# splitting rules ##############################################################
# (A _m x I_n)L_mn_m
AxI_L_split := rec(
info := "split (A_m x I_n) L^mn_m --> (L_mn/u_m x I_u) * (I_n/u x (A_m x I_u) * L_mu_m )",
forTransposition := false,
applicable := nt -> (nt.firstTag().kind() = AGenericTag) and IsVecPar(nt.params),
children := nt -> let(t := nt.getTags(), p := nt.params, d := p[1].dims(), mu := t[1].params[1], [
TTensorI(TL(d[1] * p[2]/mu, d[1],1,1), mu, AVec, AVec).withTags(t),
TTensorI(p[1], mu, AVec, APar).withTags(t)
]),
apply := (nt, c, cnt) -> let(t := nt.getTags(), n := nt.params[2], mu := t[1].params[1],
c[1] * Tensor(I(n/mu), c[2])
),
# Example
# =======
# t:=TTensorI(DFT(4, 1), 4, AVec, APar).withTags([ AGenericTag(2) ]);
# c:=AxI_L_split.children(t);
# res := AxI_L_split.apply(t,c,false);
switch:=false
),
# (I_n x A_rxs) L^ns_n
IxA_L_split := rec(
info := "split (I_n x A_rxs) L^ns_n",
forTransposition := false,
applicable := nt -> IsParVec(nt.params),
children := nt -> let(t := nt.getTags(), p := nt.params, d := p[1].dims(), [[
TTensorI(p[1], p[2], APar, APar).withTags(t),
TL(d[2]*p[2], p[2], 1, 1).withTags(t)
]]),
apply := (nt, c, cnt) -> c[1] * c[2],
#D isApplicable := P -> P[3].isPar and P[4].isVec,
#D allChildren := P -> let(pv:=P[5], d:=P[1].dims(), [[TTensorI(P[1], P[2], APar, APar, pv), TL(d[2]*P[2], P[2], 1, 1, pv)]]),
#D rule := (P, C) -> C[1] * C[2],
switch := false
),
# L^nr_n (A_rxs x I_n)
L_AxI_split := rec(
info := "split L^nr_n (A_rxs x I_n) ",
forTransposition := false,
applicable := nt -> IsParVec(nt.params),
children := nt -> let( t := nt.getTags(), p := nt.params, d := p[1].dims(), [[
TL(d[1] * p[2], p[2], 1, 1).withTags(t),
TTensorI(p[1], p[2], AVec, AVec).withTags(t)
]]),
apply := (nt, c, cnt) -> c[1] * c[2],
switch := false
#D isApplicable := P -> P[3].isPar and P[4].isVec,
#D allChildren := P -> let(pv:=P[5], d:=P[1].dims(), [[ TL(d[1]*P[2], P[2], 1, 1, pv), TTensorI(P[1], P[2], AVec, AVec, pv) ]]),
#D rule := (P, C) -> C[1] * C[2],
),
# L^nr_r (I_n x A_rxs)
L_IxA_split := rec(
info := "split L^nr_r (I_n x A_rxs)",
forTransposition := false,
applicable := nt -> IsVecPar(nt.params),
children := nt -> let( t := nt.getTags(), p := nt.params, d := p[1].dims(), [[
TL(d[1]*p[2], d[1], 1, 1).withTags(t),
TTensorI(p[1], p[2], APar, APar).withTags(t)
]]),
apply := (nt, c, cnt) -> c[1] * c[2],
#D isApplicable := P -> P[3].isVec and P[4].isPar,
#D allChildren := P -> let(pv:=P[5], d:=P[1].dims(), [[TL(d[1]*P[2], d[1], 1, 1, pv), TTensorI(P[1], P[2], APar, APar, pv)]]),
#D rule := (P, C) -> C[1] * C[2],
switch := false
),
# (A_rxs x I_n) L^nr_s
AxI_L_split := rec(
info := "split (A_rxs x I_n) L^nr_s ",
forTransposition := false,
applicable := nt -> IsVecPar(nt.params),
children := nt -> let( t := nt.getTags(), p := nt.params, d := p[1].dims(), [[
TTensorI(p[1], p[2], APar, APar).withTags(t),
TL(d[2]*p[2], d[2], 1, 1).withTags(t)
]]),
apply := (nt, c, cnt) -> c[1] * c[2],
#D isApplicable := P -> P[3].isVec and P[4].isPar,
#D allChildren := P -> let(pv:=P[5], d:=P[1].dims(), [[ TTensorI(P[1], P[2], APar, APar, pv), TL(d[2]*P[2], d[2], 1, 1, pv)]]),
#D rule := (P, C) -> C[1] * C[2],
switch := false
),
## vector recursion #############################################################
# (I x (I x A)L)L
IxA_L_vecrec := rec(
info := "(I x (I x A)L)L vector recursion",
forTransposition := false,
applicable := nt -> ObjId(nt.params[1]) = TTensorI and IsParVec(nt.params) and IsParVec(nt.params[1].params),
children := nt -> let(k := nt.params[2], m := nt.params[1].params[2], n := nt.params[1].params[1].dims(), [[
TL(k*m, k, 1, n[1]).withTags(nt.getTags()),
TTensorI(nt.params[1].params[1], nt.params[2], APar, AVec).withTags(nt.getTags()),
TL(m*n[2], m, 1, k).withTags(nt.getTags())
]]),
apply := (nt, c, cnt) -> let(m := nt.params[1].params[2],
c[1] * Tensor(I(m), c[2]) * c[3]
),
#D isApplicable := P -> P[1].name = "TTensorI" and P[3].isPar and P[4].isVec and P[1].params[3].isPar and P[1].params[4].isVec,
#D allChildren := P -> let(k:=P[2], m:=P[1].params[2], n:=P[1].params[1].dims(),
#D [[ TL(k*m, k, 1, n[1], P[5]), TTensorI(P[1].params[1], P[2], APar, AVec, P[5]), TL(m*n[2], m, 1, k, P[5])]]),
#D rule := (P, C) -> let(k:=P[2], m:=P[1].params[2], n:=P[1].params[1].dims(),
#D C[1] * Tensor(I(m), C[2]) * C[3]
#D ),
switch := false
),
# L(I x L(I x A))
L_IxA_vecrec := rec(
info := "L(I x L(I x A)) vector recursion",
forTransposition := false,
applicable := nt -> ObjId(nt.params[1]) = TTensorI and IsVecPar(nt.params) and IsVecPar(nt.params[1].params),
children := nt -> let( k := nt.params[2], m := nt.params[1].params[2], n := nt.params[1].params[1].dims(), [[
TL(m*n[1], n[1], 1, k).withTags(nt.getTags()),
TTensorI(nt.params[1].params[1], nt.params[2], AVec, APar).withTags(nt.getTags()),
TL(k*m, m, 1, n[2]).withTags(nt.getTags())
]]),
apply := (nt, c, cnt) -> let(m := nt.params[1].params[2],
c[1] * Tensor(I(m), c[2]) * c[3]
),
#D isApplicable := P -> P[1].name = "TTensorI" and P[3].isVec and P[4].isPar and P[1].params[3].isVec and P[1].params[4].isPar,
#D allChildren := P -> let(k:=P[2], m:=P[1].params[2], n:=P[1].params[1].dims(),
#D [[ TL(m*n[1], n[1], 1, k, P[5]), TTensorI(P[1].params[1], P[2], AVec, APar, P[5]), TL(k*m, m, 1, n[2], P[5])]]),
#D rule := (P, C) -> let(k:=P[2], m:=P[1].params[2], n:=P[1].params[1].dims(),
#D C[1] * Tensor(I(m), C[2]) * C[3]
#D ),
switch := false
)
));
########################################################################
# rules for L
#D isVec := P->Length(P[5]) > 0 and P[5][1].isVec;
NewRulesFor(TL, rec(
# TL(N,n,l,r,[]) -> I_l x L(N,n) x I_r
L_base := rec(
forTransposition := false,
applicable := nt -> nt.isTag(1, spiral.paradigms.smp.AParSMP) or not nt.hasTags(),
apply := (nt, c, cnt) -> let(
c1 := When(nt.params[3]=1, [], [I(nt.params[3])]),
c2 := When(nt.params[4]=1, [], [I(nt.params[4])]),
Tensor(Concat(c1, [ L(nt.params[1], nt.params[2]) ], c2))
)
),
# TL(N,n,l,r,[]) -> I_l x L(N,n) x I_r
L_func := rec(
forTransposition := false,
applicable := nt -> nt.isTag(1, spiral.paradigms.smp.AParSMP) or not nt.hasTags(),
apply := (nt, c, cnt) -> let(
c1 := When(nt.params[3]=1, [], [fId(nt.params[3])]),
c2 := When(nt.params[4]=1, [], [fId(nt.params[4])]),
Prm(fTensor(Concat(c1, [ L(nt.params[1], nt.params[2]) ], c2)))
)
),
# recursion rules
IxLxI_kmn_n := rec (
info := "I(l) x L(kmn, n) x I(r) -> (I_l x L(kn,n) x I(mr))(I(kl) x L(mn, n) x I(r))",
forTransposition := false,
applicable := nt -> Length(DivisorsIntDrop(nt.params[1]/nt.params[2])) > 0,
children := nt -> let(
N := nt.params[1], n := nt.params[2],
km := N/n, ml := DivisorsIntDrop(km),
l := nt.params[3], r := nt.params[4],
List(ml, m -> let( k := km/m, [
TL(k*n, n, l, r*m).withTags(nt.getTags()),
TL(m*n, n, k*l, r).withTags(nt.getTags())
]))
),
apply := (nt, c, cnt) -> let(
spl := c[1] * c[2],
When(nt.params[1] = nt.params[2]^2,
SymSPL(spl),
spl
)
),
#D isApplicable := P -> #isVec(P) and let(v:=P[5][1].v, (P[1]*P[2] >= v or P[1]*P[3] >= v) and
#D Length(DivisorsIntDrop(P[1]/P[2])) > 0,
#D allChildren := P -> let(N:=P[1], n:=P[2], km:=N/n, ml:=DivisorsIntDrop(km), l:=P[3], r:=P[4], vp:=P[5],
#D List(ml, m->let(k:=km/m, [TL(k*n, n, l, r*m, vp), TL(m*n,n, k*l, r, vp)])) ),
#D rule := (P, C) -> let(spl := C[1]*C[2], When(P[1]=P[2]^2, SymSPL(spl), spl)),
switch := false
),
IxLxI_kmn_km := rec (
info := "I(l) x L(kmn, km) x I(r) -> (I(kl) x L(mn,m) x I(r))(I(l) x L(kn, k) x I(r))",
forTransposition := false,
applicable := nt -> Length(DivisorsIntDrop(nt.params[2])) > 0,
children := nt -> let(
N := nt.params[1], km := nt.params[2],
n := N/km, ml := DivisorsIntDrop(km),
l := nt.params[3], r := nt.params[4],
List(ml, m->let(
k := km/m,
[
TL(m*n, m, k*l, r).withTags(nt.getTags()),
TL(k*n,k, l, m*r).withTags(nt.getTags())
]
))
),
apply := (nt, C, cnt) -> let(P := nt.params, spl := C[1]*C[2], When(P[1]=P[2]^2, SymSPL(spl), spl)),
#D isApplicable := P -> #isVec(P) and let(v:=P[5][1].v, (P[1]*P[2] >= v or P[1]*P[3] >= v) and
#D Length(DivisorsIntDrop(P[2])) > 0,
#D allChildren := P -> let(N:=P[1], km:=P[2], n:=N/km, ml:=DivisorsIntDrop(km), l:=P[3], r:=P[4], vp:=P[5],
#D List(ml, m->let(k:=km/m, [TL(m*n, m, k*l, r, vp), TL(k*n,k, l, m*r, vp)])) ),
#D rule := (P, C) -> let(spl := C[1]*C[2], When(P[1]=P[2]^2, SymSPL(spl), spl)),
switch := false
),
IxLxI_IxLxI_up := rec (
info := "I(l) x L(kmn, km) x I(r) -> (I(l) x L(kmn, k) x I(r))(I(l) x L(kmn, m) x I(r))",
forTransposition := false,
applicable := nt -> Length(DivisorPairs(nt.params[2])) > 0,
children := nt -> let(
N := nt.params[1], km := DivisorPairs(nt.params[2]),
l := nt.params[3], r := nt.params[4], t := nt.getTags(),
List(km, i->[TL(N, i[1], l, r).withTags(t), TL(N, i[2], l, r).withTags(t)])
),
apply := (nt, c, nt) -> c[1] * c[2],
#D isApplicable := P -> Length(DivisorPairs(P[2])) > 0,
#D allChildren := P -> let(N:=P[1], km:=DivisorPairs(P[2]), l:=P[3], r:=P[4], vp:=P[5],
#D List(km, i->[TL(N, i[1], l, r, vp), TL(N, i[2], l, r, vp)])),
#D rule := (P, C) -> C[1]*C[2],
switch := false
),
IxLxI_IxLxI_down := rec (
info := "I(l) x L(kmn, k) x I(r) -> (I(l) x L(kmn, km) x I(r))(I(l) x L(kmn, kn) x I(r))",
forTransposition := false,
applicable := nt -> Length(DivisorPairs(nt.params[1]/nt.params[2])) > 0,
children := nt -> let(
N := nt.params[1], km := DivisorPairs(nt.params[1]/nt.params[2]),
l := nt.params[3], r := nt.params[4], t := nt.getTags(),
List(km, i->[TL(N, N/i[1], l, r).withTags(t), TL(N, N/i[2], l, r).withTags(t)])
),
apply := (nt, c, cnt) -> c[1] * c[2],
#D isApplicable := P -> Length(DivisorPairs(P[1]/P[2])) > 0,
#D allChildren := P -> let(N:=P[1], km:=DivisorPairs(P[1]/P[2]), l:=P[3], r:=P[4], vp:=P[5],
#D List(km, i->[TL(N, N/i[1], l, r, vp), TL(N, N/i[2], l, r, vp)])),
#D rule := (P, C) -> C[1]*C[2],
switch := false
),
IxLxI_loop1 := rec(
info := "I x L x I loop1",
forTransposition := false,
applicable := nt -> not nt.hasTags(),
apply := (nt, c, cnt) -> let(
m := nt.params[2], n := nt.params[1]/nt.params[2], j:=Ind(m), fid := fId(n), fbase := fBase(m,j),
gath := Gath(fTensor(fid, fbase)), scat := Scat(fTensor(fbase, fid)),
c0 := [ISum(j, m, scat*gath)],
c1 := When(nt.params[3]=1, [], [I(nt.params[3])]),
c2 := When(nt.params[4]=1, [], [I(nt.params[4])]),
Tensor(Concat(c1,c0,c2))
),
#D isApplicable := P -> Length(P[5]) = 0,
#D rule := (P, C) -> let(m:=P[2], n:=P[1]/P[2], j:=Ind(m), fid := fId(n), fbase := fBase(m,j),
#D gath := Gath(fTensor(fid, fbase)), scat := Scat(fTensor(fbase, fid)),
#D C0 := [ISum(j, m, scat*gath)], C1:=When(P[3]=1, [], [I(P[3])]), C2:=When(P[4]=1, [], [I(P[4])]), Tensor(Concat(C1, C0, C2))),
switch := false
),
IxLxI_loop2 := rec(
info := "I x L x I loop2",
forTransposition := false,
applicable := nt -> not nt.hasTags(),
apply := (nt, c, cnt) -> let(
m := nt.params[2], n := nt.params[1]/nt.params[2], j:=Ind(m), fid := fId(n), fbase := fBase(m,j),
gath := Gath(fTensor(fbase, fid)), scat := Scat(fTensor(fid, fbase)),
c0 := [ISum(j, m, scat*gath)],
c1 := When(nt.params[3]=1, [], [I(nt.params[3])]),
c2 := When(nt.params[4]=1, [], [I(nt.params[4])]),
Tensor(Concat(c1,c0,c2))
),
#D isApplicable := P -> Length(P[5]) = 0,
#D rule := (P, C) -> let(m:=P[2], n:=P[1]/P[2], j:=Ind(n), fid := fId(m), fbase := fBase(n,j),
#D gath := Gath(fTensor(fbase, fid)), scat := Scat(fTensor(fid, fbase)),
#D C0 := [ISum(j, n, scat*gath)], C1:=When(P[3]=1, [], [I(P[3])]), C2:=When(P[4]=1, [], [I(P[4])]), Tensor(Concat(C1, C0, C2))),
switch := false
)
));
###################################################################
NewRulesFor(TICompose, rec(
TICompose_unroll := rec(
forTransposition := false,
applicable := nt -> true,
children := nt -> [[
TCompose(
List([0..nt.params[2]-1], i -> RulesStrengthReduce(SubstBottomUp(Copy(nt.params[3]), nt.params[1], e -> V(i))))
).withTags(nt.getTags())
]],
apply := (nt, c, cnt) -> c[1]
)
));
NewRulesFor(TDR, rec(
TDR_base := rec(
forTransposition := false,
applicable := nt -> true,
apply := (nt, c, cnt) -> DR(nt.params[1], nt.params[2])
#D isApplicable := True,
#D rule := (P, C) -> DR(P[1], P[2])
)
));
NewRulesFor(TGath, rec(
TGath_base := rec(
applicable := True,
apply := (t, C, nt) -> t.terminate()
)
));
NewRulesFor(TScat, rec(
TScat_base := rec(
applicable := True,
apply := (t, C, nt) -> t.terminate()
)
));
NewRulesFor(TConj, rec(
TConj_tag := rec(
applicable := True,
children := t -> [[ t.params[1].withTags(t.getTags()) ]],
apply := (t, C, nt) -> ConjLR(C[1], t.params[2], t.params[3])
),
TConj_perm := rec(
applicable := True,
_cvtPerm := (t,p, use_tl) -> Cond(
ObjId(p) = fId,
I(p.params[1]),
ObjId(p) = L and use_tl,
TL(p.params[1], p.params[2], 1, 1).withTags(t.getTags()),
# else
FormatPrm(p)
),
# one degree of freedom -- use TL (true) or use FormatPrm(L) (false)
freedoms := (self, t) >> [[ true, false ]],
child := (self, t, fr) >> [
self._cvtPerm(t, t.params[2], fr[1]),
t.params[1].withTags(t.getTags()),
self._cvtPerm(t, t.params[3], fr[1])
],
apply := (self, t, C, Nonterms) >> C[1]*C[2]*C[3]
),
TConj_cplx := rec(
applicable := t -> t.params[1] _is TRC,
_cvtPerm := (t, p) -> Cond(
ObjId(p) = fId,
I(p.params[1]),
ObjId(p) = L,
TL(p.params[1], p.params[2], 1, 1).withTags(t.getTags()),
# else
FormatPrm(p)
),
freedoms := (self, t) >> [],
child := (self, t, fr) >> [
self._cvtPerm(t, t.params[2]),
t.params[1].withTags(List(t.getTags(), t->Cond(t.kind()=spiral.paradigms.vector.AVecReg, spiral.paradigms.vector.AVecRegCx(t.isa.cplx()), t))),
self._cvtPerm(t, t.params[3])
],
apply := (self, t, C, Nonterms) >> C[1]*C[2]*C[3]
),
));
#########################################################################
NewRulesFor(TTensorInd, rec(
# base cases
# I x A
dsA_base := rec(
info := "IxA base",
forTransposition := false,
applicable := nt -> not nt.hasTags() and IsParPar(nt.params),
children := nt -> [[ nt.params[1], InfoNt(nt.params[2]) ]],
apply := (nt, c, cnt) -> IDirSum(cnt[2].params[1], c[1])
),
# A x I
L_dsA_L_base := rec(
info := "AxI base",
forTransposition := false,
applicable := nt -> not nt.hasTags() and IsVecVec(nt.params),
children := nt -> [[ nt.params[1], InfoNt(nt.params[2]) ]],
apply := (nt, c, cnt) ->
L(c[1].dims()[1] * nt.params[2].range, c[1].dims()[1]) *
IDirSum(cnt[2].params[1], c[1]) *
L(c[1].dims()[2] * nt.params[2].range, nt.params[2].range)
),
# (I x A)L
dsA_L_base := rec(
info := "(IxA)L base",
forTransposition := false,
applicable := nt -> not nt.hasTags() and IsParVec(nt.params),
children := nt -> [[ nt.params[1], InfoNt(nt.params[2]) ]],
apply := (nt, c, cnt) ->
IDirSum(cnt[2].params[1], c[1]) *
L(c[1].dims()[2] * nt.params[2].range, nt.params[2].range),
),
# L(I x A)
L_dsA_base := rec(
info := "L(IxA) base",
forTransposition := false,
applicable := nt -> not nt.hasTags() and IsVecPar(nt.params),
children := nt -> [[ nt.params[1], InfoNt(nt.params[2]) ]],
apply := (nt, c, cnt) ->
L(c[1].dims()[1] * nt.params[2].range, c[1].dims()[1]) *
IDirSum(cnt[2].params[1], c[1])
)
));
| GAP | 4 | sr7cb/spiral-software | namespaces/spiral/paradigms/common/breakdown.gi | [
"BSD-2-Clause-FreeBSD"
] |
// Copyright 2010-2012 RethinkDB, all rights reserved.
#include "concurrency/cond_var.hpp"
#include "arch/runtime/coroutines.hpp"
#include "do_on_thread.hpp"
void cond_t::pulse_if_not_already_pulsed() {
assert_thread();
if (!is_pulsed()) {
pulse();
}
}
void one_waiter_cond_t::pulse() {
rassert(!pulsed_);
pulsed_ = true;
if (waiter_) {
coro_t *tmp = waiter_;
waiter_ = nullptr;
tmp->notify_later_ordered();
}
}
void one_waiter_cond_t::wait_ordered() {
rassert(!waiter_);
if (!pulsed_) {
waiter_ = coro_t::self();
coro_t::wait();
rassert(pulsed_);
}
}
| C++ | 4 | zadcha/rethinkdb | src/concurrency/cond_var.cc | [
"Apache-2.0"
] |
package org.xtendroid.xtendroidtest.test
import android.test.AndroidTestCase
import java.util.Date
import static extension org.xtendroid.utils.TimeUtils.*
class TimeUtils extends AndroidTestCase {
def testOne() {
var date1 = now
var date2 = now + 24.hours
assertEquals(date2 - date1, 24.hours)
assertEquals(date2 - 1.hour, date1 + 23.hours)
var date3 = new Date()
var date4 = date3 + 2.hours
var date5 = new Date(date4.time)
assertEquals(date3.time - date4.time, -2.hours)
assertTrue(date4 == date5)
}
} | Xtend | 4 | Buggaboo/Xtendroid | XtendroidTest/XtendroidTestCasesTest/src/org/xtendroid/xtendroidtest/test/TimeUtils.xtend | [
"MIT"
] |
<br> <br> <br>
<div class="container-fluid" style="color:black ; background: transparent linear-gradient(to bottom, rgb(240, 249, 255) 0%, rgb(203, 235, 255) 47%, rgb(161, 219, 255) 100%) repeat scroll 0% 0% ; margin-bottom: 0%;">
<div class="container" style=" margin-bottom: 2%;">
<br> <br>
<div class="row">
<div class="col-sm-12 col-md-4">
Basic <br> <br>
<ul>
<li><a href="../doc1.13/ringapps.html" >Applications developed in little hours</a></li>
<li><a href="../doc1.13/introduction.html" >Introduction</a></li>
<li><a href="../doc1.13/languagedesign.html" >Language Design</a></li>
<li><a href="../doc1.13/sourcecode.html" >Building From Source Code</a></li>
<li><a href="../doc1.13/contribute.html" >How to contribute?</a></li>
<li><a href="../doc1.13/ringnotepad.html" >Using Ring Notepad</a></li>
<li><a href="../doc1.13/getting_started.html" >Getting Started - First Style </a></li>
<li><a href="../doc1.13/getting_started2.html" >Getting Started - Second Style</a></li>
<li><a href="../doc1.13/getting_started3.html" >Getting Started - Third Style</a></li>
<li><a href="../doc1.13/variables.html" >Variables</a></li>
<li><a href="../doc1.13/operators.html" >Operators</a></li>
<li><a href="../doc1.13/controlstructures.html" >Control Structures - First Style</a></li>
<li><a href="../doc1.13/controlstructures2.html" >Control Structures - Second Style</a></li>
<li><a href="../doc1.13/controlstructures3.html" >Control Structures - Third Style</a></li>
<li><a href="../doc1.13/getinput.html" >Getting Input</a></li>
<li><a href="../doc1.13/functions.html" >Functions - First Style</a></li>
<li><a href="../doc1.13/functions2.html" >Functions - Second Style</a></li>
<li><a href="../doc1.13/functions3.html" >Functions - Third Style</a></li>
<li><a href="../doc1.13/programstructure.html" >Program Structure</a></li>
<li><a href="../doc1.13/lists.html" >Lists</a></li>
<li><a href="../doc1.13/strings.html" >Strings</a></li>
<li><a href="../doc1.13/dateandtime.html" >Date and Time</a></li>
<li><a href="../doc1.13/checkandconvert.html" >Check Data Type and Conversion</a></li>
<li><a href="../doc1.13/mathfunc.html" >Mathematical Functions</a></li>
<li><a href="../doc1.13/files.html" >Files</a></li>
<li><a href="../doc1.13/systemfunc.html" >System Functions</a></li>
<li><a href="../doc1.13/evaldebug.html" >Eval() and Debugging</a></li>
<li><a href="../doc1.13/demo.html" >Demo Programs</a></li>
</ul>
</div>
<div class="col-sm-12 col-md-4">
Intermediate <br> <br>
<ul>
<li><a href="../doc1.13/odbc.html" >ODBC Functions</a></li>
<li><a href="../doc1.13/mysql.html" >MYSQL Functions</a></li>
<li><a href="../doc1.13/sqlite.html" >SQLite Functions</a></li>
<li><a href="../doc1.13/postgresql.html" >PostgreSQL Functions</a></li>
<li><a href="../doc1.13/secfunc.html" >Security and Internet Functions</a></li>
<li><a href="../doc1.13/oop.html" >Object Oriented Programming</a></li>
<li><a href="../doc1.13/fp.html" >Functional Programming (FP)</a></li>
<li><a href="../doc1.13/metaprog.html" >Reflection and Meta-programming</a></li>
<li><a href="../doc1.13/stdlib.html" >Stdlib Functions</a></li>
<li><a href="../doc1.13/stdlibclasses.html" >Stdlib Classes</a></li>
<li><a href="../doc1.13/declarative.html" >Declarative Programming using Nested Structures</a></li>
<li><a href="../doc1.13/natural.html" >Natural language programming</a></li>
<li><a href="../doc1.13/naturallibrary.html" >Using the Natural Library</a></li>
<li><a href="../doc1.13/scope.html" >Scope Rules for Variables and Attributes</a></li>
<li><a href="../doc1.13/scope2.html" >Scope Rules for Functions and Methods</a></li>
<li><a href="../doc1.13/syntaxflexibility.html" >Syntax Flexibility</a></li>
<li><a href="../doc1.13/distribute.html" >Distributing Ring Applications</a></li>
<li><a href="../doc1.13/distribute_ring2exe.html" >Distributing Ring Applications using Ring2EXE</a></li>
<li><a href="../doc1.13/ringpm.html" >The Ring Package Manager (RingPM)</a></li>
<li><a href="../doc1.13/typehints.html" >The Type Hints Library</a></li>
<li><a href="../doc1.13/web.html" >Web Development (CGI Library)</a></li>
<li><a href="../doc1.13/deployincloud.html" >Deploying Web Applications in the Cloud</a></li>
<li><a href="../doc1.13/libcurl.html" >Using RingLibCurl</a></li>
<li><a href="../doc1.13/ringzip.html" >Using RingZip</a></li>
<li><a href="../doc1.13/allegro.html" >Graphics and 2D Games programming using RingAllegro</a></li>
<li><a href="../doc1.13/libsdl.html" >Using RingLibSDL</a></li>
<li><a href="../doc1.13/gameengine.html" >Demo Project - Game Engine for 2D Games</a></li>
<li><a href="../doc1.13/gameengineandorid.html" >Building Games for Android</a></li>
</ul>
</div>
<div class="col-sm-12 col-md-4">
Advanced <br> <br>
<ul>
<li><a href="../doc1.13/usingopengl.html" >Using RingOpenGL and RingFreeGLUT for 3D Graphics</a></li>
<li><a href="../doc1.13/usingopengl2.html" >Using RingOpenGL and RingAllegro for 3D Graphics</a></li>
<li><a href="../doc1.13/goldmagic800.html" >The Gold Magic 800 Game</a></li>
<li><a href="../doc1.13/ringraylib.html" >Using RingRayLib</a></li>
<li><a href="../doc1.13/qt.html" >Desktop and Mobile development using RingQt</a></li>
<li><a href="../doc1.13/qtmobile.html" >Building RingQt Applications for Mobile</a></li>
<li><a href="../doc1.13/ringqtobjects.html" >Objects Library for RingQt Application</a></li>
<li><a href="../doc1.13/formdesigner.html" >Using the Form Designer</a></li>
<li><a href="../doc1.13/multilanguage.html" >Multi-language Applications</a></li>
<li><a href="../doc1.13/qt3d.html" >Using Qt3D</a></li>
<li><a href="../doc1.13/lowlevel.html" >Low Level Functions</a></li>
<li><a href="../doc1.13/debug.html" >The Trace Library and the Interactive Debugger</a></li>
<li><a href="../doc1.13/extension_tutorial.html" >Tutorial: Ring Extensions in C/C++</a></li>
<li><a href="../doc1.13/extension.html" >Extension using the C/C++ languages</a></li>
<li><a href="../doc1.13/embedding.html" >Embedding Ring Language in C/C++ Programs</a></li>
<li><a href="../doc1.13/codegenerator.html" >Code Generator for wrapping C/C++ Libraries</a></li>
<li><a href="../doc1.13/ringbeep.html" >Create your first extension using the Code Generator</a></li>
</ul>
Reference <br> <br>
<ul>
<li><a href="../doc1.13/compiler.html" >Command Line Options</a></li>
<li><a href="../doc1.13/generalinfo.html" >General Information</a></li>
<li><a href="../doc1.13/reference.html" >Language Reference</a></li>
<li><a href="../doc1.13/faq.html" >Frequently Asked Questions (FAQ)</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="container-fluid" style="text-align:center;color:black; height: 25px; background: transparent linear-gradient(to bottom, rgb(240, 249, 255) 0%, rgb(203, 235, 255) 47%, rgb(161, 219, 255) 100%) repeat scroll 0% 0% ; margin-bottom: 0%;">
<a href="https://github.com/ring-lang/ring/" target="_blank">GitHub</a>
<a href="../resources.html">Resources</a>
<a href="../team.html">Team</a>
</div>
<div class="container-fluid" style="color:black ; height: 5px; background: transparent linear-gradient(to bottom, rgb(0, 183, 234) 0%, rgb(0, 158, 195) 100%) repeat scroll 0% 0% ; margin-bottom: 0%; text-align:center;">
<p>
</p>
</div> | RHTML | 4 | idrassi/ring | marketing/website/cgi-bin/footer.rhtml | [
"MIT"
] |
$$ MODE TUSCRIPT
line=""
LOOP n=1,10
line=CONCAT (line,n)
IF (n!=10) line=CONCAT (line,", ")
ENDLOOP
PRINT line
| Turing | 3 | LaudateCorpus1/RosettaCodeData | Task/Loops-N-plus-one-half/TUSCRIPT/loops-n-plus-one-half.tu | [
"Info-ZIP"
] |
camera {
//location <15.0, 3, -3>
location <3, 0.5, -3>
look_at <4, 1, 0>
}
background {
rgb <0.8, 0.8, 0.6>
}
light_source {
<6, 4, -4>
color rgb <1, 1, 1>
area_light <2, 0, 0>, <0, 2, 0>, 8, 8
circular
orient
}
light_source {
<2.5, 4.8, -0.2>
color rgb <1, 1, 0>
fade_distance 5
fade_power 2
area_light <1, 0, 0>, <0, 1, 0>, 4, 4
circular
orient
}
#declare tile_normal =
normal {
gradient x, 2
slope_map {
[0.000 <0, 1>]
[0.005 <0.1, 0>]
[0.995 <0.1, 0>]
[1.000 <0, -1>]
}
}
#declare room_exterior =
box {
<-0.2, -0.2, 0.2>, <5.2, 5.2, -5.2>
pigment {
color rgb <1, 1, 1>
}
}
#declare room_interior =
box {
<0, 0, 0>, <5, 5, -5>
pigment {
checker
color rgb <1.0, 0.5, 0.6>
color rgb <1.0, 0.7, 0.8>
}
normal {
average normal_map {
[1 tile_normal]
[1 tile_normal rotate <0, 90, 0>]
[1 tile_normal rotate <0, 0, 90>]
}
}
finish {
specular 0.9
roughness 0.01
reflection 0.2
ambient 0.3
}
}
#declare window =
box {
<4.9, 4, -2> <5.3, 2, -4>
}
#declare room =
difference {
object {
room_exterior
}
object {
room_interior
}
object {
window
}
}
#declare glass_finish =
finish {
reflection 0.1
refraction 1.0
ior 1.5
phong 1.0
}
#declare water_glass =
difference {
cylinder {
<0, 0, 0>, <0, 1, 0>, 0.3
}
cylinder {
<0, 0.04, 0>, <0, 1.1, 0>, 0.27
}
pigment {
color rgbf <1, 1, 1, 0.8>
}
finish {
glass_finish
}
}
#declare wine_glass =
difference {
merge {
cylinder {
<0, 1.2, 0>, <0, 0.9, 0>, 0.3
}
sphere {
<0, 0.9, 0>, 0.3
}
cylinder {
<0, 0.6, 0>, <0, 0.1, 0>, 0.03
}
cone {
<0, 0.1, 0>, 0.03,
<0, 0.0, 0>, 0.3
}
}
union {
cylinder {
<0, 1.3, 0>, <0, 0.9, 0>, 0.27
}
sphere {
<0, 0.9, 0>, 0.27
}
}
pigment {
color rgbf <1, 1, 1, 0.8>
}
finish {
glass_finish
}
}
object {
room
}
object {
water_glass
translate <3, 0, -0.75>
}
object {
wine_glass
translate <3.95, 0, -1>
}
| POV-Ray SDL | 4 | spcask/pov-ray-tracing | src/scene23.pov | [
"MIT"
] |
/*
* Copyright (c) 2012-2021 Daniele Bartolini et al.
* License: https://github.com/dbartolini/crown/blob/master/LICENSE
*/
using Gee;
namespace Crown
{
public class Unit
{
public Database _db;
public Guid _id;
public Unit(Database db, Guid id)
{
_db = db;
_id = id;
}
public Value? get_component_property(Guid component_id, string key)
{
Value? val;
// Search in components
val = _db.get_property(_id, "components");
if (val != null)
{
if (((HashSet<Guid?>)val).contains(component_id))
return _db.get_property(component_id, key);
}
// Search in modified_components
val = _db.get_property(_id, "modified_components.#" + component_id.to_string() + "." + key);
if (val != null)
return val;
// Search in prefab
val = _db.get_property(_id, "prefab");
if (val != null)
{
// Convert prefab path to object ID.
string prefab = (string)val;
Guid prefab_id = _db.get_property_guid(GUID_ZERO, prefab + ".unit");
Unit unit = new Unit(_db, prefab_id);
return unit.get_component_property(component_id, key);
}
return null;
}
public bool get_component_property_bool(Guid component_id, string key)
{
return (bool)get_component_property(component_id, key);
}
public double get_component_property_double(Guid component_id, string key)
{
return (double)get_component_property(component_id, key);
}
public string get_component_property_string(Guid component_id, string key)
{
return (string)get_component_property(component_id, key);
}
public Guid get_component_property_guid(Guid component_id, string key)
{
return (Guid)get_component_property(component_id, key);
}
public Vector3 get_component_property_vector3(Guid component_id, string key)
{
return (Vector3)get_component_property(component_id, key);
}
public Quaternion get_component_property_quaternion(Guid component_id, string key)
{
return (Quaternion)get_component_property(component_id, key);
}
public void set_component_property_bool(Guid component_id, string key, bool val)
{
// Search in components
Value? components = _db.get_property(_id, "components");
if (components != null && ((HashSet<Guid?>)components).contains(component_id))
{
_db.set_property_bool(component_id, key, val);
return;
}
_db.set_property_bool(_id, "modified_components.#" + component_id.to_string() + "." + key, val);
}
public void set_component_property_double(Guid component_id, string key, double val)
{
// Search in components
Value? components = _db.get_property(_id, "components");
if (components != null && ((HashSet<Guid?>)components).contains(component_id))
{
_db.set_property_double(component_id, key, val);
return;
}
_db.set_property_double(_id, "modified_components.#" + component_id.to_string() + "." + key, val);
}
public void set_component_property_string(Guid component_id, string key, string val)
{
// Search in components
Value? components = _db.get_property(_id, "components");
if (components != null && ((HashSet<Guid?>)components).contains(component_id))
{
_db.set_property_string(component_id, key, val);
return;
}
_db.set_property_string(_id, "modified_components.#" + component_id.to_string() + "." + key, val);
}
public void set_component_property_guid(Guid component_id, string key, Guid val)
{
// Search in components
Value? components = _db.get_property(_id, "components");
if (components != null && ((HashSet<Guid?>)components).contains(component_id))
{
_db.set_property_guid(component_id, key, val);
return;
}
_db.set_property_guid(_id, "modified_components.#" + component_id.to_string() + "." + key, val);
}
public void set_component_property_vector3(Guid component_id, string key, Vector3 val)
{
// Search in components
Value? components = _db.get_property(_id, "components");
if (components != null && ((HashSet<Guid?>)components).contains(component_id))
{
_db.set_property_vector3(component_id, key, val);
return;
}
_db.set_property_vector3(_id, "modified_components.#" + component_id.to_string() + "." + key, val);
}
public void set_component_property_quaternion(Guid component_id, string key, Quaternion val)
{
// Search in components
Value? components = _db.get_property(_id, "components");
if (components != null && ((HashSet<Guid?>)components).contains(component_id))
{
_db.set_property_quaternion(component_id, key, val);
return;
}
_db.set_property_quaternion(_id, "modified_components.#" + component_id.to_string() + "." + key, val);
}
/// Returns whether the @a unit_id has a component of type @a component_type.
public static bool has_component_static(out Guid component_id, out Guid owner_id, string component_type, Database db, Guid unit_id)
{
Value? val;
component_id = GUID_ZERO;
owner_id = GUID_ZERO;
bool prefab_has_component = false;
// If the component type is found inside the "components" array, the unit has the component
// and it owns it.
val = db.get_property(unit_id, "components");
if (val != null)
{
foreach (Guid id in (HashSet<Guid?>)val)
{
if((string)db.get_property(id, "type") == component_type)
{
component_id = id;
owner_id = unit_id;
return true;
}
}
}
// Otherwise, search if any prefab has the component.
val = db.get_property(unit_id, "prefab");
if (val != null)
{
// Convert prefab path to object ID.
string prefab = (string)val;
Guid prefab_id = db.get_property_guid(GUID_ZERO, prefab + ".unit");
prefab_has_component = has_component_static(out component_id
, out owner_id
, component_type
, db
, prefab_id
);
}
if (prefab_has_component)
return db.get_property(unit_id, "deleted_components.#" + component_id.to_string()) == null;
component_id = GUID_ZERO;
owner_id = GUID_ZERO;
return false;
}
/// Returns whether the unit has the component_type.
public bool has_component(out Guid component_id, string component_type)
{
Guid owner_id;
return Unit.has_component_static(out component_id, out owner_id, component_type, _db, _id);
}
public void remove_component(Guid component_id)
{
_db.remove_from_set(_id, "components", component_id);
}
/// Returns whether the unit has a prefab.
public bool has_prefab()
{
return _db.has_property(_id, "prefab");
}
/// Returns whether the unit is a light unit.
public bool is_light()
{
return has_prefab()
&& _db.get_property_string(_id, "prefab") == "core/units/light";
}
/// Returns whether the unit is a camera unit.
public bool is_camera()
{
return has_prefab()
&& _db.get_property_string(_id, "prefab") == "core/units/camera";
}
}
}
| Vala | 5 | galek/crown | tools/level_editor/unit.vala | [
"MIT"
] |
$TTL 300
@ IN SSHFP 1 1 66C7D5540B7D75A1FB4C84FEBFA178AD99BDD67C
IN SSHFP 1 2 745A635BC46A397A5C4F21D437483005BCC40D7511FF15FBFAFE913A081559BC
IN SSHFP 2 1 66C7D5540B7D75A1FB4C84FEBFA178AD99BDD67C
IN SSHFP 2 2 745A635BC46A397A5C4F21D437483005BCC40D7511FF15FBFAFE913A081559BC
IN SSHFP 3 1 66C7D5540B7D75A1FB4C84FEBFA178AD99BDD67C
IN SSHFP 3 2 745A635BC46A397A5C4F21D437483005BCC40D7511FF15FBFAFE913A081559BC
IN SSHFP 4 1 66C7D5540B7D75A1FB4C84FEBFA178AD99BDD67C
IN SSHFP 4 2 745A635BC46A397A5C4F21D437483005BCC40D7511FF15FBFAFE913A081559BC
| DNS Zone | 2 | IT-Sumpfling/dnscontrol | pkg/js/parse_tests/022-sshfp/foo.com.zone | [
"MIT"
] |
metadata:
sidecar.istio.io/rewriteAppHTTPProbers: "false"
spec:
initContainers:
- name: grpc-bootstrap-init
image: busybox:1.28
volumeMounts:
- mountPath: /var/lib/grpc/data/
name: grpc-io-proxyless-bootstrap
env:
- name: INSTANCE_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: ISTIO_NAMESPACE
value: |
{{ .Values.global.istioNamespace }}
command:
- sh
- "-c"
- |-
NODE_ID="sidecar~${INSTANCE_IP}~${POD_NAME}.${POD_NAMESPACE}~cluster.local"
SERVER_URI="dns:///istiod.${ISTIO_NAMESPACE}.svc:15010"
echo '
{
"xds_servers": [
{
"server_uri": "'${SERVER_URI}'",
"channel_creds": [{"type": "insecure"}],
"server_features" : ["xds_v3"]
}
],
"node": {
"id": "'${NODE_ID}'",
"metadata": {
"GENERATOR": "grpc"
}
}
}' > /var/lib/grpc/data/bootstrap.json
containers:
{{- range $index, $container := .Spec.Containers }}
- name: {{ $container.Name }}
env:
- name: GRPC_XDS_BOOTSTRAP
value: /var/lib/grpc/data/bootstrap.json
- name: GRPC_GO_LOG_VERBOSITY_LEVEL
value: "99"
- name: GRPC_GO_LOG_SEVERITY_LEVEL
value: info
volumeMounts:
- mountPath: /var/lib/grpc/data/
name: grpc-io-proxyless-bootstrap
{{- end }}
volumes:
- name: grpc-io-proxyless-bootstrap
emptyDir: {}
| YAML | 4 | rveerama1/istio | manifests/charts/istio-control/istio-discovery/files/grpc-simple.yaml | [
"Apache-2.0"
] |
functions {
vector eigenvalues_sym_external(matrix K);
}
data {
int<lower = 1> N;
real<lower = 0.0> y[N - 1];
real m;
}
transformed data {
matrix[N, N] K_unscaled = rep_matrix(0, N, N);
for(n in 1:N) {
if(n == 1) {
K_unscaled[n, n] = 1.0 / m;
K_unscaled[n, n + 1] = -1.0 / m;
} else if(n == N) {
K_unscaled[n, n - 1] = -1.0 / m;
K_unscaled[n, n] = 1.0 / m;
} else {
K_unscaled[n, n - 1] = -1.0 / m;
K_unscaled[n, n] = 2.0 / m;
K_unscaled[n, n + 1] = -1.0 / m;
}
}
}
parameters {
real<lower = 0.0> k;
real<lower = 0.0> sigma;
}
transformed parameters {
vector[N - 1] eigs;
{
matrix[N, N] K = k * K_unscaled;
eigs = eigenvalues_sym_external(K)[2:N];
}
}
model {
k ~ normal(1.0, 1.0);
sigma ~ normal(0.0, 1.0);
y ~ normal(sqrt(eigs), sigma);
}
| Stan | 4 | bbbales2/stancon_2018 | models/spring_example_external.stan | [
"CC-BY-4.0"
] |
# Edge project file (edit at your own risk)
# Copyright (c) 2004-2017 Elements Interactive B.V.
# -----------------------------------------
# General project properties
projectname = "view3d"
caption = "View 3D"
target type = "bin"
appuid = "0x10205d9f"
version = "1.00.0"
capabilities = "None"
selplatform = "Series 60 (3rd edition),UIQ (3.0)"
noresemu = "1"
# Project source, header and resource tree
sourcefile = "..\code\view3d.cpp"
headerfile = "..\code\main.h"
resourcepath = "Icons"
resourcefile = "..\res\icons\ico48_64.bmp"
resourcefile = "..\res\icons\ico48.bmp"
resourcefile = "..\res\icons\ico32.bmp"
resourcefile = "..\res\icons\ico24.bmp"
resourcefile = "..\res\icons\ico20.bmp"
resourcefile = "..\res\icons\ico16.bmp"
endpath = 1
resourcepath = "Install"
resourcefile = "..\res\edgelogo.3ds"
resourcefile = "..\res\texture.png"
endpath = 0
# Project environment
incpath = "."
pluginlib = "opengl\plugin1-0.lib"
dynamiclib = "%sdkpath%\Epoc32\Release\armv5\lib\libgles_cm.dso"
macrodef = "EGL_SYMBIAN"
| Ecere Projects | 2 | elementsinteractive/edgelib | samples/View3D/workspace_eide_opengl/view3d_symbian.epj | [
"BSD-3-Clause"
] |
MSTRINGIFY(
cbuffer VSolveLinksCB : register( b0 )
{
int startLink;
int numLinks;
float kst;
int padding;
};
// Node indices for each link
StructuredBuffer<int2> g_linksVertexIndices : register( t0 );
StructuredBuffer<float> g_linksLengthRatio : register( t1 );
StructuredBuffer<float4> g_linksCurrentLength : register( t2 );
StructuredBuffer<float> g_vertexInverseMass : register( t3 );
RWStructuredBuffer<float4> g_vertexVelocity : register( u0 );
[numthreads(128, 1, 1)]
void
VSolveLinksKernel( uint3 Gid : SV_GroupID, uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID, uint GI : SV_GroupIndex )
{
int linkID = DTid.x + startLink;
if( DTid.x < numLinks )
{
int2 nodeIndices = g_linksVertexIndices[linkID];
int node0 = nodeIndices.x;
int node1 = nodeIndices.y;
float linkLengthRatio = g_linksLengthRatio[linkID];
float3 linkCurrentLength = g_linksCurrentLength[linkID].xyz;
float3 vertexVelocity0 = g_vertexVelocity[node0].xyz;
float3 vertexVelocity1 = g_vertexVelocity[node1].xyz;
float vertexInverseMass0 = g_vertexInverseMass[node0];
float vertexInverseMass1 = g_vertexInverseMass[node1];
float3 nodeDifference = vertexVelocity0 - vertexVelocity1;
float dotResult = dot(linkCurrentLength, nodeDifference);
float j = -dotResult*linkLengthRatio*kst;
float3 velocityChange0 = linkCurrentLength*(j*vertexInverseMass0);
float3 velocityChange1 = linkCurrentLength*(j*vertexInverseMass1);
vertexVelocity0 += velocityChange0;
vertexVelocity1 -= velocityChange1;
g_vertexVelocity[node0] = float4(vertexVelocity0, 0.f);
g_vertexVelocity[node1] = float4(vertexVelocity1, 0.f);
}
}
); | HLSL | 4 | BonJovi1/Bullet-the-Blue-Sky | external/bullet-2.81-rev2613/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/HLSL/VSolveLinks.hlsl | [
"WTFPL"
] |
digraph ThreadHeap {
rankdir=LR
node [shape=box, width=0.3, height=0.3]
nodesep=.05
heap [shape=record, height=2, label="<f0>class 0|<f1>class 1|<f2>class 2|..."]
O0 [label=""]
O1 [label=""]
O2 [label=""]
O3 [label=""]
O4 [label=""]
O5 [label=""]
sep1 [shape=plaintext, label="..."]
sep2 [shape=plaintext, label="..."]
sep3 [shape=plaintext, label="..."]
heap:f0 -> O0 -> O1 -> sep1
heap:f1 -> O2 -> O3 -> sep2
heap:f2 -> O4 -> O5 -> sep3
}
| Graphviz (DOT) | 2 | cssl-unist/tweezer | Docker/gperftools/docs/threadheap.dot | [
"MIT"
] |
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {Subject} from 'rxjs';
export const patchDecodeBase64 = (proto: {decodeBase64: typeof atob}) => {
let unpatch: () => void = () => undefined;
if ((typeof atob === 'undefined') && (typeof Buffer === 'function')) {
const oldDecodeBase64 = proto.decodeBase64;
const newDecodeBase64 = (input: string) => Buffer.from(input, 'base64').toString('binary');
proto.decodeBase64 = newDecodeBase64;
unpatch = () => {
proto.decodeBase64 = oldDecodeBase64;
};
}
return unpatch;
};
export class MockServiceWorkerContainer {
private onControllerChange: Function[] = [];
private onMessage: Function[] = [];
mockRegistration: MockServiceWorkerRegistration|null = null;
controller: MockServiceWorker|null = null;
messages = new Subject<any>();
notificationClicks = new Subject<{}>();
addEventListener(event: 'controllerchange'|'message', handler: Function) {
if (event === 'controllerchange') {
this.onControllerChange.push(handler);
} else if (event === 'message') {
this.onMessage.push(handler);
}
}
removeEventListener(event: 'controllerchange', handler: Function) {
if (event === 'controllerchange') {
this.onControllerChange = this.onControllerChange.filter(h => h !== handler);
} else if (event === 'message') {
this.onMessage = this.onMessage.filter(h => h !== handler);
}
}
async register(url: string): Promise<void> {
return;
}
async getRegistration(): Promise<ServiceWorkerRegistration> {
return this.mockRegistration as any;
}
setupSw(url: string = '/ngsw-worker.js'): void {
this.mockRegistration = new MockServiceWorkerRegistration();
this.controller = new MockServiceWorker(this, url);
this.onControllerChange.forEach(onChange => onChange(this.controller));
}
sendMessage(value: Object): void {
this.onMessage.forEach(onMessage => onMessage({
data: value,
}));
}
}
export class MockServiceWorker {
constructor(private mock: MockServiceWorkerContainer, readonly scriptURL: string) {}
postMessage(value: Object) {
this.mock.messages.next(value);
}
}
export class MockServiceWorkerRegistration {
pushManager: PushManager = new MockPushManager() as any;
}
export class MockPushManager {
private subscription: PushSubscription|null = null;
getSubscription(): Promise<PushSubscription|null> {
return Promise.resolve(this.subscription);
}
subscribe(options?: PushSubscriptionOptionsInit): Promise<PushSubscription> {
this.subscription = new MockPushSubscription() as any;
return Promise.resolve(this.subscription!);
}
}
export class MockPushSubscription {
unsubscribe(): Promise<boolean> {
return Promise.resolve(true);
}
}
| TypeScript | 5 | raghavendramohan/angular | packages/service-worker/testing/mock.ts | [
"MIT"
] |
/*
* Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/String.h>
#include <LibJS/Heap/Cell.h>
namespace JS {
class Symbol final : public Cell {
AK_MAKE_NONCOPYABLE(Symbol);
AK_MAKE_NONMOVABLE(Symbol);
public:
Symbol(Optional<String>, bool);
virtual ~Symbol();
String description() const { return m_description.value_or(""); }
const Optional<String>& raw_description() const { return m_description; }
bool is_global() const { return m_is_global; }
String to_string() const { return String::formatted("Symbol({})", description()); }
private:
virtual const char* class_name() const override { return "Symbol"; }
Optional<String> m_description;
bool m_is_global;
};
Symbol* js_symbol(Heap&, Optional<String> description, bool is_global);
Symbol* js_symbol(VM&, Optional<String> description, bool is_global);
}
| C | 4 | r00ster91/serenity | Userland/Libraries/LibJS/Runtime/Symbol.h | [
"BSD-2-Clause"
] |
class Foo
{
// fields
Int f00
const Int f01 := 1
const static Int f02 := 2
// methods
Void m00() {}
Int? m01(List? list) { return null }
static Void m02(Obj x) {}
static Str[]? m03(Int a, Int b) { return null }
// closures
static Func c00() { return |->| {} }
Func c01() { return |->Int| { a := 3; return a; } }
Func c02() { return |->Obj| { return m01(null) } }
static Func c03() { a := 3; return |->Obj| { return a } }
static Func c04() { a := 3; m := |->Func| { return |->Obj| { return ++a } }; return m() }
Func c05() { a := 3; m := |->Func| { return |->Obj| { return this } }; return m() }
Func c06() { list := [0,1]; return |->Obj| { return m01(list) } }
} | Fantom | 3 | fanx-dev/fanx | compiler/testCompilerx/res/misc/testIsConst.fan | [
"AFL-3.0"
] |
<html xmlns:th="http://www.thymeleaf.org">
<head>
<!--/*/ <th:block th:include="fragments/head :: head"/> /*/-->
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="box col-md-6 col-md-offset-3">
<h1>JWT CSRF Token expired</h1>
<h3 th:text="${exception.message}"></h3>
<a href="/jwt-csrf-form" class="btn btn-primary">Back</a>
</div>
</div>
</div>
</body>
</html> | HTML | 4 | zeesh49/tutorials | jjwt/src/main/resources/templates/expired-jwt.html | [
"MIT"
] |
/*
* Model of Microsoft Component Object Model (COM) query
* interface and aggregation mechanism.
*
* For a detailed description, see:
* http://sdg.lcs.mit.edu/~dnj/publications/com-fse00.pdf
*
* author: Daniel Jackson
*/
open util/relation as rel
sig IID {}
sig Interface {
qi : IID -> lone Interface,
iids : set IID,
// next two lines should use domain() or range() functions
iidsKnown : IID,
reaches : Interface
}{
iidsKnown = dom[qi]
reaches = ran[qi]
}
sig Component {
interfaces : set Interface,
iids : set IID, // can't do iids = interfaces.Interface$iids
first, identity : interfaces,
eqs: set Component,
aggregates : set Component
}
fact defineEqs {
all c1, c2: Component |
c1->c2 in eqs <=> c1.identity = c2.identity
}
fact IdentityAxiom {
some unknown : IID | all c : Component |
all i : c.interfaces | unknown.(i.qi) = c.identity
}
fact ComponentProps {
all c : Component {
c.iids = c.interfaces.iids
all i : c.interfaces | all x : IID | x.(i.qi) in c.interfaces
}
}
sig LegalInterface extends Interface { }
fact { all i : LegalInterface | all x : i.iidsKnown | x in x.(i.qi).iids}
sig LegalComponent extends Component { }
fact { LegalComponent.interfaces in LegalInterface }
fact Reflexivity { all i : LegalInterface | i.iids in i.iidsKnown }
fact Symmetry { all i, j : LegalInterface | j in i.reaches => i.iids in j.iidsKnown }
fact Transitivity { all i, j : LegalInterface | j in i.reaches => j.iidsKnown in i.iidsKnown }
fact Aggregation {
no c : Component | c in c.^aggregates
all outer : Component | all inner : outer.aggregates |
(some inner.interfaces & outer.interfaces)
&& (some o: outer.interfaces | all i: inner.interfaces - inner.first | all x: Component | (x.iids).(i.qi) = (x.iids).(o.qi))
}
assert Theorem1 {
all c: LegalComponent | all i: c.interfaces | i.iidsKnown = c.iids
}
assert Theorem2 {
all outer: Component | all inner : outer.aggregates |
inner in LegalComponent => inner.iids in outer.iids
}
assert Theorem3 {
all outer: Component | all inner : outer.aggregates | inner in outer.eqs
}
assert Theorem4a {
all c1: Component, c2: LegalComponent |
some (c1.interfaces & c2.interfaces) => c2.iids in c1.iids
}
assert Theorem4b {
all c1, c2: Component | some (c1.interfaces & c2.interfaces) => c1 in c2.eqs
}
check Theorem1 for 3 expect 0
check Theorem2 for 3 expect 0
check Theorem3 for 3 expect 0
check Theorem4a for 3 expect 0
check Theorem4b for 3 expect 0
| Alloy | 5 | c-luu/alloy-specs | models/microsoft-com/com.als | [
"Apache-2.0"
] |
--TEST--
Exception inside a foreach loop with return
--FILE--
<?php
class saboteurTestController {
public function isConsistent() { throw new \Exception(); }
}
$controllers = array(new saboteurTestController(),new saboteurTestController());
foreach ($controllers as $controller) {
try {
if ($controller->isConsistent()) {
return $controller;
}
} catch (\Exception $e) {
echo "Exception\n";
}
}
?>
--EXPECT--
Exception
Exception
| PHP | 3 | thiagooak/php-src | Zend/tests/temporary_cleaning_007.phpt | [
"PHP-3.01"
] |
<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page 3</title>
<p><input type="button" id="back" value="Back" onclick="history.go(-1)"/>
| HTML | 3 | fracturesfei/angulardemo | node_modules/selenium-webdriver/lib/test/data/proxy/page3.html | [
"MIT"
] |
def f: "f is here";
| JSONiq | 0 | aakropotkin/jq | tests/modules/lib/jq/f.jq | [
"CC-BY-3.0"
] |
{% extends "base.ahk"%}
{% block body %}
ToolTip, {{ text }}, {{ x }}, {{ y }}, {{ id }}
Sleep, {{ second * 1000 }}
ToolTip ,,,, {{ id }}
{% endblock body %}
| AutoHotkey | 4 | scslmd/ahk | ahk/templates/gui/tooltip.ahk | [
"MIT"
] |
def _bson_torepr:
def _f:
( if .type == null or .type == "array" then
( .value.elements
| map(_f)
)
elif .type == "document" then
( .value.elements
| map({key: .name, value: _f})
| from_entries
)
elif .type == "boolean" then .value != 0
else .value | tovalue
end
);
( {type: "document", value: .}
| _f
);
def _bson__help:
{ examples: [
{comment: "BSON as JSON", shell: "fq -d bson torepr file"}
],
links: [
{url: "https://wiki.theory.org/BitTorrentSpecification#Bencoding"}
]
};
| JSONiq | 3 | bbhunter/fq | format/bson/bson.jq | [
"MIT"
] |
.esh-catalog-button {
background-color: #83D01B; /* to override the style of this button ie. to make it red, use background-color: #FF001b; */
}
| CSS | 3 | slizard00/eShopOnContainers | src/Web/WebMVC/wwwroot/css/override.css | [
"MIT"
] |
module chapter6/memory/fixedSizeMemory_H [Addr, Data]
open chapter6/memory/fixedSizeMemory [Addr, Data] as memory
sig Memory_H extends memory/Memory {
unwritten: set Addr
}
pred init [m: Memory_H] {
memory/init [m]
m.unwritten = Addr
}
pred read [m: Memory_H, a: Addr, d: Data] {
memory/read [m, a, d]
}
pred write [m, m1: Memory_H, a: Addr, d: Data] {
memory/write [m, m1, a, d]
m1.unwritten = m.unwritten - a
}
| Alloy | 3 | haslab/Electrum | electrum/src/main/resources/models/book/chapter6/memory/fixedSizeMemory_H.als | [
"MIT"
] |
.experiment-list-outer-container {
padding-left: 64px;
}
.experiment-list-container {
overflow-y: scroll;
overflow-x: hidden;
width: 236px;
min-height: 100%;
}
.active-experiment-list-item {
background: rgba(67, 199, 234, 0.1);
font-weight: bold;
}
.experiment-list-item {
overflow:hidden;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 16px;
height: 40px;
width: 220px;
line-height: 40px;
padding-left: 12px;
}
.experiments-header {
font-weight: normal;
display: inline-block;
padding-bottom: 6px;
}
.collapser-container {
display: inline-block;
position: relative;
top: -2px;
}
.collapser {
display: inline-block;
background-color: #082142d6;
color: #FFFFFF;
font-size: 16px;
line-height: 24px;
width: 24px;
height: 24px;
text-align: center;
margin-left: 68px;
}
.login-icon {
background-color: #E95420;
}
.login-icon:hover {
background-color: #AEA79F;
}
.fa, .fas {
font-weight: 900;
padding-top: 3px;
}
.collapsed {
display: none; /* hide it for small displays */
}
@media (min-width: 992px) {
.collapsed {
display: block;
margin-left: -18%; /* same width as sidebar */
}
}
#row-main {
overflow-x: hidden; /* necessary to hide collapsed sidebar */
}
#sidebar {
-webkit-transition: margin 0.3s ease;
-moz-transition: margin 0.3s ease;
-o-transition: margin 0.3s ease;
transition: margin 0.3s ease;
}
#content {
-webkit-transition: width 0.3s ease;
-moz-transition: width 0.3s ease;
-o-transition: width 0.3s ease;
transition: width 0.3s ease;
}
.experiment-list-container .nav .nav-item .nav-link:hover {
padding-left: 25px;
margin-right: 25px;
color: #0193e1;
background-color: #e9ecef;
}
.nav-item .nav-link {
color: #888888;
} | CSS | 4 | firebolt55439/ray | python/ray/tune/automlboard/static/css/ExperimentList.css | [
"Apache-2.0"
] |
/*
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibJS/Runtime/Completion.h>
#include <LibJS/Runtime/Object.h>
namespace JS::Temporal {
class Now final : public Object {
JS_OBJECT(Now, Object);
public:
explicit Now(GlobalObject&);
virtual void initialize(GlobalObject&) override;
virtual ~Now() override = default;
private:
JS_DECLARE_NATIVE_FUNCTION(time_zone);
JS_DECLARE_NATIVE_FUNCTION(instant);
JS_DECLARE_NATIVE_FUNCTION(plain_date_time);
JS_DECLARE_NATIVE_FUNCTION(plain_date_time_iso);
JS_DECLARE_NATIVE_FUNCTION(zoned_date_time);
JS_DECLARE_NATIVE_FUNCTION(zoned_date_time_iso);
JS_DECLARE_NATIVE_FUNCTION(plain_date);
JS_DECLARE_NATIVE_FUNCTION(plain_date_iso);
JS_DECLARE_NATIVE_FUNCTION(plain_time_iso);
};
TimeZone* system_time_zone(GlobalObject&);
BigInt* system_utc_epoch_nanoseconds(GlobalObject&);
Instant* system_instant(GlobalObject&);
ThrowCompletionOr<PlainDateTime*> system_date_time(GlobalObject&, Value temporal_time_zone_like, Value calendar_like);
ThrowCompletionOr<ZonedDateTime*> system_zoned_date_time(GlobalObject&, Value temporal_time_zone_like, Value calendar_like);
}
| C | 3 | r00ster91/serenity | Userland/Libraries/LibJS/Runtime/Temporal/Now.h | [
"BSD-2-Clause"
] |
{
"id" : ${product.id},
"name" : "${product.name}"
} | FreeMarker | 0 | zeesh49/tutorials | java-lite/src/main/webapp/WEB-INF/views/products/_product.ftl | [
"MIT"
] |
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
<> rdfs:comment """
UTF-8 encoded sample plain-text file
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
Markus Kuhn [ˈmaʳkʊs kuːn] <http://www.cl.cam.ac.uk/~mgk25/> — 2002-07-25
The ASCII compatible UTF-8 encoding used in this plain-text file
is defined in Unicode, ISO 10646-1, and RFC 2279.
Using Unicode/UTF-8, you can write in emails and source code things such as
Mathematics and sciences:
∮ E⋅da = Q, n → ∞, ∑ f(i) = ∏ g(i), ⎧⎡⎛┌─────┐⎞⎤⎫
⎪⎢⎜│a²+b³ ⎟⎥⎪
∀x∈ℝ: ⌈x⌉ = −⌊−x⌋, α ∧ ¬β = ¬(¬α ∨ β), ⎪⎢⎜│───── ⎟⎥⎪
⎪⎢⎜⎷ c₈ ⎟⎥⎪
ℕ ⊆ ℕ₀ ⊂ ℤ ⊂ ℚ ⊂ ℝ ⊂ ℂ, ⎨⎢⎜ ⎟⎥⎬
⎪⎢⎜ ∞ ⎟⎥⎪
⊥ < a ≠ b ≡ c ≤ d ≪ ⊤ ⇒ (⟦A⟧ ⇔ ⟪B⟫), ⎪⎢⎜ ⎲ ⎟⎥⎪
⎪⎢⎜ ⎳aⁱ-bⁱ⎟⎥⎪
2H₂ + O₂ ⇌ 2H₂O, R = 4.7 kΩ, ⌀ 200 mm ⎩⎣⎝i=1 ⎠⎦⎭
Linguistics and dictionaries:
ði ıntəˈnæʃənəl fəˈnɛtık əsoʊsiˈeıʃn
Y [ˈʏpsilɔn], Yen [jɛn], Yoga [ˈjoːgɑ]
APL:
((V⍳V)=⍳⍴V)/V←,V ⌷←⍳→⍴∆∇⊃‾⍎⍕⌈
Nicer typography in plain text files:
╔══════════════════════════════════════════╗
║ ║
║ • ‘single’ and “double” quotes ║
║ ║
║ • Curly apostrophes: “We’ve been here” ║
║ ║
║ • Latin-1 apostrophe and accents: '´` ║
║ ║
║ • ‚deutsche‘ „Anführungszeichen“ ║
║ ║
║ • †, ‡, ‰, •, 3–4, —, −5/+5, ™, … ║
║ ║
║ • ASCII safety test: 1lI|, 0OD, 8B ║
║ ╭─────────╮ ║
║ • the euro symbol: │ 14.95 € │ ║
║ ╰─────────╯ ║
╚══════════════════════════════════════════╝
Combining characters:
STARGΛ̊TE SG-1, a = v̇ = r̈, a⃑ ⊥ b⃑
Greek (in Polytonic):
The Greek anthem:
Σὲ γνωρίζω ἀπὸ τὴν κόψη
τοῦ σπαθιοῦ τὴν τρομερή,
σὲ γνωρίζω ἀπὸ τὴν ὄψη
ποὺ μὲ βία μετράει τὴ γῆ.
᾿Απ᾿ τὰ κόκκαλα βγαλμένη
τῶν ῾Ελλήνων τὰ ἱερά
καὶ σὰν πρῶτα ἀνδρειωμένη
χαῖρε, ὦ χαῖρε, ᾿Ελευθεριά!
From a speech of Demosthenes in the 4th century BC:
Οὐχὶ ταὐτὰ παρίσταταί μοι γιγνώσκειν, ὦ ἄνδρες ᾿Αθηναῖοι,
ὅταν τ᾿ εἰς τὰ πράγματα ἀποβλέψω καὶ ὅταν πρὸς τοὺς
λόγους οὓς ἀκούω· τοὺς μὲν γὰρ λόγους περὶ τοῦ
τιμωρήσασθαι Φίλιππον ὁρῶ γιγνομένους, τὰ δὲ πράγματ᾿
εἰς τοῦτο προήκοντα, ὥσθ᾿ ὅπως μὴ πεισόμεθ᾿ αὐτοὶ
πρότερον κακῶς σκέψασθαι δέον. οὐδέν οὖν ἄλλο μοι δοκοῦσιν
οἱ τὰ τοιαῦτα λέγοντες ἢ τὴν ὑπόθεσιν, περὶ ἧς βουλεύεσθαι,
οὐχὶ τὴν οὖσαν παριστάντες ὑμῖν ἁμαρτάνειν. ἐγὼ δέ, ὅτι μέν
ποτ᾿ ἐξῆν τῇ πόλει καὶ τὰ αὑτῆς ἔχειν ἀσφαλῶς καὶ Φίλιππον
τιμωρήσασθαι, καὶ μάλ᾿ ἀκριβῶς οἶδα· ἐπ᾿ ἐμοῦ γάρ, οὐ πάλαι
γέγονεν ταῦτ᾿ ἀμφότερα· νῦν μέντοι πέπεισμαι τοῦθ᾿ ἱκανὸν
προλαβεῖν ἡμῖν εἶναι τὴν πρώτην, ὅπως τοὺς συμμάχους
σώσομεν. ἐὰν γὰρ τοῦτο βεβαίως ὑπάρξῃ, τότε καὶ περὶ τοῦ
τίνα τιμωρήσεταί τις καὶ ὃν τρόπον ἐξέσται σκοπεῖν· πρὶν δὲ
τὴν ἀρχὴν ὀρθῶς ὑποθέσθαι, μάταιον ἡγοῦμαι περὶ τῆς
τελευτῆς ὁντινοῦν ποιεῖσθαι λόγον.
Δημοσθένους, Γ´ ᾿Ολυνθιακὸς
Georgian:
From a Unicode conference invitation:
გთხოვთ ახლავე გაიაროთ რეგისტრაცია Unicode-ის მეათე საერთაშორისო
კონფერენციაზე დასასწრებად, რომელიც გაიმართება 10-12 მარტს,
ქ. მაინცში, გერმანიაში. კონფერენცია შეჰკრებს ერთად მსოფლიოს
ექსპერტებს ისეთ დარგებში როგორიცაა ინტერნეტი და Unicode-ი,
ინტერნაციონალიზაცია და ლოკალიზაცია, Unicode-ის გამოყენება
ოპერაციულ სისტემებსა, და გამოყენებით პროგრამებში, შრიფტებში,
ტექსტების დამუშავებასა და მრავალენოვან კომპიუტერულ სისტემებში.
Russian:
From a Unicode conference invitation:
Зарегистрируйтесь сейчас на Десятую Международную Конференцию по
Unicode, которая состоится 10-12 марта 1997 года в Майнце в Германии.
Конференция соберет широкий круг экспертов по вопросам глобального
Интернета и Unicode, локализации и интернационализации, воплощению и
применению Unicode в различных операционных системах и программных
приложениях, шрифтах, верстке и многоязычных компьютерных системах.
Thai (UCS Level 2):
Excerpt from a poetry on The Romance of The Three Kingdoms (a Chinese
classic 'San Gua'):
[----------------------------|------------------------]
๏ แผ่นดินฮั่นเสื่อมโทรมแสนสังเวช พระปกเกศกองบู๊กู้ขึ้นใหม่
สิบสองกษัตริย์ก่อนหน้าแลถัดไป สององค์ไซร้โง่เขลาเบาปัญญา
ทรงนับถือขันทีเป็นที่พึ่ง บ้านเมืองจึงวิปริตเป็นนักหนา
โฮจิ๋นเรียกทัพทั่วหัวเมืองมา หมายจะฆ่ามดชั่วตัวสำคัญ
เหมือนขับไสไล่เสือจากเคหา รับหมาป่าเข้ามาเลยอาสัญ
ฝ่ายอ้องอุ้นยุแยกให้แตกกัน ใช้สาวนั้นเป็นชนวนชื่นชวนใจ
พลันลิฉุยกุยกีกลับก่อเหตุ ช่างอาเพศจริงหนาฟ้าร้องไห้
ต้องรบราฆ่าฟันจนบรรลัย ฤๅหาใครค้ำชูกู้บรรลังก์ ฯ
(The above is a two-column text. If combining characters are handled
correctly, the lines of the second column should be aligned with the
| character above.)
Ethiopian:
Proverbs in the Amharic language:
ሰማይ አይታረስ ንጉሥ አይከሰስ።
ብላ ካለኝ እንደአባቴ በቆመጠኝ።
ጌጥ ያለቤቱ ቁምጥና ነው።
ደሀ በሕልሙ ቅቤ ባይጠጣ ንጣት በገደለው።
የአፍ ወለምታ በቅቤ አይታሽም።
አይጥ በበላ ዳዋ ተመታ።
ሲተረጉሙ ይደረግሙ።
ቀስ በቀስ፥ ዕንቁላል በእግሩ ይሄዳል።
ድር ቢያብር አንበሳ ያስር።
ሰው እንደቤቱ እንጅ እንደ ጉረቤቱ አይተዳደርም።
እግዜር የከፈተውን ጉሮሮ ሳይዘጋው አይድርም።
የጎረቤት ሌባ፥ ቢያዩት ይስቅ ባያዩት ያጠልቅ።
ሥራ ከመፍታት ልጄን ላፋታት።
ዓባይ ማደሪያ የለው፥ ግንድ ይዞ ይዞራል።
የእስላም አገሩ መካ የአሞራ አገሩ ዋርካ።
ተንጋሎ ቢተፉ ተመልሶ ባፉ።
ወዳጅህ ማር ቢሆን ጨርስህ አትላሰው።
እግርህን በፍራሽህ ልክ ዘርጋ።
Runes:
ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ
(Old English, which transcribed into Latin reads 'He cwaeth that he
bude thaem lande northweardum with tha Westsae.' and means 'He said
that he lived in the northern land near the Western Sea.')
Braille:
⡌⠁⠧⠑ ⠼⠁⠒ ⡍⠜⠇⠑⠹⠰⠎ ⡣⠕⠌
⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠙⠑⠁⠙⠒ ⠞⠕ ⠃⠑⠛⠔ ⠺⠊⠹⠲ ⡹⠻⠑ ⠊⠎ ⠝⠕ ⠙⠳⠃⠞
⠱⠁⠞⠑⠧⠻ ⠁⠃⠳⠞ ⠹⠁⠞⠲ ⡹⠑ ⠗⠑⠛⠊⠌⠻ ⠕⠋ ⠙⠊⠎ ⠃⠥⠗⠊⠁⠇ ⠺⠁⠎
⠎⠊⠛⠝⠫ ⠃⠹ ⠹⠑ ⠊⠇⠻⠛⠹⠍⠁⠝⠂ ⠹⠑ ⠊⠇⠻⠅⠂ ⠹⠑ ⠥⠝⠙⠻⠞⠁⠅⠻⠂
⠁⠝⠙ ⠹⠑ ⠡⠊⠑⠋ ⠍⠳⠗⠝⠻⠲ ⡎⠊⠗⠕⠕⠛⠑ ⠎⠊⠛⠝⠫ ⠊⠞⠲ ⡁⠝⠙
⡎⠊⠗⠕⠕⠛⠑⠰⠎ ⠝⠁⠍⠑ ⠺⠁⠎ ⠛⠕⠕⠙ ⠥⠏⠕⠝ ⠰⡡⠁⠝⠛⠑⠂ ⠋⠕⠗ ⠁⠝⠹⠹⠔⠛ ⠙⠑
⠡⠕⠎⠑ ⠞⠕ ⠏⠥⠞ ⠙⠊⠎ ⠙⠁⠝⠙ ⠞⠕⠲
⡕⠇⠙ ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠁⠎ ⠙⠑⠁⠙ ⠁⠎ ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲
⡍⠔⠙⠖ ⡊ ⠙⠕⠝⠰⠞ ⠍⠑⠁⠝ ⠞⠕ ⠎⠁⠹ ⠹⠁⠞ ⡊ ⠅⠝⠪⠂ ⠕⠋ ⠍⠹
⠪⠝ ⠅⠝⠪⠇⠫⠛⠑⠂ ⠱⠁⠞ ⠹⠻⠑ ⠊⠎ ⠏⠜⠞⠊⠊⠥⠇⠜⠇⠹ ⠙⠑⠁⠙ ⠁⠃⠳⠞
⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲ ⡊ ⠍⠊⠣⠞ ⠙⠁⠧⠑ ⠃⠑⠲ ⠔⠊⠇⠔⠫⠂ ⠍⠹⠎⠑⠇⠋⠂ ⠞⠕
⠗⠑⠛⠜⠙ ⠁ ⠊⠕⠋⠋⠔⠤⠝⠁⠊⠇ ⠁⠎ ⠹⠑ ⠙⠑⠁⠙⠑⠌ ⠏⠊⠑⠊⠑ ⠕⠋ ⠊⠗⠕⠝⠍⠕⠝⠛⠻⠹
⠔ ⠹⠑ ⠞⠗⠁⠙⠑⠲ ⡃⠥⠞ ⠹⠑ ⠺⠊⠎⠙⠕⠍ ⠕⠋ ⠳⠗ ⠁⠝⠊⠑⠌⠕⠗⠎
⠊⠎ ⠔ ⠹⠑ ⠎⠊⠍⠊⠇⠑⠆ ⠁⠝⠙ ⠍⠹ ⠥⠝⠙⠁⠇⠇⠪⠫ ⠙⠁⠝⠙⠎
⠩⠁⠇⠇ ⠝⠕⠞ ⠙⠊⠌⠥⠗⠃ ⠊⠞⠂ ⠕⠗ ⠹⠑ ⡊⠳⠝⠞⠗⠹⠰⠎ ⠙⠕⠝⠑ ⠋⠕⠗⠲ ⡹⠳
⠺⠊⠇⠇ ⠹⠻⠑⠋⠕⠗⠑ ⠏⠻⠍⠊⠞ ⠍⠑ ⠞⠕ ⠗⠑⠏⠑⠁⠞⠂ ⠑⠍⠏⠙⠁⠞⠊⠊⠁⠇⠇⠹⠂ ⠹⠁⠞
⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠁⠎ ⠙⠑⠁⠙ ⠁⠎ ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲
(The first couple of paragraphs of "A Christmas Carol" by Dickens)
Compact font selection example text:
ABCDEFGHIJKLMNOPQRSTUVWXYZ /0123456789
abcdefghijklmnopqrstuvwxyz £©µÀÆÖÞßéöÿ
–—‘“”„†•…‰™œŠŸž€ ΑΒΓΔΩαβγδω АБВГДабвгд
∀∂∈ℝ∧∪≡∞ ↑↗↨↻⇣ ┐┼╔╘░►☺♀ fi�⑀₂ἠḂӥẄɐː⍎אԱა
Greetings in various languages:
Hello world, Καλημέρα κόσμε, コンニチハ
Box drawing alignment tests: █
▉
╔══╦══╗ ┌──┬──┐ ╭──┬──╮ ╭──┬──╮ ┏━━┳━━┓ ┎┒┏┑ ╷ ╻ ┏┯┓ ┌┰┐ ▊ ╱╲╱╲╳╳╳
║┌─╨─┐║ │╔═╧═╗│ │╒═╪═╕│ │╓─╁─╖│ ┃┌─╂─┐┃ ┗╃╄┙ ╶┼╴╺╋╸┠┼┨ ┝╋┥ ▋ ╲╱╲╱╳╳╳
║│╲ ╱│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╿ │┃ ┍╅╆┓ ╵ ╹ ┗┷┛ └┸┘ ▌ ╱╲╱╲╳╳╳
╠╡ ╳ ╞╣ ├╢ ╟┤ ├┼─┼─┼┤ ├╫─╂─╫┤ ┣┿╾┼╼┿┫ ┕┛┖┚ ┌┄┄┐ ╎ ┏┅┅┓ ┋ ▍ ╲╱╲╱╳╳╳
║│╱ ╲│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╽ │┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▎
║└─╥─┘║ │╚═╤═╝│ │╘═╪═╛│ │╙─╀─╜│ ┃└─╂─┘┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▏
╚══╩══╝ └──┴──┘ ╰──┴──╯ ╰──┴──╯ ┗━━┻━━┛ ▗▄▖▛▀▜ └╌╌┘ ╎ ┗╍╍┛ ┋ ▁▂▃▄▅▆▇█
▝▀▘▙▄▟
""" .
<> rdfs:comment """
Two byte Unicode escape: \u00E0
Largest Unicode escape in Turtle: \U0010FFFF
""" .
| Turtle | 4 | joshrose/audacity | lib-src/lv2/sord/tests/UTF-8.ttl | [
"CC-BY-3.0"
] |
import os
import sys
import torch
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_dir)
from torch.testing._internal.jit_utils import JitTestCase
if __name__ == '__main__':
raise RuntimeError("This test file is not meant to be run directly, use:\n\n"
"\tpython test/test_jit.py TESTNAME\n\n"
"instead.")
class TestTensorCreationOps(JitTestCase):
"""
A suite of tests for ops that create tensors.
"""
def test_randperm_default_dtype(self):
def randperm(x: int):
perm = torch.randperm(x)
# Have to perform assertion here because TorchScript returns dtypes
# as integers, which are not comparable against eager torch.dtype.
assert perm.dtype == torch.int64
self.checkScript(randperm, (3, ))
def test_randperm_specifed_dtype(self):
def randperm(x: int):
perm = torch.randperm(x, dtype=torch.float)
# Have to perform assertion here because TorchScript returns dtypes
# as integers, which are not comparable against eager torch.dtype.
assert perm.dtype == torch.float
self.checkScript(randperm, (3, ))
def test_triu_indices_default_dtype(self):
def triu_indices(rows: int, cols: int):
indices = torch.triu_indices(rows, cols)
# Have to perform assertion here because TorchScript returns dtypes
# as integers, which are not comparable against eager torch.dtype.
assert indices.dtype == torch.int64
self.checkScript(triu_indices, (3, 3))
def test_triu_indices_specified_dtype(self):
def triu_indices(rows: int, cols: int):
indices = torch.triu_indices(rows, cols, dtype=torch.float)
# Have to perform assertion here because TorchScript returns dtypes
# as integers, which are not comparable against eager torch.dtype.
assert indices.dtype == torch.float
self.checkScript(triu_indices, (3, 3))
def test_tril_indices_default_dtype(self):
def tril_indices(rows: int, cols: int):
indices = torch.tril_indices(rows, cols)
# Have to perform assertion here because TorchScript returns dtypes
# as integers, which are not comparable against eager torch.dtype.
assert indices.dtype == torch.int64
self.checkScript(tril_indices, (3, 3))
def test_tril_indices_specified_dtype(self):
def tril_indices(rows: int, cols: int):
indices = torch.tril_indices(rows, cols, dtype=torch.float)
# Have to perform assertion here because TorchScript returns dtypes
# as integers, which are not comparable against eager torch.dtype.
assert indices.dtype == torch.float
self.checkScript(tril_indices, (3, 3))
| Python | 5 | Hacky-DH/pytorch | test/jit/test_tensor_creation_ops.py | [
"Intel"
] |
;; Copyright (c) 2020 Robert Virding
;;
;; 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.
;; File : scm.erl
;; Author : Robert Virding
;; Purpose : Lisp Flavoured Erlang scheme include macros
(defmacro begin args `(scm:begin ,@args))
(defmacro define args `(scm:define ,@args))
(defmacro define-syntax args `(scm:define-syntax ,@args))
(defmacro let-syntax args `(scm:let-syntax ,@args))
(defmacro defsyntax args `(scm:defsyntax ,@args))
| LFE | 4 | haetze/lfe | include/scm.lfe | [
"Apache-2.0"
] |
Module: sample-OLE-container
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
//**********************************************************************
//
// COleInPlaceFrame::GetWindow
//
// Purpose:
//
// Returns the frame window handle
//
// Parameters:
//
// HWND FAR* lphwnd - Location to return the window handle
//
// Return Value:
//
// S_OK
//
// Function Calls:
// Function Location
//
// OutputDebugString Windows API
// ResultFromScode OLE API
//
// Comments:
//
//********************************************************************
define method IOleWindow/GetWindow(this :: <COleInPlaceFrame>)
=> ( status :: <HRESULT>, hwnd :: <HWND> );
OutputDebugString("In IOIPF::GetWindow\r\n");
values( $S-OK, this.m-pApp.m-hAppWnd )
end method IOleWindow/GetWindow;
//**********************************************************************
//
// COleInPlaceFrame::ContextSensitiveHelp
//
// Purpose:
//
// Used in implementing Context sensitive help
//
// Parameters:
//
// BOOL fEnterMode - TRUE if starting Context Sensitive help mode
//
// Return Value:
//
// S_OK
//
// Function Calls:
// Function Location
//
// OutputDebugString Windows API
// ResultFromScode OLE API
//
// Comments:
//
// Be sure to read the technotes in the OLE toolkit.
//
//********************************************************************
define method IOleWindow/ContextSensitiveHelp(this :: <COleInPlaceFrame>,
fEnterMode :: <boolean>)
=> status :: <HRESULT>;
OutputDebugString("In IOIPF::ContextSensitiveHelp\r\n");
this.m-pApp.m-fMenuMode := fEnterMode;
$S-OK
end method IOleWindow/ContextSensitiveHelp;
//**********************************************************************
//
// COleInPlaceFrame::GetBorder
//
// Purpose:
//
// Returns the outermost border that frame adornments can be attached
// during InPlace Activation.
//
// Parameters:
//
// LPRECT lprectBorder - return parameter to contain the outermost
// rect for frame adornments
//
// Return Value:
//
// S_OK
//
// Function Calls:
// Function Location
//
// OutputDebugString Windows API
// GetClientRect Windows API
// CopyRect Windows API
// ResultFromScode OLE API
//
// Comments:
//
//********************************************************************
define method IOleInPlaceUIWindow/GetBorder(this :: <COleInPlaceFrame>,
lprectBorder :: <LPRECT>)
=> status :: <HRESULT>;
OutputDebugString("In IOIPF::GetBorder\r\n");
// get the rect for the entire frame.
GetClientRect(this.m-pApp.m-hAppWnd, lprectBorder);
$S-OK
end method IOleInPlaceUIWindow/GetBorder;
//**********************************************************************
//
// COleInPlaceFrame::RequestBorderSpace
//
// Purpose:
//
// Approves/Denies requests for border space during InPlace
// negotiation.
//
// Parameters:
//
// LPCBORDERWIDTHS lpborderwidths - The width in pixels needed on
// each side of the frame.
//
// Return Value:
//
// S_OK
//
// Function Calls:
// Function Location
//
// OutputDebugString Windows API
// ResultFromScode OLE API
//
// Comments:
//
// This implementation doesn't care about how much border space
// is used. It always returns S_OK.
//
//********************************************************************
define method IOleInPlaceUIWindow/RequestBorderSpace
(this :: <COleInPlaceFrame>, lpborderwidths /* :: <LPCBORDERWIDTHS> */ )
=> status :: <HRESULT>;
OutputDebugString("In IOIPF::RequestBorderSpace\r\n");
// always approve the request
$S-OK
end method IOleInPlaceUIWindow/RequestBorderSpace;
//**********************************************************************
//
// COleInPlaceFrame::SetBorderSpace
//
// Purpose:
//
// The object calls this method when it is actually going to
// start using the border space.
//
// Parameters:
//
// LPCBORDERWIDTHS lpborderwidths - Border space actually being used
// by the object
//
// Return Value:
//
// S_OK
//
// Function Calls:
// Function Location
//
// CSimpleApp::AddFrameLevelTools APP.CPP
// OutputDebugString Windows API
// GetClientRect Windows API
// MoveWindow Windows API
// ResultFromScode Windows API
//
// Comments:
//
// This routine could be a little smarter and check to see if
// the object is requesting the entire client area of the
// window.
//
//********************************************************************
define method IOleInPlaceUIWindow/SetBorderSpace
(this :: <COleInPlaceFrame>, lpborderwidths :: <LPCBORDERWIDTHS>)
=> status :: <HRESULT>;
OutputDebugString("In IOIPF::SetBorderSpace\r\n");
// let stabilize :: <CStabilize> = make(<CStabilize>, this.m-pApp);
let app = this.m-pApp;
if ( null-pointer?(lpborderwidths) )
AddFrameLevelTools(app);
else
let rect :: <LPRECT> = make(<LPRECT>);
GetClientRect(app.m-hAppWnd, rect);
MoveWindow(app.m-lpDoc.m-hDocWnd,
rect.left-value + lpborderwidths.left-value,
rect.top-value + lpborderwidths.top-value,
rect.right-value
- lpborderwidths.right-value - lpborderwidths.left-value,
rect.bottom-value
- lpborderwidths.bottom-value - lpborderwidths.top-value,
#t);
destroy(rect);
end if;
$S-OK
end method IOleInPlaceUIWindow/SetBorderSpace;
//**********************************************************************
//
// COleInPlaceFrame::SetActiveObject
//
// Purpose:
//
//
// Parameters:
//
// LPOLEINPLACEACTIVEOBJECT lpActiveObject - Pointer to the
// objects
// IOleInPlaceActiveObject
// interface
//
//@@WTK WIN32, UNICODE
// //LPCSTR lpszObjName - Name of the object
// LPCOLESTR lpszObjName - Name of the object
//
// Return Value:
//
// S_OK
//
// Function Calls:
// Function Location
//
// OutputDebugString Windows API
// IOleInPlaceActiveObject::AddRef Object
// IOleInPlaceActiveObject::Release Object
// ResultFromScode OLE API
//
// Comments:
//
//********************************************************************
define method IOleInPlaceUIWindow/SetActiveObject
(this :: <COleInPlaceFrame>,
lpActiveObject :: <LPOLEINPLACEACTIVEOBJECT>,
lpszObjName :: <LPCOLESTR>)
=> status :: <HRESULT>;
OutputDebugString("In IOIPF::SetActiveObject\r\n");
// let stabilize :: <CStabilize> = make(<CStabilize>, this.m-pApp);
let app = this.m-pApp;
// AddRef() it and save it...
if ( ~ null-pointer?(lpActiveObject) )
AddRef(lpActiveObject);
let ( status , window ) = IOleWindow/GetWindow(lpActiveObject);
app.m-hwndUIActiveObj := window;
unless ( null-handle?(window) )
SendMessage(window, $WM-QUERYNEWPALETTE, 0, 0);
end unless;
else
unless ( null?(app.m-lpDoc.m-lpActiveObject) )
Release(app.m-lpDoc.m-lpActiveObject);
app.m-hwndUIActiveObj := $NULL-HWND;
end unless;
end if;
// in an MDI app, this method really shouldn't be called,
// this method associated with the doc is called instead.
app.m-lpDoc.m-lpActiveObject := lpActiveObject;
// should set window title here
$S-OK
end method IOleInPlaceUIWindow/SetActiveObject;
//**********************************************************************
//
// COleInPlaceFrame::InsertMenus
//
// Purpose:
//
// Inserts the container menu into the combined menu
//
// Parameters:
//
// HMENU hmenuShared - Menu Handle to be set.
// LPOLEMENUGROUPWIDTHS lpMenuWidths - Width of menus
//
// Return Value:
//
// Function Calls:
// Function Location
//
// OutputDebugString Windows API
// AppendMenu Windows API
// ResultFromScode OLE API
//
// Comments:
//
//********************************************************************
define method IOleInPlaceFrame/InsertMenus(this :: <COleInPlaceFrame>,
hmenuShared :: <HMENU>, lpMenuWidths :: <LPOLEMENUGROUPWIDTHS>)
=> status :: <HRESULT>;
OutputDebugString("In IOIPF::InsertMenus\r\n");
// let stabilize :: <CStabilize> = make(<CStabilize>, this.m-pApp);
AppendMenu(hmenuShared, logior($MF-BYPOSITION, $MF-POPUP),
pointer-address(this.m-pApp.m-hFileMenu), TEXT("&File"));
AppendMenu(hmenuShared, logior($MF-BYPOSITION, $MF-POPUP),
pointer-address(this.m-pApp.m-hHelpMenu), TEXT("&Other"));
let widths = lpMenuWidths.width-value;
pointer-value(widths, index: 0) := 1;
pointer-value(widths, index: 2) := 0;
pointer-value(widths, index: 4) := 1;
$S-OK
end method IOleInPlaceFrame/InsertMenus;
//**********************************************************************
//
// COleInPlaceFrame::SetMenu
//
// Purpose:
//
// Sets the application menu to the combined menu
//
// Parameters:
//
// HMENU hmenuShared - The combined menu
//
// HOLEMENU holemenu - Used by OLE
//
// HWND hwndActiveObject - Used by OLE
//
// Return Value:
//
// S_OK
//
// Function Calls:
// Function Location
//
// OutputDebugString Windows API
// SetMenu Windows API
// OleSetMenuDescriptor OLE API
// ResultFromScode OLE API
//
// Comments:
//
//********************************************************************
define method IOleInPlaceFrame/SetMenu(this :: <COleInPlaceFrame>,
hmenuShared :: <HMENU>,
holemenu :: <HOLEMENU>,
hwndActiveObject :: <HWND>)
=> status :: <HRESULT>;
OutputDebugString("In IOIPF::SetMenu\r\n");
let app = this.m-pApp;
// let stabilize :: <CStabilize> = make(<CStabilize>, app);
let hMenu :: <HMENU> = app.m-hMainMenu;
unless ( null-handle?(holemenu) )
hMenu := hmenuShared;
end unless;
// call the windows API, not this method
SetMenu(app.m-hAppWnd, hMenu);
OleSetMenuDescriptor(holemenu, app.m-hAppWnd, hwndActiveObject,
this, app.m-lpDoc.m-lpActiveObject);
end method IOleInPlaceFrame/SetMenu;
//**********************************************************************
//
// COleInPlaceFrame::RemoveMenus
//
// Purpose:
//
// Removes the container menus from the combined menu
//
// Parameters:
//
// HMENU hmenuShared - Handle to the combined menu.
//
// Return Value:
//
// S_OK
//
// Function Calls:
// Function Location
//
// OutputDebugString Windows API
// GetMenuItemCount Windows API
// RemoveMenu Windows API
// ResultFromScode OLE API
//
// Comments:
//
//********************************************************************
define method IOleInPlaceFrame/RemoveMenus(this :: <COleInPlaceFrame>,
hmenuShared :: <HMENU>)
=> status :: <HRESULT>;
OutputDebugString("In IOIPF::RemoveMenus\r\n");
while( GetMenuItemCount(hmenuShared) > 0 )
RemoveMenu(hmenuShared, 0, $MF-BYPOSITION);
end while;
$S-OK
end method IOleInPlaceFrame/RemoveMenus;
//**********************************************************************
//
// COleInPlaceFrame::SetStatusText
//
// Purpose:
//
// Not Implemented
//
// Parameters:
//
// Not Implemented
//
// Return Value:
//
// Not Implemented
//
// Function Calls:
// Function Location
//
// OutputDebugString Windows API
//
// Comments:
//
// This function is not implemented due to the fact
// that this application does not have a status bar.
//
//********************************************************************
define method IOleInPlaceFrame/SetStatusText(this :: <COleInPlaceFrame>,
lpszStatusText :: <LPCOLESTR>)
=> status :: <HRESULT>;
OutputDebugString("In IOIPF::SetStatusText\r\n");
$E-FAIL
end method IOleInPlaceFrame/SetStatusText;
//**********************************************************************
//
// COleInPlaceFrame::EnableModeless
//
// Purpose:
//
// Enables/Disables container modeless dialogs
//
// Parameters:
//
// BOOL fEnable - Enable/Disable
//
// Return Value:
//
// S_OK
//
// Function Calls:
// Function Location
//
// OutputDebugString Windows API
//
// Comments:
//
// There are no modeless dialogs in this application, so the
// implementation of this method is trivial.
//
//********************************************************************
define method IOleInPlaceFrame/EnableModeless(this :: <COleInPlaceFrame>,
fEnable /* :: <boolean> */ )
=> status :: <HRESULT>;
OutputDebugString("In IOIPF::EnableModeless\r\n");
$S-OK
end method IOleInPlaceFrame/EnableModeless;
//**********************************************************************
//
// COleInPlaceFrame::TranslateAccelerator
//
// Purpose:
//
// Not Implemented
//
// Parameters:
//
// Not Implemented
//
// Return Value:
//
// Not Implemented
//
// Function Calls:
// Function Location
//
// OutputDebugString Windows API
//
// Comments:
//
// Not Implemented
//
//********************************************************************
define method IOleInPlaceFrame/TranslateAccelerator
(this :: <COleInPlaceFrame>, lpmsg /* :: <LPMSG> */ ,
wID /* :: <integer> */ )
=> status :: <HRESULT>;
OutputDebugString("In IOIPF::TranslateAccelerator\r\n");
$S-FALSE
end method IOleInPlaceFrame/TranslateAccelerator;
| Dylan | 5 | kryptine/opendylan | sources/ole/examples/sample-ole-container/ioipf.dylan | [
"BSD-2-Clause"
] |
/**
* View Models used by Spring MVC REST controllers.
*/
package com.baeldung.jhipster.uaa.web.rest.vm;
| Java | 2 | DBatOWL/tutorials | jhipster/jhipster-uaa/uaa/src/main/java/com/baeldung/jhipster/uaa/web/rest/vm/package-info.java | [
"MIT"
] |
Rebol [
Title: "Match"
Date: 4-Aug-2008
Author: "Christopher Ross-Gill"
Home: http://www.ross-gill.com/page/Match
File: %match.r3
Version: 0.1.2
Purpose: {Extract structured data from an unstructured block.}
Rights: http://opensource.org/licenses/Apache-2.0
Type: module
Name: rgchris.match
Exports: [
match
]
History: [
4-Aug-2008 0.1.2 "Ported to Rebol 3"
]
Notes: "Extracted from QuarterMaster"
Usage: [
result: match ["Product" $12.99][
name: string! ; requires a string value to be present, set to string value
price: some money! ; requires one or more money values, set to block
place: opt url! ; optional url value, set to url value or none
]
]
]
match: use [get-one get-some datatype raise][
datatype: [
'binary! | 'char! | 'date! | 'decimal! | 'email! | 'file! | 'get-word! |
'integer! | 'issue! | 'lit-path! | 'lit-word! | 'logic! | 'money! | 'none! |
'number! | 'pair! | 'paren! | 'path! | 'percent! | 'refinement! | 'set-path! |
'set-word! | 'string! | 'tag! | 'time! | 'tuple! | 'url! | 'word!
]
if system/version > 2.90.0 [throw: :do]
raise: func [reason][throw make error! rejoin compose [(reason)]]
get-one: func [source type /local out][
parse source [some [out: type to end break | skip]]
unless tail? out [take out]
]
get-some: func [source type /local rule pos out][
out: make block! length? source
parse source rule: [[pos: type (append out take pos) :pos | skip] opt rule]
unless empty? out [out]
]
func [
[catch]
source [block!] "Data source"
spec [block!] "Match specification"
/loose "Ignore unmatched values"
/local out val key required type
][
source: copy source
remove-each item out: copy spec [not set-word? item]
out: context append out none
unless parse spec [
some [
set key set-word! (key: to-word key)
set required ['opt | 'any | 'some | ]
copy type [lit-word! any ['| lit-word!] | datatype any ['| datatype]]
(
switch/default required [
any [val: any [get-some source type make block! 0]]
opt [val: get-one source type]
some [
unless val: get-some source type [
do make error! reform ["Required:" key]
]
]
][
unless val: get-one source type [
do make error! reform ["Required:" key]
]
]
out/(key): val
)
]
][
do make error! "Invalid MATCH Spec"
]
either any [loose empty? source][out][
do make error! reform ["Too Many Options:" mold source]
]
]
] | Rebol | 4 | rgchris/Scripts | r3-alpha/match.r3 | [
"Apache-2.0"
] |
from tools.linter import trailing_newlines
import unittest
import tempfile
def correct_trailing_newlines(file_contents: str) -> bool:
with tempfile.NamedTemporaryFile(mode='w', delete=False) as tmp:
filename = tmp.name
tmp.write(file_contents)
return trailing_newlines.correct_trailing_newlines(filename)
class TestTrailingNewlines(unittest.TestCase):
def test_empty(self) -> None:
self.assertTrue(correct_trailing_newlines(''))
def test_single_byte(self) -> None:
self.assertFalse(correct_trailing_newlines('a'))
def test_single_newline(self) -> None:
self.assertFalse(correct_trailing_newlines('\n'))
def test_two_newlines(self) -> None:
self.assertFalse(correct_trailing_newlines('\n\n'))
def test_three_newlines(self) -> None:
self.assertFalse(correct_trailing_newlines('\n\n\n'))
def test_hello_world(self) -> None:
self.assertFalse(correct_trailing_newlines('hello world'))
def test_hello_world_newline(self) -> None:
self.assertTrue(correct_trailing_newlines('hello world\n'))
def test_hello_world_two_newlines(self) -> None:
self.assertFalse(correct_trailing_newlines('hello world\n\n'))
def test_hello_world_three_newlines(self) -> None:
self.assertFalse(correct_trailing_newlines('hello world\n\n\n'))
def test_hello_world_multiline(self) -> None:
self.assertFalse(correct_trailing_newlines('hello\nworld'))
def test_hello_world_multiline_gap(self) -> None:
self.assertTrue(correct_trailing_newlines('hello\n\nworld\n'))
if __name__ == '__main__':
unittest.main()
| Python | 4 | Hacky-DH/pytorch | tools/test/test_trailing_newlines.py | [
"Intel"
] |
# turn output of mkindex into form needed by dict
BEGIN {
if(ARGC != 2) {
print "Usage: awk -F' ' -f canonind.awk rawindex > index"
exit 1
}
file = ARGV[1]
ARGV[1] = ""
while ((getline < file) > 0) {
for(i = 2; i <= NF; i++) {
w = $i
if(length(w) == 0)
continue
b = index(w, "(")
e = index(w, ")")
if(b && e && b < e) {
w1 = substr(w, 1, b-1)
w2 = substr(w, b+1, e-b-1)
w3 = substr(w, e+1)
printf "%s%s\t%d\n", w1, w3, $1 > "junk"
printf "%s%s%s\t%d\n", w1, w2, w3, $1 > "junk"
} else
printf "%s\t%d\n", w, $1 > "junk"
}
}
system("sort -u -t' ' +0f -1 +0 -1 +1n -2 < junk")
system("rm junk")
exit 0
}
| Awk | 3 | newluhux/plan9port | src/cmd/dict/canonind.awk | [
"MIT"
] |
$$ MODE TUSCRIPT
week="Monday'Tuesday'Wednesday'Thursday'Friday'Saterday'Sunday"
LOOP day=week
PRINT day
ENDLOOP
| Turing | 1 | LaudateCorpus1/RosettaCodeData | Task/Loops-Foreach/TUSCRIPT/loops-foreach.tu | [
"Info-ZIP"
] |
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -march=amdgcn -run-pass=regbankselect %s -verify-machineinstrs -o - -regbankselect-fast | FileCheck %s
# RUN: llc -march=amdgcn -run-pass=regbankselect %s -verify-machineinstrs -o - -regbankselect-greedy | FileCheck %s
---
name: fneg_s
legalized: true
body: |
bb.0:
liveins: $sgpr0_sgpr1
; CHECK-LABEL: name: fneg_s
; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
; CHECK: [[FNEG:%[0-9]+]]:sgpr(s32) = G_FNEG [[COPY]]
; CHECK: $vgpr0 = COPY [[FNEG]](s32)
%0:_(s32) = COPY $sgpr0
%1:_(s32) = G_FNEG %0
$vgpr0 = COPY %1
...
---
name: fneg_v
legalized: true
body: |
bb.0:
liveins: $vgpr0_vgpr1
; CHECK-LABEL: name: fneg_v
; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
; CHECK: [[FNEG:%[0-9]+]]:vgpr(s32) = G_FNEG [[COPY]]
; CHECK: $vgpr0 = COPY [[FNEG]](s32)
%0:_(s32) = COPY $vgpr0
%1:_(s32) = G_FNEG %0
$vgpr0 = COPY %1
...
| Mirah | 4 | medismailben/llvm-project | llvm/test/CodeGen/AMDGPU/GlobalISel/regbankselect-fneg.mir | [
"Apache-2.0"
] |
// ignore-order
const QUERY = 'is_nan';
const EXPECTED = {
'others': [
{ 'path': 'std::f32', 'name': 'is_nan' },
{ 'path': 'std::f64', 'name': 'is_nan' },
{ 'path': 'std::option::Option', 'name': 'is_none' },
],
};
| JavaScript | 2 | Eric-Arellano/rust | src/test/rustdoc-js-std/deduplication.js | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
import psycopg2
from django.db.models import (
CharField, Expression, Field, FloatField, Func, Lookup, TextField, Value,
)
from django.db.models.expressions import CombinedExpression
from django.db.models.functions import Cast, Coalesce
class SearchVectorExact(Lookup):
lookup_name = 'exact'
def process_rhs(self, qn, connection):
if not isinstance(self.rhs, (SearchQuery, CombinedSearchQuery)):
config = getattr(self.lhs, 'config', None)
self.rhs = SearchQuery(self.rhs, config=config)
rhs, rhs_params = super().process_rhs(qn, connection)
return rhs, rhs_params
def as_sql(self, qn, connection):
lhs, lhs_params = self.process_lhs(qn, connection)
rhs, rhs_params = self.process_rhs(qn, connection)
params = lhs_params + rhs_params
return '%s @@ %s' % (lhs, rhs), params
class SearchVectorField(Field):
def db_type(self, connection):
return 'tsvector'
class SearchQueryField(Field):
def db_type(self, connection):
return 'tsquery'
class SearchConfig(Expression):
def __init__(self, config):
super().__init__()
if not hasattr(config, 'resolve_expression'):
config = Value(config)
self.config = config
@classmethod
def from_parameter(cls, config):
if config is None or isinstance(config, cls):
return config
return cls(config)
def get_source_expressions(self):
return [self.config]
def set_source_expressions(self, exprs):
self.config, = exprs
def as_sql(self, compiler, connection):
sql, params = compiler.compile(self.config)
return '%s::regconfig' % sql, params
class SearchVectorCombinable:
ADD = '||'
def _combine(self, other, connector, reversed):
if not isinstance(other, SearchVectorCombinable):
raise TypeError(
'SearchVector can only be combined with other SearchVector '
'instances, got %s.' % type(other).__name__
)
if reversed:
return CombinedSearchVector(other, connector, self, self.config)
return CombinedSearchVector(self, connector, other, self.config)
class SearchVector(SearchVectorCombinable, Func):
function = 'to_tsvector'
arg_joiner = " || ' ' || "
output_field = SearchVectorField()
def __init__(self, *expressions, config=None, weight=None):
super().__init__(*expressions)
self.config = SearchConfig.from_parameter(config)
if weight is not None and not hasattr(weight, 'resolve_expression'):
weight = Value(weight)
self.weight = weight
def resolve_expression(self, query=None, allow_joins=True, reuse=None, summarize=False, for_save=False):
resolved = super().resolve_expression(query, allow_joins, reuse, summarize, for_save)
if self.config:
resolved.config = self.config.resolve_expression(query, allow_joins, reuse, summarize, for_save)
return resolved
def as_sql(self, compiler, connection, function=None, template=None):
clone = self.copy()
clone.set_source_expressions([
Coalesce(
expression
if isinstance(expression.output_field, (CharField, TextField))
else Cast(expression, TextField()),
Value('')
) for expression in clone.get_source_expressions()
])
config_sql = None
config_params = []
if template is None:
if clone.config:
config_sql, config_params = compiler.compile(clone.config)
template = '%(function)s(%(config)s, %(expressions)s)'
else:
template = clone.template
sql, params = super(SearchVector, clone).as_sql(
compiler, connection, function=function, template=template,
config=config_sql,
)
extra_params = []
if clone.weight:
weight_sql, extra_params = compiler.compile(clone.weight)
sql = 'setweight({}, {})'.format(sql, weight_sql)
return sql, config_params + params + extra_params
class CombinedSearchVector(SearchVectorCombinable, CombinedExpression):
def __init__(self, lhs, connector, rhs, config, output_field=None):
self.config = config
super().__init__(lhs, connector, rhs, output_field)
class SearchQueryCombinable:
BITAND = '&&'
BITOR = '||'
def _combine(self, other, connector, reversed):
if not isinstance(other, SearchQueryCombinable):
raise TypeError(
'SearchQuery can only be combined with other SearchQuery '
'instances, got %s.' % type(other).__name__
)
if reversed:
return CombinedSearchQuery(other, connector, self, self.config)
return CombinedSearchQuery(self, connector, other, self.config)
# On Combinable, these are not implemented to reduce confusion with Q. In
# this case we are actually (ab)using them to do logical combination so
# it's consistent with other usage in Django.
def __or__(self, other):
return self._combine(other, self.BITOR, False)
def __ror__(self, other):
return self._combine(other, self.BITOR, True)
def __and__(self, other):
return self._combine(other, self.BITAND, False)
def __rand__(self, other):
return self._combine(other, self.BITAND, True)
class SearchQuery(SearchQueryCombinable, Func):
output_field = SearchQueryField()
SEARCH_TYPES = {
'plain': 'plainto_tsquery',
'phrase': 'phraseto_tsquery',
'raw': 'to_tsquery',
'websearch': 'websearch_to_tsquery',
}
def __init__(self, value, output_field=None, *, config=None, invert=False, search_type='plain'):
self.function = self.SEARCH_TYPES.get(search_type)
if self.function is None:
raise ValueError("Unknown search_type argument '%s'." % search_type)
if not hasattr(value, 'resolve_expression'):
value = Value(value)
expressions = (value,)
self.config = SearchConfig.from_parameter(config)
if self.config is not None:
expressions = (self.config,) + expressions
self.invert = invert
super().__init__(*expressions, output_field=output_field)
def as_sql(self, compiler, connection, function=None, template=None):
sql, params = super().as_sql(compiler, connection, function, template)
if self.invert:
sql = '!!(%s)' % sql
return sql, params
def __invert__(self):
clone = self.copy()
clone.invert = not self.invert
return clone
def __str__(self):
result = super().__str__()
return ('~%s' % result) if self.invert else result
class CombinedSearchQuery(SearchQueryCombinable, CombinedExpression):
def __init__(self, lhs, connector, rhs, config, output_field=None):
self.config = config
super().__init__(lhs, connector, rhs, output_field)
def __str__(self):
return '(%s)' % super().__str__()
class SearchRank(Func):
function = 'ts_rank'
output_field = FloatField()
def __init__(
self, vector, query, weights=None, normalization=None,
cover_density=False,
):
if not hasattr(vector, 'resolve_expression'):
vector = SearchVector(vector)
if not hasattr(query, 'resolve_expression'):
query = SearchQuery(query)
expressions = (vector, query)
if weights is not None:
if not hasattr(weights, 'resolve_expression'):
weights = Value(weights)
expressions = (weights,) + expressions
if normalization is not None:
if not hasattr(normalization, 'resolve_expression'):
normalization = Value(normalization)
expressions += (normalization,)
if cover_density:
self.function = 'ts_rank_cd'
super().__init__(*expressions)
class SearchHeadline(Func):
function = 'ts_headline'
template = '%(function)s(%(expressions)s%(options)s)'
output_field = TextField()
def __init__(
self, expression, query, *, config=None, start_sel=None, stop_sel=None,
max_words=None, min_words=None, short_word=None, highlight_all=None,
max_fragments=None, fragment_delimiter=None,
):
if not hasattr(query, 'resolve_expression'):
query = SearchQuery(query)
options = {
'StartSel': start_sel,
'StopSel': stop_sel,
'MaxWords': max_words,
'MinWords': min_words,
'ShortWord': short_word,
'HighlightAll': highlight_all,
'MaxFragments': max_fragments,
'FragmentDelimiter': fragment_delimiter,
}
self.options = {
option: value
for option, value in options.items() if value is not None
}
expressions = (expression, query)
if config is not None:
config = SearchConfig.from_parameter(config)
expressions = (config,) + expressions
super().__init__(*expressions)
def as_sql(self, compiler, connection, function=None, template=None):
options_sql = ''
options_params = []
if self.options:
# getquoted() returns a quoted bytestring of the adapted value.
options_params.append(', '.join(
'%s=%s' % (
option,
psycopg2.extensions.adapt(value).getquoted().decode(),
) for option, value in self.options.items()
))
options_sql = ', %s'
sql, params = super().as_sql(
compiler, connection, function=function, template=template,
options=options_sql,
)
return sql, params + options_params
SearchVectorField.register_lookup(SearchVectorExact)
class TrigramBase(Func):
output_field = FloatField()
def __init__(self, expression, string, **extra):
if not hasattr(string, 'resolve_expression'):
string = Value(string)
super().__init__(expression, string, **extra)
class TrigramWordBase(Func):
output_field = FloatField()
def __init__(self, string, expression, **extra):
if not hasattr(string, 'resolve_expression'):
string = Value(string)
super().__init__(string, expression, **extra)
class TrigramSimilarity(TrigramBase):
function = 'SIMILARITY'
class TrigramDistance(TrigramBase):
function = ''
arg_joiner = ' <-> '
class TrigramWordDistance(TrigramWordBase):
function = ''
arg_joiner = ' <<-> '
class TrigramWordSimilarity(TrigramWordBase):
function = 'WORD_SIMILARITY'
| Python | 5 | KaushikSathvara/django | django/contrib/postgres/search.py | [
"BSD-3-Clause",
"0BSD"
] |
(defmodule ltest-basic-tests
(behaviour ltest-unit)
(import
(from ltest
(check-failed-assert 2)
(check-wrong-assert-exception 2))))
(include-lib "include/ltest-macros.lfe")
(deftest is
(is 'true)
(is (not 'false))
(is (not (not 'true))))
(deftest are*
(are* (x y) (== x y)
2 (+ 1 1)
4 (* 2 2)))
(deftest is-with-one-phrase-deftest
"This unit tests was originally testing the deftest macro with just one
phrase."
(is-not 'false))
(deftest is-with-two-phrase-deftest
"This unit tests was originally testing the deftest macro with two phrases."
(is-not 'false)
(is 'true))
(deftest is-with-many-phrase-deftest
"This unit tests was originally testing the deftest macro with several
phrases."
(is-not 'false)
(is 'true)
(is-equal 1 1)
(is-equal 1 (+ 1 0))
(is-not-equal 1 2))
(deftest is-fail
(try
(progn
(is 'false)
(error 'unexpected-test-success))
(catch ((tuple type value _)
(check-failed-assert value (assertion-failed))))))
(deftest is-not
(is-not 'false)
(is-not (not 'true))
(is-not (not (not 'false))))
(deftest is-not-fail
(try
(progn
(is-not 'true)
(error 'unexpected-test-success))
(catch ((tuple type value _)
(check-failed-assert value (assertion-failed))))))
(deftest is-equal
(is-equal 1 1)
(is-equal 1 (+ 1 0))
(is-equal 1 (- 2 1)))
(deftest is-equal-fail
(try
(progn
(is-equal 1 2)
(error 'unexpected-test-success))
(catch ((tuple type value _)
(check-failed-assert value (assert-equal-failed))))))
(deftest is-not-equal
(is-not-equal 0 1)
(is-not-equal 0 (+ 1 0))
(is-not-equal 0 (- 2 1)))
(deftest is-not-equal-fail
(try
(progn
(is-not-equal 1 (+ 1 0))
(error 'unexpected-test-success))
(catch ((tuple type value _)
(check-failed-assert value (assert-not-equal-failed))))))
(deftest is-exception
(is-exception 'throw 'my-error (throw 'my-error)))
(deftest is-exception-wrong-class
(try
(progn
(is-exception 'throw 'badarith (/ 1 0))
(error 'unexpected-test-success))
(catch ((tuple type value _)
(check-wrong-assert-exception value 'unexpected_exception)))))
(deftest is-exception-wrong-term
(try
(progn
(is-exception 'error 'undef (/ 1 0))
(error 'unexpected-success))
(catch ((tuple type value _)
(check-wrong-assert-exception value 'unexpected_exception)))))
(deftest is-exception-unexpected-success
(try
(progn
(is-exception 'error 'badarith (+ 1 1))
(error 'unexpected-test-success))
(catch ((tuple type value _)
(check-wrong-assert-exception value 'unexpected_success)))))
(deftest is-not-exception
(is-not-exception (+ 2 2)))
(deftest is-not-exception-exit
(is-not-exception 'exit 'badarith (/ 1 0)))
(deftest is-not-exception-throw
(is-not-exception 'throw 'badarith (/ 1 0)))
(deftest is-error
(is-error 'badarith (/ 1 0)))
(deftest is-error-wrong-term
(try
(progn
(is-error 'undef (/ 1 0))
(error 'unexpected-test-success))
(catch ((tuple type value _)
(check-wrong-assert-exception value 'unexpected_exception)))))
(deftest is-error-unexpected-success
(try
(progn
(is-error 'badarith (+ 1 1))
(error 'unexpected-test-success))
(catch ((tuple type value _)
(check-wrong-assert-exception value 'unexpected_success)))))
; XXX add test: is-not-error_test
(deftest is-throw
(is-throw 'my-error (throw 'my-error)))
(deftest is-throw-wrong-term
(try
(progn
(is-throw 'my-error (throw 'another-error))
(error 'unexpected-test-success))
(catch ((tuple type value _)
(check-wrong-assert-exception value 'unexpected_exception)))))
(deftest is-throw-unexpected-success
(try
(progn
(is-throw 'my-error (list 'no 'problem 'here))
(error 'unexpected-test-success))
(catch ((tuple type value _)
(check-wrong-assert-exception value 'unexpected_success)))))
; XXX add test: is-not-throw_test
(deftest is-exit
(is-exit 'my-error (exit 'my-error)))
(deftest is-exit-wrong-term
(try
(progn
(is-exit 'my-error (exit 'another-error))
(error 'unexpected-test-success))
(catch ((tuple type value _)
(check-wrong-assert-exception value 'unexpected_exception)))))
(deftest is-exit-unexpected-success
(try
(progn
(is-exit 'my-error (list 'no 'problem 'here))
(error 'unexpected-test-success))
(catch ((tuple type value _)
(check-wrong-assert-exception value 'unexpected_success)))))
; XXX add test: is-not-exit_test
; XXX add test: is-match_test
(deftest is-match
(is-match (tuple 1 'a) #(1 a))
(is-match (tuple 1 (tuple 2 'pull)) #(1 #(2 pull))))
(deftest is-match-fail
(try
(progn
(is-match (tuple 1 'a) #(1 b))
(error 'unexpected-test-success))
(catch ((tuple type value _)
(check-failed-assert value (assert-match-failed))))))
| LFE | 5 | ioolkos/ltest | test/ltest-basic-tests.lfe | [
"BSD-3-Clause"
] |
it("should apply pre and post loaders correctly", function() {
expect(require("./a")).toBe("resource loader2 loader1 loader3");
expect(require("!./a")).toBe("resource loader2 loader3");
expect(require("!!./a")).toBe("resource");
expect(require("-!./a")).toBe("resource loader3");
});
| JavaScript | 3 | 1shenxi/webpack | test/configCases/loaders/pre-post-loader/index.js | [
"MIT"
] |
--- nsprpub/config/Makefile.in
+++ nsprpub/config/Makefile.in
@@ -158,3 +158,7 @@
install:: nspr.m4
$(NSINSTALL) -D $(DESTDIR)$(datadir)/aclocal
$(NSINSTALL) -t -m 0644 $< $(DESTDIR)$(datadir)/aclocal
+
+install:: nspr.pc
+ $(NSINSTALL) -D $(DESTDIR)$(libdir)/pkgconfig
+ $(NSINSTALL) -t -m 0644 $< $(DESTDIR)$(libdir)/pkgconfig
--- nsprpub/config/nspr.pc.in
+++ nsprpub/config/nspr.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: NSPR
+Description: The Netscape Portable Runtime
+Version: @MOD_MAJOR_VERSION@.@MOD_MINOR_VERSION@.@MOD_PATCH_VERSION@
+Libs: -L@libdir@ -lplds@MOD_MAJOR_VERSION@ -lplc@MOD_MAJOR_VERSION@ -lnspr@MOD_MAJOR_VERSION@ @OS_LIBS@
+Cflags: -I@includedir@
--- nsprpub/configure.in
+++ nsprpub/configure.in
@@ -2766,6 +2766,7 @@
config/nsprincl.mk
config/nsprincl.sh
config/nspr-config
+config/nspr.pc
lib/Makefile
lib/ds/Makefile
lib/libc/Makefile
| Darcs Patch | 3 | crystalfontz/openembedded | recipes/mozilla/nspr-4.7.1/30_pkgconfig.dpatch | [
"MIT"
] |
# Written by Bob Rotsted
# Copyright Reservoir Labs, 2015.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
module AvgByteCount;
export {
global epoch: interval = 1min &redef;
redef enum Log::ID += { LOG };
type Info: record {
start_time: string &log;
role: string &log;
epoch: interval &log;
avg_bytes: double &log;
std_dev_bytes: double &log;
};
global log_avg_bytes_per_flow: event(rec: Info);
}
event bro_init()
{
local rec: AvgByteCount::Info;
Log::create_stream(AvgByteCount::LOG, [$columns=Info, $ev=log_avg_bytes_per_flow]);
local r1 = SumStats::Reducer($stream="avg.byte.per.epoch", $apply=set(SumStats::AVERAGE, SumStats::STD_DEV));
SumStats::create([$name="top_avg.byte.per.epoch",
$epoch=epoch,
$reducers=set(r1),
$epoch_result(ts: time, key: SumStats::Key, result: SumStats::Result) =
{
local r = result["avg.byte.per.epoch"];
rec = [$start_time= strftime("%c", r$begin), $epoch=epoch, $role=key$str, $avg_bytes=r$average, $std_dev_bytes=r$std_dev];
Log::write(AvgByteCount::LOG, rec);
}
]);
}
event connection_state_remove(c: connection)
{
SumStats::observe("avg.byte.per.epoch", [$str="orig"], [$num=c$orig$size]);
SumStats::observe("avg.byte.per.epoch", [$str="resp"], [$num=c$resp$size]);
SumStats::observe("avg.byte.per.epoch", [$str="aggregate"], [$num=c$resp$size + c$orig$size]);
}
| Bro | 4 | reservoirlabs/bro-scripts | sumstats/avg-bytes-per-flow.bro | [
"Apache-2.0"
] |
<!doctype html>
<title>CodeMirror: ProtoBuf mode</title>
<meta charset="utf-8"/>
<link rel=stylesheet href="../../doc/docs.css">
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="protobuf.js"></script>
<style>.CodeMirror { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; }</style>
<div id=nav>
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
<ul>
<li><a href="../../index.html">Home</a>
<li><a href="../../doc/manual.html">Manual</a>
<li><a href="https://github.com/codemirror/codemirror">Code</a>
</ul>
<ul>
<li><a href="../index.html">Language modes</a>
<li><a class=active href="#">ProtoBuf</a>
</ul>
</div>
<article>
<h2>ProtoBuf mode</h2>
<form><textarea id="code" name="code">
package addressbook;
message Address {
required string street = 1;
required string postCode = 2;
}
message PhoneNumber {
required string number = 1;
}
message Person {
optional int32 id = 1;
required string name = 2;
required string surname = 3;
optional Address address = 4;
repeated PhoneNumber phoneNumbers = 5;
optional uint32 age = 6;
repeated uint32 favouriteNumbers = 7;
optional string license = 8;
enum Gender {
MALE = 0;
FEMALE = 1;
}
optional Gender gender = 9;
optional fixed64 lastUpdate = 10;
required bool deleted = 11 [default = false];
}
</textarea>
<textarea id="code2" name="code2">
syntax = "proto3";
package tutorial;
import "google/protobuf/timestamp.proto";
option java_package = "com.example.tutorial";
option java_outer_classname = "AddressBookProtos";
option csharp_namespace = "Google.Protobuf.Examples.AddressBook";
message Person {
string name = 1;
int32 id = 2; // Unique ID number for this person.
string email = 3;
enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}
message PhoneNumber {
string number = 1;
PhoneType type = 2;
}
repeated PhoneNumber phones = 4;
google.protobuf.Timestamp last_updated = 5;
}
// Our address book file is just one of these.
message AddressBook {
repeated Person people = 1;
}
service Test {
rpc SayHello (HelloRequest) returns (HelloReply) {}
rpc SayHelloAgain (HelloRequest) returns (HelloReply) {}
}</textarea>
</form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
var editor = CodeMirror.fromTextArea(document.getElementById("code2"), {});
</script>
<p><strong>MIME types defined:</strong> <code>text/x-protobuf</code>.</p>
</article>
| HTML | 4 | karlcow/CodeMirror | mode/protobuf/index.html | [
"MIT"
] |
#define AppName "nocalhost"
#define AppPublisher "nocalhost.dev"
#define AppURL "https://nocalhost.dev"
#define AppExeName "nhctl.exe"
[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{CF1B1587-7851-4B9C-8997-41C91A81B24B}
AppName={#AppName}
AppVersion={#AppVersion}
OutputBaseFilename=NocalhostInstaller
OutputDir=..\..\build
AppPublisher={#AppPublisher}
AppPublisherURL={#AppURL}
AppSupportURL={#AppURL}
AppUpdatesURL={#AppURL}
DefaultDirName={autopf}\{#AppName}
DisableDirPage=yes
DefaultGroupName={#AppName}
DisableProgramGroupPage=yes
LicenseFile=..\..\LICENSE
; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest
Compression=lzma
SolidCompression=yes
WizardStyle=modern
; Tell Windows Explorer to reload the environment
ChangesEnvironment=yes
[Files]
Source: "..\..\build\{#AppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\build\kubectl.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\build\windows-amd64\helm.exe"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Tasks]
Name: "addtopath"; Description: "Add to PATH (requires shell restart)"; GroupDescription: "Other:"
[Icons]
Name: "{group}\{#AppName}"; Filename: "{app}\{#AppExeName}"
Name: "{group}\{cm:UninstallProgram,{#AppName}}"; Filename: "{uninstallexe}"
[Registry]
#define SoftwareClassesRootKey "HKLM"
; Environment
#define EnvironmentRootKey "HKLM"
#define EnvironmentKey "System\CurrentControlSet\Control\Session Manager\Environment"
#define Uninstall64RootKey "HKLM64"
#define Uninstall32RootKey "HKLM32"
Root: {#EnvironmentRootKey}; Subkey: "{#EnvironmentKey}"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}"; Tasks: addtopath; Check: NeedsAddPath(ExpandConstant('{app}'))
[Code]
function NeedsAddPath(Param: string): boolean;
var
OrigPath: string;
begin
if not RegQueryStringValue({#EnvironmentRootKey}, '{#EnvironmentKey}', 'Path', OrigPath)
then begin
Result := True;
exit;
end;
Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0;
end;
// https://stackoverflow.com/a/23838239/261019
procedure Explode(var Dest: TArrayOfString; Text: String; Separator: String);
var
i, p: Integer;
begin
i := 0;
repeat
SetArrayLength(Dest, i+1);
p := Pos(Separator,Text);
if p > 0 then begin
Dest[i] := Copy(Text, 1, p-1);
Text := Copy(Text, p + Length(Separator), Length(Text));
i := i + 1;
end else begin
Dest[i] := Text;
Text := '';
end;
until Length(Text)=0;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
Path: string;
ThisAppPath: string;
Parts: TArrayOfString;
NewPath: string;
i: Integer;
begin
if not CurUninstallStep = usUninstall then begin
exit;
end;
if not RegQueryStringValue({#EnvironmentRootKey}, '{#EnvironmentKey}', 'Path', Path)
then begin
exit;
end;
NewPath := '';
ThisAppPath := ExpandConstant('{app}')
Explode(Parts, Path, ';');
for i:=0 to GetArrayLength(Parts)-1 do begin
if CompareText(Parts[i], ThisAppPath) <> 0 then begin
NewPath := NewPath + Parts[i];
if i < GetArrayLength(Parts) - 1 then begin
NewPath := NewPath + ';';
end;
end;
end;
RegWriteExpandStringValue({#EnvironmentRootKey}, '{#EnvironmentKey}', 'Path', NewPath);
end; | Inno Setup | 4 | svcdzt/nocalhost | scripts/release/nocalhost.iss | [
"Apache-2.0"
] |
lexer grammar ExprLexer;
options {
language=Java;
}
@header {
/*
* 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.
*/
}
If : 'if';
Else : 'else';
Return : 'return';
Then : 'then';
End : 'end';
In : 'in';
Case : 'case';
When : 'when';
Cast: 'cast';
Convert : 'convert_' ('from' | 'to');
AnyValue : 'any_value' | 'ANY_VALUE';
Nullable: 'nullable';
Repeat: 'repeat';
As: 'as';
BIT : 'bit' | 'BIT';
INT : 'int' | 'INT';
BIGINT : 'bigint' | 'BIGINT';
FLOAT4 : 'float4' | 'FLOAT4';
FLOAT8 : 'float8' | 'FLOAT8';
VARCHAR : 'varchar' | 'VARCHAR';
VARBINARY: 'varbinary' | 'VARBINARY';
DATE : 'date' | 'DATE';
TIMESTAMP: 'timestamp' | 'TIMESTAMP';
TIME : 'time' | 'TIME';
TIMESTAMPTZ: 'timestamptz' | 'TIMESTAMPTZ';
INTERVAL : 'interval' | 'INTERVAL';
INTERVALYEAR : 'intervalyear' | 'INTERVALYEAR';
INTERVALDAY : 'intervalday' | 'INTERVALDAY';
Period : '.';
DECIMAL9 : 'decimal9' | 'DECIMAL9';
DECIMAL18 : 'decimal18' | 'DECIMAL18';
DECIMAL28DENSE : 'decimal28dense' | 'DECIMAL28DENSE';
DECIMAL28SPARSE : 'decimal28sparse' | 'DECIMAL28SPARSE';
DECIMAL38DENSE : 'decimal38dense' | 'DECIMAL38DENSE';
DECIMAL38SPARSE : 'decimal38sparse' | 'DECIMAL38SPARSE';
VARDECIMAL : 'vardecimal' | 'VARDECIMAL';
Or : 'or' | 'OR' | 'Or';
And : 'and' | 'AND' ;
Equals : '==' | '=';
NEquals : '<>' | '!=';
GTEquals : '>=';
LTEquals : '<=';
Caret : '^';
Excl : '!';
GT : '>';
LT : '<';
Plus : '+';
Minus : '-';
Asterisk : '*';
ForwardSlash : '/';
Percent : '%';
OBrace : '{';
CBrace : '}';
OBracket : '[';
CBracket : ']';
OParen : '(';
CParen : ')';
SColon : ';';
Comma : ',';
QMark : '?';
Colon : ':';
SingleQuote: '\'';
Bool
: 'true'
| 'false'
;
Number
: Int ('.' Digit*)? (('e' | 'E') ('+' | '-')? Digit*)?
;
Identifier
: ('a'..'z' | 'A'..'Z' | '_' | '$') ('a'..'z' | 'A'..'Z' | '_' | '$' | Digit)*
;
QuotedIdentifier
: '`' (~('`' | '\\') | '\\' ('\\' | '`'))* '`'
{
setText(getText().substring(1, getText().length()-1).replaceAll("\\\\(.)", "$1"));
}
;
String
: '\'' (~('\'' | '\\') | '\\' ('\\' | '\''))* '\''
{
setText(getText().substring(1, getText().length()-1).replaceAll("\\\\(.)", "$1"));
}
;
LineComment
: '//' ~[\r\n]* -> skip
;
BlockComment
: '/*' .*? '*/' -> skip
;
Space
: [ \n\t\r\u000C]+ -> skip
;
fragment Int
: '1'..'9' Digit*
| '0'
;
fragment Digit
: '0'..'9'
;
| ANTLR | 4 | julien-faye/drill | logical/src/main/antlr4/org/apache/drill/common/expression/parser/ExprLexer.g4 | [
"Apache-2.0"
] |
<mt:Ignore>
# =======================
#
# ウィジェット-ブログ新着-ヘッドライン
#
# =======================
</mt:Ignore>
<mt:Entries category="NOT xxx" sort_by="authored_on" sort_order="descend" limit="7">
<mt:EntriesHeader>
<div class="card widget widget-recent-headline">
<div class="card-header clearfix">
<mt:If name="__is_sub__" eq="1">
<p class="card-title pull-left">ブログ</p>
<ul class="list-inline pull-right">
<li><a href="<mt:Link template="blog_index" />" class="btn btn-sm btn-secondary">一覧へ</a></li>
</ul>
<mt:Else>
<h2 class="card-title pull-left">ブログ</h2>
<ul class="list-inline pull-right">
<li><a href="<mt:Link template="blog_index" />" class="btn btn-sm btn-primary">一覧へ</a></li>
</ul>
</mt:If>
</div>
<div class="card-block">
</mt:EntriesHeader>
<mt:Include module="記事ループ-ヘッドライン" />
<mt:EntriesFooter>
<!-- /.card-block --></div>
<!-- /.card ec-widget --></div>
</mt:EntriesFooter>
</mt:Entries>
| MTML | 3 | webbingstudio/mt_theme_echo_bootstrap | dist/themes/echo_bootstrap/templates/widget_recent_headline.mtml | [
"MIT"
] |
LIBARCHIVE-FORMATS(5) manual page
== NAME ==
'''libarchive-formats'''
- archive formats supported by the libarchive library
== DESCRIPTION ==
The
[[ManPageibarchive3]]
library reads and writes a variety of streaming archive formats.
Generally speaking, all of these archive formats consist of a series of
"entries".
Each entry stores a single file system object, such as a file, directory,
or symbolic link.
The following provides a brief description of each format supported
by libarchive, with some information about recognized extensions or
limitations of the current library support.
Note that just because a format is supported by libarchive does not
imply that a program that uses libarchive will support that format.
Applications that use libarchive specify which formats they wish
to support, though many programs do use libarchive convenience
functions to enable all supported formats.
=== Tar Formats===
The
[[ManPageibarchive3]]
library can read most tar archives.
It can write POSIX-standard
"ustar"
and
"pax interchange"
formats as well as v7 tar format and a subset of the legacy GNU tar format.
All tar formats store each entry in one or more 512-byte records.
The first record is used for file metadata, including filename,
timestamp, and mode information, and the file data is stored in
subsequent records.
Later variants have extended this by either appropriating undefined
areas of the header record, extending the header to multiple records,
or by storing special entries that modify the interpretation of
subsequent entries.
<dl>
<dt>'''gnutar'''</dt><dd>
The
[[ManPageibarchive3]]
library can read most GNU-format tar archives.
It currently supports the most popular GNU extensions, including
modern long filename and linkname support, as well as atime and ctime data.
The libarchive library does not support multi-volume
archives, nor the old GNU long filename format.
It can read GNU sparse file entries, including the new POSIX-based
formats.
The
[[ManPageibarchive3]]
library can write GNU tar format, including long filename
and linkname support, as well as atime and ctime data.
</dd><dt>'''pax'''</dt><dd>
The
[[ManPageibarchive3]]
library can read and write POSIX-compliant pax interchange format
archives.
Pax interchange format archives are an extension of the older ustar
format that adds a separate entry with additional attributes stored
as key/value pairs immediately before each regular entry.
The presence of these additional entries is the only difference between
pax interchange format and the older ustar format.
The extended attributes are of unlimited length and are stored
as UTF-8 Unicode strings.
Keywords defined in the standard are in all lowercase; vendors are allowed
to define custom keys by preceding them with the vendor name in all uppercase.
When writing pax archives, libarchive uses many of the SCHILY keys
defined by Joerg Schilling's
"star"
archiver and a few LIBARCHIVE keys.
The libarchive library can read most of the SCHILY keys
and most of the GNU keys introduced by GNU tar.
It silently ignores any keywords that it does not understand.
The pax interchange format converts filenames to Unicode
and stores them using the UTF-8 encoding.
Prior to libarchive 3.0, libarchive erroneously assumed
that the system wide-character routines natively supported
Unicode.
This caused it to mis-handle non-ASCII filenames on systems
that did not satisfy this assumption.
</dd><dt>'''restricted''' pax</dt><dd>
The libarchive library can also write pax archives in which it
attempts to suppress the extended attributes entry whenever
possible.
The result will be identical to a ustar archive unless the
extended attributes entry is required to store a long file
name, long linkname, extended ACL, file flags, or if any of the standard
ustar data (user name, group name, UID, GID, etc) cannot be fully
represented in the ustar header.
In all cases, the result can be dearchived by any program that
can read POSIX-compliant pax interchange format archives.
Programs that correctly read ustar format (see below) will also be
able to read this format; any extended attributes will be extracted as
separate files stored in
''PaxHeader''
directories.
</dd><dt>'''ustar'''</dt><dd>
The libarchive library can both read and write this format.
This format has the following limitations:
<ul>
<li>
Device major and minor numbers are limited to 21 bits.
Nodes with larger numbers will not be added to the archive.
</li><li>
Path names in the archive are limited to 255 bytes.
(Shorter if there is no / character in exactly the right place.)
</li><li>
Symbolic links and hard links are stored in the archive with
the name of the referenced file.
This name is limited to 100 bytes.
</li><li>
Extended attributes, file flags, and other extended
security information cannot be stored.
</li><li>
Archive entries are limited to 8 gigabytes in size.
</li></ul>
Note that the pax interchange format has none of these restrictions.
The ustar format is old and widely supported.
It is recommended when compatibility is the primary concern.
</dd><dt>'''v7'''</dt><dd>
The libarchive library can read and write the legacy v7 tar format.
This format has the following limitations:
<ul>
<li>
Only regular files, directories, and symbolic links can be archived.
Block and character device nodes, FIFOs, and sockets cannot be archived.
</li><li>
Path names in the archive are limited to 100 bytes.
</li><li>
Symbolic links and hard links are stored in the archive with
the name of the referenced file.
This name is limited to 100 bytes.
</li><li>
User and group information are stored as numeric IDs; there
is no provision for storing user or group names.
</li><li>
Extended attributes, file flags, and other extended
security information cannot be stored.
</li><li>
Archive entries are limited to 8 gigabytes in size.
</li></ul>
Generally, users should prefer the ustar format for portability
as the v7 tar format is both less useful and less portable.
</dd></dl>
The libarchive library also reads a variety of commonly-used extensions to
the basic tar format.
These extensions are recognized automatically whenever they appear.
<dl>
<dt>Numeric extensions.</dt><dd>
The POSIX standards require fixed-length numeric fields to be written with
some character position reserved for terminators.
Libarchive allows these fields to be written without terminator characters.
This extends the allowable range; in particular, ustar archives with this
extension can support entries up to 64 gigabytes in size.
Libarchive also recognizes base-256 values in most numeric fields.
This essentially removes all limitations on file size, modification time,
and device numbers.
</dd><dt>Solaris extensions</dt><dd>
Libarchive recognizes ACL and extended attribute records written
by Solaris tar.
</dd></dl>
The first tar program appeared in Seventh Edition Unix in 1979.
The first official standard for the tar file format was the
"ustar"
(Unix Standard Tar) format defined by POSIX in 1988.
POSIX.1-2001 extended the ustar format to create the
"pax interchange"
format.
=== Cpio Formats===
The libarchive library can read a number of common cpio variants and can write
"odc"
and
"newc"
format archives.
A cpio archive stores each entry as a fixed-size header followed
by a variable-length filename and variable-length data.
Unlike the tar format, the cpio format does only minimal padding
of the header or file data.
There are several cpio variants, which differ primarily in
how they store the initial header: some store the values as
octal or hexadecimal numbers in ASCII, others as binary values of
varying byte order and length.
<dl>
<dt>'''binary'''</dt><dd>
The libarchive library transparently reads both big-endian and little-endian
variants of the original binary cpio format.
This format used 32-bit binary values for file size and mtime,
and 16-bit binary values for the other fields.
</dd><dt>'''odc'''</dt><dd>
The libarchive library can both read and write this
POSIX-standard format, which is officially known as the
"cpio interchange format"
or the
"octet-oriented cpio archive format"
and sometimes unofficially referred to as the
"old character format".
This format stores the header contents as octal values in ASCII.
It is standard, portable, and immune from byte-order confusion.
File sizes and mtime are limited to 33 bits (8GB file size),
other fields are limited to 18 bits.
</dd><dt>'''SVR4/newc'''</dt><dd>
The libarchive library can read both CRC and non-CRC variants of
this format.
The SVR4 format uses eight-digit hexadecimal values for
all header fields.
This limits file size to 4GB, and also limits the mtime and
other fields to 32 bits.
The SVR4 format can optionally include a CRC of the file
contents, although libarchive does not currently verify this CRC.
</dd></dl>
Cpio first appeared in PWB/UNIX 1.0, which was released within
AT&T in 1977.
PWB/UNIX 1.0 formed the basis of System III Unix, released outside
of AT&T in 1981.
This makes cpio older than tar, although cpio was not included
in Version 7 AT&T Unix.
As a result, the tar command became much better known in universities
and research groups that used Version 7.
The combination of the
'''find'''
and
'''cpio'''
utilities provided very precise control over file selection.
Unfortunately, the format has many limitations that make it unsuitable
for widespread use.
Only the POSIX format permits files over 4GB, and its 18-bit
limit for most other fields makes it unsuitable for modern systems.
In addition, cpio formats only store numeric UID/GID values (not
usernames and group names), which can make it very difficult to correctly
transfer archives across systems with dissimilar user numbering.
=== Shar Formats===
A
"shell archive"
is a shell script that, when executed on a POSIX-compliant
system, will recreate a collection of file system objects.
The libarchive library can write two different kinds of shar archives:
<dl>
<dt>'''shar'''</dt><dd>
The traditional shar format uses a limited set of POSIX
commands, including
[[echo(1)|http://www.freebsd.org/cgi/man.cgi?query=echo&sektion=1]],
[[mkdir(1)|http://www.freebsd.org/cgi/man.cgi?query=mkdir&sektion=1]],
and
[[sed(1)|http://www.freebsd.org/cgi/man.cgi?query=sed&sektion=1]].
It is suitable for portably archiving small collections of plain text files.
However, it is not generally well-suited for large archives
(many implementations of
[[sh(1)|http://www.freebsd.org/cgi/man.cgi?query=sh&sektion=1]]
have limits on the size of a script) nor should it be used with non-text files.
</dd><dt>'''shardump'''</dt><dd>
This format is similar to shar but encodes files using
[[uuencode(1)|http://www.freebsd.org/cgi/man.cgi?query=uuencode&sektion=1]]
so that the result will be a plain text file regardless of the file contents.
It also includes additional shell commands that attempt to reproduce as
many file attributes as possible, including owner, mode, and flags.
The additional commands used to restore file attributes make
shardump archives less portable than plain shar archives.
</dd></dl>
=== ISO9660 format===
Libarchive can read and extract from files containing ISO9660-compliant
CDROM images.
In many cases, this can remove the need to burn a physical CDROM
just in order to read the files contained in an ISO9660 image.
It also avoids security and complexity issues that come with
virtual mounts and loopback devices.
Libarchive supports the most common Rockridge extensions and has partial
support for Joliet extensions.
If both extensions are present, the Joliet extensions will be
used and the Rockridge extensions will be ignored.
In particular, this can create problems with hardlinks and symlinks,
which are supported by Rockridge but not by Joliet.
Libarchive reads ISO9660 images using a streaming strategy.
This allows it to read compressed images directly
(decompressing on the fly) and allows it to read images
directly from network sockets, pipes, and other non-seekable
data sources.
This strategy works well for optimized ISO9660 images created
by many popular programs.
Such programs collect all directory information at the beginning
of the ISO9660 image so it can be read from a physical disk
with a minimum of seeking.
However, not all ISO9660 images can be read in this fashion.
Libarchive can also write ISO9660 images.
Such images are fully optimized with the directory information
preceding all file data.
This is done by storing all file data to a temporary file
while collecting directory information in memory.
When the image is finished, libarchive writes out the
directory structure followed by the file data.
The location used for the temporary file can be changed
by the usual environment variables.
=== Zip format===
Libarchive can read and write zip format archives that have
uncompressed entries and entries compressed with the
"deflate"
algorithm.
Other zip compression algorithms are not supported.
It can extract jar archives, archives that use Zip64 extensions and
self-extracting zip archives.
Libarchive can use either of two different strategies for
reading Zip archives:
a streaming strategy which is fast and can handle extremely
large archives, and a seeking strategy which can correctly
process self-extracting Zip archives and archives with
deleted members or other in-place modifications.
The streaming reader processes Zip archives as they are read.
It can read archives of arbitrary size from tape or
network sockets, and can decode Zip archives that have
been separately compressed or encoded.
However, self-extracting Zip archives and archives with
certain types of modifications cannot be correctly
handled.
Such archives require that the reader first process the
Central Directory, which is ordinarily located
at the end of a Zip archive and is thus inaccessible
to the streaming reader.
If the program using libarchive has enabled seek support, then
libarchive will use this to processes the central directory first.
In particular, the seeking reader must be used to
correctly handle self-extracting archives.
Such archives consist of a program followed by a regular
Zip archive.
The streaming reader cannot parse the initial program
portion, but the seeking reader starts by reading the
Central Directory from the end of the archive.
Similarly, Zip archives that have been modified in-place
can have deleted entries or other garbage data that
can only be accurately detected by first reading the
Central Directory.
=== Archive (library) file format===
The Unix archive format (commonly created by the
[[ar(1)|http://www.freebsd.org/cgi/man.cgi?query=ar&sektion=1]]
archiver) is a general-purpose format which is
used almost exclusively for object files to be
read by the link editor
[[ld(1)|http://www.freebsd.org/cgi/man.cgi?query=ld&sektion=1]].
The ar format has never been standardised.
There are two common variants:
the GNU format derived from SVR4,
and the BSD format, which first appeared in 4.4BSD.
The two differ primarily in their handling of filenames
longer than 15 characters:
the GNU/SVR4 variant writes a filename table at the beginning of the archive;
the BSD format stores each long filename in an extension
area adjacent to the entry.
Libarchive can read both extensions,
including archives that may include both types of long filenames.
Programs using libarchive can write GNU/SVR4 format
if they provide an entry called
''//''
containing a filename table to be written into the archive
before any of the entries.
Any entries whose names are not in the filename table
will be written using BSD-style long filenames.
This can cause problems for programs such as
GNU ld that do not support the BSD-style long filenames.
=== mtree===
Libarchive can read and write files in
[[ManPageMtree5]]
format.
This format is not a true archive format, but rather a textual description
of a file hierarchy in which each line specifies the name of a file and
provides specific metadata about that file.
Libarchive can read all of the keywords supported by both
the NetBSD and FreeBSD versions of
[[mtree(8)|http://www.freebsd.org/cgi/man.cgi?query=mtree&sektion=8]],
although many of the keywords cannot currently be stored in an
'''archive_entry'''
object.
When writing, libarchive supports use of the
[[ManPagerchiveriteetptions3]]
interface to specify which keywords should be included in the
output.
If libarchive was compiled with access to suitable
cryptographic libraries (such as the OpenSSL libraries),
it can compute hash entries such as
'''sha512'''
or
'''md5'''
from file data being written to the mtree writer.
When reading an mtree file, libarchive will locate the corresponding
files on disk using the
'''contents'''
keyword if present or the regular filename.
If it can locate and open the file on disk, it will use that
to fill in any metadata that is missing from the mtree file
and will read the file contents and return those to the program
using libarchive.
If it cannot locate and open the file on disk, libarchive
will return an error for any attempt to read the entry
body.
=== 7-Zip===
Libarchive can read and write 7-Zip format archives.
TODO: Need more information
=== CAB===
Libarchive can read Microsoft Cabinet (
"CAB )"
format archives.
TODO: Need more information.
=== LHA===
TODO: Information about libarchive's LHA support
=== RAR===
Libarchive has limited support for reading RAR format archives.
Currently, libarchive can read RARv3 format archives
which have been either created uncompressed, or compressed using
any of the compression methods supported by the RARv3 format.
Libarchive can also read self-extracting RAR archives.
=== Warc===
Libarchive can read and write
"web archives".
TODO: Need more information
=== XAR===
Libarchive can read and write the XAR format used by many Apple tools.
TODO: Need more information
== SEE ALSO ==
[[ar(1)|http://www.freebsd.org/cgi/man.cgi?query=ar&sektion=1]],
[[ManPageBsdcpio1]],
[[mkisofs(1)|http://www.freebsd.org/cgi/man.cgi?query=mkisofs&sektion=1]],
[[shar(1)|http://www.freebsd.org/cgi/man.cgi?query=shar&sektion=1]],
[[ManPageBsdtar1]],
[[zip(1)|http://www.freebsd.org/cgi/man.cgi?query=zip&sektion=1]],
[[zlib(3)|http://www.freebsd.org/cgi/man.cgi?query=zlib&sektion=3]],
[[ManPageCpio5]],
[[ManPageMtree5]],
[[ManPageTar5]]
| MediaWiki | 3 | probonopd/imagewriter | dependencies/libarchive-3.4.2/doc/wiki/ManPageLibarchiveFormats5.wiki | [
"Apache-2.0"
] |
; ModuleID = 'interface.go'
source_filename = "interface.go"
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32--wasi"
%runtime.typecodeID = type { %runtime.typecodeID*, i32, %runtime.interfaceMethodInfo*, %runtime.typecodeID* }
%runtime.interfaceMethodInfo = type { i8*, i32 }
%runtime._interface = type { i32, i8* }
%runtime._string = type { i8*, i32 }
@"reflect/types.type:basic:int" = linkonce_odr constant %runtime.typecodeID { %runtime.typecodeID* null, i32 0, %runtime.interfaceMethodInfo* null, %runtime.typecodeID* @"reflect/types.type:pointer:basic:int" }
@"reflect/types.type:pointer:basic:int" = linkonce_odr constant %runtime.typecodeID { %runtime.typecodeID* @"reflect/types.type:basic:int", i32 0, %runtime.interfaceMethodInfo* null, %runtime.typecodeID* null }
@"reflect/types.type:pointer:named:error" = linkonce_odr constant %runtime.typecodeID { %runtime.typecodeID* @"reflect/types.type:named:error", i32 0, %runtime.interfaceMethodInfo* null, %runtime.typecodeID* null }
@"reflect/types.type:named:error" = linkonce_odr constant %runtime.typecodeID { %runtime.typecodeID* @"reflect/types.type:interface:{Error:func:{}{basic:string}}", i32 0, %runtime.interfaceMethodInfo* null, %runtime.typecodeID* @"reflect/types.type:pointer:named:error" }
@"reflect/types.type:interface:{Error:func:{}{basic:string}}" = linkonce_odr constant %runtime.typecodeID { %runtime.typecodeID* bitcast ([1 x i8*]* @"reflect/types.interface:interface{Error() string}$interface" to %runtime.typecodeID*), i32 0, %runtime.interfaceMethodInfo* null, %runtime.typecodeID* @"reflect/types.type:pointer:interface:{Error:func:{}{basic:string}}" }
@"reflect/methods.Error() string" = linkonce_odr constant i8 0, align 1
@"reflect/types.interface:interface{Error() string}$interface" = linkonce_odr constant [1 x i8*] [i8* @"reflect/methods.Error() string"]
@"reflect/types.type:pointer:interface:{Error:func:{}{basic:string}}" = linkonce_odr constant %runtime.typecodeID { %runtime.typecodeID* @"reflect/types.type:interface:{Error:func:{}{basic:string}}", i32 0, %runtime.interfaceMethodInfo* null, %runtime.typecodeID* null }
@"reflect/types.type:pointer:interface:{String:func:{}{basic:string}}" = linkonce_odr constant %runtime.typecodeID { %runtime.typecodeID* @"reflect/types.type:interface:{String:func:{}{basic:string}}", i32 0, %runtime.interfaceMethodInfo* null, %runtime.typecodeID* null }
@"reflect/types.type:interface:{String:func:{}{basic:string}}" = linkonce_odr constant %runtime.typecodeID { %runtime.typecodeID* bitcast ([1 x i8*]* @"reflect/types.interface:interface{String() string}$interface" to %runtime.typecodeID*), i32 0, %runtime.interfaceMethodInfo* null, %runtime.typecodeID* @"reflect/types.type:pointer:interface:{String:func:{}{basic:string}}" }
@"reflect/methods.String() string" = linkonce_odr constant i8 0, align 1
@"reflect/types.interface:interface{String() string}$interface" = linkonce_odr constant [1 x i8*] [i8* @"reflect/methods.String() string"]
@"reflect/types.typeid:basic:int" = external constant i8
@"error$interface" = linkonce_odr constant [1 x i8*] [i8* @"reflect/methods.Error() string"]
declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*)
define hidden void @main.init(i8* %context, i8* %parentHandle) unnamed_addr {
entry:
ret void
}
define hidden %runtime._interface @main.simpleType(i8* %context, i8* %parentHandle) unnamed_addr {
entry:
ret %runtime._interface { i32 ptrtoint (%runtime.typecodeID* @"reflect/types.type:basic:int" to i32), i8* null }
}
define hidden %runtime._interface @main.pointerType(i8* %context, i8* %parentHandle) unnamed_addr {
entry:
ret %runtime._interface { i32 ptrtoint (%runtime.typecodeID* @"reflect/types.type:pointer:basic:int" to i32), i8* null }
}
define hidden %runtime._interface @main.interfaceType(i8* %context, i8* %parentHandle) unnamed_addr {
entry:
ret %runtime._interface { i32 ptrtoint (%runtime.typecodeID* @"reflect/types.type:pointer:named:error" to i32), i8* null }
}
define hidden %runtime._interface @main.anonymousInterfaceType(i8* %context, i8* %parentHandle) unnamed_addr {
entry:
ret %runtime._interface { i32 ptrtoint (%runtime.typecodeID* @"reflect/types.type:pointer:interface:{String:func:{}{basic:string}}" to i32), i8* null }
}
define hidden i1 @main.isInt(i32 %itf.typecode, i8* %itf.value, i8* %context, i8* %parentHandle) unnamed_addr {
entry:
%typecode = call i1 @runtime.typeAssert(i32 %itf.typecode, i8* nonnull @"reflect/types.typeid:basic:int", i8* undef, i8* null)
br i1 %typecode, label %typeassert.ok, label %typeassert.next
typeassert.ok: ; preds = %entry
br label %typeassert.next
typeassert.next: ; preds = %typeassert.ok, %entry
ret i1 %typecode
}
declare i1 @runtime.typeAssert(i32, i8* dereferenceable_or_null(1), i8*, i8*)
define hidden i1 @main.isError(i32 %itf.typecode, i8* %itf.value, i8* %context, i8* %parentHandle) unnamed_addr {
entry:
%0 = call i1 @runtime.interfaceImplements(i32 %itf.typecode, i8** getelementptr inbounds ([1 x i8*], [1 x i8*]* @"error$interface", i32 0, i32 0), i8* undef, i8* null)
br i1 %0, label %typeassert.ok, label %typeassert.next
typeassert.ok: ; preds = %entry
br label %typeassert.next
typeassert.next: ; preds = %typeassert.ok, %entry
ret i1 %0
}
declare i1 @runtime.interfaceImplements(i32, i8** dereferenceable_or_null(4), i8*, i8*)
define hidden i1 @main.isStringer(i32 %itf.typecode, i8* %itf.value, i8* %context, i8* %parentHandle) unnamed_addr {
entry:
%0 = call i1 @runtime.interfaceImplements(i32 %itf.typecode, i8** getelementptr inbounds ([1 x i8*], [1 x i8*]* @"reflect/types.interface:interface{String() string}$interface", i32 0, i32 0), i8* undef, i8* null)
br i1 %0, label %typeassert.ok, label %typeassert.next
typeassert.ok: ; preds = %entry
br label %typeassert.next
typeassert.next: ; preds = %typeassert.ok, %entry
ret i1 %0
}
define hidden %runtime._string @main.callErrorMethod(i32 %itf.typecode, i8* %itf.value, i8* %context, i8* %parentHandle) unnamed_addr {
entry:
%invoke.func = call i32 @runtime.interfaceMethod(i32 %itf.typecode, i8** getelementptr inbounds ([1 x i8*], [1 x i8*]* @"error$interface", i32 0, i32 0), i8* nonnull @"reflect/methods.Error() string", i8* undef, i8* null)
%invoke.func.cast = inttoptr i32 %invoke.func to %runtime._string (i8*, i8*, i8*)*
%0 = call %runtime._string %invoke.func.cast(i8* %itf.value, i8* undef, i8* undef)
ret %runtime._string %0
}
declare i32 @runtime.interfaceMethod(i32, i8** dereferenceable_or_null(4), i8* dereferenceable_or_null(1), i8*, i8*)
| LLVM | 2 | JAicewizard/tinygo | compiler/testdata/interface.ll | [
"Apache-2.0"
] |
/home/spinalvm/hdl/riscv-compliance/work//C.JALR.elf: file format elf32-littleriscv
Disassembly of section .text.init:
80000000 <_start>:
80000000: 0001 nop
80000002: 0001 nop
80000004: 0001 nop
80000006: 0001 nop
80000008: 0001 nop
8000000a: 0001 nop
8000000c: 0001 nop
8000000e: 0001 nop
80000010: 0001 nop
80000012: 0001 nop
80000014: 0001 nop
80000016: 0001 nop
80000018: 0001 nop
8000001a: 0001 nop
8000001c: 0001 nop
8000001e: 0001 nop
80000020: 0001 nop
80000022: 0001 nop
80000024: 0001 nop
80000026: 0001 nop
80000028: 0001 nop
8000002a: 0001 nop
8000002c: 0001 nop
8000002e: 0001 nop
80000030: 0001 nop
80000032: 0001 nop
80000034: 0001 nop
80000036: 0001 nop
80000038: 0001 nop
8000003a: 0001 nop
8000003c: 0001 nop
8000003e: 0001 nop
80000040: 0001 nop
80000042: 0001 nop
80000044: 0001 nop
80000046: 0001 nop
80000048: 0001 nop
8000004a: 0001 nop
8000004c: 0001 nop
8000004e: 0001 nop
80000050: 0001 nop
80000052: 0001 nop
80000054: 0001 nop
80000056: 0001 nop
80000058: 0001 nop
8000005a: 0001 nop
8000005c: 0001 nop
8000005e: 0001 nop
80000060: 0001 nop
80000062: 0001 nop
80000064: 0001 nop
80000066: 0001 nop
80000068: 0001 nop
8000006a: 0001 nop
8000006c: 0001 nop
8000006e: 0001 nop
80000070: 0001 nop
80000072: 0001 nop
80000074: 0001 nop
80000076: 0001 nop
80000078: 0001 nop
8000007a: 0001 nop
8000007c: 0001 nop
8000007e: 0001 nop
80000080: 0001 nop
80000082: 0001 nop
80000084: 0001 nop
80000086: 0001 nop
80000088: 0001 nop
8000008a: 0001 nop
8000008c: 0001 nop
8000008e: 0001 nop
80000090: 0001 nop
80000092: 0001 nop
80000094: 0001 nop
80000096: 0001 nop
80000098: 0001 nop
8000009a: 0001 nop
8000009c: 0001 nop
8000009e: 0001 nop
800000a0: 0001 nop
800000a2: 0001 nop
800000a4: 0001 nop
800000a6: 0001 nop
800000a8: 0001 nop
800000aa: 0001 nop
800000ac: 0001 nop
800000ae: 0001 nop
800000b0: 0001 nop
800000b2: 0001 nop
800000b4: 0001 nop
800000b6: 0001 nop
800000b8: 0001 nop
800000ba: 0001 nop
800000bc: 0001 nop
800000be: 0001 nop
800000c0: 0001 nop
800000c2: 0001 nop
800000c4: 0001 nop
800000c6: 0001 nop
800000c8: 0001 nop
800000ca: 0001 nop
800000cc: 0001 nop
800000ce: 0001 nop
800000d0: 0001 nop
800000d2: 0001 nop
800000d4: 0001 nop
800000d6: 0001 nop
800000d8: 0001 nop
800000da: 0001 nop
800000dc: 0001 nop
800000de: 0001 nop
800000e0: 0001 nop
800000e2: 0001 nop
800000e4: 0001 nop
800000e6: 0001 nop
800000e8: 0001 nop
800000ea: 0001 nop
800000ec: 0001 nop
800000ee: 00001117 auipc sp,0x1
800000f2: f1210113 addi sp,sp,-238 # 80001000 <codasip_signature_start>
800000f6: 4501 li a0,0
800000f8: 00000617 auipc a2,0x0
800000fc: 01260613 addi a2,a2,18 # 8000010a <_start+0x10a>
80000100: 9602 jalr a2
80000102: 00012537 lui a0,0x12
80000106: 3ab50513 addi a0,a0,939 # 123ab <_start-0x7ffedc55>
8000010a: c032 sw a2,0(sp)
8000010c: 00001117 auipc sp,0x1
80000110: ef810113 addi sp,sp,-264 # 80001004 <test_2_res>
80000114: 4505 li a0,1
80000116: 00000697 auipc a3,0x0
8000011a: 01268693 addi a3,a3,18 # 80000128 <_start+0x128>
8000011e: 9682 jalr a3
80000120: 00012537 lui a0,0x12
80000124: 3ab50513 addi a0,a0,939 # 123ab <_start-0x7ffedc55>
80000128: c036 sw a3,0(sp)
8000012a: 00001117 auipc sp,0x1
8000012e: ede10113 addi sp,sp,-290 # 80001008 <test_3_res>
80000132: 557d li a0,-1
80000134: 00000717 auipc a4,0x0
80000138: 01270713 addi a4,a4,18 # 80000146 <_start+0x146>
8000013c: 9702 jalr a4
8000013e: 00012537 lui a0,0x12
80000142: 3ab50513 addi a0,a0,939 # 123ab <_start-0x7ffedc55>
80000146: c03a sw a4,0(sp)
80000148: 00001117 auipc sp,0x1
8000014c: ec410113 addi sp,sp,-316 # 8000100c <test_4_res>
80000150: 00008537 lui a0,0x8
80000154: fff50513 addi a0,a0,-1 # 7fff <_start-0x7fff8001>
80000158: 00000797 auipc a5,0x0
8000015c: 01278793 addi a5,a5,18 # 8000016a <_start+0x16a>
80000160: 9782 jalr a5
80000162: 00012537 lui a0,0x12
80000166: 3ab50513 addi a0,a0,939 # 123ab <_start-0x7ffedc55>
8000016a: c03e sw a5,0(sp)
8000016c: 00001117 auipc sp,0x1
80000170: ea410113 addi sp,sp,-348 # 80001010 <test_5_res>
80000174: 6521 lui a0,0x8
80000176: 00000817 auipc a6,0x0
8000017a: 01280813 addi a6,a6,18 # 80000188 <_start+0x188>
8000017e: 9802 jalr a6
80000180: 00012537 lui a0,0x12
80000184: 3ab50513 addi a0,a0,939 # 123ab <_start-0x7ffedc55>
80000188: c042 sw a6,0(sp)
8000018a: 00001517 auipc a0,0x1
8000018e: e7650513 addi a0,a0,-394 # 80001000 <codasip_signature_start>
80000192: 00001597 auipc a1,0x1
80000196: e8e58593 addi a1,a1,-370 # 80001020 <_end>
8000019a: f0100637 lui a2,0xf0100
8000019e: f2c60613 addi a2,a2,-212 # f00fff2c <_end+0x700fef0c>
800001a2 <complience_halt_loop>:
800001a2: 00b50c63 beq a0,a1,800001ba <complience_halt_break>
800001a6: 4554 lw a3,12(a0)
800001a8: c214 sw a3,0(a2)
800001aa: 4514 lw a3,8(a0)
800001ac: c214 sw a3,0(a2)
800001ae: 4154 lw a3,4(a0)
800001b0: c214 sw a3,0(a2)
800001b2: 4114 lw a3,0(a0)
800001b4: c214 sw a3,0(a2)
800001b6: 0541 addi a0,a0,16
800001b8: b7ed j 800001a2 <complience_halt_loop>
800001ba <complience_halt_break>:
800001ba: f0100537 lui a0,0xf0100
800001be: f2050513 addi a0,a0,-224 # f00fff20 <_end+0x700fef00>
800001c2: 00052023 sw zero,0(a0)
...
Disassembly of section .data:
80001000 <codasip_signature_start>:
80001000: ffff 0xffff
80001002: ffff 0xffff
80001004 <test_2_res>:
80001004: ffff 0xffff
80001006: ffff 0xffff
80001008 <test_3_res>:
80001008: ffff 0xffff
8000100a: ffff 0xffff
8000100c <test_4_res>:
8000100c: ffff 0xffff
8000100e: ffff 0xffff
80001010 <test_5_res>:
80001010: ffff 0xffff
80001012: ffff 0xffff
...
| ObjDump | 1 | cbrune/VexRiscv | src/test/resources/asm/C.JALR.elf.objdump | [
"MIT"
] |
#! /usr/bin/env sage
import sys
import hashlib
from sage.all import *
# For degree n (prime) and constant c (2 or more), find the largest prime
# p such that:
# p >= 5
# p >= min_p
# 2 <= c <= p-2
# (1+c*(n-1))*p^2 + (2^16-1)*p < 2^32+2^16
# z^n-c is irreducible over GF(p)[z]
# If there is no solution, then 0 is returned.
def find_best_prime_spec(n, c, min_p):
if min_p == 0:
min_p = 5
if min_p < c + 2:
min_p = c + 2
lim = 2^32 + 2^16
e = 1 + c*(n-1)
max_p = int(sqrt((2^32 + 2^16) / e))
p = max_p - (max_p % n) + 1
if (p % 2) == 0:
p = p - n
while p >= min_p:
if c >= p-1:
return 0
if (e*p^2 + (2^16 - 1)*p) < (2^32 + 2^16) and is_prime(p):
K = Zmod(p)
R = PolynomialRing(K, 'z')
z = R.gen()
if (z^n - K(c)).is_irreducible():
return p
p = p - 2*n
return 0
# Given degree n, find and print the best constant c and prime p that
# fulfills the criteria (see find_best_prime_spec()) and maximize p^n.
def find_best_prime(n):
c = 2
best_c = 0
best_p = 0
best_q = 0
while true:
p = find_best_prime_spec(n, c, best_p)
if p == 0:
if best_p != 0:
print "n=%d -> p=%d c=%d log2(q)=%.3f" % (n, best_p, best_c, (log(best_q)/log(2)).n(60))
return
q = p^n
if q > best_q:
best_c = c
best_p = p
best_q = q
c = c + 1
# Try all prime degrees n, starting at 11. We know that there can be no
# solution for n >= 1291.
for n in range(11, 1291):
if is_prime(n):
find_best_prime(n)
| Sage | 5 | pornin/curve9767 | extra/findprime.sage | [
"MIT"
] |
(*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
let test_truncate_short () =
let s = "hello world" in
let len = String.length s in
let truncated = String_utils.truncate len s in
Asserter.String_asserter.assert_equals
"hello world"
truncated
"truncated to exact length should return the same string";
let len = len + 10 in
let truncated = String_utils.truncate len s in
Asserter.String_asserter.assert_equals
"hello world"
truncated
"truncated with room for more should return the same string";
true
(** Input string is too long and gets cut short *)
let test_truncate_long () =
let s = "hello world" in
let len = 5 in
let truncated = String_utils.truncate len s in
Asserter.String_asserter.assert_equals "hello" truncated "truncate cuts the string short";
true
let tests =
[("test_truncate_short", test_truncate_short); ("test_truncate_long", test_truncate_long)]
let () = Unit_test.run_all tests
| OCaml | 4 | esilkensen/flow | src/hack_forked/test/unit/utils/string_utils_test.ml | [
"MIT"
] |
import { useEffect, useRef, useCallback } from 'react'
export default function Index() {
const workerRef = useRef()
useEffect(() => {
workerRef.current = new Worker(new URL('../worker.js', import.meta.url))
workerRef.current.onmessage = (evt) =>
alert(`WebWorker Response => ${evt.data}`)
return () => {
workerRef.current.terminate()
}
}, [])
const handleWork = useCallback(async () => {
workerRef.current.postMessage(100000)
}, [])
return (
<div>
<p>Do work in a WebWorker!</p>
<button onClick={handleWork}>Calculate PI</button>
</div>
)
}
| JavaScript | 4 | blomqma/next.js | examples/with-web-worker/pages/index.js | [
"MIT"
] |
<!-- Modal -->
<div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">{{title}}</h4>
</div>
<div class="modal-body">
{{{body}}}
</div>
<div class="modal-footer">
{{{footer}}}
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
| Harbour | 3 | blacktail/real-edit | public_src/scripts/common/templates/modal.hb | [
"MIT"
] |
package com.baeldung.collections.comparation;
import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.Test;
import java.util.*;
class ListVsMapUnitTest {
@Test
void givenList_whenIteratingTroughValues_thenEachValueIsPresent() {
List<String> list = new ArrayList<>();
list.add("Daniel");
list.add("Marko");
for (String name : list) {
assertThat(name).isIn(list);
}
assertThat(list).containsExactly("Daniel", "Marko");
}
@Test
void givenMap_whenIteratingTroughValues_thenEachValueIsPresent() {
Map<Integer, String> map = new HashMap<>();
map.put(1, "Daniel");
map.put(2, "Marko");
for (String name : map.values()) {
assertThat(name).isIn(map.values());
}
assertThat(map.values()).containsExactlyInAnyOrder("Daniel", "Marko");
}
}
| Java | 4 | DBatOWL/tutorials | core-java-modules/core-java-collections-4/src/test/java/com/baeldung/collections/comparation/ListVsMapUnitTest.java | [
"MIT"
] |
<?php
ini_set('opcache.enable', 0);
require_once 'bug78106_include.inc';
echo "done\n";
| PHP | 0 | thiagooak/php-src | ext/opcache/tests/bug78106_test1.php | [
"PHP-3.01"
] |
# Copyright (C) 2007-2012, Parrot Foundation.
=pod
=head1 DESCRIPTION
A tutorial lesson about Parrot's control flow (continued).
=head1 LOOPS
PIR has no built-in looping structures such as C<for>, C<while>,
C<repeat> or C<until>. All loops are built by using conditionals
and C<goto>.
The loop below calculates 5 factorial, stored in C<$I0>. C<$I1>
is the loop counter. In each loop iteration we decrement the counter
to see if we've done the loop enough times. The conditional jump
moves control flow back to the top of the loop if more iterations
are needed.
=cut
.sub main :main
$I0 = 1 # product
$I1 = 5 # counter
REDO: # start of loop
$I0 = $I0 * $I1
dec $I1 # decrement counter
if $I1 > 0 goto REDO # end of loop
print $I0
print "\n"
.end
# Local Variables:
# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir:
| Parrot Internal Representation | 4 | winnit-myself/Wifie | examples/tutorial/53_loop.pir | [
"Artistic-2.0"
] |
--TEST--
SPL: SplDoublyLinkedList with overridden count()
--FILE--
<?php
$obj = new SplDoublyLinkedList();
$obj[] = 1;
$obj[] = 2;
var_dump(count($obj));
class SplDoublyLinkedList2 extends SplDoublyLinkedList{
public function count(): int {
return -parent::count();
}
}
$obj = new SplDoublyLinkedList2();
$obj[] = 1;
$obj[] = 2;
var_dump(count($obj));
?>
--EXPECT--
int(2)
int(-2)
| PHP | 3 | NathanFreeman/php-src | ext/spl/tests/dllist_008.phpt | [
"PHP-3.01"
] |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "./RecordInterface.sol";
import "./UserStorage.sol";
import "./OrderStorage.sol";
interface TokenTransfer {
function transfer(address recipient, uint256 amount) external;
function balanceOf(address account) external view returns (uint256);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external;
function allowance(address _owner, address _spender)
external
view
returns (uint256 remaining);
}
contract RecordStorage is Ownable {
mapping(string => address) coinTypeMaping;
string[] coinTypeList = ["USDT", "USDC", "BUSD"];
uint256 merchantNeedCount = 10000000000 * (10**18);
uint256 witnessNeedCount = 100000000000 * (10**18);
uint256 congressNeedCount = 1000000000000 * (10**18);
string[] appealFeeCoinTypeList = ["AIR"];
uint256 appealFee = 1000000 * (10**18);
uint256 appealFeeFinal = 10000000 * (10**18);
uint256 canWithdrawToTime = 28;
uint256 subWitFee = 2000000 * (10**18);
uint256 subWitCredit = 10;
uint256 witnessHandleReward = 1000000 * (10**18);
uint256 observerHandleReward = 10000000 * (10**18);
uint256 witnessHandleCredit = 1;
uint256 observerHandleCredit = 1;
bool openTrade = false;
uint256 tradeCredit = 1;
uint256 subTCredit = 10;
mapping(address => uint256) witnessFlag;
mapping(address => uint256) congressFlag;
function setWitnessFlag(address _addr, uint256 _flag) public onlyOwner {
witnessFlag[_addr] = _flag;
if (_flag == 1) {
uint256 _amt = availableTotal[_addr]["AIR"];
require(_amt >= witnessNeedCount, "coin not enough");
_userStorage.updateUserRole(_addr, 1);
} else {
_userStorage.updateUserRole(_addr, 0);
}
}
function getWitnessFlag(address _addr) public view returns (uint256) {
return witnessFlag[_addr];
}
function setCongressFlag(address _addr, uint256 _flag) public onlyOwner {
congressFlag[_addr] = _flag;
if (_flag == 1) {
uint256 _amt = availableTotal[_addr]["AIR"];
require(_amt >= congressNeedCount, "coin not enough");
_userStorage.updateUserRole(_addr, 2);
} else {
_userStorage.updateUserRole(_addr, 0);
}
}
function getCongressFlag(address _addr) public view returns (uint256) {
return congressFlag[_addr];
}
function setCoinType(string[] memory _coinTypeList) public onlyOwner {
coinTypeList = _coinTypeList;
}
function getCoinType() public view returns (string[] memory) {
return coinTypeList;
}
function setCoinTypeMapping(string memory _coinType, address _coinTypeAddr)
public
onlyOwner
{
coinTypeMaping[_coinType] = _coinTypeAddr;
}
function getCoinTypeMapping(string memory _coinType)
public
view
returns (address)
{
return coinTypeMaping[_coinType];
}
function setMerchantNeedCount(uint256 _count) public onlyOwner {
merchantNeedCount = _count * (10**18);
}
function getMerchantNeedCount() public view returns (uint256) {
return merchantNeedCount;
}
function setWitnessNeedCount(uint256 _count) public onlyOwner {
witnessNeedCount = _count * (10**18);
}
function getWitnessNeedCount() public view returns (uint256) {
return witnessNeedCount;
}
function setCongressNeedCount(uint256 _count) public onlyOwner {
congressNeedCount = _count * (10**18);
}
function getCongressNeedCount() public view returns (uint256) {
return congressNeedCount;
}
function setAppealFee(uint256 _count) public onlyOwner {
appealFee = _count * (10**18);
}
function getAppealFee() public view returns (uint256) {
return appealFee;
}
function setAppealFeeFinal(uint256 _count) public onlyOwner {
appealFeeFinal = _count * (10**18);
}
function getAppealFeeFinal() public view returns (uint256) {
return appealFeeFinal;
}
function setCanWithdrawToTime(uint256 _days) public onlyOwner {
canWithdrawToTime = _days;
}
function getCanWithdrawToTime() public view returns (uint256) {
return canWithdrawToTime;
}
function setAppealFeeCoinTypeList(string[] memory _list) public onlyOwner {
appealFeeCoinTypeList = _list;
}
function getAppealFeeCoinTypeList() public view returns (string[] memory) {
return appealFeeCoinTypeList;
}
function setSubWitFee(uint256 _c) public onlyOwner {
subWitFee = _c * (10**18);
}
function getSubWitFee() public view returns (uint256) {
return subWitFee;
}
function setSubWitCredit(uint256 _c) public onlyOwner {
subWitCredit = _c;
}
function getSubWitCredit() public view returns (uint256) {
return subWitCredit;
}
function setWitnessHandleReward(uint256 _c) public onlyOwner {
witnessHandleReward = _c * (10**18);
}
function getWitnessHandleReward() public view returns (uint256) {
return witnessHandleReward;
}
function setObserverHandleReward(uint256 _c) public onlyOwner {
observerHandleReward = _c * (10**18);
}
function getObserverHandleReward() public view returns (uint256) {
return observerHandleReward;
}
function setWitnessHandleCredit(uint256 _c) public onlyOwner {
witnessHandleCredit = _c;
}
function getWitnessHandleCredit() public view returns (uint256) {
return witnessHandleCredit;
}
function setObserverHandleCredit(uint256 _c) public onlyOwner {
observerHandleCredit = _c;
}
function getObserverHandleCredit() public view returns (uint256) {
return observerHandleCredit;
}
function setOpenTrade(bool _c) public onlyOwner {
openTrade = _c;
}
function getOpenTrade() public view returns (bool) {
return openTrade;
}
function setTradeCredit(uint256 _c) public onlyOwner {
tradeCredit = _c;
}
function getTradeCredit() public view returns (uint256) {
return tradeCredit;
}
function setSubTCredit(uint256 _c) public onlyOwner {
subTCredit = _c;
}
function getSubTCredit() public view returns (uint256) {
return subTCredit;
}
function punishPerson(
address _from,
address _to,
uint256 _count
) public onlyOwner {
require(_from != address(0), "Invalid from");
require(_to != address(0), "Invalid to");
UserStorage.User memory _user = _userStorage.searchUser(_from);
require(
_user.userFlag == 1 || _user.userFlag == 2,
"can't punish this person"
);
require(
availableTotal[_from]["AIR"] >= _count,
"user balance not enough"
);
availableTotal[_from]["AIR"] = SafeMath.sub(
availableTotal[_from]["AIR"],
_count
);
availableTotal[_to]["AIR"] = SafeMath.add(
availableTotal[_to]["AIR"],
_count
);
}
UserInterface private _userStorage;
OrderInterface private _orderStorage;
struct Record {
uint256 recordNo;
address userAddr;
string tradeHash;
string coinType;
uint256 hostCount;
uint256 hostStatus;
uint256 hostType;
uint256 hostDirection;
uint256 hostTime;
uint256 updateTime;
}
mapping(uint256 => Record) public records;
mapping(uint256 => uint256) public recordIndex;
Record[] public recordList;
uint256 subFromDraing = 0;
mapping(address => mapping(string => uint256)) public availableTotal;
mapping(address => mapping(string => uint256)) public frozenTotal;
mapping(address => mapping(string => uint256)) public unfrozenTotal;
mapping(address => uint256) lastWithdrawTime;
mapping(address => mapping(uint256 => uint256)) lastWithdrawAmount;
mapping(address => mapping(string => uint256)) public withdrawingTotal;
mapping(address => mapping(uint256 => uint256)) orderSubFrozenList;
constructor(
address _usdtAddress,
address _usdcAddress,
address _busdAddress,
address _airAddress
) {
coinTypeMaping["USDT"] = _usdtAddress;
coinTypeMaping["USDC"] = _usdcAddress;
coinTypeMaping["BUSD"] = _busdAddress;
coinTypeMaping["AIR"] = _airAddress;
}
function setERC20Address(string memory _coinType)
public
view
returns (TokenTransfer)
{
require(bytes(_coinType).length != 0, "Invalid coin type");
address _remoteAddr = coinTypeMaping[_coinType];
require(_remoteAddr != address(0), "Invalid coin type");
TokenTransfer _tokenTransfer = TokenTransfer(_remoteAddr);
return _tokenTransfer;
}
event RecordAdd(
uint256 _recordNo,
address _addr,
string _tradeHash,
string _coinType,
uint256 _hostCount,
uint256 _hostStatus,
uint256 _hostType,
uint256 _hostDirection
);
event RecordApplyUnfrozen(address _addr, uint256 _amt);
event UnfrozenTotalTransfer(
address _addr,
string _coinType,
uint256 _lastAmount
);
event RecordUpdate(
address _addr,
uint256 _recordNo,
string _hash,
uint256 _hostStatus
);
address _userAddr;
address _restCAddr;
address _orderCAddr;
address _appealCAddr;
modifier onlyAuthFromAddr() {
require(_userAddr != address(0), "Invalid address call user");
require(_restCAddr != address(0), "Invalid address call rest");
require(_orderCAddr != address(0), "Invalid address call order");
require(_appealCAddr != address(0), "Invalid address call appeal");
_;
}
function authFromContract(
address _fromUser,
address _fromRest,
address _fromOrder,
address _fromAppeal
) external {
require(_userAddr == address(0), "rest address has Auth");
require(_restCAddr == address(0), "rest address has Auth");
require(_orderCAddr == address(0), "order address has Auth");
require(_appealCAddr == address(0), "appeal address has Auth");
_userAddr = _fromUser;
_restCAddr = _fromRest;
_orderCAddr = _fromOrder;
_appealCAddr = _fromAppeal;
_userStorage = UserInterface(_userAddr);
_orderStorage = OrderInterface(_orderCAddr);
}
function _insert(
address _addr,
string memory _tradeHash,
string memory _coinType,
uint256 _hostCount,
uint256 _hostStatus,
uint256 _hostType,
uint256 _hostDirection
) internal returns (uint256 recordNo) {
require(_addr != address(0), "address null is not allowed");
require(bytes(_coinType).length != 0, "coinType null is not allowed");
require(_hostCount != uint256(0), "hostCount null is not allowed");
require(_hostType != uint256(0), "hostType null is not allowed");
require(
_hostDirection != uint256(0),
"hostDirection null is not allowed"
);
uint256 _recordNo = block.timestamp;
Record memory _record = Record({
recordNo: _recordNo,
userAddr: _addr,
tradeHash: _tradeHash,
coinType: _coinType,
hostCount: _hostCount,
hostStatus: _hostStatus,
hostType: _hostType,
hostDirection: _hostDirection,
hostTime: block.timestamp,
updateTime: 0
});
records[_recordNo] = _record;
recordList.push(_record);
recordIndex[_recordNo] = recordList.length - 1;
emit RecordAdd(
_recordNo,
_addr,
_tradeHash,
_coinType,
_hostCount,
_hostStatus,
_hostType,
_hostDirection
);
return _recordNo;
}
function tokenEscrow(string memory _coinType, uint256 _amt) external {
require(_amt > 0, "Invalid transfer amount");
require(
availableTotal[msg.sender][_coinType] + _amt >
availableTotal[msg.sender][_coinType],
"Invalid transfer amount"
);
availableTotal[msg.sender][_coinType] = SafeMath.add(
availableTotal[msg.sender][_coinType],
_amt
);
uint256 _hostType = 1;
if (
keccak256(abi.encodePacked(_coinType)) ==
keccak256(abi.encodePacked("AIR"))
) {
_hostType = 3;
UserStorage.User memory _user = _userStorage.searchUser(msg.sender);
UserStorage.MorgageStats memory _morgageStats = _user.morgageStats;
_morgageStats.mortgage = SafeMath.add(_morgageStats.mortgage, _amt);
_userStorage.updateMorgageStats(msg.sender, _morgageStats);
if (
_user.userFlag == 0 &&
_morgageStats.mortgage >= merchantNeedCount
) {
_userStorage.updateUserRole(msg.sender, 3);
}
}
_insert(msg.sender, "", _coinType, _amt, 2, _hostType, 1);
TokenTransfer _tokenTransfer = setERC20Address(_coinType);
_tokenTransfer.transferFrom(msg.sender, address(this), _amt);
}
function addRecord(
address _addr,
string memory _tradeHash,
string memory _coinType,
uint256 _hostCount,
uint256 _hostStatus,
uint256 _hostType,
uint256 _hostDirection
) public onlyAuthFromAddr {
require(
msg.sender == _restCAddr || msg.sender == _orderCAddr,
"RedocrdStorage:Invalid from contract address"
);
frozenTotal[_addr][_coinType] = SafeMath.add(
frozenTotal[_addr][_coinType],
_hostCount
);
_insert(
_addr,
_tradeHash,
_coinType,
_hostCount,
_hostStatus,
_hostType,
_hostDirection
);
}
function addAvailableTotal(
address _addr,
string memory _coinType,
uint256 _amt
) public onlyAuthFromAddr {
require(
msg.sender == _restCAddr || msg.sender == _orderCAddr,
"Invalid address"
);
require(_amt > 0, "Invalid transfer amount");
uint256 _aBalance = getErcBalance(_coinType, address(this));
require(_aBalance >= _amt, "balance not enough");
require(frozenTotal[_addr][_coinType] >= _amt, "Invalid amount");
require(
SafeMath.sub(frozenTotal[_addr][_coinType], _amt) <=
frozenTotal[_addr][_coinType],
"Invalid amount"
);
frozenTotal[_addr][_coinType] = SafeMath.sub(
frozenTotal[_addr][_coinType],
_amt
);
TokenTransfer _tokenTransfer = setERC20Address(_coinType);
_tokenTransfer.transfer(_addr, _amt);
}
function getAvailableTotal(address _addr, string memory _coinType)
public
view
returns (uint256)
{
return availableTotal[_addr][_coinType];
}
function subFrozenTotal(uint256 _orderNo, address _addr)
public
onlyAuthFromAddr
{
require(
msg.sender == _orderCAddr || msg.sender == _appealCAddr,
"Invalid from contract address"
);
OrderStorage.Order memory _order = _orderStorage.searchOrder(_orderNo);
require(_order.orderNo != uint256(0), "order not exist");
address _seller = _order.orderDetail.sellerAddr;
string memory _coinType = _order.orderDetail.coinType;
uint256 _subAmount = orderSubFrozenList[_seller][_orderNo];
require(_subAmount == 0, "order not exist");
uint256 _frozen = frozenTotal[_seller][_coinType];
uint256 _orderCount = _order.coinCount;
require(_frozen >= _orderCount, "Invalid amount");
require(
SafeMath.sub(_frozen, _orderCount) <= _frozen,
"Invalid amount 2"
);
frozenTotal[_seller][_coinType] = SafeMath.sub(_frozen, _orderCount);
orderSubFrozenList[_seller][_orderNo] = _orderCount;
TokenTransfer _tokenTransfer = setERC20Address(_coinType);
_tokenTransfer.transfer(_addr, _orderCount);
}
function subAvaAppeal(
address _from,
address _to,
AppealStorage.Appeal memory _al,
uint256 _amt,
uint256 _t,
uint256 _self
) public onlyAuthFromAddr {
require(
msg.sender == _appealCAddr,
"RedocrdStorage:Invalid from contract address"
);
uint256 _available = getAvailableTotal(_from, "AIR");
uint256 _need = 0;
address _opt = _t == 1 ? _al.witness : _al.detail.observerAddr;
if (_available >= _amt) {
_need = _amt;
} else {
_need = _available;
}
if (
(_t == 1 && _self == 0) ||
(_t == 2 && _al.detail.finalAppealAddr != _from)
) {
availableTotal[_from]["AIR"] = SafeMath.sub(
availableTotal[_from]["AIR"],
_need
);
availableTotal[_to]["AIR"] = SafeMath.add(
availableTotal[_to]["AIR"],
_need
);
}
availableTotal[_opt]["AIR"] = SafeMath.add(
availableTotal[_opt]["AIR"],
_amt
);
chanRole(_from);
UserStorage.User memory _user = _userStorage.searchUser(_opt);
if (_t == 1) {
_user.credit = _user.credit + witnessHandleCredit;
} else if (_t == 2) {
_user.credit = _user.credit + observerHandleCredit;
}
UserStorage.TradeStats memory _tradeStats = _user.tradeStats;
_userStorage.updateTradeStats(_opt, _tradeStats, _user.credit);
}
function subWitnessAvailable(address _addr) public onlyAuthFromAddr {
require(
msg.sender == _appealCAddr,
"RedocrdStorage:Invalid from contract address"
);
require(_addr != address(0), "witness address is null");
uint256 _availableTotal = availableTotal[_addr]["AIR"];
uint256 _need = 0;
if (_availableTotal >= subWitFee) {
_need = subWitFee;
availableTotal[_addr]["AIR"] = SafeMath.sub(_availableTotal, _need);
} else {
availableTotal[_addr]["AIR"] = 0;
uint256 _draing = withdrawingTotal[_addr]["AIR"];
if (SafeMath.add(_availableTotal, _draing) >= subWitFee) {
_need = subWitFee;
subFromDraing = subWitFee - _availableTotal - _draing;
withdrawingTotal[_addr]["AIR"] = SafeMath.sub(
withdrawingTotal[_addr]["AIR"],
subFromDraing
);
} else {
_need = SafeMath.add(
withdrawingTotal[_addr]["AIR"],
availableTotal[_addr]["AIR"]
);
withdrawingTotal[_addr]["AIR"] = 0;
}
}
chanRole(_addr);
UserStorage.User memory _user = _userStorage.searchUser(_addr);
_user.credit = _user.credit >= subWitCredit
? (_user.credit - subWitCredit)
: 0;
UserStorage.TradeStats memory _tradeStats = _user.tradeStats;
_userStorage.updateTradeStats(_addr, _tradeStats, _user.credit);
TokenTransfer _tokenTransfer = setERC20Address("AIR");
_tokenTransfer.transfer(owner(), _need);
}
function getFrozenTotal(address _addr, string memory _coinType)
public
view
returns (uint256)
{
return frozenTotal[_addr][_coinType];
}
function applyUnfrozen(uint256 _amt) public returns (uint256) {
string memory _coinType = "AIR";
require(_amt > 0, "Invalid transfer amount");
require(
availableTotal[msg.sender][_coinType] >= _amt,
"Invalid amount"
);
require(
SafeMath.sub(availableTotal[msg.sender][_coinType], _amt) <
availableTotal[msg.sender][_coinType],
"Invalid amount 2"
);
lastWithdrawTime[msg.sender] = block.timestamp;
lastWithdrawAmount[msg.sender][lastWithdrawTime[msg.sender]] = _amt;
availableTotal[msg.sender][_coinType] = SafeMath.sub(
availableTotal[msg.sender][_coinType],
_amt
);
withdrawingTotal[msg.sender][_coinType] = SafeMath.add(
withdrawingTotal[msg.sender][_coinType],
_amt
);
chanRole(msg.sender);
_insert(msg.sender, "", _coinType, _amt, 3, 3, 2);
emit RecordApplyUnfrozen(msg.sender, _amt);
return getAvailableTotal(msg.sender, _coinType);
}
function chanRole(address _addr) internal {
uint256 _avail = availableTotal[_addr]["AIR"];
UserStorage.User memory _user = _userStorage.searchUser(_addr);
UserStorage.MorgageStats memory _morgageStats = _user.morgageStats;
_morgageStats.mortgage = _avail;
_userStorage.updateMorgageStats(_addr, _morgageStats);
if (
_user.userFlag == 2 &&
_avail < congressNeedCount &&
_avail >= merchantNeedCount
) {
_userStorage.updateUserRole(_addr, 3);
}
if (
_user.userFlag == 1 &&
_avail < witnessNeedCount &&
_avail >= merchantNeedCount
) {
_userStorage.updateUserRole(_addr, 3);
}
if (_avail < merchantNeedCount) {
_userStorage.updateUserRole(_addr, 0);
}
}
function applyWithdraw(uint256 _recordNo) public {
Record memory _record = records[_recordNo];
require(_record.recordNo != uint256(0), "record not exist");
require(_record.userAddr == msg.sender, "record user not exist");
require(_record.hostStatus == 3, "status error");
require(
withdrawingTotal[msg.sender]["AIR"] >= _record.hostCount,
"balance not enough"
);
require(
block.timestamp >= (_record.hostTime + canWithdrawToTime * 1 days),
"can't withdraw"
);
withdrawingTotal[msg.sender]["AIR"] = SafeMath.sub(
withdrawingTotal[msg.sender]["AIR"],
_record.hostCount
);
unfrozenTotal[msg.sender]["AIR"] = SafeMath.add(
unfrozenTotal[msg.sender]["AIR"],
_record.hostCount
);
_record.hostCount = SafeMath.sub(_record.hostCount, subFromDraing);
_record.hostStatus = 4;
_record.updateTime = block.timestamp;
records[_recordNo] = _record;
recordList[recordIndex[_recordNo]] = _record;
emit RecordUpdate(msg.sender, _recordNo, _record.tradeHash, 4);
TokenTransfer _tokenTransfer = setERC20Address("AIR");
_tokenTransfer.transfer(msg.sender, _record.hostCount);
}
function unfrozenTotalSearch(address _addr, string memory _coinType)
public
view
returns (uint256)
{
require(_addr != address(0), "user address is null");
return unfrozenTotal[_addr][_coinType];
}
function getUnfrozenTotal(address _addr, string memory _coinType)
external
view
returns (uint256)
{
return unfrozenTotal[_addr][_coinType];
}
function getWithdrawingTotal(address _addr, string memory _coinType)
public
view
returns (uint256)
{
return withdrawingTotal[_addr][_coinType];
}
function getErcBalance(string memory _coinType, address _addr)
public
view
returns (uint256)
{
TokenTransfer _tokenTransfer = setERC20Address(_coinType);
return _tokenTransfer.balanceOf(_addr);
}
function _updateInfo(
address _addr,
uint256 _recordNo,
string memory _hash,
uint256 _hostStatus
) internal returns (bool) {
Record memory _record = records[_recordNo];
require(_record.userAddr == _addr, "record not exist");
require(_hostStatus == 1 || _hostStatus == 2, "invalid hostStatus");
if (_hostStatus != uint256(0)) {
_record.hostStatus = _hostStatus;
}
if (bytes(_hash).length != 0) {
_record.tradeHash = _hash;
}
_record.updateTime = block.timestamp;
records[_recordNo] = _record;
recordList[recordIndex[_recordNo]] = _record;
emit RecordUpdate(_addr, _recordNo, _hash, _hostStatus);
return true;
}
function updateInfo(
address _addr,
uint256 _recordNo,
string memory _hash,
uint256 _hostStatus
) external returns (bool) {
return _updateInfo(_addr, _recordNo, _hash, _hostStatus);
}
function searchRecord(uint256 _recordNo)
external
view
returns (Record memory record)
{
return records[_recordNo];
}
function searchRecordList() external view returns (Record[] memory) {
return recordList;
}
}
| Solidity | 4 | Aircoin-official/AirCash | RecordStorage.sol | [
"MIT"
] |
// @@ANTLR Tool Options@@: -trace
tree grammar t051treeRewriteASTrWalker;
options {
language=JavaScript;
output=AST;
ASTLabelType=CommonTree;
tokenVocab=t051treeRewriteASTr;
}
a : ^(ID (ID | INT) ) ;
| G-code | 3 | DanielMabadeje/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | java/java2py/antlr-3.1.3/runtime/JavaScript/tests/functional/t051treeRewriteASTrWalker.g | [
"Apache-2.0"
] |
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
import { IRemoteAuthorityResolverService, RemoteAuthorityResolverError } from 'vs/platform/remote/common/remoteAuthorityResolver';
import { IProductService } from 'vs/platform/product/common/productService';
import { BrowserSocketFactory } from 'vs/platform/remote/browser/browserSocketFactory';
import { AbstractRemoteAgentService } from 'vs/workbench/services/remote/common/abstractRemoteAgentService';
import { ISignService } from 'vs/platform/sign/common/sign';
import { ILogService } from 'vs/platform/log/common/log';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { INotificationService, IPromptChoice, Severity } from 'vs/platform/notification/common/notification';
import { Registry } from 'vs/platform/registry/common/platform';
import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions } from 'vs/workbench/common/contributions';
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { getRemoteName } from 'vs/platform/remote/common/remoteHosts';
import { INativeHostService } from 'vs/platform/native/electron-sandbox/native';
import { URI } from 'vs/base/common/uri';
import { IOpenerService } from 'vs/platform/opener/common/opener';
export class RemoteAgentService extends AbstractRemoteAgentService implements IRemoteAgentService {
constructor(
@IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService,
@IProductService productService: IProductService,
@IRemoteAuthorityResolverService remoteAuthorityResolverService: IRemoteAuthorityResolverService,
@ISignService signService: ISignService,
@ILogService logService: ILogService,
) {
super(new BrowserSocketFactory(null), environmentService, productService, remoteAuthorityResolverService, signService, logService);
}
}
class RemoteConnectionFailureNotificationContribution implements IWorkbenchContribution {
constructor(
@IRemoteAgentService private readonly _remoteAgentService: IRemoteAgentService,
@INotificationService notificationService: INotificationService,
@IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService,
@ITelemetryService telemetryService: ITelemetryService,
@INativeHostService nativeHostService: INativeHostService,
@IRemoteAuthorityResolverService private readonly _remoteAuthorityResolverService: IRemoteAuthorityResolverService,
@IOpenerService openerService: IOpenerService,
) {
// Let's cover the case where connecting to fetch the remote extension info fails
this._remoteAgentService.getRawEnvironment()
.then(undefined, err => {
type RemoteConnectionFailureClassification = {
web: { classification: 'SystemMetaData', purpose: 'PerformanceAndHealth' };
remoteName: { classification: 'SystemMetaData', purpose: 'PerformanceAndHealth' };
message: { classification: 'SystemMetaData', purpose: 'PerformanceAndHealth' };
};
type RemoteConnectionFailureEvent = {
web: boolean;
remoteName: string | undefined;
message: string;
};
telemetryService.publicLog2<RemoteConnectionFailureEvent, RemoteConnectionFailureClassification>('remoteConnectionFailure', {
web: false,
remoteName: getRemoteName(environmentService.remoteAuthority),
message: err ? err.message : '',
});
if (!RemoteAuthorityResolverError.isHandled(err)) {
const choices: IPromptChoice[] = [
{
label: nls.localize('devTools', "Open Developer Tools"),
run: () => nativeHostService.openDevTools()
}
];
const troubleshootingURL = this._getTroubleshootingURL();
if (troubleshootingURL) {
choices.push({
label: nls.localize('directUrl', "Open in browser"),
run: () => openerService.open(troubleshootingURL, { openExternal: true })
});
}
notificationService.prompt(
Severity.Error,
nls.localize('connectionError', "Failed to connect to the remote extension host server (Error: {0})", err ? err.message : ''),
choices
);
}
});
}
private _getTroubleshootingURL(): URI | null {
const remoteAgentConnection = this._remoteAgentService.getConnection();
if (!remoteAgentConnection) {
return null;
}
const connectionData = this._remoteAuthorityResolverService.getConnectionData(remoteAgentConnection.remoteAuthority);
if (!connectionData) {
return null;
}
return URI.from({
scheme: 'http',
authority: `${connectionData.host}:${connectionData.port}`,
path: `/version`
});
}
}
const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(Extensions.Workbench);
workbenchRegistry.registerWorkbenchContribution(RemoteConnectionFailureNotificationContribution, LifecyclePhase.Ready);
| TypeScript | 5 | kklt2002/vscode | src/vs/workbench/services/remote/electron-sandbox/remoteAgentServiceImpl.ts | [
"MIT"
] |
import { MyModule } from 'my-library';
import { App } from 'my-library/components';
import { Header, Footer } from 'my-library/components/App';
| JavaScript | 3 | hanneslund/next.js | packages/next-swc/crates/modularize_imports/tests/fixture/regex/input.js | [
"MIT"
] |
/*
* Copyright (c) 2020-2021 Alex Spataru <https://github.com/alex-spataru>
*
* 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 QtQuick
import QtQuick.Layouts
import QtQuick.Controls
Control {
id: root
implicitHeight: layout.implicitHeight + app.spacing * 2
//
// Access to properties
//
property alias port: _portCombo.currentIndex
property alias baudRate: _baudCombo.currentIndex
property alias dataBits: _dataCombo.currentIndex
property alias parity: _parityCombo.currentIndex
property alias flowControl: _flowCombo.currentIndex
property alias stopBits: _stopBitsCombo.currentIndex
property alias autoReconnect: _autoreconnect.checked
//
// Update listbox models when translation is changed
//
Connections {
target: Cpp_Misc_Translator
function onLanguageChanged() {
var oldParityIndex = _parityCombo.currentIndex
var oldFlowControlIndex = _flowCombo.currentIndex
_parityCombo.model = Cpp_IO_Serial.parityList
_flowCombo.model = Cpp_IO_Serial.flowControlList
_parityCombo.currentIndex = oldParityIndex
_flowCombo.currentIndex = oldFlowControlIndex
}
}
//
// Control layout
//
ColumnLayout {
anchors.fill: parent
anchors.margins: app.spacing
//
// Controls
//
GridLayout {
id: layout
columns: 2
Layout.fillWidth: true
rowSpacing: app.spacing
columnSpacing: app.spacing
//
// COM port selector
//
Label {
opacity: enabled ? 1 : 0.5
enabled: !Cpp_IO_Manager.connected
Behavior on opacity {NumberAnimation{}}
text: qsTr("COM Port") + ":"
} ComboBox {
id: _portCombo
Layout.fillWidth: true
model: Cpp_IO_Serial.portList
currentIndex: Cpp_IO_Serial.portIndex
onCurrentIndexChanged: {
if (currentIndex !== Cpp_IO_Serial.portIndex)
Cpp_IO_Serial.portIndex = currentIndex
}
opacity: enabled ? 1 : 0.5
enabled: !Cpp_IO_Manager.connected
Behavior on opacity {NumberAnimation{}}
}
//
// Baud rate selector
//
Label {
opacity: enabled ? 1 : 0.5
Behavior on opacity {NumberAnimation{}}
text: qsTr("Baud Rate") + ":"
} ComboBox {
id: _baudCombo
editable: true
currentIndex: 4
Layout.fillWidth: true
model: Cpp_IO_Serial.baudRateList
validator: IntValidator {
bottom: 1
}
onAccepted: {
if (find(editText) === -1)
Cpp_IO_Serial.appendBaudRate(editText)
}
onCurrentTextChanged: {
var value = currentText
Cpp_IO_Serial.baudRate = value
}
}
//
// Auto-reconnect
//
Label {
text: qsTr("Auto-reconnect") + ":"
} CheckBox {
id: _autoreconnect
Layout.alignment: Qt.AlignLeft
Layout.leftMargin: -app.spacing
checked: Cpp_IO_Serial.autoReconnect
onCheckedChanged: {
if (Cpp_IO_Serial.autoReconnect !== checked)
Cpp_IO_Serial.autoReconnect = checked
}
}
//
// Spacer
//
Item {
Layout.minimumHeight: app.spacing / 2
Layout.maximumHeight: app.spacing / 2
} Item {
Layout.minimumHeight: app.spacing / 2
Layout.maximumHeight: app.spacing / 2
}
//
// Data bits selector
//
Label {
text: qsTr("Data Bits") + ":"
} ComboBox {
id: _dataCombo
Layout.fillWidth: true
model: Cpp_IO_Serial.dataBitsList
currentIndex: Cpp_IO_Serial.dataBitsIndex
onCurrentIndexChanged: {
if (Cpp_IO_Serial.dataBitsIndex !== currentIndex)
Cpp_IO_Serial.dataBitsIndex = currentIndex
}
}
//
// Parity selector
//
Label {
text: qsTr("Parity") + ":"
} ComboBox {
id: _parityCombo
Layout.fillWidth: true
model: Cpp_IO_Serial.parityList
currentIndex: Cpp_IO_Serial.parityIndex
onCurrentIndexChanged: {
if (Cpp_IO_Serial.parityIndex !== currentIndex)
Cpp_IO_Serial.parityIndex = currentIndex
}
}
//
// Stop bits selector
//
Label {
text: qsTr("Stop Bits") + ":"
} ComboBox {
id: _stopBitsCombo
Layout.fillWidth: true
model: Cpp_IO_Serial.stopBitsList
currentIndex: Cpp_IO_Serial.stopBitsIndex
onCurrentIndexChanged: {
if (Cpp_IO_Serial.stopBitsIndex !== currentIndex)
Cpp_IO_Serial.stopBitsIndex = currentIndex
}
}
//
// Flow control selector
//
Label {
text: qsTr("Flow Control") + ":"
} ComboBox {
id: _flowCombo
Layout.fillWidth: true
model: Cpp_IO_Serial.flowControlList
currentIndex: Cpp_IO_Serial.flowControlIndex
onCurrentIndexChanged: {
if (Cpp_IO_Serial.flowControlIndex !== currentIndex)
Cpp_IO_Serial.flowControlIndex = currentIndex
}
}
}
//
// Vertical spacer
//
Item {
Layout.fillHeight: true
}
}
}
| QML | 5 | Serial-Studio/Serial-Studio | assets/qml/Panes/SetupPanes/Serial.qml | [
"MIT"
] |
A ← 3 2 ⍴ ⍳ 5 ⍝ Example input A
B ← ⍉ A ⍝ Example input B
WA ← (1↓⍴B),⍴A
KA ← (⊃⍴⍴A)-1
VA ← ⍳ ⊃ ⍴WA
ZA ← (KA⌽¯1↓VA),¯1↑VA
TA ← ZA⍉WA⍴A ⍝ Replicate, transpose
WB ← (¯1↓⍴A),⍴B
KB ← ⊃ ⍴⍴A
VB ← ⍳ ⊃ ⍴WB
ZB0 ← (-KB) ↓ KB ⌽ ⍳(⊃⍴VB)
ZB ← (¯1↓(⍳ KB)),ZB0,KB
TB ← ZB⍉WB⍴B ⍝ Replicate, transpose
R ← +/ TA×TB
R2 ← ×/ +/ R
⍝ 1 3 5
⍝ 2 4 1
⍝
⍝ 1 2 5 11 7 -+-> 23 |
⍝ 3 4 11 25 19 -+-> 55 ×
⍝ 5 1 7 19 26 -+-> 52 |
⍝ 65780 v
| APL | 3 | mbudde/apltail | tests/inner3.apl | [
"MIT"
] |
scriptname _DE_WetMeterUpdate extends Quest
_DE_WetMeter property WetMeter auto
_DE_Compatibility property Compatibility auto
_DE_EPMonitor_1_6 property Frostfall auto
GlobalVariable property _DE_FireDistance auto
GlobalVariable property _DE_ExposureMeterDisplay_Contextual auto
GlobalVariable property _DE_ExposureMeter_Opacity auto
GlobalVariable property _DE_WMColor_Light auto
GlobalVariable property _DE_WMColor_Dark auto
GlobalVariable property _DE_MeterDisplayTime auto
Formlist property _DE_SleepObjects auto
Actor property PlayerRef auto
int iDisplayIterationsRemaining
float fLastWet
Event OnInit()
WetMeter.HAnchor = "left"
WetMeter.VAnchor = "top"
WetMeter.X = 61.0
WetMeter.Y = 75.2
StartUpdating()
endEvent
Event OnGameReload()
StartUpdating()
endEvent
Event OnUpdate()
if Compatibility.isSKYUILoaded
if Frostfall.pSetting_IsRunning == false || Frostfall.ShutdownState == true
WetMeter.Alpha = 0.0
else
UpdateMeter()
endif
endif
RegisterForSingleUpdate(2)
endEvent
function StartUpdating()
RegisterForSingleUpdate(2)
endFunction
function UpdateMeter(bool bSkipDisplayHandling = false)
float fThisWet = Frostfall.pWetPoints
if _DE_ExposureMeterDisplay_Contextual.GetValueInt() == 1
WetMeter.Alpha = _DE_ExposureMeter_Opacity.GetValue()
elseif _DE_ExposureMeterDisplay_Contextual.GetValueInt() == 2 || bSkipDisplayHandling
ContextualDisplay(fThisWet)
elseif _DE_ExposureMeterDisplay_Contextual.GetValueInt() == 0 && iDisplayIterationsRemaining == 0
WetMeter.Alpha = 0.0
return
endif
WetMeter.SetPercent(fThisWet / 750.0)
WetMeter.SetColors(_DE_WMColor_Light.GetValueInt(), _DE_WMColor_Dark.GetValueInt())
fLastWet = fThisWet
if iDisplayIterationsRemaining > 0
iDisplayIterationsRemaining -= 1
if iDisplayIterationsRemaining <= 0
iDisplayIterationsRemaining = 0
if _DE_ExposureMeterDisplay_Contextual.GetValueInt() != 1
WetMeter.FadeTo(0.0, 3.0)
endif
endif
elseif iDisplayIterationsRemaining == 0
if WetMeter.Alpha == _DE_ExposureMeter_Opacity.GetValue()
if _DE_ExposureMeterDisplay_Contextual.GetValueInt() != 1
WetMeter.FadeTo(0.0, 3.0)
endif
endif
else
;keep it on
endif
endFunction
function ContextualDisplay(float fThisWet, bool bSkipDisplayHandling = false)
;debug.trace("[Frostfall] " + fThisWet + " " + fLastWet + " " + iDisplayIterationsRemaining)
if bSkipDisplayHandling
iDisplayIterationsRemaining = _DE_MeterDisplayTime.GetValueInt()
return
endif
bool GoingUp = fLastWet < fThisWet
if GoingUp && fThisWet >= 550.0
WetMeter.FadeTo(_DE_ExposureMeter_Opacity.GetValue(), 2.0)
iDisplayIterationsRemaining = _DE_MeterDisplayTime.GetValueInt()
elseif GoingUp && fLastWet < 200.0 && fThisWet >= 200.0
WetMeter.FadeTo(_DE_ExposureMeter_Opacity.GetValue(), 2.0)
iDisplayIterationsRemaining = _DE_MeterDisplayTime.GetValueInt()
elseif GoingUp && fLastWet < 400.0 && fThisWet >= 400.0
WetMeter.FadeTo(_DE_ExposureMeter_Opacity.GetValue(), 2.0)
iDisplayIterationsRemaining = _DE_MeterDisplayTime.GetValueInt()
elseif !GoingUp && fLastWet != fThisWet && fThisWet > 0.0 && (_DE_FireDistance.GetValue() != -1 || Game.FindClosestReferenceOfAnyTypeInListFromRef(_DE_SleepObjects, PlayerRef, 600.0) != None)
WetMeter.FadeTo(_DE_ExposureMeter_Opacity.GetValue(), 2.0)
iDisplayIterationsRemaining = -1
elseif (fLastWet > 0.0 && fThisWet <= 0.0) || (_DE_FireDistance.GetValue() == -1 && fThisWet < 550.0)
if iDisplayIterationsRemaining == -1
iDisplayIterationsRemaining = _DE_MeterDisplayTime.GetValueInt()
endif
endif
endFunction
function ForceDisplayAndUpdate(bool bSkipDisplayHandling = true)
if Compatibility.isSKYUILoaded
;Called by spells that change exposure.
iDisplayIterationsRemaining = _DE_MeterDisplayTime.GetValueInt()
WetMeter.FadeTo(_DE_ExposureMeter_Opacity.GetValue(), 1.0)
UpdateMeter(bSkipDisplayHandling)
endif
endFunction | Papyrus | 4 | chesko256/Campfire | Scripts/Source/_DE_WetMeterUpdate.psc | [
"MIT"
] |
module chapter5/lists ---- page 157
some sig Element {}
abstract sig List {}
one sig EmptyList extends List {}
sig NonEmptyList extends List {
element: Element,
rest: List
}
fact ListGenerator {
all list: List, e: Element |
some list1: List | list1.rest = list and list1.element = e
}
assert FalseAssertion {
all list: List | list != list
}
// This check finds no counterexample since
// the only possible counterexamples are infinite.
check FalseAssertion
| Alloy | 4 | haslab/Electrum | electrum/src/main/resources/models/book/chapter5/lists.als | [
"MIT"
] |
#![feature(associated_type_defaults)]
trait Foo {
type Bar = ();
}
| Rust | 4 | mbc-git/rust | src/tools/rustfmt/tests/target/associated_type_defaults.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
0 reg32_t "dword"
1 code_t "proc*"
2 num32_t "int"
3 uint32_t "size_t"
4 ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(struct(0:num32_t,4:ptr(reg8_t),8:ptr(reg8_t),12:ptr(reg8_t),16:ptr(reg8_t),20:ptr(reg8_t),24:ptr(reg8_t),28:ptr(reg8_t),32:ptr(reg8_t),36:ptr(reg8_t),40:ptr(reg8_t),44:ptr(reg8_t),48:ptr(TOP),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),8:num32_t)),52:ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(TOP),8:num32_t)),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))) "FILE*"
5 ptr(num8_t) "char*"
6 ptr(TOP) "void*"
7 ptr(struct(0:ptr(TOP),12:reg32_t,16:reg32_t,20:ptr(struct(8:float32_t,12:float32_t)))) "Struct_7*"
8 num8_t "char"
9 ptr(struct(0:ptr(num8_t),8:num32_t)) "Struct_14*"
3 uint32_t "unsigned int"
10 ptr(array(reg8_t,16)) "unknown_128*"
11 ptr(array(reg8_t,56)) "unknown_448*"
12 ptr(array(reg8_t,99)) "unknown_792*"
13 union(ptr(num8_t),ptr(ptr(num8_t))) "Union_4"
14 ptr(array(reg8_t,42)) "unknown_336*"
15 ptr(struct(0:array(reg8_t,8192),8192:num8_t)) "StructFrag_16*"
16 union(ptr(num8_t),ptr(struct(0:array(reg8_t,8192),8192:num8_t))) "Union_2"
5 ptr(num8_t) "char[]"
17 union(ptr(struct(0:array(reg8_t,28),28:code_t)),ptr(struct(0:ptr(TOP),12:reg32_t,16:reg32_t,20:ptr(struct(8:float32_t,12:float32_t))))) "Union_3"
18 ptr(num32_t) "int*"
19 ptr(array(reg8_t,32)) "unknown_256*"
20 ptr(array(reg8_t,31)) "unknown_248*"
21 ptr(array(reg8_t,64)) "unknown_512*"
22 reg64_t "qword"
23 ptr(reg32_t) "dword*"
24 union(ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(struct(0:num32_t,4:ptr(reg8_t),8:ptr(reg8_t),12:ptr(reg8_t),16:ptr(reg8_t),20:ptr(reg8_t),24:ptr(reg8_t),28:ptr(reg8_t),32:ptr(reg8_t),36:ptr(reg8_t),40:ptr(reg8_t),44:ptr(reg8_t),48:ptr(TOP),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(reg8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(reg8_t,40))),8:num32_t)),52:ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(TOP),8:num32_t)),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(TOP),8:num32_t)),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40)))) "Union_0"
25 union(ptr(num8_t),ptr(struct(0:reg16_t,2:num8_t))) "Union_1"
26 ptr(struct(0:reg16_t,2:num8_t)) "StructFrag_0*"
27 ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(TOP),8:num32_t)),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))) "_IO_FILE*"
28 ptr(struct(0:ptr(TOP),12:reg32_t)) "Struct_10*"
29 reg16_t "word"
30 num64_t "long long"
31 ptr(struct(0:ptr(TOP),4:ptr(TOP),8:reg32_t,12:reg32_t,16:reg32_t,20:ptr(struct(0:float32_t,4:float32_t,8:float32_t)),36:ptr(struct(0:reg32_t,4:ptr(TOP))))) "Struct_20*"
32 ptr(struct(0:reg32_t,4:ptr(TOP))) "StructFrag_17*"
33 ptr(ptr(struct(0:reg32_t,4:ptr(TOP)))) "StructFrag_17**"
34 ptr(struct(0:ptr(TOP),4:reg32_t,8:reg32_t,12:reg32_t,16:reg32_t)) "Struct_21*"
35 ptr(struct(0:ptr(struct(0:array(reg8_t,20),20:ptr(TOP))),32:code_t,36:ptr(struct(0:reg32_t,4:ptr(TOP))))) "Struct_40*"
36 ptr(struct(0:ptr(TOP),4:reg32_t,16:reg32_t)) "Struct_35*"
37 ptr(struct(0:ptr(struct(0:reg32_t,4:ptr(TOP))),4:reg32_t)) "Struct_36*"
38 ptr(struct(0:reg32_t,4:reg32_t)) "StructFrag_19*"
39 ptr(struct(0:ptr(struct(0:ptr(TOP),4:reg32_t,8:reg32_t,12:reg32_t,16:reg32_t)),4:ptr(struct(0:reg32_t,4:ptr(TOP))))) "Struct_23*"
40 ptr(struct(0:array(reg8_t,28),28:code_t)) "StructFrag_4*"
41 float64_t "double"
42 ptr(struct(0:ptr(struct(0:reg32_t,4:ptr(TOP))),4:reg32_t,8:reg32_t,12:reg32_t,16:reg32_t)) "Struct_33*"
43 ptr(struct(0:reg64_t,8:float32_t)) "StructFrag_6*"
44 ptr(struct(0:ptr(TOP),4:ptr(TOP),8:reg32_t,12:reg32_t,20:ptr(struct(0:reg64_t,8:float32_t)))) "Struct_26*"
45 ptr(struct(0:num32_t,4:ptr(ptr(num8_t)),4294967292:reg32_t)) "Struct_13*"
46 ptr(struct(0:ptr(num8_t),4:num32_t,8:ptr(num32_t),12:num32_t)) "option*"
47 ptr(ptr(num8_t)) "char**"
48 ptr(struct(0:reg32_t,40:ptr(num8_t),44:ptr(num8_t))) "Struct_6*"
49 ptr(uint32_t) "size_t*"
32 ptr(struct(0:reg32_t,4:ptr(TOP))) "Struct_0*"
50 ptr(struct(0:num32_t,4:reg32_t,40:ptr(num8_t),44:ptr(num8_t))) "Struct_44*"
23 ptr(reg32_t) "dword[]"
51 int32_t "signed int"
52 ptr(struct(0:array(reg8_t,18),18:num8_t)) "StructFrag_7*"
53 ptr(struct(0:ptr(struct(0:reg32_t,4:ptr(struct(0:reg32_t,4:ptr(TOP))))),12:reg32_t)) "Struct_30*"
54 ptr(struct(0:reg32_t,4:ptr(struct(0:reg32_t,4:ptr(TOP))))) "Struct_29*"
55 ptr(struct(0:ptr(struct(0:reg16_t,2:num8_t)),4:reg32_t,8:reg32_t,12:reg32_t,16:reg32_t)) "Struct_18*"
56 ptr(ptr(struct(0:reg16_t,2:num8_t))) "StructFrag_0**"
57 ptr(struct(0:ptr(num8_t),4:reg32_t,8:reg32_t,12:reg32_t,16:reg32_t)) "Struct_38*"
49 ptr(uint32_t) "unsigned int[]"
58 ptr(struct(0:array(reg8_t,3),3:num8_t)) "StructFrag_22*"
49 ptr(uint32_t) "unsigned int*"
59 union(ptr(num8_t),ptr(struct(0:reg32_t,4:ptr(TOP))),ptr(struct(0:array(reg8_t,8192),8192:num8_t))) "Union_8"
2 num32_t "__ssize_t"
60 ptr(ptr(uint16_t)) "unsigned short**"
61 union(ptr(struct(0:reg32_t,4:ptr(TOP))),ptr(struct(0:reg32_t,4:ptr(TOP))),ptr(struct(0:reg32_t,4:ptr(struct(0:reg32_t,4:ptr(TOP)))))) "Union_6"
53 ptr(struct(0:ptr(struct(0:reg32_t,4:ptr(struct(0:reg32_t,4:ptr(TOP))))),12:reg32_t)) "Struct_32*"
32 ptr(struct(0:reg32_t,4:ptr(TOP))) "StructFrag_1*"
62 ptr(struct(8:float32_t)) "Struct_19*"
63 ptr(struct(8:float32_t,12:float32_t)) "Struct_5*"
64 ptr(struct(0:float32_t,4:float32_t,8:float32_t)) "Struct_12*"
32 ptr(struct(0:reg32_t,4:ptr(TOP))) "StructFrag_20*"
65 ptr(ptr(TOP)) "void**"
66 ptr(struct(0:num32_t,4:uint32_t,40:ptr(num8_t),44:ptr(num8_t))) "Struct_47*"
67 ptr(struct(0:num32_t,40:ptr(num8_t),44:ptr(num8_t))) "Struct_46*"
68 union(ptr(num8_t),ptr(struct(0:array(reg8_t,8192),8192:num8_t)),ptr(struct(0:ptr(TOP),4:reg32_t,8:reg32_t,12:reg32_t,16:reg32_t))) "Union_7"
69 ptr(reg16_t) "word[]"
70 ptr(ptr(struct(0:float32_t,4:float32_t,8:float32_t,12:float32_t))) "Struct_2**"
71 ptr(struct(28:code_t,36:ptr(struct(0:reg32_t,4:ptr(TOP))))) "Struct_25*"
72 ptr(struct(0:reg32_t,8:reg32_t,24:code_t)) "Struct_31*"
73 ptr(struct(12:reg32_t,36:ptr(struct(0:reg32_t,4:ptr(TOP))))) "Struct_27*"
74 ptr(struct(0:array(reg8_t,75810),75810:reg32_t)) "StructFrag_11*"
75 ptr(struct(0:array(reg8_t,536870908),4294967292:reg32_t)) "StructFrag_12*"
76 ptr(struct(0:array(reg8_t,38172),38172:reg32_t)) "StructFrag_14*"
77 ptr(struct(0:array(reg8_t,520),520:reg32_t)) "StructFrag_15*"
78 ptr(struct(0:uint32_t,4:ptr(TOP))) "Struct_45*"
79 ptr(struct(0:float32_t,4:float32_t,8:float32_t,12:float32_t)) "Struct_2*"
80 ptr(uint16_t) "unsigned short*"
81 ptr(struct(0:reg64_t,8:uint32_t)) "StructFrag_21*"
82 array(reg8_t,4096) "unknown_32768"
83 array(reg8_t,135168) "unknown_1081344"
84 array(reg8_t,30) "unknown_240"
85 array(reg8_t,5) "unknown_40"
86 array(reg8_t,25) "unknown_200"
87 array(reg8_t,16) "unknown_128"
88 array(reg8_t,99) "unknown_792"
89 array(reg8_t,77) "unknown_616"
90 array(reg8_t,24) "unknown_192"
91 array(reg8_t,14) "unknown_112"
92 array(reg8_t,9) "unknown_72"
93 array(reg8_t,12) "unknown_96"
94 array(reg8_t,10) "unknown_80"
95 array(reg8_t,53) "unknown_424"
96 array(reg8_t,35) "unknown_280"
97 array(reg8_t,7) "unknown_56"
98 array(reg8_t,34) "unknown_272"
99 array(reg8_t,55) "unknown_440"
100 array(reg8_t,45) "unknown_360"
101 array(reg8_t,17) "unknown_136"
102 array(reg8_t,11) "unknown_88"
103 array(reg8_t,40) "unknown_320"
104 array(reg8_t,19) "unknown_152"
105 array(reg8_t,41) "unknown_328"
106 array(reg8_t,51) "unknown_408"
107 array(reg8_t,13) "unknown_104"
108 array(reg8_t,32) "unknown_256"
109 array(reg8_t,52) "unknown_416"
110 array(reg8_t,268) "unknown_2144"
111 array(reg8_t,50) "unknown_400"
112 array(reg8_t,38) "unknown_304"
113 array(reg8_t,147) "unknown_1176"
114 array(reg8_t,42) "unknown_336"
115 array(reg8_t,27) "unknown_216"
116 array(reg8_t,66) "unknown_528"
117 array(reg8_t,20) "unknown_160"
118 array(reg8_t,22) "unknown_176"
119 array(reg8_t,18) "unknown_144"
120 array(reg8_t,31) "unknown_248"
121 array(reg8_t,59) "unknown_472"
122 array(reg8_t,112) "unknown_896"
123 array(reg8_t,138) "unknown_1104"
124 array(reg8_t,26) "unknown_208"
125 array(reg8_t,6) "unknown_48"
126 array(reg8_t,3) "unknown_24"
127 array(reg8_t,21) "unknown_168"
128 array(reg8_t,102) "unknown_816"
129 array(reg8_t,28) "unknown_224"
130 array(reg8_t,104) "unknown_832"
131 array(reg8_t,214) "unknown_1712"
132 array(reg8_t,56) "unknown_448"
133 array(reg8_t,153) "unknown_1224"
134 array(reg8_t,48) "unknown_384"
135 array(reg8_t,109) "unknown_872"
136 array(reg8_t,33) "unknown_264"
137 array(reg8_t,15) "unknown_120"
138 array(reg8_t,39) "unknown_312"
139 array(reg8_t,29) "unknown_232"
140 array(reg8_t,80) "unknown_640"
141 array(reg8_t,96) "unknown_768"
142 array(reg8_t,62) "unknown_496"
143 array(reg8_t,74) "unknown_592"
144 array(reg8_t,47) "unknown_376"
145 array(reg8_t,44) "unknown_352"
146 array(reg8_t,90) "unknown_720"
147 array(reg8_t,57) "unknown_456"
148 array(reg8_t,23) "unknown_184"
149 array(reg8_t,37) "unknown_296"
150 array(reg8_t,87) "unknown_696"
151 array(reg8_t,162) "unknown_1296"
152 array(reg8_t,176) "unknown_1408"
153 array(reg8_t,160) "unknown_1280"
154 array(reg8_t,61) "unknown_488"
155 array(reg8_t,83) "unknown_664"
156 array(reg8_t,60) "unknown_480"
157 array(reg8_t,65) "unknown_520"
158 array(reg8_t,36) "unknown_288"
159 array(reg8_t,73) "unknown_584"
160 array(reg8_t,64) "unknown_512"
161 array(reg8_t,43) "unknown_344"
162 array(reg8_t,108) "unknown_864"
163 array(reg8_t,71) "unknown_568"
164 array(reg8_t,72) "unknown_576"
165 array(reg8_t,111) "unknown_888"
166 array(num8_t,39) "char[39]"
167 array(num8_t,31) "char[31]"
168 array(num8_t,56) "char[56]"
169 array(num8_t,437) "char[437]"
170 array(num8_t,506) "char[506]"
171 array(num8_t,45) "char[45]"
172 array(num8_t,54) "char[54]"
173 array(num8_t,69) "char[69]"
174 array(num8_t,65) "char[65]"
175 array(num8_t,87) "char[87]"
176 array(num8_t,46) "char[46]"
177 array(num8_t,23) "char[23]"
178 array(num8_t,10) "char[10]"
179 array(num8_t,4) "char[4]"
180 array(num8_t,16) "char[16]"
181 array(num8_t,9) "char[9]"
182 struct(0:ptr(num8_t),4:num32_t,8:ptr(num32_t),12:num32_t) "option"
183 array(num8_t,12) "char[12]"
184 array(num8_t,7) "char[7]"
185 array(num8_t,24) "char[24]"
186 array(num8_t,33) "char[33]"
187 float32_t "float"
188 array(num8_t,8) "char[8]"
189 array(num8_t,3) "char[3]"
190 array(num8_t,2) "char[2]"
191 array(reg32_t,9) "dword[9]"
192 array(reg32_t,127) "dword[127]"
193 array(reg32_t,34) "dword[34]"
194 array(num8_t,28) "char[28]"
195 array(num8_t,21) "char[21]"
196 array(num8_t,22) "char[22]"
197 array(num8_t,20) "char[20]"
198 array(num8_t,203) "char[203]"
199 array(num8_t,32) "char[32]"
200 array(num8_t,36) "char[36]"
201 array(num8_t,40) "char[40]"
202 array(num8_t,44) "char[44]"
203 array(num8_t,48) "char[48]"
204 array(num8_t,52) "char[52]"
205 array(num8_t,60) "char[60]"
206 array(num8_t,64) "char[64]"
207 array(ptr(TOP),10) "void*[10]"
208 array(num8_t,47) "char[47]"
209 array(num8_t,17) "char[17]"
210 array(num8_t,6) "char[6]"
211 array(num8_t,78) "char[78]"
212 array(reg8_t,932) "unknown_7456"
213 array(reg8_t,8080) "unknown_64640"
214 array(reg8_t,5504) "unknown_44032"
1 code_t "(void -?-> dword)*"
215 array(reg8_t,232) "unknown_1856"
216 array(reg8_t,256) "unknown_2048"
| BlitzBasic | 1 | matt-noonan/retypd-data | data/readlink.decls | [
"MIT"
] |
React = require \react
Form = class Form extends React.Component
(props) ->
super(props)
this.state =
dropdown-direction: -1
# render :: a -> ReactElement
render: ->
React.create-element MultiSelect,
options: <[apple mango grapes melon strawberry]> |> map ~> label: it, value: it
placeholder: "Select fruits"
dropdown-direction: @state.dropdown-direction
ref: \select
# component-did-mount :: a -> Void
component-did-mount: !->
@on-scroll-change = ~>
{offset-top} = find-DOM-node @refs.select
screen-top = offset-top - (window.scroll-y ? document.document-element.scroll-top)
dropdown-direction = if window.inner-height - screen-top < 215 then -1 else 1
if dropdown-direction != @state.dropdown-direction
@set-state {dropdown-direction}
window.add-event-listener \scroll, @on-scroll-change
# component-will-unmount :: a -> Void
component-will-unmount: !->
window.remove-event-listener \scroll, @on-scroll-change
render (React.create-element Form, null), mount-node | LiveScript | 4 | rodcope1/react-selectize-rodcope1 | public/examples/multi/DropdownDirection.ls | [
"Apache-2.0"
] |
### /resource/create 成功
POST {{baseUrl}}/resource/create
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer {{accessToken}}
name=测试菜单&permission=resource:add&type=1&sort=1&pid=0&route=/resource/list&icon=test
### /admin/update 成功
POST {{baseUrl}}/resource/update
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer {{accessToken}}
id=61&name=测试菜单2&permission=resource:add&type=1&sort=1&pid=0&route=/resource/list&icon=test
### /resource/delete 成功
POST {{baseUrl}}/resource/delete
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer {{accessToken}}
resourceId=61
### /resource/get 成功
GET {{baseUrl}}/resource/get?resourceId=61
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer {{accessToken}}
### /resource/list 成功
GET {{baseUrl}}/resource/list?resourceIds=61,63
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer {{accessToken}}
### /resource/tree 成功
GET {{baseUrl}}/resource/tree
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer {{accessToken}}
###
| HTTP | 3 | ssSlowDown/onemall | management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/ResourceController.http | [
"MulanPSL-1.0"
] |
( Generated from test_statement_switch_in.muv by the MUV compiler. )
( https://github.com/revarbat/pymuv )
: _complex_match[ _v1 _v2 -- ret ]
_v1 @ number? dup if pop
_v2 @ number?
then if
_v1 @ _v2 @ = exit
then
_v1 @ string? dup if pop
_v2 @ int?
then if
_v1 @ _v2 @ intostr strcmp not exit
then
_v1 @ "%?" fmtstring _v2 @ "%?" fmtstring strcmp not if
0 exit
then
_v1 @ string? if
_v1 @ tolower _v2 @ tolower strcmp not exit
then
0
;
: _main[ _arg -- ret ]
2 var! _i
begin
_i @
var! _swvar
_swvar @ 1 = if
"One." me @ swap notify break
then
_swvar @ 2 = if
"Two." me @ swap notify break
then
_swvar @ 3 = if
"Three." me @ swap notify break
then
repeat
begin
_arg @
var! _swvar2
_swvar2 @ "greet" strcmp not if
"Hello." me @ swap notify break
then
_swvar2 @ "who" strcmp not if
"I'm called MUV." me @ swap notify break
then
_swvar2 @ "what" strcmp not if
"I'm a nicer language to use than MUF." me @ swap notify break
then
"I don't understand." me @ swap notify break
repeat
begin
_arg @
var! _swvar3
_swvar3 @ "fee" complex_match if
"Fee selected!" me @ swap notify break
then
_swvar3 @ 1 complex_match if
"One selected!" me @ swap notify break
then
_swvar3 @ "" complex_match if
"None selected!" me @ swap notify break
then
repeat
"foo" var! _a
begin
42
var! _swvar4
_swvar4 @ 99 > if
"A" me @ swap notify break
then
_swvar4 @ 50 > if
"B" me @ swap notify break
then
_swvar4 @ 25 > if
"C" me @ swap notify break
then
_swvar4 @ 10 > if
"D" me @ swap notify break
then
repeat
0
;
: __start
"me" match me ! me @ location loc ! trig trigger !
_main
;
| MUF | 4 | revarbat/pymuv | tests/test_statement_switch_cmp.muf | [
"MIT"
] |
double run_fftw(int n,const float * x,float * y)
{
fftwf_plan p1 = fftwf_plan_dft_1d(n,(fftwf_complex *)x,(fftwf_complex *)y,
FFTW_FORWARD,FFTW_ESTIMATE);
const int nops = 10;
double t = cl::realTime();
for (int op = 0;op < nops;op++) {
fftwf_execute(p1);
}
t = (cl::realTime() - t)/(double)nops;
fftwf_destroy_plan(p1);
return t;
}
| OpenCL | 4 | JavascriptID/sourcerer-app | src/test/resources/samples/langs/OpenCL/fft.cl | [
"MIT"
] |
{ nixpkgs ? <nixpkgs>}:
with import nixpkgs {};
rec {
breathe = with python27Packages; buildPythonPackage rec {
version = "git-arximboldi-${commit}";
pname = "breathe";
name = "${pname}-${version}";
commit = "5074aecb5ad37bb70f50216eaa01d03a375801ec";
src = fetchFromGitHub {
owner = "arximboldi";
repo = "breathe";
rev = commit;
sha256 = "10kkh3wb0ggyxx1a7x50aklhhw0cq269g3jddf2gb3pv9gpbj7sa";
};
propagatedBuildInputs = [ docutils sphinx ];
meta = with stdenv.lib; {
homepage = https://github.com/michaeljones/breathe;
license = licenses.bsd3;
description = "Sphinx Doxygen renderer";
inherit (sphinx.meta) platforms;
};
};
recommonmark = python27Packages.recommonmark;
}
| Nix | 4 | ikrima/immer | nix/docs.nix | [
"BSL-1.0"
] |
// Daniel Shiffman
// http://codingtra.in
// Islamic Star Patterns
// Video Part 1: https://youtu.be/sJ6pMLp_IaI
// Video Part 2: [coming soon]
// Based on: http://www.cgl.uwaterloo.ca/csk/projects/starpatterns/
// Processing transcription: Chuck England
// Repo with more tiling patterns and features
// https://github.com/CodingTrain/StarPatterns
class Hankin {
PVector a;
PVector v;
PVector b;
PVector end = null;
float prevD;
Hankin(PVector a_, PVector v_) {
a = a_;
v = v_;
b = PVector.add(a, v);
}
void show() {
stroke(255, 0, 255);
line(a.x, a.y, end.x, end.y);
// fill(255);
// ellipse(this.a.x, this.a.y, 8);
// if (this.end) {
// fill(255, 255, 0);
// ellipse(this.end.x, this.end.y, 8);
// }
}
void findEnd(Hankin other) {
// line line intersection???
// this.a, this.v (P1, P2-P1)
// other.a, other.v (P3, P4-P3)
// From: http://paulbourke.net/geometry/pointlineplane/
float den = (other.v.y * v.x) - (other.v.x * v.y);
//if (!den) {
// return;
//}
if (den == 0.0) {
return;
}
float numa = (other.v.x * (this.a.y - other.a.y)) - (other.v.y * (this.a.x - other.a.x));
float numb = (this.v.x * (this.a.y - other.a.y)) - (this.v.y * (this.a.x - other.a.x));
float ua = numa / den;
float ub = numb / den;
float x = this.a.x + (ua * this.v.x);
float y = this.a.y + (ua * this.v.y);
if (ua > 0 && ub > 0) {
PVector candidate = new PVector(x, y);
float d1 = PVector.dist(candidate, this.a);
float d2 = PVector.dist(candidate, other.a);
float d = d1 + d2;
float diff = abs(d1 - d2);
if (diff < 0.001) {
if (end == null) {
end = candidate;
prevD = d;
} else if (d < this.prevD) {
prevD = d;
end = candidate;
}
}
}
}
};
| Processing | 4 | aerinkayne/website | CodingChallenges/CC_054.1_StarPatterns/Processing/CC_054_StarPatterns/Hankin.pde | [
"MIT"
] |
//
// Copyright (c) 2010, Brian Frank and Andy Frank
// Licensed under the Academic Free License version 3.0
//
// History:
// 20 Mar 10 Brian Frank Creation
//
**
** CsvOutStream is used to write delimiter-separated values
** as specified by RFC 4180. Format details:
** - rows are delimited by a newline
** - cells are separated by `delimiter` char
** - cells containing the delimiter, '"' double quote, or
** newline are quoted; quotes are escaped as '""'
**
** Also see `CsvInStream`.
**
@Js
class CsvOutStream : ProxyOutStream
{
**
** Wrap the underlying output stream.
**
new make(OutStream out) : super(out) {}
**
** Delimiter character; defaults to comma.
**
Int delimiter := ','
**
** Write the row of cells with the configured delimiter.
** Also see `writeCell`.
**
virtual This writeRow(Str[] row)
{
row.each |cell, i|
{
if (i > 0) writeChar(delimiter)
writeCell(cell)
}
return writeChar('\n')
}
**
** Write a single cell. If `isQuoteRequired` returns true,
** then quote it.
**
virtual This writeCell(Str cell)
{
if (!isQuoteRequired(cell)) return print(cell)
writeChar('"')
cell.each |ch|
{
if (ch == '"') writeChar('"')
writeChar(ch)
}
return writeChar('"')
}
**
** Return if the given cell string contains:
** - the configured delimiter
** - double quote '"' char
** - leading/trailing whitespace
** - newlines
**
Bool isQuoteRequired(Str cell)
{
if (cell.isEmpty) return true
if (cell[0].isSpace || cell[cell.size-1].isSpace) return true
return cell.any |ch| { ch == delimiter || ch == '"' || ch == '\n' || ch == '\r' }
}
} | Fantom | 5 | fanx-dev/fanx | library/util/fan/CsvOutStream.fan | [
"AFL-3.0"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.