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 |
|---|---|---|---|---|---|
WBGet(WinTitle := "ahk_class IEFrame", Svr#=1) { ;// based on ComObjQuery docs
static msg := DllCall("RegisterWindowMessage", "str", "WM_HTML_GETOBJECT")
, IID := "{0002DF05-0000-0000-C000-000000000046}" ;// IID_IWebBrowserApp
;// , IID := "{332C4427-26CB-11D0-B483-00C04FD90119}" ;// IID_IHTMLWindow2
SendMessage msg, 0, 0, Internet Explorer_Server%Svr#%, %WinTitle%
if (ErrorLevel != "FAIL") {
lResult:=ErrorLevel, VarSetCapacity(GUID,16,0)
if DllCall("ole32\CLSIDFromString", "wstr","{332C4425-26CB-11D0-B483-00C04FD90119}", "ptr",&GUID) >= 0 {
DllCall("oleacc\ObjectFromLresult", "ptr",lResult, "ptr",&GUID, "ptr",0, "ptr*",pdoc)
return ComObj(9,ComObjQuery(pdoc,IID,IID),1), ObjRelease(pdoc)
}
}
} | AutoHotkey | 3 | standardgalactic/PuloversMacroCreator | LIB/WBGet.ahk | [
"Unlicense"
] |
% Sort.Txl - simple numeric bubble sort
define program
[repeat number]
end define
rule main
replace [repeat number]
N1 [number] N2 [number] Rest [repeat number]
where
N1 [> N2]
by
N2 N1 Rest
end rule
| TXL | 3 | pseudoPixels/SourceFlow | app_txl_cloud/txl_sources/examples/bubble_sort/bubble_sort.txl | [
"MIT"
] |
/*
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server;
import org.springframework.http.client.reactive.ClientHttpResponse;
/**
* Simple {@link ClientHttpResponse} extension that also exposes a result object
* from the underlying mock server exchange for further assertions on the state
* of the server response after the request is performed.
*
* @author Rossen Stoyanchev
* @since 5.3
*/
public interface MockServerClientHttpResponse extends ClientHttpResponse {
/**
* Return the result object with the server request and response.
*/
Object getServerResult();
}
| Java | 5 | spreoW/spring-framework | spring-test/src/main/java/org/springframework/test/web/reactive/server/MockServerClientHttpResponse.java | [
"Apache-2.0"
] |
create table `first` (id int primary key);
| SQL | 2 | imtbkcat/tidb-lightning | tests/black-white-list/data/firstdb.first-schema.sql | [
"Apache-2.0"
] |
{-# LANGUAGE StandaloneDeriving #-}
module Network.GRPC.Unsafe.Slice where
#include <grpc/slice.h>
#include <grpc_haskell.h>
import qualified Data.ByteString as B
import Foreign.C.String
import Foreign.C.Types
import Foreign.Ptr
-- | A 'Slice' is gRPC's string type. We can easily convert these to and from
-- ByteStrings. This type is a pointer to a C type.
{#pointer *grpc_slice as Slice newtype #}
deriving instance Show Slice
-- TODO: we could also represent this type as 'Ptr Slice', by doing this:
-- newtype Slice = Slice {#type grpc_slice#}
-- This would have no practical effect, but it would communicate intent more
-- clearly by emphasizing that the type is indeed a pointer and that the data
-- it is pointing to might change/be destroyed after running IO actions. To make
-- the change, we would just need to change all occurrences of 'Slice' to
-- 'Ptr Slice' and add 'castPtr' in and out marshallers.
-- This seems like the right way to do it, but c2hs doesn't make it easy, so
-- maybe the established idiom is to do what c2hs does.
-- | Get the length of a slice.
{#fun unsafe grpc_slice_length_ as ^ {`Slice'} -> `CULong'#}
-- | Slices allocated using this function must be freed by
-- 'freeSlice'
{#fun unsafe grpc_slice_malloc_ as ^ {`Int'} -> `Slice'#}
-- | Returns a pointer to the start of the character array contained by the
-- slice.
{#fun unsafe grpc_slice_start_ as ^ {`Slice'} -> `Ptr CChar' castPtr #}
-- | Slices must be freed using 'freeSlice'.
{#fun unsafe grpc_slice_from_copied_buffer_ as ^ {`CString', `Int'} -> `Slice'#}
-- | Properly cleans up all memory used by a 'Slice'. Danger: the Slice should
-- not be used after this function is called on it.
{#fun unsafe free_slice as ^ {`Slice'} -> `()'#}
-- | Copies a 'Slice' to a ByteString.
-- TODO: there are also non-copying unsafe ByteString construction functions.
-- We could gain some speed by using them.
-- idea would be something :: (ByteString -> Response) -> IO () that handles
-- getting and freeing the slice behind the scenes.
sliceToByteString :: Slice -> IO B.ByteString
sliceToByteString slice = do
len <- fmap fromIntegral $ grpcSliceLength slice
str <- grpcSliceStart slice
B.packCStringLen (str, len)
-- | Copies a 'ByteString' to a 'Slice'.
byteStringToSlice :: B.ByteString -> IO Slice
byteStringToSlice bs = B.useAsCStringLen bs $ uncurry grpcSliceFromCopiedBuffer
| C2hs Haskell | 5 | rickibm/daml | nix/third-party/gRPC-haskell/core/src/Network/GRPC/Unsafe/Slice.chs | [
"Apache-2.0"
] |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
using namespace System.Collections.Generic
using namespace System.Management.Automation
$crontabcmd = "/usr/bin/crontab"
class CronJob {
[string] $Minute
[string] $Hour
[string] $DayOfMonth
[string] $Month
[string] $DayOfWeek
[string] $Command
[string] ToString()
{
return "{0} {1} {2} {3} {4} {5}" -f
$this.Minute, $this.Hour, $this.DayOfMonth, $this.Month, $this.DayOfWeek, $this.Command
}
}
# Internal helper functions
function Get-CronTab ([String] $user) {
$crontab = Invoke-CronTab -user $user -arguments "-l" -noThrow
if ($crontab -is [ErrorRecord]) {
if ($crontab.Exception.Message.StartsWith("no crontab for ")) {
$crontab = @()
}
else {
throw $crontab.Exception
}
}
[string[]] $crontab
}
function ConvertTo-CronJob ([String] $crontab) {
$split = $crontab -split " ", 6
$cronjob = [CronJob]@{
Minute = $split[0];
Hour = $split[1];
DayOfMonth= $split[2];
Month =$split[3];
DayOfWeek = $split[4];
Command = $split[5]
}
$cronjob
}
function Invoke-CronTab ([String] $user, [String[]] $arguments, [Switch] $noThrow) {
If ($user -ne [String]::Empty) {
$arguments = Write-Output "-u" $UserName $arguments
}
Write-Verbose "Running: $crontabcmd $arguments"
$output = & $crontabcmd @arguments 2>&1
if ($LASTEXITCODE -ne 0 -and -not $noThrow) {
$e = New-Object System.InvalidOperationException -ArgumentList $output.Exception.Message
throw $e
} else {
$output
}
}
function Import-CronTab ([String] $user, [String[]] $crontab) {
$temp = New-TemporaryFile
[String]::Join([Environment]::NewLine,$crontab) | Set-Content $temp.FullName
Invoke-CronTab -user $user $temp.FullName
Remove-Item $temp
}
# Public functions
function Remove-CronJob {
<#
.SYNOPSIS
Removes the exactly matching cron job from the cron table
.DESCRIPTION
Removes the exactly matching cron job from the cron table
.EXAMPLE
Get-CronJob | Where-Object {%_.Command -like 'foo *'} | Remove-CronJob
.RETURNVALUE
None
.PARAMETER UserName
Optional parameter to specify a specific user's cron table
.PARAMETER Job
Cron job object returned from Get-CronJob
.PARAMETER Force
Don't prompt when removing the cron job
#>
[CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact="High")]
param (
[ArgumentCompleter( { $wordToComplete = $args[2]; Get-CronTabUser | Where-Object { $_ -like "$wordToComplete*" } | Sort-Object } )]
[Alias("u")]
[Parameter(Mandatory=$false)]
[String]
$UserName,
[Alias("j")]
[Parameter(Mandatory=$true,ValueFromPipeline=$true)]
[CronJob]
$Job,
[Switch]
$Force
)
process {
[string[]] $crontab = Get-CronTab -user $UserName
$newcrontab = [List[string]]::new()
$found = $false
$JobAsString = $Job.ToString()
foreach ($line in $crontab) {
if ($JobAsString -ceq $line) {
$found = $true
} else {
$newcrontab.Add($line)
}
}
if (-not $found) {
$e = New-Object System.Exception -ArgumentList "Job not found"
throw $e
}
if ($Force -or $PSCmdlet.ShouldProcess($Job.Command,"Remove")) {
Import-CronTab -user $UserName -crontab $newcrontab
}
}
}
function New-CronJob {
<#
.SYNOPSIS
Create a new cron job
.DESCRIPTION
Create a new job in the cron table. Date and time parameters can be specified
as ranges such as 10-30, as a list: 5,6,7, or combined 1-5,10-15. An asterisk
means 'first through last' (the entire allowed range). Step values can be used
with ranges or with an asterisk. Every 2 hours can be specified as either
0-23/2 or */2.
.EXAMPLE
New-CronJob -Minute 10-30 -Hour 10-20/2 -DayOfMonth */2 -Command "/bin/bash -c 'echo hello' > ~/hello"
.RETURNVALUE
If successful, an object representing the cron job is returned
.PARAMETER UserName
Optional parameter to specify a specific user's cron table
.PARAMETER Minute
Valid values are 0 to 59. If not specified, defaults to *.
.PARAMETER Hour
Valid values are 0-23. If not specified, defaults to *.
.PARAMETER DayOfMonth
Valid values are 1-31. If not specified, defaults to *.
.PARAMETER Month
Valid values are 1-12. If not specified, defaults to *.
.PARAMETER DayOfWeek
Valid values are 0-7. 0 and 7 are both Sunday. If not specified, defaults to *.
.PARAMETER Command
Command to execute at the scheduled time and day.
#>
[CmdletBinding()]
param (
[ArgumentCompleter( { $wordToComplete = $args[2]; Get-CronTabUser | Where-Object { $_ -like "$wordToComplete*" } | Sort-Object } )]
[Alias("u")]
[Parameter(Mandatory=$false)]
[String]
$UserName,
[Alias("mi")][Parameter(Position=1)][String[]] $Minute = "*",
[Alias("h")][Parameter(Position=2)][String[]] $Hour = "*",
[Alias("dm")][Parameter(Position=3)][String[]] $DayOfMonth = "*",
[Alias("mo")][Parameter(Position=4)][String[]] $Month = "*",
[Alias("dw")][Parameter(Position=5)][String[]] $DayOfWeek = "*",
[Alias("c")][Parameter(Mandatory=$true,Position=6)][String] $Command
)
process {
# TODO: validate parameters, note that different versions of crontab support different capabilities
$line = "{0} {1} {2} {3} {4} {5}" -f [String]::Join(",",$Minute), [String]::Join(",",$Hour),
[String]::Join(",",$DayOfMonth), [String]::Join(",",$Month), [String]::Join(",",$DayOfWeek), $Command
[string[]] $crontab = Get-CronTab -user $UserName
$crontab += $line
Import-CronTab -User $UserName -crontab $crontab
ConvertTo-CronJob -crontab $line
}
}
function Get-CronJob {
<#
.SYNOPSIS
Returns the current cron jobs from the cron table
.DESCRIPTION
Returns the current cron jobs from the cron table
.EXAMPLE
Get-CronJob -UserName Steve
.RETURNVALUE
CronJob objects
.PARAMETER UserName
Optional parameter to specify a specific user's cron table
#>
[CmdletBinding()]
[OutputType([CronJob])]
param (
[Alias("u")][Parameter(Mandatory=$false)][String] $UserName
)
process {
$crontab = Get-CronTab -user $UserName
ForEach ($line in $crontab) {
if ($line.Trim().Length -gt 0)
{
ConvertTo-CronJob -crontab $line
}
}
}
}
function Get-CronTabUser {
<#
.SYNOPSIS
Returns the users allowed to use crontab
#>
[CmdletBinding()]
[OutputType([String])]
param()
$allow = '/etc/cron.allow'
if (Test-Path $allow)
{
Get-Content $allow
}
else
{
$users = Get-Content /etc/passwd | ForEach-Object { ($_ -split ':')[0] }
$deny = '/etc/cron.deny'
if (Test-Path $deny)
{
$denyUsers = Get-Content $deny
$users | Where-Object { $denyUsers -notcontains $_ }
}
else
{
$users
}
}
}
| PowerShell | 5 | rdtechie/PowerShell | demos/crontab/CronTab/CronTab.psm1 | [
"MIT"
] |
<!doctype html>
<html>
<head>
<title>{{pageTitle}}</title>
<meta charset="utf-8">
<link rel="stylesheet" href="{{{global.baseUrl}}}/css/main.css" crossorigin="anonymous">
{{#cssFiles}}
<link rel="stylesheet" href="{{{.}}}" crossorigin="anonymous">
{{/cssFiles}}
{{#jsFiles}}
<script src="{{{.}}}"></script>
{{/jsFiles}}
</head>
<body class="page-{{{pageName}}}">
<main class="main">
<div class="container">
{{{contentHtml}}}
</div>
</main>
{{> footer}}
</body>
</html> | HTML+Django | 4 | asahiocean/joplin | packages/server/src/views/layouts/basic.mustache | [
"MIT"
] |
ALTER TABLE hdb_catalog.hdb_table
ADD COLUMN is_enum boolean NOT NULL DEFAULT false;
DROP TRIGGER hdb_table_oid_check ON hdb_catalog.hdb_table;
DROP FUNCTION hdb_catalog.hdb_table_oid_check();
CREATE OR REPLACE VIEW hdb_catalog.hdb_foreign_key_constraint AS
SELECT
q.table_schema :: text,
q.table_name :: text,
q.constraint_name :: text,
min(q.constraint_oid) :: integer as constraint_oid,
min(q.ref_table_table_schema) :: text as ref_table_table_schema,
min(q.ref_table) :: text as ref_table,
json_object_agg(ac.attname, afc.attname) as column_mapping,
min(q.confupdtype) :: text as on_update,
min(q.confdeltype) :: text as on_delete,
json_agg(ac.attname) as columns,
json_agg(afc.attname) as ref_columns
FROM
(SELECT
ctn.nspname AS table_schema,
ct.relname AS table_name,
r.conrelid AS table_id,
r.conname as constraint_name,
r.oid as constraint_oid,
cftn.nspname AS ref_table_table_schema,
cft.relname as ref_table,
r.confrelid as ref_table_id,
r.confupdtype,
r.confdeltype,
UNNEST (r.conkey) AS column_id,
UNNEST (r.confkey) AS ref_column_id
FROM
pg_catalog.pg_constraint r
JOIN pg_catalog.pg_class ct
ON r.conrelid = ct.oid
JOIN pg_catalog.pg_namespace ctn
ON ct.relnamespace = ctn.oid
JOIN pg_catalog.pg_class cft
ON r.confrelid = cft.oid
JOIN pg_catalog.pg_namespace cftn
ON cft.relnamespace = cftn.oid
WHERE
r.contype = 'f'
) q
JOIN pg_catalog.pg_attribute ac
ON q.column_id = ac.attnum
AND q.table_id = ac.attrelid
JOIN pg_catalog.pg_attribute afc
ON q.ref_column_id = afc.attnum
AND q.ref_table_id = afc.attrelid
GROUP BY q.table_schema, q.table_name, q.constraint_name;
CREATE VIEW hdb_catalog.hdb_column AS
WITH primary_key_references AS (
SELECT fkey.table_schema AS src_table_schema
, fkey.table_name AS src_table_name
, fkey.columns->>0 AS src_column_name
, json_agg(json_build_object(
'schema', fkey.ref_table_table_schema,
'name', fkey.ref_table
)) AS ref_tables
FROM hdb_catalog.hdb_foreign_key_constraint AS fkey
JOIN hdb_catalog.hdb_primary_key AS pkey
ON pkey.table_schema = fkey.ref_table_table_schema
AND pkey.table_name = fkey.ref_table
AND pkey.columns::jsonb = fkey.ref_columns::jsonb
WHERE json_array_length(fkey.columns) = 1
GROUP BY fkey.table_schema
, fkey.table_name
, fkey.columns->>0)
SELECT columns.table_schema
, columns.table_name
, columns.column_name AS name
, columns.udt_name AS type
, columns.is_nullable
, columns.ordinal_position
, coalesce(pkey_refs.ref_tables, '[]') AS primary_key_references
FROM information_schema.columns
LEFT JOIN primary_key_references AS pkey_refs
ON columns.table_schema = pkey_refs.src_table_schema
AND columns.table_name = pkey_refs.src_table_name
AND columns.column_name = pkey_refs.src_column_name;
CREATE OR REPLACE VIEW hdb_catalog.hdb_table_info_agg AS (
select
tables.table_name as table_name,
tables.table_schema as table_schema,
coalesce(columns.columns, '[]') as columns,
coalesce(pk.columns, '[]') as primary_key_columns,
coalesce(constraints.constraints, '[]') as constraints,
coalesce(views.view_info, 'null') as view_info
from
information_schema.tables as tables
left outer join (
select
c.table_name,
c.table_schema,
json_agg(
json_build_object(
'name', name,
'type', type,
'is_nullable', is_nullable :: boolean,
'references', primary_key_references
)
) as columns
from
hdb_catalog.hdb_column c
group by
c.table_schema,
c.table_name
) columns on (
tables.table_schema = columns.table_schema
AND tables.table_name = columns.table_name
)
left outer join (
select * from hdb_catalog.hdb_primary_key
) pk on (
tables.table_schema = pk.table_schema
AND tables.table_name = pk.table_name
)
left outer join (
select
c.table_schema,
c.table_name,
json_agg(constraint_name) as constraints
from
information_schema.table_constraints c
where
c.constraint_type = 'UNIQUE'
or c.constraint_type = 'PRIMARY KEY'
group by
c.table_schema,
c.table_name
) constraints on (
tables.table_schema = constraints.table_schema
AND tables.table_name = constraints.table_name
)
left outer join (
select
table_schema,
table_name,
json_build_object(
'is_updatable',
(is_updatable::boolean OR is_trigger_updatable::boolean),
'is_deletable',
(is_updatable::boolean OR is_trigger_deletable::boolean),
'is_insertable',
(is_insertable_into::boolean OR is_trigger_insertable_into::boolean)
) as view_info
from
information_schema.views v
) views on (
tables.table_schema = views.table_schema
AND tables.table_name = views.table_name
)
);
| SQL | 4 | gh-oss-contributor/graphql-engine-1 | server/src-rsr/migrations/19_to_20.sql | [
"Apache-2.0",
"MIT"
] |
select minMap(arrayJoin([([1], [null]), ([1], [null])])); -- { serverError 43 }
select maxMap(arrayJoin([([1], [null]), ([1], [null])])); -- { serverError 43 }
select sumMap(arrayJoin([([1], [null]), ([1], [null])])); -- { serverError 43 }
select sumMapWithOverflow(arrayJoin([([1], [null]), ([1], [null])])); -- { serverError 43 }
select minMap(arrayJoin([([1, 2], [null, 11]), ([1, 2], [null, 22])]));
select maxMap(arrayJoin([([1, 2], [null, 11]), ([1, 2], [null, 22])]));
select sumMap(arrayJoin([([1, 2], [null, 11]), ([1, 2], [null, 22])]));
select sumMapWithOverflow(arrayJoin([([1, 2], [null, 11]), ([1, 2], [null, 22])]));
| SQL | 3 | pdv-ru/ClickHouse | tests/queries/0_stateless/01422_map_skip_null.sql | [
"Apache-2.0"
] |
xquery version "1.0" encoding "UTF-8";
(: the prefix declaration for our custom extension :)
declare namespace efx = "http://test/saxon/ext";
<transformed extension-function-render="{efx:simple(/body/text())}" /> | XQuery | 4 | vkasala/camel-quarkus | integration-tests/saxon/src/main/resources/transformWithExtension.xquery | [
"Apache-2.0"
] |
<mt:Ignore>
# =======================
#
# ウィジェット-ブログ新着-カード
#
# =======================
</mt:Ignore>
<mt:SetVar name="entry_count" value="0" />
<mt:Entries category="NOT xxx" sort_by="authored_on" sort_order="descend" limit="6">
<mt:EntriesHeader>
<div class="widget widget-recent-card">
<mt:Unless name="__is_sub__" eq="1" note="サイドメニュー内ではないとき: rowを生成する">
<div class="row js-flatheight">
</mt:Unless>
</mt:EntriesHeader>
<mt:If name="__is_sub__" eq="1">
<mt:Include module="記事ループ-カード" tag="p" />
<mt:Else>
<div class="col-sm-4">
<mt:Include module="記事ループ-カード" />
<!-- /.col-sm-4 --></div>
</mt:If>
<mt:SetVarBlock name="__post_par__"><mt:Var name="__counter__" op="%" value="3" /></mt:SetVarBlock>
<mt:Unless name="__is_sub__" eq="1">
<mt:If name="__post_par__" eq="0">
<!-- /.row --></div>
<div class="row js-flatheight">
</mt:If>
</mt:Unless>
<mt:EntriesFooter>
<mt:Unless name="__is_sub__" eq="1">
<!-- /.row --></div>
</mt:Unless>
<!-- /.widget --></div>
</mt:EntriesFooter>
</mt:Entries>
| MTML | 4 | webbingstudio/mt_theme_echo_bootstrap | dist/themes/echo_bootstrap/templates/widget_recent_card.mtml | [
"MIT"
] |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
my ($tree);
for my $a (0...3) {
for my $b (0...2) {
for my $c (0...2) {
for my $d (0...3) {
$tree->{$a}{$b}{$c}{$d} = [''];
}
}
}
}
check_archive ($tree);
pass;
| ChucK | 2 | nguyenvannam2698/os_pintos_20211 | src/tests/filesys/extended/dir-mk-tree-persistence.ck | [
"MIT"
] |
C Copyright(c) 1997, Space Science and Engineering Center, UW-Madison
C Refer to "McIDAS Software Acquisition and Distribution Policies"
C in the file mcidas/data/license.txt
C *** $Id: kbxmsat.dlm,v 1.1 2000/07/24 13:50:41 gad Exp $ ***
C ? REALTIME METEOSAT CALIBRATION SEE KBXMET FOR OLD TAPE RESTORES
INTEGER FUNCTION KBXINI(CIN,COUT,IOPT)
IMPLICIT NONE
CHARACTER*4 CIN
CHARACTER*4 COUT
INTEGER IOPT(*)
! symbolic constants & shared data
INCLUDE 'areaparm.inc'
INTEGER JTYPE
INTEGER ISOU
INTEGER IDES
INTEGER JOPT(NUMAREAOPTIONS)
COMMON/METXXX/JTYPE,ISOU,IDES,JOPT
! external functions
! local variables
CALL MOVW(NUMAREAOPTIONS,IOPT,JOPT)
JTYPE=0
ISOU=IOPT(1)
IDES=IOPT(2)
IF(CIN.EQ.'RAW '.AND.COUT.EQ.'RAD ') JTYPE=1
IF(CIN.EQ.'RAW '.AND.COUT.EQ.'TEMP') JTYPE=2
IF(CIN.EQ.'RAW '.AND.COUT.EQ.'BRIT') JTYPE=3
IF(CIN.EQ.'RAW '.AND.COUT.EQ.'MODB') JTYPE=3
IF(JTYPE.EQ.0) GO TO 900
KBXINI=0
RETURN
900 CONTINUE
KBXINI=-1
RETURN
END
INTEGER FUNCTION KBXCAL(CALB,IDIR,NVAL,JBAND,IBUF)
IMPLICIT NONE
INTEGER CALB(*)
INTEGER IDIR(*)
INTEGER NVAL
INTEGER JBAND
INTEGER IBUF(*)
! symbolic constants & shared data
INCLUDE 'areaparm.inc'
INTEGER NUM
PARAMETER (NUM=34)
INTEGER JTYPE
INTEGER ISOU
INTEGER IDES
INTEGER JOPT(NUMAREAOPTIONS)
COMMON/METXXX/JTYPE,ISOU,IDES,JOPT
CHARACTER*4 CALTYP
COMMON/BRKPNT/CALTYP
! external functions
INTEGER BRKVAL
INTEGER GRYSCL
! local variables
INTEGER I
INTEGER ICAL
INTEGER IBAND
INTEGER IE
INTEGER IOFF
INTEGER ITABLE(256)
INTEGER J
REAL A
REAL B
REAL BBC
REAL COEF(4,NUM)
REAL E
REAL FVAL
REAL XCAL(2)
REAL XCO
REAL XRAD(NUM)
REAL XTEMP(NUM)
! initialized variables
! DATA M3/ #0000D4F3 /,M4/ #0000D4F4 /
! NOTE #D4F3= 54515 , #D4F4=54516
REAL YCAL(2)
INTEGER ITEMP
INTEGER INC
INTEGER LASARA
INTEGER LASTYP
INTEGER IP2
INTEGER NEWCAL
INTEGER LASBND
INTEGER ISEN
INTEGER M3
INTEGER M4
INTEGER M5
INTEGER M6
INTEGER M7
INTEGER IRAD(NUM,18)
DATA YCAL / .04,.008 /
DATA ITEMP / 165 /
DATA INC / 5 /
DATA LASARA / -999 /
DATA LASTYP / -1 /
DATA IP2 / 88224 /
DATA NEWCAL / 89128 /
DATA LASBND / -999 /
DATA M3 / 54515 /
DATA M4 / 54516 /
DATA M5 / 54517 /
DATA M6 / 54518 /
DATA M7 / 54519 /
C
C---RADIANCES VALUES FOR 165K TO 330K BY 5 DEGREES
C--- 11 MU FOLLOWED BY 6 MU (REPEAT FOR M3 SATELLITE)
C--- FOLLOWED BY M4, M5, M6 & M7 (PRIMARY AND SECONDARY IR & WV SENSORS)
C
DATA ((IRAD(I,J),I=1,NUM),J=1,4)/
&0217,0271,0335,0409,0494,0591,0700,0823,0959,1111,1277,1459,
&1658,1873,2106,2356,2623,2910,3214,3537,3879,4239,4619,5017,
&5435,5872,6327,6802,7296,7808,8339,8889,9457,10043,
&0012,0017,0025,0035,0049,0066,0089,0117,0153,0196,0250,0315,
&0392,0484,0592,0719,0866,1035,1229,1450,1701,1983,2299,2651,
&3043,3477,3954,4479,5052,5677,6357,7093,7889,8745,
&0230,0287,0354,0432,0521,0622,0737,0865,1008,1167,1341,1531,
&1739,1963,2206,2467,2746,3044,3362,3698,4054,4429,4825,5239,
&5674,6128,6602,7096,7609,8141,8693,9264,9854,10463,
&0014,0021,0030,0043,0059,0080,0107,0141,0183,0235,0298,0375,
&0467,0575,0703,0852,1024,1223,1451,1709,2002,2331,2700,3111,
&3567,4071,4626,5235,5900,6625,7411,8263,9183,10172/
DATA ((IRAD(I,J),I=1,NUM),J=5,6)/
&0300,0475,0587,0717,0867,1037,1230,1446,1687,1954,2248,2570,
&2921,3302,3713,4155,4630,5136,5676,6248,6854,7494,8167,8875,
&9616,10392,11201,12045,12922,13833,14777,15755,16765,17809,
&0007,0015,0022,0031,0043,0060,0081,0107,0141,0183,0235,0299,
&0375,0466,0574,0702,0850,1023,1221,1449,1707,2000,2330,2700,
&3113,3571,4078,4636,5250,5921,6653,7448,8310,9241/
DATA ((IRAD(I,J),I=1,NUM),J=7,8)/
&0368,0478,0590,0721,0871,1042,1236,1453,1695,1963,2258,2582,
&2934,3317,3730,4175,4651,5160,5702,6277,6886,7529,8206,8917,
&9662,10441,11255,12103,12985,13900,14850,15832,16848,17897,
&0010,0018,0026,0037,0052,0072,0098,0130,0172,0223,0286,0363,
&0457,0568,0700,0856,1038,1248,1492,1770,2087,2447,2851,3305,
&3812,4375,4999,5686,6441,7268,8169,9150,10212,11362/
DATA ((IRAD(I,J),I=1,NUM),J=9,10)/
&0348,0452,0559,0684,0827,0990,1175,1382,1614,1870,2153,2462,
&2800,3166,3563,3989,4446,4935,5455,6008,6593,7211,7861,8545,
&9262,10012,10795,11612,12461,13343,14257,15204,16183,17194,
&0010,0017,0025,0035,0049,0068,0092,0122,0161,0209,0269,0341,
&0429,0534,0658,0805,0977,1176,1405,1668,1967,2307,2689,3118,
&3598,4130,4720,5370,6085,6867,7721,8649,9656,10744/
DATA ((IRAD(I,J),I=1,NUM),J=11,12)/
&0387,0505,0624,0761,0919,1099,1302,1530,1784,2065,2374,2713,
&3082,3482,3913,4378,4876,5407,5972,6572,7207,7877,8582,9323,
&10098,10910,11756,12638,13555,14507,15493,16514,17569,18658,
&0008,0015,0022,0032,0044,0061,0082,0110,0145,0188,0242,0307,
&0385,0479,0591,0722,0876,1054,1259,1494,1762,2065,2406,2789,
&3217,3692,4217,4797,5433,6130,6890,7716,8611,9580/
DATA ((IRAD(I,J),I=1,NUM),J=13,14)/
&0387,0503,0621,0758,0915,1094,1296,1523,1776,2055,2363,2700,
&3067,3466,3896,4358,4853,5382,5945,6543,7175,7842,8544,9281,
&10053,10861,11704,12582,13495,14443,15425,16442,17492,18577,
&0008,0015,0022,0031,0044,0061,0082,0110,0144,0187,0241,0306,
&0384,0478,0589,0720,0873,1051,1256,1490,1758,2060,2401,2784,
&3211,3685,4210,4790,5426,6122,6881,7707,8602,9570/
DATA ((IRAD(I,J),I=1,NUM),J=15,16)/
&0537,0667,0822,1002,1207,1441,1704,1999,2328,2690,3089,3526,
&4000,4514,5069,5665,6303,6983,7707,8474,9285,10141,11040,
&11984,12973,14006,15083,16205,17371,18580,19833,21130,22469,
&23850,
&0013,0021,0030,0043,0060,0082,0111,0147,0193,0250,0320,0405,
&0507,0628,0772,0941,1138,1366,1627,1927,2267,2651,3083,3566,
&4105,4703,5363,6089,6886,7756,8705,9734,10849,12052/
DATA ((IRAD(I,J),I=1,NUM),J=17,18)/
&0534,0664,0818,0996,1200,1433,1695,1988,2315,2676,3072,3506,
&3978,4490,5041,5634,6268,6945,7664,8427,9234,10084,10979,
&11918,12901,13928,14999,16115,17274,18477,19723,21012,22343,
&23717,
&0011,0020,0030,0042,0059,0080,0108,0144,0189,0244,0313,0396,
&0496,0615,0756,0922,1115,1339,1596,1890,2224,2602,3026,3502,
&4031,4619,5268,5983,6767,7624,8558,9571,10669,11854/
C
C*********************************************************
C
C
C
C
KBXCAL=0
C
C--- BECAUSE MSAT HAS SINGLE BANDS, NOT NUMBERED AS 1, WE MUST DEFAULT TO
C--- THE CORRECT BAND NUMBER IF IT ISN'T SPECIFIED. THIS TEST WILL NOT
C--- TRIGGER ON MULTI-BANDED IMAGES, OR IF A SINGLE NON-EXISTENT BAND
C--- IS REQUESTED.
C
IBAND=JBAND
IF(IBAND.EQ.0) THEN
IF(IDIR(19).EQ. 1) IBAND=1
IF(IDIR(19).EQ.128) IBAND=8
IF(IDIR(19).EQ.512) IBAND=10
END IF
IF(LASARA.NE.IDIR(33).OR.JTYPE.NE.LASTYP.OR.
& LASBND.NE.IBAND) THEN
LASBND=IBAND
LASARA=IDIR(33)
LASTYP=JTYPE
C
C--- IDENTIFY AS A VISIBLE BAND, UNLESS BAND IS 8 OR 10
C
IF(IBAND.NE.8.AND.IBAND.NE.10) THEN
IF ((CALTYP.EQ.'BRIT').OR.(CALTYP.EQ.'RAW')) THEN
DO 1 J=0,255
ITABLE(J+1) = BRKVAL(REAL(J))
1 CONTINUE
ELSE
DO 5 J=0,255
ITABLE(J+1) = J
5 CONTINUE
ENDIF
GO TO 150
ENDIF
C
C--- END OF VISIBLE BAND LOOKUP TABLE GENERATION
C
C
C--- BEGIN IR BAND RADIANCE TO TEMPERATURE TABLE GENERATION
C--- WORDS 21-24 OF AREA DIRECTORY ARE MSAT CALIBRATION CONSTANTS:
C
C 21: Satellite ID: M3-M7 (after (89128)
C Blackbody constant (prior to 89128)
C
C 22: B = Slope for Radiance (after(89128)
C Band 8 Slope Constant (prior to 89128) unused if IDIR(21)=0)
C
C 23: XCO = Zero Rad. Offset (after 89128)
C Band 10 Slope Constant (prior to 89128) unused if IDIR(21)=0)
C
C 24: Sensor ID for a single banded image (1,2, or 0 if undefined)
C
C NOTE THAT AS OF THE MAY 1996 UPGRADE, THE CALIBRATION BLOCK FOR A
C McIDAS AREA WILL CONTAIN THE FIRST 480 BYTES OF THE INTERPRETATION
C DATA BLOCK TRANSMITTED WITH THE METEOSAT SIGNAL.
C
C THE CALIBRATION BLOCK FORMAT WILL BE AS FOLLOWS:
C WORD 1: "MET1" -- Meteosat Calibration Format #1
C (format identifier for calibration block)
C 2-8: Reserved for McIDAS
C 9-128: Bytes 0-479 of the Interpretation Data Block
C
C THIS IS BEING DONE IN PREPARATION FOR MULTI-BANDED AREAS AND USE OF
C X-SECTOR DATA. AT SOME FUTURE TIME, M8 OR LATER, USE OF THE AREA
C DIRECTORY FOR STORING CALIBRATION CONSTANTS WILL BE DISCONTINUED,
C AND THE SIZE OF THE CALIBRATION BLOCK WILL PROBABLY INCREASE AS WELL.
C RESEARCHERS WHO USE CALIBRATION INFORMATION SHOULD TAKE NOTE OF THIS
C COMING CHANGE AND START ACQUIRING CALIBRATION CONSTANTS FROM THE
C CALIBRATION BLOCK INSTEAD OF THE AREA DIRECTORY.
C
C FOR THE PRESENT, UNTIL THE X-SECTOR DOCUMENTATION STABILIZES, X-SECTOR
C IMAGES WILL BE IDENTIFIED AS VISR/BRIT CALIBRATION, NOT MSAT/BRIT, AND
C WILL BE IDENTIFIED AS BAND 1, WITH "RT MSAT MX" PLACED IN THE MEMO FIELD.
C NO CALIBRATED OR NAVIGATED DATA WILL CURRENTLY BE AVAILABLE FROM SUCH
C AREAS.
C
XCO = 5.0 ! Default zero radiance level = 5 DN
! (we won't allow negative radiances though)
B = 0.0 ! Default slope (should never be used!!!)
IOFF = 1 ! Default Offset into Temp tables
! Tables alternate 11 MU & 6 MU
C
C--- WHICH SATELLITE?? P2 OPERATION 11 AUG 1988 (88224 UP TO 89128)
C
IF(IDIR(4).GE.IP2) IOFF=2
C
C--- CHECK FOR NEWCAL (89128 OR AFTER), BUT NOT IF IDIR(4) INDICATES CAL BLOCK
C--- SHOULD BE USED INSTEAD (AFTER A CERTAIN DATE IN 1997-8 CALLED NEWFMT,
C--- WHEN THE CONSTANTS WILL BE REMOVED FROM THE AREA DIRECTORY 21-24).
C--- AS OF MAY 1996, THAT INFORMATION IS NOW DUPLICATED IN CAL BLOCK
C--- IF(IDIR(4).GE.NEWFMT) use the cal block for newest image slope-offset
C
IF(IDIR(4).GE.NEWCAL) THEN
C
C--- NOMINAL NEW CALIBRATION (M3-M6 SLOPE & OFFSET IN IDIR ARE SCALED INTEGERS)
C
B=IDIR(22)/100000. ! Slope constant for radiance
XCO=IDIR(23)/10. ! Offset constant (zero radiance level)
ISEN=IDIR(24) ! Primary or backup sensor ID (M5-M6)
C--- INDICES NEEDED FOR M3 ONLY
ICAL=1 ! Index to cal constants for band 8
IF(IBAND.EQ.10) ICAL=2 ! Index to cal constants for band 10
C--- CHECK FOR VALID SENSOR ID FOR M5, M6 & M7 (1 or 2)
C--- IF UNUSED (M3 & M4), VALUE MUST BE 0
C
IF(ISEN.LT.0.OR.ISEN.GT.2) THEN
CALL EDEST('Invalid sensor ID for band ',IBAND)
CALL EDEST('Valid IR sensors are 1, 2, or 0, not ',ISEN)
KBXCAL=-1
END IF
C
C--- GET INDEX FOR TEMP TABLES -- LATE M3 (AFTER 89128), AND M4-M7
C
IF (IDIR(21).EQ.M3.AND.IBAND.EQ. 8) THEN
IOFF=3
ELSE IF(IDIR(21).EQ.M3.AND.IBAND.EQ.10) THEN
IOFF=4
ELSE IF(IDIR(21).EQ.M4.AND.IBAND.EQ. 8) THEN
IOFF=5
ELSE IF(IDIR(21).EQ.M4.AND.IBAND.EQ.10) THEN
IOFF=6
ELSE IF(IDIR(21).EQ.M5.AND.IBAND.EQ. 8.AND.ISEN.EQ.1) THEN
IOFF=7 ! IR1
ELSE IF(IDIR(21).EQ.M5.AND.IBAND.EQ.10.AND.ISEN.EQ.1) THEN
IOFF=8 ! WV1
ELSE IF(IDIR(21).EQ.M5.AND.IBAND.EQ. 8.AND.ISEN.EQ.2) THEN
IOFF=9 ! IR2
ELSE IF(IDIR(21).EQ.M5.AND.IBAND.EQ.10.AND.ISEN.EQ.2) THEN
IOFF=10 ! WV2
ELSE IF(IDIR(21).EQ.M6.AND.IBAND.EQ. 8.AND.ISEN.EQ.1) THEN
IOFF=11 ! IR1
ELSE IF(IDIR(21).EQ.M6.AND.IBAND.EQ.10.AND.ISEN.EQ.1) THEN
IOFF=12 ! WV1
ELSE IF(IDIR(21).EQ.M6.AND.IBAND.EQ. 8.AND.ISEN.EQ.2) THEN
IOFF=13 ! IR2
ELSE IF(IDIR(21).EQ.M6.AND.IBAND.EQ.10.AND.ISEN.EQ.2) THEN
IOFF=14 ! WV2
ELSE IF(IDIR(21).EQ.M7.AND.IBAND.EQ. 8.AND.ISEN.EQ.1) THEN
IOFF=15 ! IR1
ELSE IF(IDIR(21).EQ.M7.AND.IBAND.EQ.10.AND.ISEN.EQ.1) THEN
IOFF=16 ! WV1
ELSE IF(IDIR(21).EQ.M7.AND.IBAND.EQ. 8.AND.ISEN.EQ.2) THEN
IOFF=17 ! IR2
ELSE IF(IDIR(21).EQ.M7.AND.IBAND.EQ.10.AND.ISEN.EQ.2) THEN
IOFF=18 ! WV2
ELSE
CALL EDEST('TABLE UNIDENTIFIED: IDIR(21)=',IDIR(21))
CALL EDEST(' IBAND=',IBAND)
CALL EDEST(' SENSOR=',IDIR(24))
CALL EDEST(' OFFSET=',IOFF)
END IF
ELSE IF(IDIR(21).EQ.0) THEN
C
C--- EARLY M3 (PRIOR TO 89128 NO CAL CONSTANTS WERE IN IDIR)
C
A=YCAL(ICAL)
B=1.0
B=B*A
ELSE
C
C--- LATE M3 -- (CONSTANTS IN IDIR PRIOR TO 89128 DEFINED DIFFERENTLY)
C
BBC=IDIR(21)/100.
XCAL(1)=IDIR(22)/1000000.
XCAL(2)=IDIR(23)/1000000.
IF(IDIR(23).LT.5000) XCAL(2)=IDIR(23)/100000.
B=121./BBC
A=XCAL(ICAL)
B=B*A
ENDIF
IF(B.EQ.0.0) THEN
CALL EDEST('ERROR: Radiance slope = 0.0',0)
CALL EDEST(' Check IDIR(21-24)',0)
END IF
C
C---USE BREAKPOINT TABLE TO GET MODIFIED BRIGHTNESS FROM RAW
C
IF(CALTYP .EQ.'RAW'.AND.JTYPE .EQ.3) THEN
DO 10 I=0,255
ITABLE(I+1) = BRKVAL(REAL(I))
10 CONTINUE
GOTO 150
ENDIF
C
C---CALCULATE LINEAR RADIANCE VALUES FROM RAW (NEG VALUES NOT PERMITTED)
C
IF (CALTYP .EQ. 'RAD'.AND. JTYPE.EQ.3) THEN
DO 15 I=0,255
E=MAX(0.0,B*(I-XCO))
ITABLE(I+1) = BRKVAL(REAL(E))
15 CONTINUE
GO TO 150
ELSE
DO 20 I=0,255
E=B*(I-XCO)
IE=MAX0(0,NINT(E*1000.))
ITABLE(I+1)=IE
20 CONTINUE
IF(JTYPE.EQ.1) GO TO 150
ENDIF
C
C---CONVERT RADIANCE VALUES TO TEMPERATURE
C
DO 30 I=1,NUM
XTEMP(I)=10.*(ITEMP+(I-1)*INC)
XRAD(I)=IRAD(I,IOFF)
30 CONTINUE
CALL ASSPL2(NUM,XRAD,XTEMP,COEF)
DO 60 I=1,256
IF ((CALTYP .EQ.'TEMP') .AND. (JTYPE.EQ.3)) THEN
ITABLE(I)=
& BRKVAL(REAL(FVAL(NUM,REAL(ITABLE(I)),XRAD,COEF)/10))
ELSE
ITABLE(I)=NINT(FVAL(NUM,REAL(ITABLE(I)),XRAD,COEF))
ENDIF
60 CONTINUE
IF(JTYPE.EQ.2) GO TO 150
IF ((CALTYP .EQ.'TEMP') .AND. (JTYPE.EQ.3))THEN
GOTO 150
ENDIF
C
C---CONVERT TEMPERATURES TO GRAY SCALE
C
IF ((CALTYP .EQ. 'BRIT').AND.(JTYPE .EQ.3)) THEN
DO 70 I=1,256
ITABLE(I) = BRKVAL(REAL(GRYSCL(ITABLE(I)/10.)))
70 CONTINUE
ELSE
DO 80 I=1,256
ITABLE(I)=GRYSCL(ITABLE(I)/10.)
80 CONTINUE
ENDIF
C
C---FINISHED, NEW LOOKUP TABLE GENERATED
C
150 CONTINUE
ENDIF
C
C---APPLY LOOKUP TABLE TO DATA
C
CALL MPIXTB(NVAL,ISOU,IDES,IBUF,ITABLE)
RETURN
END
INTEGER FUNCTION KBXOPT(CFUNC,IIN,IOUT)
IMPLICIT NONE
CHARACTER*4 CFUNC
INTEGER IIN(*)
INTEGER IOUT(*)
! symbolic constants & shared data
INCLUDE 'areaparm.inc'
INTEGER JTYPE
INTEGER ISOU
INTEGER IDES
INTEGER JOPT(NUMAREAOPTIONS)
COMMON/METXXX/JTYPE,ISOU,IDES,JOPT
CHARACTER*4 CALTYP
COMMON/BRKPNT/CALTYP
! external functions
INTEGER ISCHAR
INTEGER LIT
! local variables
CHARACTER*8 CFILE
INTEGER *4 BRKSET
IF(CFUNC.EQ.'KEYS') THEN
C--- IIN CONTAINS THE FRAME DIRECTORY
IF(IIN(4).EQ.8.OR.IIN(4).EQ.10) THEN
IOUT(1)=4
IOUT(2)=LIT('RAW ')
IOUT(3)=LIT('RAD ')
IOUT(4)=LIT('TEMP')
IOUT(5)=LIT('BRIT')
ELSE
IOUT(1)=2
IOUT(2)=LIT('RAW ')
IOUT(3)=LIT('BRIT')
ENDIF
C
C--- IF THE FRAME DIRECTORY HAS THE BREAKPOINT TABLE NAME IN IT, SET BREAKPOINT
C
IF (ISCHAR(IIN(38)).EQ.1) THEN
CALL MOVWC(IIN(38),CFILE)
IF (BRKSET(CFILE,CALTYP) .NE.0) THEN
KBXOPT = -3
RETURN
ENDIF
ENDIF
KBXOPT=0
C
C--- BRKP OPTION WILL SET UP THE BREAKPOINT TABLE TO BE USED IN CAL
C
ELSE IF (CFUNC .EQ.'BRKP') THEN
CALL MOVWC(IIN(1),CFILE)
IF (BRKSET(CFILE,CALTYP).NE.0) THEN
KBXOPT = -3
RETURN
ENDIF
KBXOPT = 0
C
C--- INFO OPTION PASSES BACK THE VALID KEYS, UNITS AND SCALING FACTORS
C
ELSE IF (CFUNC .EQ.'INFO') THEN
C
C--- CHECK TO SEE IF VALID BAND
C
IF (IIN(1).LT.1.OR.IIN(1).GT.12) THEN
KBXOPT = -2
RETURN
ENDIF
IF(IIN(1).EQ.8.OR.IIN(1).EQ.10) THEN
IOUT(1) = 4
IOUT(2) = LIT('RAW ')
IOUT(3) = LIT('RAD ')
IOUT(4) = LIT('TEMP')
IOUT(5) = LIT('BRIT')
IOUT(6) = LIT(' ')
IOUT(7) = LIT('WP**')
IOUT(8) = LIT('K ')
IOUT(9) = LIT(' ')
IOUT(10) = 1
IOUT(11) = 1000
IOUT(12) = 10
IOUT(13) = 1
KBXOPT=0
ELSE
IOUT(1) = 2
IOUT(2) = LIT('RAW ')
IOUT(3) = LIT('BRIT')
IOUT(4) = LIT(' ')
IOUT(5) = LIT(' ')
IOUT(6) = 1
IOUT(7) = 1
KBXOPT=0
ENDIF
ELSE
KBXOPT = -1
ENDIF
RETURN
END
C $ FUNCTION GRYSCL(TEMPK) (RCD)
C $ CONVERT A BRIGHTNESS TEMPERATURE TO A GREY SCALE
C $ TEMPK = (R) INPUT TEMPERATURE IN DEGRESS KELVIN
C $$ GRYSCL = CONVERT
INTEGER FUNCTION GRYSCL (TEMPK)
IMPLICIT NONE
REAL TEMPK
! initialized variables
INTEGER CON1
INTEGER CON2
REAL TLIM
DATA CON1 / 418 /
DATA CON2 / 660 /
DATA TLIM / 242.0 /
C CONVERT A BRIGHTNESS TEMPERATURE TO A GREY SCALE
C TEMPK---TEMPERATURE IN DEGREES KELVIN
IF (TEMPK .GE. TLIM) GOTO 100
GRYSCL = MIN0 (CON1 - IFIX (TEMPK), 255)
GOTO 200
100 CONTINUE
GRYSCL = MAX0 (CON2 - IFIX (2 * TEMPK), 0)
200 CONTINUE
RETURN
END
| IDL | 4 | oxelson/gempak | extlibs/AODT/v72/odtmcidas/navcal/navcal/kbxmsat.dlm | [
"BSD-3-Clause"
] |
// 功能:8*8 的矩阵转置,用 BRAM 做缓存
package TransposeBuffer;
import BRAM::*;
// 流式 8x8 矩阵转置器 的接口
interface TransposeBuffer;
method Action rewind; // 重置,如果当前有一块没有完全写完,则撤销其中已有的数据,重新写入
method Action put(int val); // 向矩阵转置器中写入行主序的数据
method ActionValue#(int) get; // 从矩阵转置器中获取列主序的数据
endinterface
// 流式 8x8 矩阵转置器
module mkTransposeBuffer88 (TransposeBuffer);
BRAM2Port#( Tuple3#(bit, UInt#(3), UInt#(3)) , int ) ram <- mkBRAM2Server(defaultValue);
Reg#(Bit#(2)) wblock <- mkReg(0); // 写块号
Reg#(UInt#(3)) wi <- mkReg(0); // 写行号
Reg#(UInt#(3)) wj <- mkReg(0); // 写列号
Reg#(Bit#(2)) rblock <- mkReg(0); // 读块号
Reg#(UInt#(3)) ri <- mkReg(0); // 读行号
Reg#(UInt#(3)) rj <- mkReg(0); // 读列号
// 双缓冲空满判断
Wire#(Bool) empty <- mkWire;
Wire#(Bool) full <- mkWire;
rule empty_full;
empty <= wblock == rblock;
full <= wblock == {~rblock[1], rblock[0]};
endrule
rule read_ram ( !empty );
ram.portB.request.put(BRAMRequest{write: False, responseOnWrite: False, address: tuple3(rblock[0], ri, rj), datain: 0 } );
ri <= ri + 1;
if(ri == 7) begin
rj <= rj + 1;
if(rj == 7)
rblock <= rblock + 1;
end
endrule
PulseWire rewind_call <- mkPulseWire;
method Action rewind if( empty );
rewind_call.send;
wi <= 0;
wj <= 0;
endmethod
method Action put(int val) if( !full && !rewind_call );
ram.portA.request.put(BRAMRequest{write: True, responseOnWrite: False, address: tuple3(wblock[0], wi, wj), datain: val } );
wj <= wj + 1;
if(wj == 7) begin
wi <= wi + 1;
if(wi == 7)
wblock <= wblock + 1;
end
endmethod
method get = ram.portB.response.get;
endmodule
// mkTransposeBuffer88 的 testbench
// 行为:向矩阵转置器中输入 0,1,2,3,...,255 。然后打印输出
module mkTb ();
Reg#(int) cnt <- mkReg(0);
rule up_counter;
cnt <= cnt + 1;
endrule
Reg#(int) indata <- mkReg(0);
Reg#(int) cnt_ref <- mkReg(0);
let transposebuffer <- mkTransposeBuffer88;
(* preempts = "transposebuffer_rewind, transposebuffer_put" *)
rule transposebuffer_rewind (cnt == 0);
transposebuffer.rewind;
endrule
rule transposebuffer_put; // (cnt%2 == 0); // 矩阵转置器 输入,可添加隐式条件来实现不积极输入
transposebuffer.put(indata);
indata <= indata + 1;
endrule
rule transposebuffer_get; // (cnt%3 == 0); // 矩阵转置器 输出并验证,可添加隐式条件来实现不积极输出
cnt_ref <= cnt_ref + 1;
int data_ref = unpack( { pack(cnt_ref)[31:6], pack(cnt_ref)[2:0], pack(cnt_ref)[5:3] } );
int data_out <- transposebuffer.get;
$display("cnt=%3d output_data:%3d reference_data:%3d", cnt, data_out, data_ref);
if(data_out != data_ref) $display("wrong!");
if(data_ref >= 255) $finish;
endrule
endmodule
endpackage
| Bluespec | 5 | Xiefengshang/BSV_Tutorial_cn | src/17.TransposeBuffer/TransposeBuffer.bsv | [
"MIT"
] |
extends Control
onready var _client = $Client
onready var _log_dest = $Panel/VBoxContainer/RichTextLabel
onready var _line_edit = $Panel/VBoxContainer/Send/LineEdit
onready var _host = $Panel/VBoxContainer/Connect/Host
onready var _multiplayer = $Panel/VBoxContainer/Settings/Multiplayer
onready var _write_mode = $Panel/VBoxContainer/Settings/Mode
onready var _destination = $Panel/VBoxContainer/Settings/Destination
func _ready():
_write_mode.clear()
_write_mode.add_item("BINARY")
_write_mode.set_item_metadata(0, WebSocketPeer.WRITE_MODE_BINARY)
_write_mode.add_item("TEXT")
_write_mode.set_item_metadata(1, WebSocketPeer.WRITE_MODE_TEXT)
_destination.add_item("Broadcast")
_destination.set_item_metadata(0, 0)
_destination.add_item("Last connected")
_destination.set_item_metadata(1, 1)
_destination.add_item("All But last connected")
_destination.set_item_metadata(2, -1)
_destination.select(0)
func _on_Mode_item_selected(_id):
_client.set_write_mode(_write_mode.get_selected_metadata())
func _on_Send_pressed():
if _line_edit.text == "":
return
var dest = _destination.get_selected_metadata()
if dest > 0:
dest = _client.last_connected_client
elif dest < 0:
dest = -_client.last_connected_client
Utils._log(_log_dest, "Sending data %s to %s" % [_line_edit.text, dest])
_client.send_data(_line_edit.text, dest)
_line_edit.text = ""
func _on_Connect_toggled( pressed ):
if pressed:
var multiplayer = _multiplayer.pressed
if multiplayer:
_write_mode.disabled = true
else:
_destination.disabled = true
_multiplayer.disabled = true
if _host.text != "":
Utils._log(_log_dest, "Connecting to host: %s" % [_host.text])
var supported_protocols = PoolStringArray(["my-protocol2", "my-protocol", "binary"])
_client.connect_to_url(_host.text, supported_protocols, multiplayer)
else:
_destination.disabled = false
_write_mode.disabled = false
_multiplayer.disabled = false
_client.disconnect_from_host()
| GDScript | 4 | jonbonazza/godot-demo-projects | networking/websocket_chat/client/client_ui.gd | [
"MIT"
] |
<Directory "${VHostRoot}">
Options All
AllowOverride All
Order deny,allow
Allow from all
Satisfy Any
</Directory>
<VirtualHost *:80>
DocumentRoot ${VHostRoot}
ServerName ${VHost}
<IfDefine VHostDomain>
ServerAlias ${VHost}.${VHostDomain}
</IfDefine>
ServerAdmin ${VHostAdmin}
ErrorLog logs/${VHostLog}-error.log
<IfModule log_config_module>
CustomLog logs/${VHostLog}-access.log combined
</IfModule>
php_value error_log ${SRVRoot}/logs/${VHostLog}-error-php.log
php_value mail.log ${SRVRoot}/logs/${VHostLog}-error-php_mail.log
</VirtualHost>
##
## SSL Virtual Host Context
##
<IfModule ssl_module>
<VirtualHost *:443>
DocumentRoot ${VHostRoot}
ServerName ${VHost}
<IfDefine VHostDomain>
ServerAlias ${VHost}.${VHostDomain}
</IfDefine>
ServerAdmin ${VHostAdmin}
ErrorLog logs/${VHostLog}-ssl-error.log
<IfModule log_config_module>
CustomLog logs/${VHostLog}-ssl-accessd.log combined
</IfModule>
php_value error_log ${SRVRoot}/logs/${VHostLog}-error-php.log
php_value mail.log ${SRVRoot}/logs/${VHostLog}-error-php_mail.log
Include conf/extra/httpd-ssl-common.conf
CustomLog "logs/${VHostLog}-ssl-request.log" "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>
</IfModule>
| ApacheConf | 3 | fawno/WAMP-Tools | usr/etc/httpd/vhosts/_default_.vhost | [
"MIT"
] |
const std = @import("std");
const expect = std.testing.expect;
const c = @cImport(@cInclude("a.h"));
test "import C add" {
const result = c.add(2, 1);
try expect(result == 3);
}
| Zig | 4 | lukekras/zig | test/standalone/link_static_lib_as_system_lib/main.zig | [
"MIT"
] |
export const message = "Hello World";
| JavaScript | 0 | 1shenxi/webpack | test/statsCases/output-module/module.js | [
"MIT"
] |
xquery version "3.0";
declare function local:add-log-message($message as xs:string) as empty-sequence()?
{
let $logfile-collection := "/db/apps/exist101/log"
let $logfile-name := "exist101-log.xml"
let $logfile-full := concat($logfile-collection, '/', $logfile-name)
let $logfile-created :=
if(doc-available($logfile-full))then
$logfile-full
else
xmldb:store($logfile-collection, $logfile-name, <eXist101-Log/>)
return
update insert
<LogEntry timestamp="{current-dateTime()}">{$message}</LogEntry>
into doc($logfile-full)/*
};
declare function local:insert-attributes() {
let $elm as element() := doc('/db/Path/To/Some/Document.xml')/*
return (
update insert <NEW/> into $elm,
update insert attribute x { 'y' } into $elm/*[last()],
update insert attribute a { 'b' } into $elm/*[last()]
)
};
declare function local:insert-elem() {
let $elm as element() := doc('/db/Path/To/Some/Document.xml')/*
return
update insert <NEW x="y" a="b"/> into $elm
};
declare function local:insert-elem2() {
let $elm as element() := doc('/db/Path/To/Some/Document.xml')/*
let $new-element as element() := <NEW x="y" a="b"/>
return
update insert $new-element into $elm
};
declare function local:insert-single() {
update insert <LogEntry>Something happened...</LogEntry> into doc('/db/logs/mainlog.xml')/*
};
declare function local:trim-insert() {
let $document := doc('/db/logs/mainlog.xml')
let $newentry := <LogEntry>Something happened...</LogEntry>
return
update delete $document/*/LogEntry[position() ge 10],
if(exists($document/*/LogEntry[1]))then
update insert $newentry preceding $document/*/LogEntry[1]
else
update insert $newentry into $document/*
};
declare function local:attempt-document-node-insert() {
(: This is invalid: :)
let $document as document-node() := <Root><a/></Root>
return
update insert <b/> into $document/*
};
declare function local:attempt-attr-update-with-node() {
update replace doc('/db/test/test.xml')/*/@name with
<a>aaa<b>bbb</b></a>
};
(# exist:batch-transaction #) {
update delete $document/*/LogEntry[position() ge 10],
update insert $newentry preceding $document/*/LogEntry[1]
} | XQuery | 4 | btashton/pygments | tests/examplefiles/test-exist-update.xq | [
"BSD-2-Clause"
] |
import QtQuick 2.3
import QGroundControl.Palette 1.0
/// QGC version of ListVIew control that shows horizontal/vertial scroll indicators
ListView {
id: root
boundsBehavior: Flickable.StopAtBounds
property color indicatorColor: qgcPal.text
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
Component.onCompleted: {
var indicatorComponent = Qt.createComponent("QGCFlickableVerticalIndicator.qml")
indicatorComponent.createObject(root)
indicatorComponent = Qt.createComponent("QGCFlickableHorizontalIndicator.qml")
indicatorComponent.createObject(root)
}
}
| QML | 4 | uavosky/uavosky-qgroundcontrol | src/QmlControls/QGCListView.qml | [
"Apache-2.0"
] |
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!319 &31900000
AvatarMask:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: acorn mask -CopyToAddAMask-
m_Mask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
m_Elements:
- m_Path:
m_Weight: 1
- m_Path: root
m_Weight: 1
- m_Path: root/transRotScale
m_Weight: 1
- m_Path: root/transRotScale/hip
m_Weight: 1
- m_Path: root/transRotScale/hip/chest
m_Weight: 1
- m_Path: root/transRotScale/hip/chest/head
m_Weight: 1
- m_Path: root/transRotScale/hip/chest/head/left_eye
m_Weight: 1
- m_Path: root/transRotScale/hip/chest/head/left_eye/left_pupil
m_Weight: 1
- m_Path: root/transRotScale/hip/chest/head/nose
m_Weight: 1
- m_Path: root/transRotScale/hip/chest/head/right_eye
m_Weight: 1
- m_Path: root/transRotScale/hip/chest/head/right_eye/right_pupil
m_Weight: 1
- m_Path: root/transRotScale/hip/chest/leftUp_arm
m_Weight: 1
- m_Path: root/transRotScale/hip/chest/leftUp_arm/leftLow_arm
m_Weight: 1
- m_Path: root/transRotScale/hip/chest/leftUp_arm/leftLow_arm/left_hand
m_Weight: 1
- m_Path: root/transRotScale/hip/chest/leftUp_arm/leftLow_arm/left_hand/left_thumb
m_Weight: 1
- m_Path: root/transRotScale/hip/chest/rightUp_arm
m_Weight: 1
- m_Path: root/transRotScale/hip/chest/rightUp_arm/rightLow_arm
m_Weight: 1
- m_Path: root/transRotScale/hip/chest/rightUp_arm/rightLow_arm/right_hand
m_Weight: 1
- m_Path: root/transRotScale/hip/chest/rightUp_arm/rightLow_arm/right_hand/right_thumb
m_Weight: 1
- m_Path: root/transRotScale/hip/leftUp_leg
m_Weight: 1
- m_Path: root/transRotScale/hip/leftUp_leg/leftLow_leg
m_Weight: 1
- m_Path: root/transRotScale/hip/leftUp_leg/leftLow_leg/left_foot
m_Weight: 1
- m_Path: root/transRotScale/hip/leftUp_leg/leftLow_leg/left_foot/left_toe
m_Weight: 1
- m_Path: root/transRotScale/hip/rightUp_leg
m_Weight: 1
- m_Path: root/transRotScale/hip/rightUp_leg/rightLow_leg
m_Weight: 1
- m_Path: root/transRotScale/hip/rightUp_leg/rightLow_leg/right_foot
m_Weight: 1
- m_Path: root/transRotScale/hip/rightUp_leg/rightLow_leg/right_foot/right_toe
m_Weight: 1
- m_Path: root/transRotScale/IK_handles
m_Weight: 1
- m_Path: root/transRotScale/IK_handles/head_IK
m_Weight: 1
- m_Path: root/transRotScale/IK_handles/left_elbow_pole
m_Weight: 1
- m_Path: root/transRotScale/IK_handles/left_foot_IK
m_Weight: 1
- m_Path: root/transRotScale/IK_handles/left_hand_IK
m_Weight: 1
- m_Path: root/transRotScale/IK_handles/left_knee_pole
m_Weight: 1
- m_Path: root/transRotScale/IK_handles/right_elbow_pole
m_Weight: 1
- m_Path: root/transRotScale/IK_handles/right_foot_IK
m_Weight: 1
- m_Path: root/transRotScale/IK_handles/right_hand_IK
m_Weight: 1
- m_Path: root/transRotScale/IK_handles/right_knee_pole
m_Weight: 1
- m_Path: root/transRotScale/interaction_objects
m_Weight: 1
| Mask | 2 | diegodelarocha/Acorn | Assets/acorn/animation tools/avatars/avatar masks/acorn mask -CopyToAddAMask-.mask | [
"MIT"
] |
% Program to fetch original source given the XML source coordinates
% Jim Cordy, April 2008
tokens
charlit ""
end tokens
define program
[xml_source_coordinate]
| [source_lines]
end define
define xml_source_coordinate
'< 'source 'file=[stringlit] 'startline=[stringlit] 'endline=[stringlit] '>
end define
define source_lines
[repeat source_line]
end define
define source_line
[repeat not_newline] [newline]
end define
define not_newline
[not newline] [token]
end define
function main
replace [program]
'< source 'file=File[stringlit] 'startline=Start[stringlit] 'endline=End[stringlit] '>
construct Source [repeat source_line]
_ [pragma "-char -nomultiline"] [read File]
construct StartLine [number]
_ [unquote Start]
construct EndLine [number]
_ [unquote End]
by
Source [select StartLine EndLine]
end function
| TXL | 4 | coder-chenzhi/SQA | SourcererCC/parser/java/txl/getoriginal.txl | [
"Apache-2.0"
] |
#
# @expect="/nlist[@name='profile']/list[@name='a']/*[2]=2 and /nlist[@name='profile']/long[@name='b']=2 and /nlist[@name='profile']/long[@name='c']=3 and /nlist[@name='profile']/list[@name='d']/*[2]=7"
# @format=pan
object template list7;
"/a" = list(1, 2);
"/b" = value("/a/-1");
"/c" = {
t = list(3, 4);
t[-2];
};
"/d" = list(5, 6);
"/d/-1" = 7;
| Pan | 3 | aka7/pan | panc/src/test/pan/Functionality/list/list7.pan | [
"Apache-2.0"
] |
Read( "fibonacci.gi" );
ForAll( [ 1 .. 10 ], i -> fibonacci_rec( i ) = fibonacci_internal( i ) );
ForAll( [ 1 .. 10 ], i -> fibonacci_iterative( i ) = fibonacci_internal( i ) );
iterator := fibonacci_iterator( );
ForAll( [ 1 .. 100 ], i -> iterator( ) = fibonacci_internal( i ) );
| GAP | 3 | Mynogs/Algorithm-Implementations | Fibonacci_series/GAP/sebasguts/fibonacci_tests.gi | [
"MIT"
] |
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<installer-gui-script minSpecVersion="1">
<options customize="never"
hostArchitectures="i386"
require-scripts="true"
/>
<title>Haskell Platform {{hpVersion}}</title>
<background file="logo-color.png" mime-type="image/png"
alignment="bottomleft"/>
<welcome file="welcome.rtf" mime-type="text/rtf"/>
<!-- <license file="license.rtf" mime-type="text/rtf"/> -->
<!-- <readme file="readme.rtf" mime-type="text/rtf"/> -->
<!-- <conclusion file="conclusion.rtf" mime-type="text/rtf"/> -->
<choices-outline>
<line choice="default">
<line choice="GHC.choice"/>
<line choice="Libraries.choice"/>
</line>
</choices-outline>
<choice id="default"/>
<choice id="GHC.choice" visible="false">
<pkg-ref id="GHC.pkg-ref"/>
</choice>
<choice id="Libraries.choice" visible="false">
<pkg-ref id="Libraries.pkg-ref"/>
</choice>
<pkg-ref id="GHC.pkg-ref">GHC.pkg</pkg-ref>
<pkg-ref id="Libraries.pkg-ref">HaskellPlatform.pkg</pkg-ref>
<installation-check script="find_gcc()"/>
<volume-check script="true">
<allowed-os-versions>
<os-version min="10.6"/>
</allowed-os-versions>
</volume-check>
<script>
<![CDATA[
function find_gcc() {
var r = system.files.fileExistsAtPath('/usr/bin/gcc');
if (!r) {
my.result.type = 'Warn';
my.result.title = 'Command Line Build Tools Required';
my.result.message = 'The command line build tools (C compiler, linker, etc...) need to be installed. They are an optional part of Xcode, or can be installed independently. See http://hackage.haskell.org/platform/mac.html for details.';
}
return r;
}
]]>
</script>
</installer-gui-script>
| mupad | 3 | bgamari/haskell-platform | hptool/os-extras/osx/installer.dist.mu | [
"BSD-3-Clause"
] |
-- moonscript module
import with_dev from require "spec.helpers"
describe "moonscript.base", ->
with_dev!
it "should create moonpath", ->
path = ";./?.lua;/usr/share/lua/5.1/?.lua;/usr/share/lua/5.1/?/init.lua;/usr/lib/lua/5.1/?.luac;/home/leafo/.luarocks/lua/5.1/?.lua"
import create_moonpath from require "moonscript.base"
assert.same "./?.moon;/usr/share/lua/5.1/?.moon;/usr/share/lua/5.1/?/init.moon;/home/leafo/.luarocks/lua/5.1/?.moon", create_moonpath(path)
| MoonScript | 3 | Shados/moonscript | spec/moonscript_spec.moon | [
"MIT",
"Unlicense"
] |
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">
<!-- Copy all attributes and elements to the output. -->
<xsl:template match="@*|*">
<xsl:copy>
<xsl:apply-templates select="@*|*"/>
</xsl:copy>
</xsl:template>
<xsl:output method="xml" indent="yes" />
<!-- LICENSE* files are installed from rustc dir. -->
<xsl:key name="duplicates-cmp-ids" match="wix:Component[./wix:File[contains(@Source, 'LICENSE')]|./wix:File[contains(@Source, 'rust-installer-version')]]" use="@Id" />
<xsl:template match="wix:Component[key('duplicates-cmp-ids', @Id)]" />
<xsl:template match="wix:ComponentRef[key('duplicates-cmp-ids', @Id)]" />
<xsl:template match="wix:File[contains(@Source, 'README.md')]">
<xsl:copy>
<xsl:apply-templates select="@*|*"/>
<xsl:attribute name="Name">README-CARGO.md</xsl:attribute>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
| XSLT | 5 | Eric-Arellano/rust | src/etc/installer/msi/remove-duplicates.xsl | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
{
// width: 2166, height: 1650, fps: 30,
width: 720, height: 1280, fps: 30,
outPath: './commonFeatures.mp4',
// outPath: './commonFeatures.gif',
audioFilePath: './assets/High [NCS Release] - JPB (No Copyright Music)-R8ZRCXy5vhA.m4a',
defaults: {
transition: { name: 'random' },
layer: { fontPath: './assets/Patua_One/PatuaOne-Regular.ttf' },
},
clips: [
{ duration: 3, transition: { name: 'directional-left' }, layers: [{ type: 'title-background', text: 'EDITLY\nVideo editing framework', background: { type: 'linear-gradient', colors: ['#02aab0', '#00cdac'] } }] },
{ duration: 4, transition: { name: 'dreamyzoom' }, layers: [{ type: 'title-background', text: 'Multi-line text with animated linear or radial gradients', background: { type: 'radial-gradient' } }] },
{ duration: 3, transition: { name: 'directional-right' }, layers: [{ type: 'rainbow-colors' }, { type: 'title', text: 'Colorful backgrounds' }] },
{ duration: 3, layers: [{ type: 'pause' }, { type: 'title', text: 'and separators' }] },
{ duration: 3, transition: { name: 'fadegrayscale' }, layers: [{ type: 'title-background', text: 'Image slideshows with Ken Burns effect', background: { type: 'linear-gradient' } }] },
{ duration: 2.5, transition: { name: 'directionalWarp' }, layers: [{ type: 'image', path: './assets/vertical.jpg', zoomDirection: 'out' }] },
{ duration: 3, transition: { name: 'dreamyzoom' }, layers: [{ type: 'image', path: './assets/img1.jpg', duration: 2.5, zoomDirection: 'in' }, { type: 'subtitle', text: 'Indonesia has many spectacular locations. Here is the volcano Kelimutu, which has three lakes in its core, some days with three different colors!' }, { type: 'title', position: 'top', text: 'With text' }] },
{ duration: 3, transition: { name: 'colorphase' }, layers: [{ type: 'image', path: './assets/img2.jpg', zoomDirection: 'out' }, { type: 'subtitle', text: 'Komodo national park is the only home of the endangered Komodo dragons' }] },
{ duration: 2.5, transition: { name: 'simplezoom' }, layers: [{ type: 'image', path: './assets/img3.jpg', zoomDirection: 'in' }] },
{ duration: 1.5, transition: { name: 'crosszoom', duration: 0.3 }, layers: [{ type: 'video', path: 'assets/kohlipe1.mp4', cutTo: 58 }, { type: 'title', text: 'Videos' }] },
{ duration: 3, transition: { name: 'fade' }, layers: [{ type: 'video', path: 'assets/kohlipe1.mp4', cutFrom: 58 }] },
{ transition: { name: 'fade' }, layers: [{ type: 'video', path: 'assets/kohlipe2.mp4', cutTo: 2.5 }] },
{ duration: 1.5, layers: [{ type: 'video', path: 'assets/kohlipe3.mp4', cutFrom: 3, cutTo: 30 }] },
{ duration: 3, transition: { name: 'crosszoom' }, layers: [{ type: 'gl', fragmentPath: './assets/shaders/3l23Rh.frag' }, { type: 'title', text: 'OpenGL\nshaders' }] },
{ duration: 3, layers: [{ type: 'gl', fragmentPath: './assets/shaders/MdXyzX.frag' }] },
{ duration: 3, layers: [{ type: 'gl', fragmentPath: './assets/shaders/30daysofshade_010.frag' }] },
{ duration: 3, layers: [{ type: 'gl', fragmentPath: './assets/shaders/wd2yDm.frag', speed: 5 }] },
{ duration: 3, layers: [
{ type: 'image', path: './assets/91083241_573589476840991_4224678072281051330_n.jpg' },
{ type: 'news-title', text: 'BREAKING NEWS' },
{ type: 'subtitle', text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.', backgroundColor: 'rgba(0,0,0,0.5)' }
] },
{ duration: 3, layers: [
{ type: 'rainbow-colors' },
{ type: 'video', path: './assets/tungestolen.mp4', resizeMode: 'contain', width: 0.4, height: 0.4, top: 0.05, left: 0.95, originY: 'top', originX: 'right' },
{ type: 'title', position: 'bottom', text: 'Picture-in-Picture' }
] },
{ duration: 3, layers: [{ type: 'editly-banner' }] },
],
}
| JSON5 | 4 | aaverty/editly | examples/commonFeatures.json5 | [
"MIT"
] |
%%{
machine MultitokenDef;
# AddLastToken(ts, tokend) should be implemented except member functions called here
action begin_token {
BeginToken(ts, p);
}
action begin_word {
BeginToken(ts, p, TOKEN_WORD);
}
action begin_number {
BeginToken(ts, p, TOKEN_NUMBER);
}
action update_token {
UpdateToken();
}
action add_token {
AddToken();
}
action update_prefix {
UpdatePrefix(*p);
}
action update_suffix {
UpdateSuffix(*p);
}
# @ATTENTION if '%' is added to subtokdelim it breaks the code in MakeMultitokenEntry(): utf8 = Find(.., PERCENT_CHAR, ..);
# in this case two chars that follow '%' must be checked for one of '0123456789ABCDEF'
# @note when '%' action fired 'p' points to the next character so to take the previous character use 'p[-1]'
tokendelim = ( cc_apostrophe %{ SetTokenDelim(TOKDELIM_APOSTROPHE, p[-1]); } )
| ( cc_minus %{ SetTokenDelim(TOKDELIM_MINUS, p[-1]); } ); # ['-] = tokdelim
multitokendelim = ( cc_plus %{ SetTokenDelim(TOKDELIM_PLUS, p[-1]); } )
| ( cc_underscore %{ SetTokenDelim(TOKDELIM_UNDERSCORE, p[-1]); } )
| ( cc_slash %{ SetTokenDelim(TOKDELIM_SLASH, p[-1]); } )
| ( cc_atsign %{ SetTokenDelim(TOKDELIM_AT_SIGN, p[-1]); } )
| ( cc_dot %{ SetTokenDelim(TOKDELIM_DOT, p[-1]); } ); # [+_/@.] = identdelim + [.]
tokpart = ( tokchar ( tokchar | accent )* ); # | ( yspecialkey );
numpart = ( ydigit ( ydigit | accent )* );
tokfirst = ( ( ( accent* >begin_token ) ( tokpart >begin_word ) ) $update_token %add_token );
tokfirst_special = ( ( ( accent* >begin_token ) ( yspecialkey >begin_word ) ) $update_token %add_token );
toknext = ( tokpart >begin_word $update_token %add_token );
numfirst = ( ( ( accent* >begin_token ) ( numpart >begin_number ) ) $update_token %add_token );
numnext = ( numpart >begin_number $update_token %add_token );
#wordpart = tokfirst;
toksuffix = (cc_numbersign | cc_plus | cc_plus . cc_plus) $update_suffix; # ([#] | [+] | [++])
# - in case of " abc&x301;123 " accent is attached to "abc"
# - 'accent*' cannot be removed from the front 'token' and 'number' because in this case text "abc-&x301;123" or
# "123-&x301;abc" it will be processed incorrectly
# - begin_token can be called twice in case "exa­́mple" so BeginToken() has 'if (CurCharSpan.Len == 0)'
# and it processes only the first call
solidtoken = ( tokfirst ( numnext toknext )* )
| ( numfirst toknext ( numnext toknext )* )
| ( numfirst ( toknext numnext )* )
| ( tokfirst numnext ( toknext numnext )* )
| (tokfirst_special);
multitoken = ( solidtoken ( tokendelim solidtoken ){,4} );
multitokenwithsuffix = ( ( tokprefix $update_prefix )? multitoken toksuffix? );
compositemultitoken = ( multitokenwithsuffix ( multitokendelim multitokenwithsuffix )* );
}%%
| Ragel in Ruby Host | 4 | ZhekehZ/catboost | library/tokenizer/multitoken_v3.rl | [
"Apache-2.0"
] |
%%
%eof{ /*no code same line*/return;
%eof}
%eofthrow{
%eofthrow}
NO_BRACK_IN_CLASS=[^[]
NO_MACRO_IN_LINE=abc=d
UNCLOSED_CLASS = [
DIGITS={DIGIT}+
#if($dialect == '111' || $dialect == '222')
NUMBER_PREFIX=[]
FLOAT_POSTFIX=[dDfF]
#end
NEWLINES=A
"a"
[:digit:]
[a]
(A
| B)
BAD
%% | JFlex | 1 | JojOatXGME/Grammar-Kit | testData/jflex/parser/ParserFixes2.flex | [
"Apache-2.0"
] |
(ns wisp.engine.node
(:require [fs :refer [read-file-sync]]
[wisp.compiler :refer [compile]]))
(set! global.**verbose** (<= 0 (.indexOf process.argv :--verbose)))
(defn compile-path
[path]
(let [source (read-file-sync path :utf8)
output (compile source {:source-uri path})]
(if (:error output)
(throw (:error output))
(:code output))))
;; Register `.wisp` file extension so that
;; modules can be simply required.
(set! (get require.extensions ".wisp")
#(._compile %1 (compile-path %2))) | wisp | 4 | bamboo/wisp | src/engine/node.wisp | [
"BSD-3-Clause"
] |
; Copyright (C) 2008 The Android Open Source Project
;
; 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.
.class blort
.super java/lang/Object
.method public static test1(ZBCSI[I)V
.limit locals 6
.limit stack 3
iload_0
iload_1
if_icmpeq zorch
iload_2
iload_3
if_icmpne zorch
iload 4
aload 5
iconst_0
iaload
if_icmplt zorch
aload 5
iconst_0
iaload
iload_0
if_icmpgt zorch
iload 4
iload_1
if_icmpge zorch
nop
zorch:
return
.end method
.method public static test2(I)Ljava/lang/Object;
.limit locals 2
.limit stack 3
aconst_null
astore 1
aload_1
iconst_0
iaload
iload_0
if_icmpge zorch
nop
zorch:
aconst_null
areturn
.end method
.method public static test3(I[I)Ljava/lang/Object;
.limit locals 3
.limit stack 3
aconst_null
astore 2
frotz:
aload_2
ifnonnull fizmo
aload_1
astore_2
goto frotz
fizmo:
aload_2
iconst_0
iaload
iload_0
if_icmpge zorch
nop
zorch:
aconst_null
areturn
.end method
| Jasmin | 3 | Unknoob/buck | third-party/java/dx/tests/109-int-branch/blort.j | [
"Apache-2.0"
] |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
namespace Microsoft.CodeAnalysis.MSBuild.Logging
{
internal class DiagnosticLogItem
{
public WorkspaceDiagnosticKind Kind { get; }
public string Message { get; }
public string ProjectFilePath { get; }
public DiagnosticLogItem(WorkspaceDiagnosticKind kind, string message, string projectFilePath)
{
Kind = kind;
Message = message ?? throw new ArgumentNullException(nameof(message));
ProjectFilePath = projectFilePath ?? throw new ArgumentNullException(nameof(message));
}
public DiagnosticLogItem(WorkspaceDiagnosticKind kind, Exception exception, string projectFilePath)
: this(kind, exception.Message, projectFilePath)
{
}
public override string ToString() => Message;
}
}
| C# | 4 | samaw7/roslyn | src/Workspaces/Core/MSBuild/MSBuild/Logging/DiagnosticLogItem.cs | [
"MIT"
] |
syntax = "proto3";
package upb_benchmark;
message Empty {}
| Protocol Buffer | 2 | warlock135/grpc | third_party/upb/benchmarks/empty.proto | [
"Apache-2.0"
] |
/* Copyright (c) 2017-2019 Netronome Systems, Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
;TEST_INIT_EXEC nfp-mem i32.ctm:0x80 0x00154d0e 0x04a5001b 0x213cac30 0x08004500
;TEST_INIT_EXEC nfp-mem i32.ctm:0x90 0x006e8806 0x40004011 0x8a761400 0x00021400
;TEST_INIT_EXEC nfp-mem i32.ctm:0xa0 0x0001a9b3 0x17c1005a 0x00000000 0x65580000
;TEST_INIT_EXEC nfp-mem i32.ctm:0xb0 0x0b00b69e 0xd2495148 0xfe71d883 0x724f0800
;TEST_INIT_EXEC nfp-mem i32.ctm:0xc0 0x4500003c 0x5a114000 0x4006a4a8 0x1e000002
;TEST_INIT_EXEC nfp-mem i32.ctm:0xd0 0x1e000001 0xc8190016 0x17b30caf 0x00000000
;TEST_INIT_EXEC nfp-mem i32.ctm:0xe0 0xa0023908 0xe4370000 0x020405b4 0x0402080a
;TEST_INIT_EXEC nfp-mem i32.ctm:0xf0 0xab6d56be 0x00000000 0x01030307
#include <aggregate.uc>
#include <stdmac.uc>
#include <pv.uc>
.reg pkt_vec[PV_SIZE_LW]
aggregate_zero(pkt_vec, PV_SIZE_LW)
move(pkt_vec[0], 0x7b)
move(pkt_vec[2], 0x80)
move(pkt_vec[3], 0xe2)
move(pkt_vec[4], 0x3fc0)
move(pkt_vec[5], ((14 << 24) | ((14 + 20) << 16) |
((14 + 20 + 8 + 8 + 14) << 8) |
(14 + 20 + 8 + 8 + 14 + 20)))
| UnrealScript | 2 | pcasconnetronome/nic-firmware | test/datapath/pkt_ipv4_geneve_tcp_x80.uc | [
"BSD-2-Clause"
] |
use v6;
say qq/
Problem 10
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.
/;
# Answer: 142913828922
# Times:
#
# euler10a (array)
# $n = 200-1 : 0.82s
# $n = 2000-1 : 4.3s (with grep: 5.5s)
# $n = 20000-1: 41.9s (with grep: 53.8s)
# $n = 200000-1: ?
#
# euler10b (sets, take 1)
# $n = 20-1 : 1.3s
# $n = 200-1 : 1:06 minutes
# $n = 2000-1 : ?
# $n = 20000-1:
# $n = 200000-1:
# euler10b2 (sets, take 2)
# $n = 20-1 : 1.3s
# $n = 200-1 : 6.7s
# $n = 2000-1 : > 10 minutes
# $n = 20000-1:
# $n = 200000-1:
# my $n = 200-1;
my $n = 2000000-1;
euler10a($n); # array version
# euler10b($n); # set version, I
# euler10b2($n); # set version, II
#
# Using arrays
#
sub euler10a($n) {
my @primes = 1 xx (1+$n);
for 2..$n -> $i {
next if !@primes[$i];
my $j = 2;
while $i*$j <= $n {
@primes[$i*$j] = 0;
$j++;
}
}
# gather seems to be faster than grep..
say [+] gather for 2..$n-1 { take $_ if @primes[$_] };
# say [+] (2..$n-1).grep({ @primes[$_] });
}
#
# Using sets
# This is too slow now...
#
# sub euler10b($n) {
# my $primes = set 2..$n;
# for 2..$n -> $i {
# next if !$primes.exists($i);
# my $j = 2;
# while $i*$j <= $n {
# $primes = $primes.difference(set $i*$j);
# $j++;
# }
# }
# say $primes;
# say [+] $primes.keys;
# }
# #
# # Using sets, alternative and faster (than euler10b) version
# #
# sub euler10b2($n) {
# my $primes = set 2..$n;
# # weed out the 2's first
# my $j = 2;
# my $twos = set ($j..($n/$j).Int).map: {$_*$j};
# # $primes = $primes.difference($twos);
# $primes (-)= $twos; # shorter variant
# say $primes;
# $j = 3;
# my $max = $primes.max;
# while $j <= ($max/$j).Int {
# # while $j <= ($n/$j).Int {
# say "j: $j";
# # $j += 2 and next if !$primes.exists($j);
# my $s2 = set ($j..($n/$j).Int).map: {$_ * $j};
# # $primes = $primes.difference($s2);
# $primes (-)= $s2;
# $max = $primes.max;
# $j+=2;
# }
# say $primes;
# say [+] $primes.keys;
# }
| Perl6 | 5 | Wikunia/hakank | perl6/euler10.p6 | [
"MIT"
] |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.spark.deploy.yarn
import org.scalatest.matchers.must.Matchers
import org.scalatest.matchers.should.Matchers._
import org.apache.spark.{SparkConf, SparkFunSuite}
import org.apache.spark.util.ManualClock
class FailureTrackerSuite extends SparkFunSuite with Matchers {
override def beforeAll(): Unit = {
super.beforeAll()
}
test("failures expire if validity interval is set") {
val sparkConf = new SparkConf()
sparkConf.set(config.EXECUTOR_ATTEMPT_FAILURE_VALIDITY_INTERVAL_MS, 100L)
val clock = new ManualClock()
val failureTracker = new FailureTracker(sparkConf, clock)
clock.setTime(0)
failureTracker.registerFailureOnHost("host1")
failureTracker.numFailuresOnHost("host1") should be (1)
failureTracker.numFailedExecutors should be (1)
clock.setTime(10)
failureTracker.registerFailureOnHost("host2")
failureTracker.numFailuresOnHost("host2") should be (1)
failureTracker.numFailedExecutors should be (2)
clock.setTime(20)
failureTracker.registerFailureOnHost("host1")
failureTracker.numFailuresOnHost("host1") should be (2)
failureTracker.numFailedExecutors should be (3)
clock.setTime(30)
failureTracker.registerFailureOnHost("host2")
failureTracker.numFailuresOnHost("host2") should be (2)
failureTracker.numFailedExecutors should be (4)
clock.setTime(101)
failureTracker.numFailuresOnHost("host1") should be (1)
failureTracker.numFailedExecutors should be (3)
clock.setTime(231)
failureTracker.numFailuresOnHost("host1") should be (0)
failureTracker.numFailuresOnHost("host2") should be (0)
failureTracker.numFailedExecutors should be (0)
}
test("failures never expire if validity interval is not set (-1)") {
val sparkConf = new SparkConf()
val clock = new ManualClock()
val failureTracker = new FailureTracker(sparkConf, clock)
clock.setTime(0)
failureTracker.registerFailureOnHost("host1")
failureTracker.numFailuresOnHost("host1") should be (1)
failureTracker.numFailedExecutors should be (1)
clock.setTime(10)
failureTracker.registerFailureOnHost("host2")
failureTracker.numFailuresOnHost("host2") should be (1)
failureTracker.numFailedExecutors should be (2)
clock.setTime(20)
failureTracker.registerFailureOnHost("host1")
failureTracker.numFailuresOnHost("host1") should be (2)
failureTracker.numFailedExecutors should be (3)
clock.setTime(30)
failureTracker.registerFailureOnHost("host2")
failureTracker.numFailuresOnHost("host2") should be (2)
failureTracker.numFailedExecutors should be (4)
clock.setTime(1000)
failureTracker.numFailuresOnHost("host1") should be (2)
failureTracker.numFailuresOnHost("host2") should be (2)
failureTracker.numFailedExecutors should be (4)
}
}
| Scala | 5 | OlegPt/spark | resource-managers/yarn/src/test/scala/org/apache/spark/deploy/yarn/FailureTrackerSuite.scala | [
"Apache-2.0"
] |
SmalltalkCISpec {
#loading : [
SCIMetacelloLoadSpec {
#baseline : 'IMAPClient',
#directory : 'packages',
#load : 'Tests',
#platforms : [ #squeak ]
}
],
#testing : {
#coverage : {
#packages : [ 'IMAPClient-Core', 'IMAPClient-Protocol' ]
}
}
}
| STON | 4 | hpi-swa-teaching/IMAPClient | .smalltalk.ston | [
"MIT"
] |
#pragma once
#include "envoy/network/address.h"
namespace Envoy {
namespace Network {
struct ProxyProtocolData {
const Network::Address::InstanceConstSharedPtr src_addr_;
const Network::Address::InstanceConstSharedPtr dst_addr_;
std::string asStringForHash() const {
return std::string(src_addr_ ? src_addr_->asString() : "null") +
(dst_addr_ ? dst_addr_->asString() : "null");
}
};
} // namespace Network
} // namespace Envoy
| C | 4 | dcillera/envoy | envoy/network/proxy_protocol.h | [
"Apache-2.0"
] |
type mytuple = int;
proc foo(t : mytuple, param i : int) where i == 1 {
return 1;
}
proc foo(t : mytuple, param i : int) where i == 2 {
return 2;
}
var t : mytuple;
writeln(t);
t = 4;
writeln(t);
writeln(foo(t, 1));
writeln(foo(t, 2));
| Chapel | 4 | jhh67/chapel | test/types/tuple/deitz/recordAsTuple/test_tuple_record_implementation4.chpl | [
"ECL-2.0",
"Apache-2.0"
] |
/*--------------------------------------------------*/
/* SAS Programming for R Users - code for exercises */
/* Copyright 2016 SAS Institute Inc. */
/*--------------------------------------------------*/
/*SP4R07s01*/
proc iml;
items ={'Groceries','Utilities','Rent','Car Expenses',
'Fun Money','Personal Expenses'};
weeks ={'Week 1','Week 2','Week 3','Week 4'};
amounts ={96 78 82 93,
61 77 62 68,
300 300 300 300,
25 27 98 18,
55 34 16 53,
110 85 96 118};
weeklyIncome ={900 850 1050 950};
weeklyExpenses=amounts[+,];
/*Part A*/
proportionIncomeSpent=weeklyExpenses / weeklyIncome;
reset noname;
print "Proportion of income spent each week",
proportionIncomeSpent[colname=weeks format=percent7.2];
/*Part B*/
proportionIncomeSaved=1 - proportionIncomeSpent;
print "Proportion of income saved each week",
proportionIncomeSaved[colname=weeks format=percent7.2];
/*Part C*/
proportionSpentPerItem=amounts/weeklyIncome;
print "Percentage of income spent on each item, by week",
proportionSpentPerItem [rowname=items
colname=weeks format=percent7.2];
/*Part D*/
weeklyExpenseChange={. . .,
. . .,
. . .,
. . .,
. . .,
. . .};
weeklyExpenseChange [,1]=amounts[,2] - amounts[,1];
weeklyExpenseChange [,2]=amounts[,3] - amounts[,2];
weeklyExpenseChange [,3]=amounts[,4] - amounts[,3];
print "Change in spending from previous week, by item",
weeklyExpenseChange [rowname=items
colname={"Week 2","Week 3", "Week 4"}];
quit;
| SAS | 4 | snowdj/sas-prog-for-r-users | code/SP4R07s01.sas | [
"CC-BY-4.0"
] |
$$ MODE TUSCRIPT
SET data = REQUEST ("http://www.puzzlers.org/pub/wordlists/unixdict.txt")
DICT orderdwords CREATE 99999
COMPILE
LOOP word=data
- "<%" = any token
SET letters=STRINGS (word,":<%:")
SET wordsignatur= ALPHA_SORT (letters)
IF (wordsignatur==letters) THEN
SET wordlength=LENGTH (word)
DICT orderdwords ADD/COUNT word,num,cnt,wordlength
ENDIF
ENDLOOP
DICT orderdwords UNLOAD words,num,cnt,wordlength
SET maxlength=MAX_LENGTH (words)
SET rtable=QUOTES (maxlength)
BUILD R_TABLE maxlength = rtable
SET index=FILTER_INDEX (wordlength,maxlength,-)
SET longestwords=SELECT (words,#index)
PRINT num," ordered words - max length is ",maxlength,":"
LOOP n,w=longestwords
SET n=CONCAT (n,"."), n=CENTER(n,4)
PRINT n,w
ENDLOOP
ENDCOMPILE
| Turing | 3 | LaudateCorpus1/RosettaCodeData | Task/Ordered-words/TUSCRIPT/ordered-words.tu | [
"Info-ZIP"
] |
PING example.com (93.184.216.34) 56(84) bytes of data.
64 bytes from 93.184.216.34: icmp_seq=1 ttl=61 time=172 ms
--- example.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 172.585/172.585/172.585/0.000 ms
| DIGITAL Command Language | 0 | multani/inspec | test/unit/mock/cmd/ping-example.com | [
"Apache-2.0"
] |
global _start
section .data
align 16
myquad:
dq 0xad0000ceadad00ff
mydword:
dd 0xcafebabe
myaddress:
dq 0x00adbeefc0de00ce
%include "header.inc"
movq mm0, [myquad]
pshufw mm0, [myaddress], 0xAB
pshufw mm1, [myaddress], 0xFE
pshufw mm2, [myquad], 0xFF
pshufw mm6, [myaddress], 0x19
pshufw mm7, [myaddress], 0xB5
%include "footer.inc"
| Assembly | 2 | Tuna0128/Tuna0128.github.io | tests/nasm/pshufw.asm | [
"BSD-2-Clause-FreeBSD"
] |
#ifndef TEST_INTEROP_CXX_TEMPLATES_INPUTS_LINKAGE_OF_SWIFT_SYMBOLS_FOR_IMPORTED_TYPES_H
#define TEST_INTEROP_CXX_TEMPLATES_INPUTS_LINKAGE_OF_SWIFT_SYMBOLS_FOR_IMPORTED_TYPES_H
template<class T>
struct MagicWrapper {
T t;
int callGetInt() const {
return t.getInt() + 5;
}
};
struct MagicNumber {
// Swift runtime defines many value witness tables for types with some common layouts.
// This struct's uncommon size forces the compiler to define a new value witness table instead of reusing one from the runtime.
char forceVWTableCreation[57];
int getInt() const { return 12; }
};
typedef MagicWrapper<MagicNumber> WrappedMagicNumber;
#endif // TEST_INTEROP_CXX_TEMPLATES_INPUTS_LINKAGE_OF_SWIFT_SYMBOLS_FOR_IMPORTED_TYPES_H
| C | 4 | gandhi56/swift | test/Interop/Cxx/templates/Inputs/linkage-of-swift-symbols-for-imported-types.h | [
"Apache-2.0"
] |
package FShow;
// The FShow typeclass is now defined in the Prelude and FShow instances
// are defined alongside the types, so there is no need for this file.
// However, we provide this empty package, so that existing code that
// imports the FShow package will still compile.
endpackage
| Bluespec | 1 | sarman1998/vscode-verilog-hdl-support | syntaxes/bsc-lib/FShow.bsv | [
"MIT"
] |
import Prelude (IO)
import Application (appMain)
main :: IO ()
main = appMain
| Haskell | 4 | JigarJoshi/openapi-generator | samples/server/petstore/haskell-yesod/app/main.hs | [
"Apache-2.0"
] |
# Check that jobs in a console pool can't be released.
# RUN: rm -rf %t.build
# RUN: mkdir -p %t.build
# RUN: cp %s %t.build/build.ninja
# RUN: cp %S/Inputs/run-releasing-control-fd %t.build
# RUN: cp %S/Inputs/wait-for-file %t.build
# RUN: %{llbuild} ninja build --jobs 3 --no-db --chdir %t.build &> %t.out
# RUN: %{FileCheck} < %t.out %s
#
# CHECK: [1/{{.*}}] touch executing
# CHECK: [{{.*}}] test ! -f executing
# CHECK: [{{.*}}] touch stop
rule STOP
command = touch stop
build stop: STOP
rule CUSTOM
pool = console
command = ${COMMAND}
build first: CUSTOM
command = touch executing && exec ./run-releasing-control-fd "./wait-for-file stop && rm -f executing"
build second: CUSTOM
command = test ! -f executing
build output: phony first second stop
default output
| Ninja | 4 | allevato/swift-llbuild | tests/Ninja/Build/console-pool-no-control-fd.ninja | [
"Apache-2.0"
] |
@\media screen {}
@\media \screen {}
| CSS | 2 | maxxcs/swc | crates/swc_css_parser/tests/fixture/at-rule/media/input.css | [
"Apache-2.0",
"MIT"
] |
CLASS zcl_abapgit_integration_git DEFINITION PUBLIC FINAL CREATE PUBLIC.
ENDCLASS.
CLASS zcl_abapgit_integration_git IMPLEMENTATION.
ENDCLASS. | ABAP | 0 | Manny27nyc/abapGit | test/zcl_abapgit_integration_git.clas.abap | [
"MIT"
] |
---
title: "Working With Samples from Many Meters"
author: "Sam Borgeson"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Working With Samples from Many Meters}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
Examples of iterator function usage TBD. Please see vignette on feature extraction for a working example.
```{r eval=F}
```
| RMarkdown | 0 | ConvergenceDA/visdom | vignettes/example_iterator_usage.rmd | [
"MIT"
] |
{******************************************************************************}
{ }
{ Visual Styles (Themes) API interface Unit for Object Pascal }
{ }
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
{ Corporation. All Rights Reserved. }
{ }
{ The original file is: uxtheme.h, released June 2001. The original Pascal }
{ code is: UxTheme.pas, released July 2001. The initial developer of the }
{ Pascal code is Marcel van Brakel (brakelm@chello.nl). }
{ }
{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
{ Marcel van Brakel. All Rights Reserved. }
{ }
{ Portions created by Mike Lischke are Copyright (C) 1999-2002 }
{ Mike Lischke. All Rights Reserved. }
{ }
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
{ }
{ You may retrieve the latest version of this file at the Project JEDI home }
{ page, located at http://delphi-jedi.org or my personal homepage located at }
{ http://members.chello.nl/m.vanbrakel2 }
{ }
{ The contents of this file are used with permission, subject to the Mozilla }
{ Public License Version 1.1 (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.mozilla.org/MPL/MPL-1.1.html }
{ }
{ Software distributed under the License is distributed on an "AS IS" basis, }
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
{ the specific language governing rights and limitations under the License. }
{ }
{ Alternatively, the contents of this file may be used under the terms of the }
{ GNU Lesser General Public License (the "LGPL License"), in which case the }
{ provisions of the LGPL License are applicable instead of those above. }
{ If you wish to allow use of your version of this file only under the terms }
{ of the LGPL License and not to allow others to use your version of this file }
{ under the MPL, indicate your decision by deleting the provisions above and }
{ replace them with the notice and other provisions required by the LGPL }
{ License. If you do not delete the provisions above, a recipient may use }
{ your version of this file under either the MPL or the LGPL License. }
{ }
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
{ }
{******************************************************************************}
{ Simplified by Martijn Laan for Inno Setup and Delphi 2 }
unit UxTheme;
interface
uses
Windows;
procedure FreeThemeLibrary;
function InitThemeLibrary: Boolean;
function UseThemes: Boolean;
const
WM_THEMECHANGED = $031A;
type
HIMAGELIST = THANDLE; // TODO TEMPORARY
HTHEME = THANDLE; // handle to a section of theme data for class
//----------------------------------------------------------------------------------------------------------------------
// NOTE: PartId's and StateId's used in the theme API are defined in the
// hdr file <tmschema.h> using the TM_PART and TM_STATE macros. For
// example, "TM_PART(BP, PUSHBUTTON)" defines the PartId "BP_PUSHBUTTON".
//----------------------------------------------------------------------------------------------------------------------
// OpenThemeData() - Open the theme data for the specified HWND and
// semi-colon separated list of class names.
//
// OpenThemeData() will try each class name, one at
// a time, and use the first matching theme info
// found. If a match is found, a theme handle
// to the data is returned. If no match is found,
// a "NULL" handle is returned.
//
// When the window is destroyed or a WM_THEMECHANGED
// msg is received, "CloseThemeData()" should be
// called to close the theme handle.
//
// hwnd - window handle of the control/window to be themed
//
// pszClassList - class name (or list of names) to match to theme data
// section. if the list contains more than one name,
// the names are tested one at a time for a match.
// If a match is found, OpenThemeData() returns a
// theme handle associated with the matching class.
// This param is a list (instead of just a single
// class name) to provide the class an opportunity
// to get the "best" match between the class and
// the current theme. For example, a button might
// pass L"OkButton, Button" if its ID=ID_OK. If
// the current theme has an entry for OkButton,
// that will be used. Otherwise, we fall back on
// the normal Button entry.
//----------------------------------------------------------------------------------------------------------------------
var
OpenThemeData: function(hwnd: HWND; pszClassList: LPCWSTR): HTHEME; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// CloseTHemeData() - closes the theme data handle. This should be done
// when the window being themed is destroyed or
// whenever a WM_THEMECHANGED msg is received
// (followed by an attempt to create a new Theme data
// handle).
//
// hTheme - open theme data handle (returned from prior call
// to OpenThemeData() API).
//----------------------------------------------------------------------------------------------------------------------
var
CloseThemeData: function(hTheme: HTHEME): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// functions for basic drawing support
//----------------------------------------------------------------------------------------------------------------------
// The following methods are the theme-aware drawing services.
// Controls/Windows are defined in drawable "parts" by their author: a
// parent part and 0 or more child parts. Each of the parts can be
// described in "states" (ex: disabled, hot, pressed).
//----------------------------------------------------------------------------------------------------------------------
// For the list of all themed classes and the definition of all
// parts and states, see the file "tmschmea.h".
//----------------------------------------------------------------------------------------------------------------------
// Each of the below methods takes a "iPartId" param to specify the
// part and a "iStateId" to specify the state of the part.
// "iStateId=0" refers to the root part. "iPartId" = "0" refers to
// the root class.
//----------------------------------------------------------------------------------------------------------------------
// Note: draw operations are always scaled to fit (and not to exceed)
// the specified "Rect".
//----------------------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------
// DrawThemeBackground()
// - draws the theme-specified border and fill for
// the "iPartId" and "iStateId". This could be
// based on a bitmap file, a border and fill, or
// other image description.
//
// hTheme - theme data handle
// hdc - HDC to draw into
// iPartId - part number to draw
// iStateId - state number (of the part) to draw
// pRect - defines the size/location of the part
// pClipRect - optional clipping rect (don't draw outside it)
//----------------------------------------------------------------------------------------------------------------------
var
DrawThemeBackground: function(hTheme: HTHEME; hdc: HDC; iPartId, iStateId: Integer; const pRect: TRect;
pClipRect: PRECT): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
//----- DrawThemeText() flags ----
const
DTT_GRAYED = $1; // draw a grayed-out string
//----------------------------------------------------------------------------------------------------------------------
// DrawThemeText() - draws the text using the theme-specified
// color and font for the "iPartId" and
// "iStateId".
//
// hTheme - theme data handle
// hdc - HDC to draw into
// iPartId - part number to draw
// iStateId - state number (of the part) to draw
// pszText - actual text to draw
// dwCharCount - number of chars to draw (-1 for all)
// dwTextFlags - same as DrawText() "uFormat" param
// dwTextFlags2 - additional drawing options
// pRect - defines the size/location of the part
//----------------------------------------------------------------------------------------------------------------------
var
DrawThemeText: function(hTheme: HTHEME; hdc: HDC; iPartId, iStateId: Integer; pszText: LPCWSTR; iCharCount: Integer;
dwTextFlags, dwTextFlags2: DWORD; const pRect: TRect): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// GetThemeBackgroundContentRect()
// - gets the size of the content for the theme-defined
// background. This is usually the area inside
// the borders or Margins.
//
// hTheme - theme data handle
// hdc - (optional) device content to be used for drawing
// iPartId - part number to draw
// iStateId - state number (of the part) to draw
// pBoundingRect - the outer RECT of the part being drawn
// pContentRect - RECT to receive the content area
//----------------------------------------------------------------------------------------------------------------------
var
GetThemeBackgroundContentRect: function(hTheme: HTHEME; hdc: HDC; iPartId, iStateId: Integer;
const pBoundingRect: TRect; pContentRect: PRECT): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// GetThemeBackgroundExtent() - calculates the size/location of the theme-
// specified background based on the
// "pContentRect".
//
// hTheme - theme data handle
// hdc - (optional) device content to be used for drawing
// iPartId - part number to draw
// iStateId - state number (of the part) to draw
// pContentRect - RECT that defines the content area
// pBoundingRect - RECT to receive the overall size/location of part
//----------------------------------------------------------------------------------------------------------------------
var
GetThemeBackgroundExtent: function(hTheme: HTHEME; hdc: HDC; iPartId, iStateId: Integer; const pContentRect: TRect;
var pExtentRect: TRect): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
type
THEMESIZE = (
TS_MIN, // minimum size
TS_TRUE, // size without stretching
TS_DRAW // size that theme mgr will use to draw part
);
TThemeSize = THEMESIZE;
//----------------------------------------------------------------------------------------------------------------------
// GetThemePartSize() - returns the specified size of the theme part
//
// hTheme - theme data handle
// hdc - HDC to select font into & measure against
// iPartId - part number to retrieve size for
// iStateId - state number (of the part)
// prc - (optional) rect for part drawing destination
// eSize - the type of size to be retreived
// psz - receives the specified size of the part
//----------------------------------------------------------------------------------------------------------------------
var
GetThemePartSize: function(hTheme: HTHEME; hdc: HDC; iPartId, iStateId: Integer; prc: PRECT; eSize: THEMESIZE;
var psz: TSize): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// GetThemeTextExtent() - calculates the size/location of the specified
// text when rendered in the Theme Font.
//
// hTheme - theme data handle
// hdc - HDC to select font & measure into
// iPartId - part number to draw
// iStateId - state number (of the part)
// pszText - the text to be measured
// dwCharCount - number of chars to draw (-1 for all)
// dwTextFlags - same as DrawText() "uFormat" param
// pszBoundingRect - optional: to control layout of text
// pszExtentRect - receives the RECT for text size/location
//----------------------------------------------------------------------------------------------------------------------
var
GetThemeTextExtent: function(hTheme: HTHEME; hdc: HDC; iPartId, iStateId: Integer; pszText: LPCWSTR;
iCharCount: Integer; dwTextFlags: DWORD; pBoundingRect: PRECT; var pExtentRect: TRect): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// GetThemeTextMetrics()
// - returns info about the theme-specified font
// for the part/state passed in.
//
// hTheme - theme data handle
// hdc - optional: HDC for screen context
// iPartId - part number to draw
// iStateId - state number (of the part)
// ptm - receives the font info
//----------------------------------------------------------------------------------------------------------------------
var
GetThemeTextMetrics: function(hTheme: HTHEME; hdc: HDC; iPartId, iStateId: Integer;
var ptm: TTEXTMETRIC): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// GetThemeBackgroundRegion()
// - computes the region for a regular or partially
// transparent theme-specified background that is
// bound by the specified "pRect".
// If the rectangle is empty, sets the HRGN to NULL
// and return S_FALSE.
//
// hTheme - theme data handle
// hdc - optional HDC to draw into (DPI scaling)
// iPartId - part number to draw
// iStateId - state number (of the part)
// pRect - the RECT used to draw the part
// pRegion - receives handle to calculated region
//----------------------------------------------------------------------------------------------------------------------
var
GetThemeBackgroundRegion: function(hTheme: HTHEME; hdc: HDC; iPartId, iStateId: Integer; const pRect: TRect;
var pRegion: HRGN): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
//----- HitTestThemeBackground, HitTestThemeBackgroundRegion flags ----
// Theme background segment hit test flag (default). possible return values are:
// HTCLIENT: hit test succeeded in the middle background segment
// HTTOP, HTLEFT, HTTOPLEFT, etc: // hit test succeeded in the the respective theme background segment.
const
HTTB_BACKGROUNDSEG = $0000;
// Fixed border hit test option. possible return values are:
// HTCLIENT: hit test succeeded in the middle background segment
// HTBORDER: hit test succeeded in any other background segment
HTTB_FIXEDBORDER = $0002; // Return code may be either HTCLIENT or HTBORDER.
// Caption hit test option. Possible return values are:
// HTCAPTION: hit test succeeded in the top, top left, or top right background segments
// HTNOWHERE or another return code, depending on absence or presence of accompanying flags, resp.
HTTB_CAPTION = $0004;
// Resizing border hit test flags. Possible return values are:
// HTCLIENT: hit test succeeded in middle background segment
// HTTOP, HTTOPLEFT, HTLEFT, HTRIGHT, etc: hit test succeeded in the respective system resizing zone
// HTBORDER: hit test failed in middle segment and resizing zones, but succeeded in a background border segment
HTTB_RESIZINGBORDER_LEFT = $0010; // Hit test left resizing border,
HTTB_RESIZINGBORDER_TOP = $0020; // Hit test top resizing border
HTTB_RESIZINGBORDER_RIGHT = $0040; // Hit test right resizing border
HTTB_RESIZINGBORDER_BOTTOM = $0080; // Hit test bottom resizing border
HTTB_RESIZINGBORDER = (HTTB_RESIZINGBORDER_LEFT or HTTB_RESIZINGBORDER_TOP or
HTTB_RESIZINGBORDER_RIGHT or HTTB_RESIZINGBORDER_BOTTOM);
// Resizing border is specified as a template, not just window edges.
// This option is mutually exclusive with HTTB_SYSTEMSIZINGWIDTH; HTTB_SIZINGTEMPLATE takes precedence
HTTB_SIZINGTEMPLATE = $0100;
// Use system resizing border width rather than theme content margins.
// This option is mutually exclusive with HTTB_SIZINGTEMPLATE, which takes precedence.
HTTB_SYSTEMSIZINGMARGINS = $0200;
//----------------------------------------------------------------------------------------------------------------------
// HitTestThemeBackground()
// - returns a HitTestCode (a subset of the values
// returned by WM_NCHITTEST) for the point "ptTest"
// within the theme-specified background
// (bound by pRect). "pRect" and "ptTest" should
// both be in the same coordinate system
// (client, screen, etc).
//
// hTheme - theme data handle
// hdc - HDC to draw into
// iPartId - part number to test against
// iStateId - state number (of the part)
// pRect - the RECT used to draw the part
// hrgn - optional region to use; must be in same coordinates as
// - pRect and pTest.
// ptTest - the hit point to be tested
// dwOptions - HTTB_xxx constants
// pwHitTestCode - receives the returned hit test code - one of:
//
// HTNOWHERE, HTLEFT, HTTOPLEFT, HTBOTTOMLEFT,
// HTRIGHT, HTTOPRIGHT, HTBOTTOMRIGHT,
// HTTOP, HTBOTTOM, HTCLIENT
//----------------------------------------------------------------------------------------------------------------------
var
HitTestThemeBackground: function(hTheme: HTHEME; hdc: HDC; iPartId, iStateId: Integer; dwOptions: DWORD;
const pRect: TRect; hrgn: HRGN; ptTest: TPoint; var pwHitTestCode: WORD): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// DrawThemeEdge() - Similar to the DrawEdge() API, but uses part colors
// and is high-DPI aware
// hTheme - theme data handle
// hdc - HDC to draw into
// iPartId - part number to draw
// iStateId - state number of part
// pDestRect - the RECT used to draw the line(s)
// uEdge - Same as DrawEdge() API
// uFlags - Same as DrawEdge() API
// pContentRect - Receives the interior rect if (uFlags & BF_ADJUST)
//----------------------------------------------------------------------------------------------------------------------
var
DrawThemeEdge: function(hTheme: HTHEME; hdc: HDC; iPartId, iStateId: Integer; const pDestRect: TRect; uEdge,
uFlags: UINT; pContentRect: PRECT): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// DrawThemeIcon() - draws an image within an imagelist based on
// a (possible) theme-defined effect.
//
// hTheme - theme data handle
// hdc - HDC to draw into
// iPartId - part number to draw
// iStateId - state number of part
// pRect - the RECT to draw the image within
// himl - handle to IMAGELIST
// iImageIndex - index into IMAGELIST (which icon to draw)
//----------------------------------------------------------------------------------------------------------------------
var
DrawThemeIcon: function(hTheme: HTHEME; hdc: HDC; iPartId, iStateId: Integer; const pRect: TRect; himl: HIMAGELIST;
iImageIndex: Integer): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// IsThemePartDefined() - returns TRUE if the theme has defined parameters
// for the specified "iPartId" and "iStateId".
//
// hTheme - theme data handle
// iPartId - part number to find definition for
// iStateId - state number of part
//----------------------------------------------------------------------------------------------------------------------
var
IsThemePartDefined: function(hTheme: HTHEME; iPartId, iStateId: Integer): BOOL; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// IsThemeBackgroundPartiallyTransparent()
// - returns TRUE if the theme specified background for
// the part/state has transparent pieces or
// alpha-blended pieces.
//
// hTheme - theme data handle
// iPartId - part number
// iStateId - state number of part
//----------------------------------------------------------------------------------------------------------------------
var
IsThemeBackgroundPartiallyTransparent: function(hTheme: HTHEME; iPartId, iStateId: Integer): BOOL; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// lower-level theme information services
//----------------------------------------------------------------------------------------------------------------------
// The following methods are getter routines for each of the Theme Data types.
// Controls/Windows are defined in drawable "parts" by their author: a
// parent part and 0 or more child parts. Each of the parts can be
// described in "states" (ex: disabled, hot, pressed).
//----------------------------------------------------------------------------------------------------------------------
// Each of the below methods takes a "iPartId" param to specify the
// part and a "iStateId" to specify the state of the part.
// "iStateId=0" refers to the root part. "iPartId" = "0" refers to
// the root class.
//----------------------------------------------------------------------------------------------------------------------
// Each method also take a "iPropId" param because multiple instances of
// the same primitive type can be defined in the theme schema.
//----------------------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------
// GetThemeColor() - Get the value for the specified COLOR property
//
// hTheme - theme data handle
// iPartId - part number
// iStateId - state number of part
// iPropId - the property number to get the value for
// pColor - receives the value of the property
//----------------------------------------------------------------------------------------------------------------------
var
GetThemeColor: function(hTheme: HTHEME; iPartId, iStateId, iPropId: Integer; var pColor: COLORREF): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// GetThemeMetric() - Get the value for the specified metric/size
// property
//
// hTheme - theme data handle
// hdc - (optional) hdc to be drawn into (DPI scaling)
// iPartId - part number
// iStateId - state number of part
// iPropId - the property number to get the value for
// piVal - receives the value of the property
//----------------------------------------------------------------------------------------------------------------------
var
GetThemeMetric: function(hTheme: HTHEME; hdc: HDC; iPartId, iStateId, iPropId: Integer;
var piVal: Integer): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// GetThemeString() - Get the value for the specified string property
//
// hTheme - theme data handle
// iPartId - part number
// iStateId - state number of part
// iPropId - the property number to get the value for
// pszBuff - receives the string property value
// cchMaxBuffChars - max. number of chars allowed in pszBuff
//----------------------------------------------------------------------------------------------------------------------
var
GetThemeString: function(hTheme: HTHEME; iPartId, iStateId, iPropId: Integer; pszBuff: LPWSTR;
cchMaxBuffChars: Integer): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// GetThemeBool() - Get the value for the specified BOOL property
//
// hTheme - theme data handle
// iPartId - part number
// iStateId - state number of part
// iPropId - the property number to get the value for
// pfVal - receives the value of the property
//----------------------------------------------------------------------------------------------------------------------
var
GetThemeBool: function(hTheme: HTHEME; iPartId, iStateId, iPropId: Integer; var pfVal: BOOL): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// GetThemeInt() - Get the value for the specified int property
//
// hTheme - theme data handle
// iPartId - part number
// iStateId - state number of part
// iPropId - the property number to get the value for
// piVal - receives the value of the property
//----------------------------------------------------------------------------------------------------------------------
var
GetThemeInt: function(hTheme: HTHEME; iPartId, iStateId, iPropId: Integer; var piVal: Integer): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// GetThemeEnumValue() - Get the value for the specified ENUM property
//
// hTheme - theme data handle
// iPartId - part number
// iStateId - state number of part
// iPropId - the property number to get the value for
// piVal - receives the value of the enum (cast to int*)
//----------------------------------------------------------------------------------------------------------------------
var
GetThemeEnumValue: function(hTheme: HTHEME; iPartId, iStateId, iPropId: Integer; var piVal: Integer): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// GetThemePosition() - Get the value for the specified position
// property
//
// hTheme - theme data handle
// iPartId - part number
// iStateId - state number of part
// iPropId - the property number to get the value for
// pPoint - receives the value of the position property
//----------------------------------------------------------------------------------------------------------------------
var
GetThemePosition: function(hTheme: HTHEME; iPartId, iStateId, iPropId: Integer;var pPoint: TPoint): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// GetThemeFont() - Get the value for the specified font property
//
// hTheme - theme data handle
// hdc - (optional) hdc to be drawn to (DPI scaling)
// iPartId - part number
// iStateId - state number of part
// iPropId - the property number to get the value for
// pFont - receives the value of the LOGFONT property
// (scaled for the current logical screen dpi)
//----------------------------------------------------------------------------------------------------------------------
var
GetThemeFont: function(hTheme: HTHEME; hdc: HDC; iPartId, iStateId, iPropId: Integer;
var pFont: TLOGFONT): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// GetThemeRect() - Get the value for the specified RECT property
//
// hTheme - theme data handle
// iPartId - part number
// iStateId - state number of part
// iPropId - the property number to get the value for
// pRect - receives the value of the RECT property
//----------------------------------------------------------------------------------------------------------------------
var
GetThemeRect: function(hTheme: HTHEME; iPartId, iStateId, iPropId: Integer; var pRect: TRect): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
type
_MARGINS = record
cxLeftWidth: Integer; // width of left border that retains its size
cxRightWidth: Integer; // width of right border that retains its size
cyTopHeight: Integer; // height of top border that retains its size
cyBottomHeight: Integer; // height of bottom border that retains its size
end;
MARGINS = _MARGINS;
PMARGINS = ^MARGINS;
TMargins = MARGINS;
//----------------------------------------------------------------------------------------------------------------------
// GetThemeMargins() - Get the value for the specified MARGINS property
//
// hTheme - theme data handle
// hdc - (optional) hdc to be used for drawing
// iPartId - part number
// iStateId - state number of part
// iPropId - the property number to get the value for
// prc - RECT for area to be drawn into
// pMargins - receives the value of the MARGINS property
//----------------------------------------------------------------------------------------------------------------------
var
GetThemeMargins: function(hTheme: HTHEME; hdc: HDC; iPartId, iStateId, iPropId: Integer; prc: PRECT;
var pMargins: MARGINS): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
const
MAX_INTLIST_COUNT = 10;
type
_INTLIST = record
iValueCount: Integer; // number of values in iValues
iValues: array [0..MAX_INTLIST_COUNT - 1] of Integer;
end;
INTLIST = _INTLIST;
PINTLIST = ^INTLIST;
TIntList = INTLIST;
//----------------------------------------------------------------------------------------------------------------------
// GetThemeIntList() - Get the value for the specified INTLIST struct
//
// hTheme - theme data handle
// iPartId - part number
// iStateId - state number of part
// iPropId - the property number to get the value for
// pIntList - receives the value of the INTLIST property
//----------------------------------------------------------------------------------------------------------------------
var
GetThemeIntList: function(hTheme: HTHEME; iPartId, iStateId, iPropId: Integer; var pIntList: INTLIST): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
type
PROPERTYORIGIN = (
PO_STATE, // property was found in the state section
PO_PART, // property was found in the part section
PO_CLASS, // property was found in the class section
PO_GLOBAL, // property was found in [globals] section
PO_NOTFOUND); // property was not found
TPropertyOrigin = PROPERTYORIGIN;
//----------------------------------------------------------------------------------------------------------------------
// GetThemePropertyOrigin()
// - searches for the specified theme property
// and sets "pOrigin" to indicate where it was
// found (or not found)
//
// hTheme - theme data handle
// iPartId - part number
// iStateId - state number of part
// iPropId - the property number to search for
// pOrigin - receives the value of the property origin
//----------------------------------------------------------------------------------------------------------------------
var
GetThemePropertyOrigin: function(hTheme: HTHEME; iPartId, iStateId, iPropId: Integer;
var pOrigin: PROPERTYORIGIN): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// SetWindowTheme()
// - redirects an existing Window to use a different
// section of the current theme information than its
// class normally asks for.
//
// hwnd - the handle of the window (cannot be NULL)
//
// pszSubAppName - app (group) name to use in place of the calling
// app's name. If NULL, the actual calling app
// name will be used.
//
// pszSubIdList - semicolon separated list of class Id names to
// use in place of actual list passed by the
// window's class. if NULL, the id list from the
// calling class is used.
//----------------------------------------------------------------------------------------------------------------------
// The Theme Manager will remember the "pszSubAppName" and the
// "pszSubIdList" associations thru the lifetime of the window (even
// if themes are subsequently changed). The window is sent a
// "WM_THEMECHANGED" msg at the end of this call, so that the new
// theme can be found and applied.
//----------------------------------------------------------------------------------------------------------------------
// When "pszSubAppName" or "pszSubIdList" are NULL, the Theme Manager
// removes the previously remember association. To turn off theme-ing for
// the specified window, you can pass an empty string (L"") so it
// won't match any section entries.
//----------------------------------------------------------------------------------------------------------------------
var
SetWindowTheme: function(hwnd: HWND; pszSubAppName: LPCWSTR; pszSubIdList: LPCWSTR): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// GetThemeFilename() - Get the value for the specified FILENAME property.
//
// hTheme - theme data handle
// iPartId - part number
// iStateId - state number of part
// iPropId - the property number to search for
// pszThemeFileName - output buffer to receive the filename
// cchMaxBuffChars - the size of the return buffer, in chars
//----------------------------------------------------------------------------------------------------------------------
var
GetThemeFilename: function(hTheme: HTHEME; iPartId, iStateId, iPropId: Integer; pszThemeFileName: LPWSTR;
cchMaxBuffChars: Integer): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// GetThemeSysColor() - Get the value of the specified System color.
//
// hTheme - the theme data handle. if non-NULL, will return
// color from [SysMetrics] section of theme.
// if NULL, will return the global system color.
//
// iColorId - the system color index defined in winuser.h
//----------------------------------------------------------------------------------------------------------------------
var
GetThemeSysColor: function(hTheme: HTHEME; iColorId: Integer): COLORREF; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// GetThemeSysColorBrush()
// - Get the brush for the specified System color.
//
// hTheme - the theme data handle. if non-NULL, will return
// brush matching color from [SysMetrics] section of
// theme. if NULL, will return the brush matching
// global system color.
//
// iColorId - the system color index defined in winuser.h
//----------------------------------------------------------------------------------------------------------------------
var
GetThemeSysColorBrush: function(hTheme: HTHEME; iColorId: Integer): HBRUSH; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// GetThemeSysBool() - Get the boolean value of specified System metric.
//
// hTheme - the theme data handle. if non-NULL, will return
// BOOL from [SysMetrics] section of theme.
// if NULL, will return the specified system boolean.
//
// iBoolId - the TMT_XXX BOOL number (first BOOL
// is TMT_FLATMENUS)
//----------------------------------------------------------------------------------------------------------------------
var
GetThemeSysBool: function(hTheme: HTHEME; iBoolId: Integer): BOOL; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// GetThemeSysSize() - Get the value of the specified System size metric.
// (scaled for the current logical screen dpi)
//
// hTheme - the theme data handle. if non-NULL, will return
// size from [SysMetrics] section of theme.
// if NULL, will return the global system metric.
//
// iSizeId - the following values are supported when
// hTheme is non-NULL:
//
// SM_CXBORDER (border width)
// SM_CXVSCROLL (scrollbar width)
// SM_CYHSCROLL (scrollbar height)
// SM_CXSIZE (caption width)
// SM_CYSIZE (caption height)
// SM_CXSMSIZE (small caption width)
// SM_CYSMSIZE (small caption height)
// SM_CXMENUSIZE (menubar width)
// SM_CYMENUSIZE (menubar height)
//
// when hTheme is NULL, iSizeId is passed directly
// to the GetSystemMetrics() function
//----------------------------------------------------------------------------------------------------------------------
var
GetThemeSysSize: function(hTheme: HTHEME; iSizeId: Integer): Integer; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// GetThemeSysFont() - Get the LOGFONT for the specified System font.
//
// hTheme - the theme data handle. if non-NULL, will return
// font from [SysMetrics] section of theme.
// if NULL, will return the specified system font.
//
// iFontId - the TMT_XXX font number (first font
// is TMT_CAPTIONFONT)
//
// plf - ptr to LOGFONT to receive the font value.
// (scaled for the current logical screen dpi)
//----------------------------------------------------------------------------------------------------------------------
var
GetThemeSysFont: function(hTheme: HTHEME; iFontId: Integer; var plf: TLOGFONT): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// GetThemeSysString() - Get the value of specified System string metric.
//
// hTheme - the theme data handle (required)
//
// iStringId - must be one of the following values:
//
// TMT_CSSNAME
// TMT_XMLNAME
//
// pszStringBuff - the buffer to receive the string value
//
// cchMaxStringChars - max. number of chars that pszStringBuff can hold
//----------------------------------------------------------------------------------------------------------------------
var
GetThemeSysString: function(hTheme: HTHEME; iStringId: Integer; pszStringBuff: LPWSTR;
cchMaxStringChars: Integer): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// GetThemeSysInt() - Get the value of specified System int.
//
// hTheme - the theme data handle (required)
//
// iIntId - must be one of the following values:
//
// TMT_DPIX
// TMT_DPIY
// TMT_MINCOLORDEPTH
//
// piValue - ptr to int to receive value
//----------------------------------------------------------------------------------------------------------------------
var
GetThemeSysInt: function(hTheme: HTHEME; iIntId: Integer; var piValue: Integer): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// IsThemeActive() - can be used to test if a system theme is active
// for the current user session.
//
// use the API "IsAppThemed()" to test if a theme is
// active for the calling process.
//----------------------------------------------------------------------------------------------------------------------
var
IsThemeActive: function: BOOL; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// IsAppThemed() - returns TRUE if a theme is active and available to
// the current process
//----------------------------------------------------------------------------------------------------------------------
var
IsAppThemed: function: BOOL; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// GetWindowTheme() - if window is themed, returns its most recent
// HTHEME from OpenThemeData() - otherwise, returns
// NULL.
//
// hwnd - the window to get the HTHEME of
//----------------------------------------------------------------------------------------------------------------------
var
GetWindowTheme: function(hwnd: HWND): HTHEME; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// EnableThemeDialogTexture()
//
// - Enables/disables dialog background theme. This method can be used to
// tailor dialog compatibility with child windows and controls that
// may or may not coordinate the rendering of their client area backgrounds
// with that of their parent dialog in a manner that supports seamless
// background texturing.
//
// hdlg - the window handle of the target dialog
// dwFlags - ETDT_ENABLE to enable the theme-defined dialog background texturing,
// ETDT_DISABLE to disable background texturing,
// ETDT_ENABLETAB to enable the theme-defined background
// texturing using the Tab texture
//----------------------------------------------------------------------------------------------------------------------
const
ETDT_DISABLE = $00000001;
ETDT_ENABLE = $00000002;
ETDT_USETABTEXTURE = $00000004;
ETDT_ENABLETAB = (ETDT_ENABLE or ETDT_USETABTEXTURE);
var
EnableThemeDialogTexture: function(hwnd: HWND; dwFlags: DWORD): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// IsThemeDialogTextureEnabled()
//
// - Reports whether the dialog supports background texturing.
//
// hdlg - the window handle of the target dialog
//----------------------------------------------------------------------------------------------------------------------
var
IsThemeDialogTextureEnabled: function(hwnd: HWND): BOOL; stdcall;
//----------------------------------------------------------------------------------------------------------------------
//---- flags to control theming within an app ----
const
STAP_ALLOW_NONCLIENT = (1 shl 0);
STAP_ALLOW_CONTROLS = (1 shl 1);
STAP_ALLOW_WEBCONTENT = (1 shl 2);
//----------------------------------------------------------------------------------------------------------------------
// GetThemeAppProperties()
// - returns the app property flags that control theming
//----------------------------------------------------------------------------------------------------------------------
var
GetThemeAppProperties: function: DWORD; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// SetThemeAppProperties()
// - sets the flags that control theming within the app
//
// dwFlags - the flag values to be set
//----------------------------------------------------------------------------------------------------------------------
var
SetThemeAppProperties: procedure(dwFlags: DWORD); stdcall;
//----------------------------------------------------------------------------------------------------------------------
// GetCurrentThemeName()
// - Get the name of the current theme in-use.
// Optionally, return the ColorScheme name and the
// Size name of the theme.
//
// pszThemeFileName - receives the theme path & filename
// cchMaxNameChars - max chars allowed in pszNameBuff
//
// pszColorBuff - (optional) receives the canonical color scheme name
// (not the display name)
// cchMaxColorChars - max chars allowed in pszColorBuff
//
// pszSizeBuff - (optional) receives the canonical size name
// (not the display name)
// cchMaxSizeChars - max chars allowed in pszSizeBuff
//----------------------------------------------------------------------------------------------------------------------
var
GetCurrentThemeName: function(pszThemeFileName: LPWSTR; cchMaxNameChars: Integer; pszColorBuff: LPWSTR;
cchMaxColorChars: Integer; pszSizeBuff: LPWSTR; cchMaxSizeChars: Integer): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// GetThemeDocumentationProperty()
// - Get the value for the specified property name from
// the [documentation] section of the themes.ini file
// for the specified theme. If the property has been
// localized in the theme files string table, the
// localized version of the property value is returned.
//
// pszThemeFileName - filename of the theme file to query
// pszPropertyName - name of the string property to retreive a value for
// pszValueBuff - receives the property string value
// cchMaxValChars - max chars allowed in pszValueBuff
//----------------------------------------------------------------------------------------------------------------------
const
SZ_THDOCPROP_DISPLAYNAME = 'DisplayName';
SZ_THDOCPROP_CANONICALNAME = 'ThemeName';
SZ_THDOCPROP_TOOLTIP = 'ToolTip';
SZ_THDOCPROP_AUTHOR = 'author';
var
GetThemeDocumentationProperty: function(pszThemeName, pszPropertyName: LPCWSTR; pszValueBuff: LPWSTR;
cchMaxValChars: Integer): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// Theme API Error Handling
//
// All functions in the Theme API not returning an HRESULT (THEMEAPI_)
// use the WIN32 function "SetLastError()" to record any call failures.
//
// To retreive the error code of the last failure on the
// current thread for these type of API's, use the WIN32 function
// "GetLastError()".
//
// All Theme API error codes (HRESULT's and GetLastError() values)
// should be normal win32 errors which can be formatted into
// strings using the Win32 API FormatMessage().
//----------------------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------
// DrawThemeParentBackground()
// - used by partially-transparent or alpha-blended
// child controls to draw the part of their parent
// that they appear in front of.
//
// hwnd - handle of the child control
// hdc - hdc of the child control
// prc - (optional) rect that defines the area to be
// drawn (CHILD coordinates)
//----------------------------------------------------------------------------------------------------------------------
var
DrawThemeParentBackground: function(hwnd: HWND; hdc: HDC; prc: PRECT): HRESULT; stdcall;
//----------------------------------------------------------------------------------------------------------------------
// EnableTheming() - enables or disables themeing for the current user
// in the current and future sessions.
//
// fEnable - if FALSE, disable theming & turn themes off.
// - if TRUE, enable themeing and, if user previously
// had a theme active, make it active now.
//----------------------------------------------------------------------------------------------------------------------
var
EnableTheming: function(fEnable: BOOL): HRESULT; stdcall;
implementation
//----------------------------------------------------------------------------------------------------------------------
uses
SysUtils, PathFunc;
const
themelib = 'uxtheme.dll';
var
ThemeLibrary: THandle;
ReferenceCount: Integer; // We have to keep track of several load/unload calls.
procedure FreeThemeLibrary;
begin
if ReferenceCount > 0 then
Dec(ReferenceCount);
if (ThemeLibrary <> 0) and (ReferenceCount = 0) then
begin
FreeLibrary(ThemeLibrary);
ThemeLibrary := 0;
OpenThemeData := nil;
CloseThemeData := nil;
DrawThemeBackground := nil;
DrawThemeText := nil;
GetThemeBackgroundContentRect := nil;
GetThemeBackgroundExtent := nil;
GetThemePartSize := nil;
GetThemeTextExtent := nil;
GetThemeTextMetrics := nil;
GetThemeBackgroundRegion := nil;
HitTestThemeBackground := nil;
DrawThemeEdge := nil;
DrawThemeIcon := nil;
IsThemePartDefined := nil;
IsThemeBackgroundPartiallyTransparent := nil;
GetThemeColor := nil;
GetThemeMetric := nil;
GetThemeString := nil;
GetThemeBool := nil;
GetThemeInt := nil;
GetThemeEnumValue := nil;
GetThemePosition := nil;
GetThemeFont := nil;
GetThemeRect := nil;
GetThemeMargins := nil;
GetThemeIntList := nil;
GetThemePropertyOrigin := nil;
SetWindowTheme := nil;
GetThemeFilename := nil;
GetThemeSysColor := nil;
GetThemeSysColorBrush := nil;
GetThemeSysBool := nil;
GetThemeSysSize := nil;
GetThemeSysFont := nil;
GetThemeSysString := nil;
GetThemeSysInt := nil;
IsThemeActive := nil;
IsAppThemed := nil;
GetWindowTheme := nil;
EnableThemeDialogTexture := nil;
IsThemeDialogTextureEnabled := nil;
GetThemeAppProperties := nil;
SetThemeAppProperties := nil;
GetCurrentThemeName := nil;
GetThemeDocumentationProperty := nil;
DrawThemeParentBackground := nil;
EnableTheming := nil;
end;
end;
//----------------------------------------------------------------------------------------------------------------------
function InitThemeLibrary: Boolean;
function IsWindowsXP: Boolean;
var
Info: TOSVersionInfo;
begin
Result := False;
Info.dwOSVersionInfoSize := SizeOf(Info);
if GetVersionEx(Info) then
if Info.dwPlatformId = VER_PLATFORM_WIN32_NT then
if (Info.dwMajorVersion > 5) or
((Info.dwMajorVersion = 5) and (Info.dwMinorVersion >= 1)) then
Result := True;
end;
function GetSystemDir: String;
var
Buf: array[0..MAX_PATH-1] of Char;
begin
GetSystemDirectory(Buf, SizeOf(Buf) div SizeOf(Buf[0]));
Result := StrPas(Buf);
end;
begin
Inc(ReferenceCount);
{ Only attempt to load uxtheme.dll if running Windows XP or later; otherwise
if uxtheme.dll happens to exist on Windows 2000 (it shouldn't unless a
bugged installer put it there) we get a "RtlUnhandledExceptionFilter could
not be located in the dynamic link library ntdll.dll" error message }
if (ThemeLibrary = 0) and IsWindowsXP then
begin
ThemeLibrary := LoadLibrary(PChar(AddBackslash(GetSystemDir) + themelib));
if ThemeLibrary <> 0 then
begin
OpenThemeData := GetProcAddress(ThemeLibrary, 'OpenThemeData');
CloseThemeData := GetProcAddress(ThemeLibrary, 'CloseThemeData');
DrawThemeBackground := GetProcAddress(ThemeLibrary, 'DrawThemeBackground');
DrawThemeText := GetProcAddress(ThemeLibrary, 'DrawThemeText');
GetThemeBackgroundContentRect := GetProcAddress(ThemeLibrary, 'GetThemeBackgroundContentRect');
GetThemeBackgroundExtent := GetProcAddress(ThemeLibrary, 'GetThemeBackgroundContentRect');
GetThemePartSize := GetProcAddress(ThemeLibrary, 'GetThemePartSize');
GetThemeTextExtent := GetProcAddress(ThemeLibrary, 'GetThemeTextExtent');
GetThemeTextMetrics := GetProcAddress(ThemeLibrary, 'GetThemeTextMetrics');
GetThemeBackgroundRegion := GetProcAddress(ThemeLibrary, 'GetThemeBackgroundRegion');
HitTestThemeBackground := GetProcAddress(ThemeLibrary, 'HitTestThemeBackground');
DrawThemeEdge := GetProcAddress(ThemeLibrary, 'DrawThemeEdge');
DrawThemeIcon := GetProcAddress(ThemeLibrary, 'DrawThemeIcon');
IsThemePartDefined := GetProcAddress(ThemeLibrary, 'IsThemePartDefined');
IsThemeBackgroundPartiallyTransparent := GetProcAddress(ThemeLibrary, 'IsThemeBackgroundPartiallyTransparent');
GetThemeColor := GetProcAddress(ThemeLibrary, 'GetThemeColor');
GetThemeMetric := GetProcAddress(ThemeLibrary, 'GetThemeMetric');
GetThemeString := GetProcAddress(ThemeLibrary, 'GetThemeString');
GetThemeBool := GetProcAddress(ThemeLibrary, 'GetThemeBool');
GetThemeInt := GetProcAddress(ThemeLibrary, 'GetThemeInt');
GetThemeEnumValue := GetProcAddress(ThemeLibrary, 'GetThemeEnumValue');
GetThemePosition := GetProcAddress(ThemeLibrary, 'GetThemePosition');
GetThemeFont := GetProcAddress(ThemeLibrary, 'GetThemeFont');
GetThemeRect := GetProcAddress(ThemeLibrary, 'GetThemeRect');
GetThemeMargins := GetProcAddress(ThemeLibrary, 'GetThemeMargins');
GetThemeIntList := GetProcAddress(ThemeLibrary, 'GetThemeIntList');
GetThemePropertyOrigin := GetProcAddress(ThemeLibrary, 'GetThemePropertyOrigin');
SetWindowTheme := GetProcAddress(ThemeLibrary, 'SetWindowTheme');
GetThemeFilename := GetProcAddress(ThemeLibrary, 'GetThemeFilename');
GetThemeSysColor := GetProcAddress(ThemeLibrary, 'GetThemeSysColor');
GetThemeSysColorBrush := GetProcAddress(ThemeLibrary, 'GetThemeSysColorBrush');
GetThemeSysBool := GetProcAddress(ThemeLibrary, 'GetThemeSysBool');
GetThemeSysSize := GetProcAddress(ThemeLibrary, 'GetThemeSysSize');
GetThemeSysFont := GetProcAddress(ThemeLibrary, 'GetThemeSysFont');
GetThemeSysString := GetProcAddress(ThemeLibrary, 'GetThemeSysString');
GetThemeSysInt := GetProcAddress(ThemeLibrary, 'GetThemeSysInt');
IsThemeActive := GetProcAddress(ThemeLibrary, 'IsThemeActive');
IsAppThemed := GetProcAddress(ThemeLibrary, 'IsAppThemed');
GetWindowTheme := GetProcAddress(ThemeLibrary, 'GetWindowTheme');
EnableThemeDialogTexture := GetProcAddress(ThemeLibrary, 'EnableThemeDialogTexture');
IsThemeDialogTextureEnabled := GetProcAddress(ThemeLibrary, 'IsThemeDialogTextureEnabled');
GetThemeAppProperties := GetProcAddress(ThemeLibrary, 'GetThemeAppProperties');
SetThemeAppProperties := GetProcAddress(ThemeLibrary, 'SetThemeAppProperties');
GetCurrentThemeName := GetProcAddress(ThemeLibrary, 'GetCurrentThemeName');
GetThemeDocumentationProperty := GetProcAddress(ThemeLibrary, 'GetThemeDocumentationProperty');
DrawThemeParentBackground := GetProcAddress(ThemeLibrary, 'DrawThemeParentBackground');
EnableTheming := GetProcAddress(ThemeLibrary, 'EnableTheming');
end;
end;
Result := ThemeLibrary <> 0;
end;
//----------------------------------------------------------------------------------------------------------------------
function UseThemes: Boolean;
begin
Result := ThemeLibrary <> 0;
if Result then
Result := IsAppThemed and IsThemeActive;
end;
//----------------------------------------------------------------------------------------------------------------------
{ Following commented out by JR. Depending on unit deinitialization order, the
FreeThemeLibrary call below could be made while other units are still using
the theme library. This happens with NewCheckListBox when Application.Run
isn't called; this unit gets deinitialized before WizardForm and its
TNewCheckListBoxes are destroyed. This resulted in an AV before because
TNewCheckListBox.Destroy calls theme functions.
And there's really no point in freeing a DLL during shutdown anyway; the
system will do so automatically. }
(*
initialization
finalization
while ReferenceCount > 0 do
FreeThemeLibrary;
*)
end.
| Pascal | 5 | Patriccollu/issrc | Components/UxTheme.pas | [
"FSFAP"
] |
import time
import json
import torch
import benchmark_cpp_extension # noqa: F401
"""PyTorch performance microbenchmarks.
This module contains PyTorch-specific functionalities for performance
microbenchmarks.
"""
class TorchBenchmarkBase(torch.nn.Module):
""" This is a base class used to create Pytorch operator benchmark.
module_name is the name of the operator being benchmarked.
test_name is the name (it's created by concatenating all the
inputs) of a specific test
"""
def __init__(self):
super(TorchBenchmarkBase, self).__init__()
self.user_given_name = None
self._pass_count = 0
self._num_inputs_require_grads = 0
def _set_backward_test(self, is_backward):
self._is_backward = is_backward
def auto_set(self):
""" This is used to automatically set the require_grad for the backward patch.
It is implemented based on two counters. One counter to save the number of
times init has been called. The other counter to save the number of times
this function itself has been called. In the very first time init is called,
this function counts how many inputs require gradient. In each of the
following init calls, this function will return only one true value.
Here is an example:
...
self.v1 = torch.rand(M, N, K, requires_grad=self.auto_set())
self.v2 = torch.rand(M, N, K, requires_grad=self.auto_set())
...
"""
if not self._is_backward:
return False
if self._pass_count == 0:
self._num_inputs_require_grads += 1
return True
else:
self._auto_set_counter += 1
return (self._pass_count == self._auto_set_counter)
def extract_inputs_tuple(self):
self.inputs_tuple = tuple(self.inputs.values())
@torch.jit.export
def get_inputs(self):
# Need to convert the inputs to tuple outside of JIT so that
# JIT can infer the size of the inputs.
return self.inputs_tuple
@torch.jit.export
def forward_impl(self):
# This is to supply the inputs to the forward function which
# will be called in both the eager and JIT mode of local runs
return self.forward(*self.get_inputs())
@torch.jit.export
def forward_consume(self, iters: int):
# _consume is used to avoid the dead-code-elimination optimization
for _ in range(iters):
torch.ops.operator_benchmark._consume(self.forward_impl())
def module_name(self):
""" this is used to label the operator being benchmarked
"""
if self.user_given_name:
return self.user_given_name
return self.__class__.__name__
def set_module_name(self, name):
self.user_given_name = name
def test_name(self, **kargs):
""" this is a globally unique name which can be used to
label a specific test
"""
# This is a list of attributes which will not be included
# in the test name.
skip_key_list = ['device']
test_name_str = []
for key in kargs:
value = kargs[key]
test_name_str.append(
('' if key in skip_key_list else key)
+ str(value if type(value) != bool else int(value)))
name = (self.module_name() + '_' +
'_'.join(test_name_str)).replace(" ", "")
return name
class PyTorchOperatorTestCase(object):
""" This class includes all the information needed to benchmark an operator.
op_bench: it's a user-defined class (child of TorchBenchmarkBase)
which includes input and operator, .etc
test_config: a namedtuple includes test_name, input_shape, tag, run_backward.
When run_backward is false, the run_forward method will be executed,
When run_backward is true, run_forward_eager and _output_mean will be
executed to generate output. Then, run_backward will be executed.
"""
def __init__(self, op_bench, test_config):
self.test_config = test_config
self.op_bench = op_bench
self.place_holder_tensor = torch.ones(1)
self.framework = "PyTorch"
self.time_series = []
self._jit_forward_graph = None
def _generate_jit_forward_graph(self):
""" generate a graph for the forward function via scripting
"""
scripted_op_bench = torch.jit.script(self.op_bench)
return scripted_op_bench.forward_consume
def run_jit_forward(self, num_runs, print_per_iter=False, cuda_sync=False):
""" Run the forward path of an op with JIT mode
"""
if self._jit_forward_graph is None:
self._jit_forward_graph = self._generate_jit_forward_graph()
self._jit_forward_graph(num_runs)
def _print_per_iter(self):
# print last 50 values
length = min(len(self.time_series), 50)
for i in range(length):
print("PyTorchObserver " + json.dumps(
{
"type": self.test_config.test_name,
"metric": "latency",
"unit": "ms",
"value": str(self.time_series[length - i - 1]),
}
))
def run_forward(self, num_runs, print_per_iter, cuda_sync):
""" Run the forward path of an op with eager mode
"""
if print_per_iter:
for _ in range(num_runs):
start_time = time.time()
self.output = self.op_bench.forward_impl()
if cuda_sync:
torch.cuda.synchronize(torch.cuda.current_device())
end_time = time.time()
self.time_series.append((end_time - start_time) * 1e3)
else:
for _ in range(num_runs):
self.output = self.op_bench.forward_impl()
if cuda_sync:
torch.cuda.synchronize(torch.cuda.current_device())
def _output_mean(self):
""" TODO (mingzhe): it is not necessary to sum up everything by myself,
torch.autograd.backward do take a gradient tensor. By default, it
is the same shape as your output tensor, with all 1s.
Mathematically, it is the same as if the output is summed together.
So we should be able to get ride of this method.
dummy function for gradient calculation
"""
self.mean = self.output.mean()
def run_backward(self, num_runs, print_per_iter=False):
""" Run the backward path of an op in many iterations
"""
# TODO: can we use JIT here to reduce python overhead?
for _ in range(num_runs):
self.mean.backward(retain_graph=True)
def create_pytorch_op_test_case(op_bench, test_config):
""" This method is used to generate est. func_name is a global unique
string. For PyTorch add operator with M=8, N=2, K=1, tag = long, here
are the values for the members in test_case:
op.module_name: add
framework: PyTorch
test_config: TestConfig(test_name='add_M8_N2_K1', input_config='M: 8, N: 2, K: 1',
tag='long', run_backward=False)
func_name: addPyTorchTestConfig(test_name='add_M8_N2_K1', input_config='M: 8, N: 2, K: 1',
tag='long', run_backward=False)
"""
test_case = PyTorchOperatorTestCase(op_bench, test_config)
test_config = test_case.test_config
op = test_case.op_bench
func_name = "{}{}{}".format(op.module_name(), test_case.framework, str(test_config))
return (func_name, test_case)
| Python | 5 | Hacky-DH/pytorch | benchmarks/operator_benchmark/benchmark_pytorch.py | [
"Intel"
] |
// @traceResolution: true
// @Filename: /src/a.ts
export default 0;
// No extension: '.ts' added
// @Filename: /src/b.ts
import a from './a';
// '.js' extension: stripped and replaced with '.ts'
// @Filename: /src/d.ts
import a from './a.js';
// @Filename: /src/jquery.d.ts
declare var x: number;
export default x;
// No extension: '.d.ts' added
// @Filename: /src/jquery_user_1.ts
import j from "./jquery";
// '.js' extension: stripped and replaced with '.d.ts'
// @Filename: /src/jquery_user_1.ts
import j from "./jquery.js"
| TypeScript | 4 | nilamjadhav/TypeScript | tests/cases/conformance/externalModules/moduleResolutionWithExtensions.ts | [
"Apache-2.0"
] |
#! /bin/csh
eval `scramv1 runtime -csh`
cmsRun SiPixelRecHitsValid_cfg.py
root -b -p -q SiPixelRecHitsCompare.C
| Tcsh | 3 | ckamtsikis/cmssw | Validation/TrackerRecHits/test/SiPixelRecHitsValid.csh | [
"Apache-2.0"
] |
$!
$!
$ olddir = f$environment("default")
$ on control_y then goto YExit
$!
$ gosub Init
$ if .not. init_status then goto YExit
$!
$ call CompileAll
$ call BuildTransferVectors
$ call LinkShared
$!
$ call Cleanup
$!
$YExit:
$ set noon
$!
$ deassign srcdir
$ if f$search("objdir:*.*;*") .nes. "" then delete objdir:*.*;*
$ deassign objdir
$ delete library_objects.dir;*
$!
$ set default 'olddir'
$exit
$!
$!---------------------------------------------------------------------
$!
$Init:
$!
$!
$ init_status = 1
$ thisid = f$integer( %x'f$getjpi(0,"pid")')
$ mdir = f$environment("procedure")
$ mdir = mdir - f$parse(mdir,,,"name") - f$parse(mdir,,,"type") - f$parse(mdir,,,"version")
$ set default 'mdir'
$!
$ objdir = "[.library_objects]"
$ srcdir = "[-.src]"
$!
$ objdirfile = objdir - "[." - "]" + ".dir"
$ if f$search( objdirfile ) .eqs. ""
$ then
$ create/directory 'objdir'
$ endif
$!
$ define objdir 'objdir'
$ define srcdir 'srcdir'
$!
$ cc_include = "/include=([],[-.include])"
$ link_opts = "objdir:libssh2_''thisid'.opt"
$!
$ pipe search [-.include]libssh2.h libssh2_version_major/nohead | (read sys$input l ; l = f$element(2," ",f$edit(l,"trim,compress")) ; -
define/job majorv &l )
$ pipe search [-.include]libssh2.h libssh2_version_minor/nohead | (read sys$input l ; l = f$element(2," ",f$edit(l,"trim,compress")) ; -
define/job minorv &l )
$ pipe search [-.include]libssh2.h libssh2_version_patch/nohead | (read sys$input l ; l = f$element(2," ",f$edit(l,"trim,compress")) ; -
define/job patchv &l )
$!
$ majorv = f$trnlnm("majorv")
$ minorv = f$integer(f$trnlnm("minorv"))
$ patchv = f$integer( f$trnlnm("patchv"))
$!
$ OLBONLY = "FALSE"
$ if p1 .eqs. "OLBONLY"
$ then
$ OLBONLY = "TRUE"
$ endif
$!
$ deassign/job majorv
$ deassign/job minorv
$ deassign/job patchv
$!
$return
$!
$!---------------------------------------------------------------------
$!
$Cleanup: subroutine
$!
$ set noon
$ purge *.opt
$ purge *.olb
$ purge *.exe
$!
$exit 1
$endsubroutine
$!
$!---------------------------------------------------------------------
$!
$LinkShared: subroutine
$!
$!
$!
$ cversion = f$fao("!3ZL",minorv) + f$fao("!3ZL",patchv)
$!
$! General linking options in link_libssh2_version...opt
$! Vectors in link_libssh2_vectors...opt
$!
$ open/write uitv link_libssh2_version_'majorv'_'minorv'_'patchv'.opt
$ write uitv "GSMATCH=LEQUAL,''majorv',''cversion'"
$ write uitv "IDENTIFICATION=""LIBSSH2 ''majorv'.''minorv'.''patchv'"""
$ write uitv "sys$share:ssl$libcrypto_shr32.exe/share"
$ write uitv "sys$share:ssl$libssl_shr32.exe/share"
$ write uitv "gnv$libzshr/share"
$ close uitv
$!
$ link/shared/exe=libssh2_'majorv'_'minorv'_'patchv'.exe -
libssh2.olb/lib, -
link_libssh2_version_'majorv'_'minorv'_'patchv'.opt/opt, -
link_libssh2_vectors_'majorv'_'minorv'_'patchv'.opt/opt
$!
$exit
$endsubroutine
$!
$!---------------------------------------------------------------------
$!
$CompileAll: subroutine
$!
$ set noon
$!
$ if f$search("objdir:*.obj;*") .nes ""
$ then
$ delete objdir:*.obj;*
$ endif
$ if f$search("[.cxx_repository]cxx$demangler_db.;") .nes ""
$ then
$ delete [.cxx_repository]cxx$demangler_db.;*
$ endif
$!
$! Compile all .c files in [-.src], first as_is
$! and then as default all uppercase names
$! and add the resulting object to object libraries
$! libssh2_up.olb and libssh2_as_is.olb.
$!
$ case = 0
$ if OLBONLY then case = 1
$CaseLoop:
$!
$ if case .eq. 0
$ then!camel case names
$ cc_flags = "/names=(shortened,as_is)"
$ objlib = "libssh2_asis.olb"
$ endif
$!
$ if case .eq. 1
$ then!uppercase names
$ if f$search("[.cxx_repository]cxx$demangler_db.;") .nes ""
$ then
$ rename [.cxx_repository]cxx$demangler_db.; *.lowercase
$ purge [.cxx_repository]cxx$demangler_db.lowercase
$ endif
$!
$ cc_flags = "/names=(shortened)"
$ objlib = "libssh2_up.olb"
$ endif
$!
$ if f$search("''objlib';*") .nes. "" then delete 'objlib';*
$ library/create 'objlib'
$!
$Loop:
$ this = f$search("srcdir:*.c;0")
$ if this .eqs. "" then goto EndLoop
$!
$ what = f$parse( this,,,"name")
$!
$ call CompileAndAdd
$!
$ goto Loop
$EndLoop:
$ case = case + 1
$ delete objdir:*.obj;*
$ if case .lt 2 then goto CaseLoop
$!
$ rename libssh2_up.olb libssh2.olb
$ if f$search("[.cxx_repository]cxx$demangler_db.;") .nes ""
$ then
$ rename [.cxx_repository]cxx$demangler_db.; *.uppercase
$ purge [.cxx_repository]cxx$demangler_db.uppercase
$ endif
$!
$ if OLBONLY then exit 4
$!
$! For each function that is too long, create a global symbol
$! low$'shortened-uppercase-name' with as value lowercase shortened
$! name in it, so we can add the proper lower or mixed case
$! shortened name later when building the transfer vectors
$! for the shared image.
$! This is to prevent two very long similar function names
$! that are shortened getting mixed up when sorted alphabetically.
$!
$ inputfile = "[.cxx_repository]cxx$demangler_db.lowercase"
$ gosub GetShortened
$!
$ inputfile = "[.cxx_repository]cxx$demangler_db.uppercase"
$ gosub GetShortened
$!
$exit
$!
$GetShortened:
$!
$ open/read s 'inputfile'
$ namecount = 0
$ReadLoop:
$!
$ read/end=endreadloop s regel
$!
$ shortname = f$element(0,"$",regel) + "$"
$ longname = f$element(1,"$",regel)
$!
$ symvalue = ""
$!
$ if shortname .eqs. f$edit(shortname,"upcase")
$ then
$! this is an uppercase shortname, add it
$ symname = "u$''longname'"
$ symvalue = "''shortname'"
$ low$'shortname' == l$'longname'
$!
$ delete/symbol l$'longname'
$!
$ else
$! this is an lowercase shortname
$ symname = "l$''longname'"
$ symvalue = "''shortname'"
$ 'symname' = "''symvalue'"
$ endif
$!
$ namecount = namecount + 1
$!
$ goto ReadLoop
$EndReadLoop:
$!
$close s
$return
$!
$endsubroutine
$!
$!---------------------------------------------------------------------
$!
$CompileAndAdd: subroutine
$!
$ on error then goto End
$!
$ cc /warn=disable=longextern/lis=objdir:/show=all 'cc_include' 'cc_flags'/object=objdir:'what'.obj srcdir:'what'.c
$ library/insert 'objlib' objdir:'what'.obj
$!
$End:
$exit
$endsubroutine
$!
$!---------------------------------------------------------------------
$!
$BuildTransferVectors: subroutine
$!
$! Do a balanced read of the uppercase library names
$! and the mixed case library names, and build the
$! transfer vectors with uppercase entry points
$! with an alternative in mixed case.
$! For shortened names, use the low$* symbols
$! to avoid being fooled by the sort.
$!
$ thislib = "libssh2.olb"
$ library/lis=libu.'thisid'/names libssh2.olb
$ library/lis=lib_asisu.'thisid'/names libssh2_asis.olb
$!
$! case blind sort of all modules in both the uppercase
$! as the case sensitive object library.
$!
$ sort libu.'thisid' lib.'thisid'/spec=sys$input
/COLLATING_SEQUENCE=(SEQUENCE= ("A" - "Z","0"-"9","_"), FOLD)
$ sort lib_asisu.'thisid' lib_asis.'thisid'/spec=sys$input
/COLLATING_SEQUENCE=(SEQUENCE= ("A" - "Z","0"-"9","_"), FOLD)
$!
$ open/read in lib.'thisid'
$ open/read inasis lib_asis.'thisid'
$ open/write uit link_libssh2_vectors_'majorv'_'minorv'_'patchv'.opt
$!
$ write uit "CASE_SENSITIVE=YES"
$ write uit "SYMBOL_VECTOR= ( -"
$!
$ mode = 0
$ uitregel = ""
$!
$ReadLoop:
$!
$ read/end=ReadAsis in regel
$ReadAsis:
$ read/end=EndReadLoop inasis asisregel
$!
$ regel = f$edit( regel, "trim,compress" )
$ asisregel = f$edit( asisregel, "trim,compress" )
$!
$ if f$element(0," ",regel) .eqs. "Module" .or. -
f$extract(0,1,regel) .eqs. "_" .or. -
f$element(1," ",regel) .nes. " " .or. -
regel .eqs. ""
$ then
$ goto ReadLoop
$ endif
$!
$ if uitregel .nes. "" .and. mode .eq. 1
$ then
$ write uit "''uitregel'=PROCEDURE, -"
$ write uit "''uitasis'/''uitregel'=PROCEDURE, -"
$!
$ uitregel = ""
$ uitasis = ""
$ endif
$!
$ uitregel = regel
$ if f$type( low$'uitregel' ) .nes. ""
$ then
$ uitasis = low$'uitregel'
$ delete/symbol/global low$'uitregel'
$ else
$ uitasis = asisregel
$ endif
$!
$ mode = 1
$!
$ goto ReadLoop
$EndreadLoop:
$!
$! To get the closing brace after the last procedure
$! keyword.
$!
$ if uitregel .nes. ""
$ then
$ write uit "''uitregel'=PROCEDURE, -"
$ write uit "''uitasis'/''uitregel'=PROCEDURE)"
$ endif
$!
$ write uit "CASE_SENSITIVE=NO"
$!
$ close in
$ close inasis
$ close uit
$!
$ delete lib*.'thisid';*
$!
$exit
$endsubroutine
$!
$!---------------------------------------------------------------------
$!
| Clean | 4 | ilineicry/amr | deps/libssh/vms/libssh2_make_lib.dcl | [
"MIT"
] |
// https://doc.sccode.org/Tutorials/Getting-Started/14-Scheduling-Events.html
// https://doc.sccode.org/Classes/Event.html
// An Event specifies an action to be taken in response to a -play message. Its key/value pairs specify the parameters of that action. Event inherits most of its methods from its superclasses, especially from Dictionary. For the usage and meaning of the parent and proto events, see IdentityDictionary.
a = (x: 6, y: 7, play: { (~x * ~y).postln });
a.play; // returns 6 * 7
(freq: 761).play // play a default synth sound with 761 Hz
// Scheduling
SystemClock.sched(5, { "5 seconds passed".postln });
(
var timeNow;
TempoClock.default.tempo = 2; // 2 beats/sec, or 120 BPM
timeNow = TempoClock.default.beats;
"Time is now: ".post; timeNow.postln;
"Scheduling for: ".post; (timeNow + 5).postln;
TempoClock.default.schedAbs(timeNow + 5, {
"Time is later: ".post;
thisThread.clock.beats.postln;
nil;
});
)
// What time is it?
SystemClock.beats;
TempoClock.default.beats;
AppClock.beats;
thisThread.clock.beats; // use inside a scheduled function without worrying about which clock ran the function.
// What can you schedule?
TempoClock.default.sched(5, "hello"); // nothing happens, hello is just a value.
// rather, you need to schedule something that takes action, like a Function, Routine, or Task.
//
// CAUTION: If you schedule a *Function* (but not a Routine or Task) that returns a number, the clock will treat that number as the amount of time before running the function again.
//
// fires many times (but looks like it should fire just once). This will keep going forever, until you stop it with cmd-.
TempoClock.default.sched(1, { rrand(1, 3).postln; });
// If you want the function to run only once, make sure to end the function with 'nil':
TempoClock.default.sched(1, { rrand(1, 3).postln; nil }); // fires once | SuperCollider | 5 | drichardson/examples | SuperCollider/Event.scd | [
"Unlicense"
] |
# Should be an error
function = 42
var = 42
# Shouldn't be an error
abc.with = 42
function: 42
var: 42
# Keywords shouldn't be highlighted
abc.function
abc.do
abc.break
abc.true
abc::function
abc::do
abc::break
abc::true
abc:: function
abc. function
# Numbers should be highlighted
def.42
def .42
def::42
| CoffeeScript | 1 | shriniwas26/vimrc | sources_non_forked/vim-coffee-script/test/test-reserved.coffee | [
"MIT"
] |
c dsdotsub.f
c
c The program is a fortran wrapper for dsdot.
c Witten by Keita Teranishi. 2/11/1998
c
subroutine dsdotsub(n,x,incx,y,incy,dot)
c
external dsdot
double precision dsdot,dot
integer n,incx,incy
real x(*),y(*)
c
dot=dsdot(n,x,incx,y,incy)
return
end
| FORTRAN | 3 | yatonon/dlib-face | dlib/external/cblas/dsdotsub.f | [
"BSL-1.0"
] |
// Ported from musl, which is licensed under the MIT license:
// https://git.musl-libc.org/cgit/musl/tree/COPYRIGHT
//
// https://git.musl-libc.org/cgit/musl/tree/src/math/cosf.c
// https://git.musl-libc.org/cgit/musl/tree/src/math/cos.c
const std = @import("../std.zig");
const math = std.math;
const expect = std.testing.expect;
const kernel = @import("__trig.zig");
const __rem_pio2 = @import("__rem_pio2.zig").__rem_pio2;
const __rem_pio2f = @import("__rem_pio2f.zig").__rem_pio2f;
/// Returns the cosine of the radian value x.
///
/// Special Cases:
/// - cos(+-inf) = nan
/// - cos(nan) = nan
pub fn cos(x: anytype) @TypeOf(x) {
const T = @TypeOf(x);
return switch (T) {
f32 => cos32(x),
f64 => cos64(x),
else => @compileError("cos not implemented for " ++ @typeName(T)),
};
}
fn cos32(x: f32) f32 {
// Small multiples of pi/2 rounded to double precision.
const c1pio2: f64 = 1.0 * math.pi / 2.0; // 0x3FF921FB, 0x54442D18
const c2pio2: f64 = 2.0 * math.pi / 2.0; // 0x400921FB, 0x54442D18
const c3pio2: f64 = 3.0 * math.pi / 2.0; // 0x4012D97C, 0x7F3321D2
const c4pio2: f64 = 4.0 * math.pi / 2.0; // 0x401921FB, 0x54442D18
var ix = @bitCast(u32, x);
const sign = ix >> 31 != 0;
ix &= 0x7fffffff;
if (ix <= 0x3f490fda) { // |x| ~<= pi/4
if (ix < 0x39800000) { // |x| < 2**-12
// raise inexact if x != 0
math.doNotOptimizeAway(x + 0x1p120);
return 1.0;
}
return kernel.__cosdf(x);
}
if (ix <= 0x407b53d1) { // |x| ~<= 5*pi/4
if (ix > 0x4016cbe3) { // |x| ~> 3*pi/4
return -kernel.__cosdf(if (sign) x + c2pio2 else x - c2pio2);
} else {
if (sign) {
return kernel.__sindf(x + c1pio2);
} else {
return kernel.__sindf(c1pio2 - x);
}
}
}
if (ix <= 0x40e231d5) { // |x| ~<= 9*pi/4
if (ix > 0x40afeddf) { // |x| ~> 7*pi/4
return kernel.__cosdf(if (sign) x + c4pio2 else x - c4pio2);
} else {
if (sign) {
return kernel.__sindf(-x - c3pio2);
} else {
return kernel.__sindf(x - c3pio2);
}
}
}
// cos(Inf or NaN) is NaN
if (ix >= 0x7f800000) {
return x - x;
}
var y: f64 = undefined;
const n = __rem_pio2f(x, &y);
return switch (n & 3) {
0 => kernel.__cosdf(y),
1 => kernel.__sindf(-y),
2 => -kernel.__cosdf(y),
else => kernel.__sindf(y),
};
}
fn cos64(x: f64) f64 {
var ix = @bitCast(u64, x) >> 32;
ix &= 0x7fffffff;
// |x| ~< pi/4
if (ix <= 0x3fe921fb) {
if (ix < 0x3e46a09e) { // |x| < 2**-27 * sqrt(2)
// raise inexact if x!=0
math.doNotOptimizeAway(x + 0x1p120);
return 1.0;
}
return kernel.__cos(x, 0);
}
// cos(Inf or NaN) is NaN
if (ix >= 0x7ff00000) {
return x - x;
}
var y: [2]f64 = undefined;
const n = __rem_pio2(x, &y);
return switch (n & 3) {
0 => kernel.__cos(y[0], y[1]),
1 => -kernel.__sin(y[0], y[1], 1),
2 => -kernel.__cos(y[0], y[1]),
else => kernel.__sin(y[0], y[1], 1),
};
}
test "math.cos" {
try expect(cos(@as(f32, 0.0)) == cos32(0.0));
try expect(cos(@as(f64, 0.0)) == cos64(0.0));
}
test "math.cos32" {
const epsilon = 0.00001;
try expect(math.approxEqAbs(f32, cos32(0.0), 1.0, epsilon));
try expect(math.approxEqAbs(f32, cos32(0.2), 0.980067, epsilon));
try expect(math.approxEqAbs(f32, cos32(0.8923), 0.627623, epsilon));
try expect(math.approxEqAbs(f32, cos32(1.5), 0.070737, epsilon));
try expect(math.approxEqAbs(f32, cos32(-1.5), 0.070737, epsilon));
try expect(math.approxEqAbs(f32, cos32(37.45), 0.969132, epsilon));
try expect(math.approxEqAbs(f32, cos32(89.123), 0.400798, epsilon));
}
test "math.cos64" {
const epsilon = 0.000001;
try expect(math.approxEqAbs(f64, cos64(0.0), 1.0, epsilon));
try expect(math.approxEqAbs(f64, cos64(0.2), 0.980067, epsilon));
try expect(math.approxEqAbs(f64, cos64(0.8923), 0.627623, epsilon));
try expect(math.approxEqAbs(f64, cos64(1.5), 0.070737, epsilon));
try expect(math.approxEqAbs(f64, cos64(-1.5), 0.070737, epsilon));
try expect(math.approxEqAbs(f64, cos64(37.45), 0.969132, epsilon));
try expect(math.approxEqAbs(f64, cos64(89.123), 0.40080, epsilon));
}
test "math.cos32.special" {
try expect(math.isNan(cos32(math.inf(f32))));
try expect(math.isNan(cos32(-math.inf(f32))));
try expect(math.isNan(cos32(math.nan(f32))));
}
test "math.cos64.special" {
try expect(math.isNan(cos64(math.inf(f64))));
try expect(math.isNan(cos64(-math.inf(f64))));
try expect(math.isNan(cos64(math.nan(f64))));
}
| Zig | 5 | lukekras/zig | lib/std/math/cos.zig | [
"MIT"
] |
// run-pass
pub trait FakeGenerator {
type Yield;
type Return;
}
pub trait FakeFuture {
type Output;
}
pub fn future_from_generator<
T: FakeGenerator<Yield = ()>
>(x: T) -> impl FakeFuture<Output = T::Return> {
GenFuture(x)
}
struct GenFuture<T: FakeGenerator<Yield = ()>>(T);
impl<T: FakeGenerator<Yield = ()>> FakeFuture for GenFuture<T> {
type Output = T::Return;
}
fn main() {}
| Rust | 4 | Eric-Arellano/rust | src/test/ui/impl-trait/bounds_regression.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
package com.baeldung.hibernate.pessimisticlocking;
import javax.persistence.Entity;
import java.math.BigDecimal;
@Entity
public class PessimisticLockingEmployee extends Individual {
private BigDecimal salary;
public PessimisticLockingEmployee(Long id, String name, String lastName, BigDecimal salary) {
super(id, name, lastName);
this.salary = salary;
}
public PessimisticLockingEmployee() {
super();
}
public BigDecimal getSalary() {
return salary;
}
public void setSalary(BigDecimal average) {
this.salary = average;
}
}
| Java | 4 | zeesh49/tutorials | hibernate5/src/main/java/com/baeldung/hibernate/pessimisticlocking/PessimisticLockingEmployee.java | [
"MIT"
] |
google-site-verification: google385281288605d160.html | HTML | 0 | coreyscherbing/angular | aio/src/google385281288605d160.html | [
"MIT"
] |
implementation-class=org.jetbrains.kotlin.gradle.plugin.performance.KotlinPerformancePlugin | INI | 0 | Mu-L/kotlin | libraries/tools/kotlin-gradle-plugin/src/main/resources/META-INF/gradle-plugins/org.jetbrains.kotlin.native.performance.properties | [
"ECL-2.0",
"Apache-2.0"
] |
import "regent"
terralib.includepath = ".;"..terralib.includepath
local stdlib = terralib.includec("stdlib.h")
local stdio = terralib.includec("stdio.h")
local gocean2d_io_mod = terralib.includec("gocean2d_io_mod.h")
terralib.linklibrary("libgfortran.so")
terralib.linklibrary("./libgocean2d_io_mod.so")
fspace setup_type{
jpiglo: int,
jpjglo: int,
dx: double,
dy: double,
nit000: int,
nitend: int,
record: int,
jphgr_msh: int,
dep_const: double,
rdt: double,
cbfr: double,
visc: double
}
--Uses the libgocean2d_io_mod to read the namelist into the setup_type
task read_namelist(in1 : region(ispace(int1d), setup_type)) where writes(in1) do
var t_jpi = 0
var t_jpj = 0
var t_dx : double = 0.0
var t_dy : double = 0.0
var t_nit000 = 0
var t_nitend = 0
var t_record = 0
var t_jphgr = 0
var t_dep : double = 0.0
var t_rdt : double = 0.0
var t_cbfr : double = 0.0
var t_visc : double = 0.0
gocean2d_io_mod.read_namelist(&t_jpi, &t_jpj, &t_dx, &t_dy, &t_nit000, &t_nitend,
&t_record, &t_jphgr, &t_dep, &t_rdt, &t_cbfr, &t_visc)
in1[0].jpiglo = t_jpi
in1[0].jpjglo = t_jpj
in1[0].dx = t_dx
in1[0].dy = t_dy
in1[0].nit000 = t_nit000
in1[0].nitend = t_nitend
in1[0].record = t_record
in1[0].jphgr_msh = t_jphgr
in1[0].dep_const = t_dep
in1[0].rdt = t_rdt
in1[0].cbfr = t_cbfr
in1[0].visc = t_visc
end
| Rouge | 4 | stfc/PSycloneBench | benchmarks/nemo/nemolite2d/manual_versions/regent/read_namelist.rg | [
"BSD-3-Clause"
] |
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="x-apple-disable-message-reformatting">
<title>{subject}</title>
<!--[if mso]>
<style>
* { font-family: sans-serif !important; }
</style>
<![endif]-->
<!-- @import "../kit/_variables.kit" -->
<style>
<!--
@import "../css/_reset.css"
-->
<!--
@import "../css/_enhancements.css"
-->
a {
color: <!-- $link-color -->;
text-decoration: <!-- $link-text-decoration -->;
font-weight: <!-- $link-font-weight -->;
}
</style>
<!--[if gte mso 9]>
<xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml>
<![endif]-->
</head>
<body width="100%" bgcolor="<!-- $page-background-color -->" style="margin: 0; mso-line-height-rule: exactly;">
<center style="width: 100%; background: <!-- $page-background-color -->; text-align: left;">
<!-- Email Header : BEGIN -->
<div data-section-wrapper="1">
<div style="max-width: 680px; margin: auto;" class="email-container" data-section="1">
<!--[if mso]>
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="680" align="center">
<tr>
<td>
<![endif]-->
<div data-slot-container="1">
<table role="presentation" cellspacing="0" cellpadding="0" border="0" align="center" width="100%"
style="max-width: 680px;">
<tr>
<td style="padding: 25px 0; text-align: center">
<div data-slot="image">
<img src="{{ getAssetUrl('themes/'~template~'/images/header-logo.png', null, null, true) }}"
width="200" height="auto" alt="alt_text" border="0"
style="height: auto; background: transparent; font-family: sans-serif; font-size: 15px; line-height: 20px; color: <!-- $primary-color -->;">
</div>
</td>
</tr>
</table>
</div>
<!--[if mso]>
</td></tr></table>
<![endif]-->
</div>
</div>
<!-- Email Header : END -->
<!-- Hero Image, Flush : BEGIN -->
<div data-section-wrapper="1">
<div style="max-width: 680px; margin: auto;" class="email-container" data-section="1">
<!--[if mso]>
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="680" align="center">
<tr>
<td>
<![endif]-->
<div data-section="1">
<table role="presentation" cellspacing="0" cellpadding="0" border="0" align="center" width="100%"
style="max-width: 680px;" class="email-container">
<tr>
<td bgcolor="<!-- $container-background-color -->" align="center">
<div data-slot-container="1">
<div data-slot="image">
<img src="{{ getAssetUrl('themes/'~template~'/images/brooke-cagle-199263.jpg', null, null, true) }}"
width="680" height="auto" alt="alt_text"
border="0"
align="center"
style="width: 100%; max-width: 680px; height: auto; background: <!-- $image-fallback-background-color -->; font-family: sans-serif; font-size: 15px; line-height: 20px; color: <!-- $image-fallback-alt-text-color -->; margin: auto;"
class="fluid g-img">
</div>
</div>
</td>
</tr>
</table>
</div>
<!--[if mso]>
</td></tr></table>
<![endif]-->
</div>
</div>
<!-- Hero Image, Flush : END -->
<!-- 1 Column Text + Button : BEGIN -->
<div data-section-wrapper="one-column">
<div style="max-width: 680px; margin: auto;" class="email-container" data-section="1">
<!--[if mso]>
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="680" align="center">
<tr>
<td>
<![endif]-->
<div data-section="1">
<table role="presentation" cellspacing="0" cellpadding="0" border="0" align="center" width="100%"
style="max-width: 680px;" class="email-container">
<tr>
<td bgcolor="<!-- $container-background-color -->" style=" padding: 10px 20px;">
<div data-slot-container="1">
<table role="presentation" cellspacing="0" cellpadding="0" border="0"
width="100%"
style="font-family: sans-serif; font-size: <!-- $body-text-font-size-->; line-height: <!-- $body-text-line-height -->; color: <!-- $body-text-color -->; text-align: <!-- $body-text-align -->;">
<tr>
<td>
<div data-slot="text"
data-param-padding-top="<!--$data-text-padding-top-->"
data-param-padding-bottom="<!--$data-text-padding-bottom-->">
<h1 style="
margin: 0;
font-family: sans-serif;
text-align: <!-- $h1-text-align -->;
font-size: <!-- $h1-font-size -->;
line-height: <!-- $h1-line-height -->;
color: <!-- $h1-color -->;
font-weight: <!-- $h1-font-weight -->;
padding-top: <!--$data-text-padding-top-->px;
padding-bottom: <!--$data-text-padding-bottom-->px">
Praesent laoreet malesuada cursus.
</h1>
</div>
</td>
</tr>
<tr>
<td>
<div data-slot="text"
data-param-padding-top="<!--$data-text-padding-top-->"
data-param-padding-bottom="<!--$data-text-padding-bottom-->">
<p style="
margin: 0;
padding-top: <!--$data-text-padding-top-->px;
padding-bottom: <!--$data-text-padding-bottom-->px">
Maecenas sed ante pellentesque,
posuere leo
id,
eleifend
dolor. Class aptent taciti sociosqu ad litora torquent
per
conubia
nostra,
per inceptos himenaeos. Praesent laoreet malesuada
cursus.
Maecenas
scelerisque congue eros eu posuere. Praesent in felis
ut
velit
pretium
lobortis rhoncus ut erat.
</p>
</div>
</td>
</tr>
<tr>
<td>
<!-- Button : BEGIN -->
<div data-slot="button"
data-param-float="1"
align="center"
data-param-padding-top="<!--$button-padding-top -->"
data-param-padding-bottom="<!--$button-padding-bottom -->"
data-param-border-radius="<!-- $button-border-radius -->"
data-param-background-color="<!-- $button-background -->"
data-param-color="<!-- $button-color -->"
data-param-button-size="1"
data-param-link-text="PURCHASE NOW"
data-param-href="#"
style="padding-top: <!--$button-padding-top -->px;
padding-bottom: <!--$button-padding-bottom -->px;">
<a href="#" class="button" target="_blank"
style="
font-family: sans-serif;
font-weight: <!--$button-font-weight -->;
line-height: 1.1;
border-color: <!-- $button-border-color -->;
border-width: <!--$button-border-top-bottom-width--> <!--$button-border-left-right-width-->;
border-style: <!--$button-border-style -->;
text-decoration: <!-- $button-text-decoration -->;
border-radius: <!--$button-border-radius -->px;
background-color: <!-- $button-background -->;
display: inline-block;
font-size: <!-- $button-font-size -->;
color: <!-- $button-color -->;"
background="<!-- $button-background -->">
PURCHASE NOW
</a>
</div>
<!-- Button : END -->
</td>
</tr>
<tr>
<td>
<div data-slot="text"
data-param-padding-top="<!--$data-text-padding-top-->"
data-param-padding-bottom="<!--$data-text-padding-bottom-->">
<p style="
margin: 0;
padding-top: <!--$data-text-padding-top-->px;
padding-bottom: <!--$data-text-padding-bottom-->px">
Fusce in condimentum dolor, vitae
mollis
est.
Nullam
ullamcorper lectus sit amet mauris tempor lobortis.
</p>
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
<!--[if mso]>
</td></tr></table>
<![endif]-->
</div>
</div>
<!-- 1 Column Text + Button : END -->
<!-- 2 Even Columns : BEGIN -->
<div data-section-wrapper="two-column">
<div style="max-width: 680px; margin: auto;" class="email-container" data-section="1">
<!--[if mso]>
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="680" align="center">
<tr>
<td>
<![endif]-->
<div data-slot-container="1">
<div data-section="1">
<table role="presentation" cellspacing="0" cellpadding="0" border="0" align="center"
width="100%"
style="max-width: 680px;" class="email-container">
<tr>
<td bgcolor="<!-- $container-background-color -->" align="center" height="100%"
valign="top"
width="100%">
<div data-section-wrapper="1">
<!--[if mso]>
<table role="presentation" border="0" cellspacing="0" cellpadding="0"
align="center"
width="660">
<tr>
<td align="center" valign="top" width="660">
<![endif]-->
<div data-section="1">
<table role="presentation" border="0" cellpadding="0" cellspacing="0"
align="center"
width="100%" style="max-width:660px;">
<tr>
<td align="center" valign="top"
style="font-size:0; padding: 10px 0;">
<!--[if mso]>
<table role="presentation" border="0" cellspacing="0"
cellpadding="0"
align="center" width="660">
<tr>
<td align="left" valign="top" width="330">
<![endif]-->
<div style="display:inline-block; margin: 0 -2px; width:100%; min-width:200px; max-width:330px; vertical-align:top;"
class="stack-column">
<table role="presentation" cellspacing="0"
cellpadding="0"
border="0"
width="100%">
<tr>
<td style="padding: 10px 10px;">
<div data-slot-container="1">
<table role="presentation"
cellspacing="0"
cellpadding="0"
border="0" width="100%"
style="font-size: <!-- $two-columns-text-size -->;text-align: <!-- $two-columns-text-align -->;">
<tr>
<td>
<div data-slot="image">
<img src="{{ getAssetUrl('themes/'~template~'/images/alejandra-higareda-295605.jpg', null, null, true) }}"
width="310"
height=""
border="0"
alt="alt_text"
class="center-on-narrow"
style="width: 100%; max-width: 310px; height: auto; background: <!-- $image-fallback-background-color -->; font-family: sans-serif; font-size: 15px; line-height: 20px; color: <!-- $image-fallback-alt-text-color -->;">
</div>
</td>
</tr>
<tr>
<td style="font-family: sans-serif; font-size: <!-- $two-columns-text-size -->; line-height: <!-- $two-columns-text-line-height -->; color: <!-- $body-text-color -->; padding-top: 10px;"
class="stack-column-center">
<div data-slot="text">
<p style="margin: 0;">
Maecenas
sed
ante
pellentesque,
posuere
leo
id,
eleifend
dolor.
Class
aptent
taciti
sociosqu
ad
litora
torquent
per
conubia
nostra,
per
inceptos
himenaeos.</p>
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
<!--[if mso]>
</td>
<td align="left" valign="top" width="330">
<![endif]-->
<div style="display:inline-block; margin: 0 -2px; width:100%; min-width:200px; max-width:330px; vertical-align:top;"
class="stack-column">
<table role="presentation" cellspacing="0"
cellpadding="0"
border="0"
width="100%">
<tr>
<td style="padding: 10px 10px;">
<div data-slot-container="1">
<table role="presentation"
cellspacing="0"
cellpadding="0"
border="0" width="100%"
style="font-size: 14px;text-align: left;">
<tr>
<td>
<div data-slot="image">
<img src="{{ getAssetUrl('themes/'~template~'/images/lucas-sankey-378674.jpg', null, null, true) }}"
width="310"
height=""
border="0"
alt="alt_text"
class="center-on-narrow"
style="width: 100%; max-width: 310px; height: auto; background: <!-- $image-fallback-background-color -->; font-family: sans-serif; font-size: 15px; line-height: 20px; color: <!-- $image-fallback-alt-text-color -->;">
</div>
</td>
</tr>
<tr>
<td style="font-family: sans-serif; font-size: <!-- $two-columns-text-size -->; line-height: <!-- $two-columns-text-line-height -->; color: <!-- $body-text-color -->; padding-top: 10px;"
class="stack-column-center">
<div data-slot="text">
<p style="margin: 0;">
Maecenas
sed
ante
pellentesque,
posuere
leo
id,
eleifend
dolor.
Class
aptent
taciti
sociosqu
ad
litora
torquent
per
conubia
nostra,
per
inceptos
himenaeos.</p>
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
<!--[if mso]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>
</table>
</div>
<!--[if mso]>
</td>
</tr>
</table>
<![endif]-->
</div>
</td>
</tr>
</table>
</div>
</div>
<!--[if mso]>
</td></tr></table>
<![endif]-->
</div>
</div>
<!-- 2 Even Columns : END -->
<!-- 3 Even Columns : BEGIN -->
<div data-section-wrapper="three-column">
<div data-section-wrapper="1">
<div style="max-width: 680px; margin: auto;" class="email-container">
<!--[if mso]>
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="680" align="center">
<tr>
<td>
<![endif]-->
<div data-section="1">
<table role="presentation" cellspacing="0" cellpadding="0" border="0" align="center"
width="100%"
style="max-width: 680px;" class="email-container">
<tr>
<td bgcolor="<!-- $container-background-color -->" align="center" height="100%"
valign="top"
width="100%"
style="padding: 10px 0;">
<table role="presentation" border="0" cellpadding="0" cellspacing="0"
align="center"
width="100%" style="max-width:660px;">
<tr>
<td align="center" valign="top" style="font-size:0;">
<!--[if mso]>
<table role="presentation" border="0" cellspacing="0"
cellpadding="0"
align="center" width="660">
<tr>
<td align="left" valign="top" width="220">
<![endif]-->
<div style="display:inline-block; margin: 0 -2px; max-width:33.33%; min-width:220px; vertical-align:top; width:100%;"
class="stack-column">
<table role="presentation" cellspacing="0" cellpadding="0"
border="0"
width="100%">
<tr>
<td style="padding: 10px 10px;">
<table role="presentation" cellspacing="0"
cellpadding="0"
border="0" width="100%"
style="font-size: <!--$three-columns-text-size-->;text-align: <!--$three-columns-text-align-->;">
<tr>
<td style="font-family: sans-serif; font-size: <!-- $three-columns-text-size -->; line-height: <!-- $three-columns-text-line-height -->; color: <!-- $body-text-color -->; padding-top: 10px;"
class="stack-column-center">
<div data-slot-container="1">
<div data-slot="image">
<img
src="{{ getAssetUrl('themes/'~template~'/images/william-iven-8514.jpg', null, null, true) }}"
width="200"
height=""
border="0"
alt="alt_text"
class="center-on-narrow"
style="width: 100%; max-width: 200px; height: auto; background: <!-- $image-fallback-background-color -->; font-family: sans-serif; font-size: 15px; line-height: 20px; color: <!-- $image-fallback-alt-text-color -->;"/>
</div>
<div data-slot="text">
<p>Maecenas sed
ante
pellentesque,
posuere leo id,
eleifend
dolor. Class
aptent taciti
sociosqu
ad
litora torquent
per conubia
nostra,
per
inceptos
himenaeos.</p>
</div>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!--[if mso]>
</td>
<td align="left" valign="top" width="220">
<![endif]-->
<div style="display:inline-block; margin: 0 -2px; max-width:33.33%; min-width:220px; vertical-align:top; width:100%;"
class="stack-column">
<table role="presentation" cellspacing="0" cellpadding="0"
border="0"
width="100%">
<tr>
<td style="padding: 10px 10px;">
<table role="presentation" cellspacing="0"
cellpadding="0"
border="0" width="100%"
style="font-size: <!--$three-columns-text-size-->;text-align: <!--$three-columns-text-align-->;">
<tr>
<td style="font-family: sans-serif; font-size: <!-- $three-columns-text-size -->; line-height: <!-- $three-columns-text-line-height -->; color: <!-- $body-text-color -->; padding-top: 10px;"
class="stack-column-center">
<div data-slot-container="1">
<div data-slot="image">
<img
src="{{ getAssetUrl('themes/'~template~'/images/stefan-stefancik-297983.jpg', null, null, true) }}"
width="200"
height=""
border="0"
alt="alt_text"
class="center-on-narrow"
style="width: 100%; max-width: 200px; height: auto; background: <!-- $image-fallback-background-color -->; font-family: sans-serif; font-size: 15px; line-height: 20px; color: <!-- $image-fallback-alt-text-color -->;"/>
</div>
<div data-slot="text">
<p>Maecenas sed
ante
pellentesque,
posuere leo id,
eleifend
dolor. Class
aptent taciti
sociosqu
ad
litora torquent
per conubia
nostra,
per
inceptos
himenaeos.</p>
</div>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!--[if mso]>
</td>
<td align="left" valign="top" width="220">
<![endif]-->
<div style="display:inline-block; margin: 0 -2px; max-width:33.33%; min-width:220px; vertical-align:top; width:100%;"
class="stack-column">
<table role="presentation" cellspacing="0" cellpadding="0"
border="0"
width="100%">
<tr>
<td style="padding: 10px 10px;">
<table role="presentation" cellspacing="0"
cellpadding="0"
border="0" width="100%"
style="font-size: <!--$three-columns-text-size-->;text-align: <!--$three-columns-text-align-->;">
<tr>
<td style="font-family: sans-serif; font-size: <!-- $three-columns-text-size -->; line-height: <!-- $three-columns-text-line-height -->; color: <!-- $body-text-color -->; padding-top: 10px;"
class="stack-column-center">
<div data-slot-container="1">
<div data-slot="image">
<img
src="{{ getAssetUrl('themes/'~template~'/images/fabian-irsara-92113.jpg', null, null, true) }}"
width="200"
height=""
border="0"
alt="alt_text"
class="center-on-narrow"
style="width: 100%; max-width: 200px; height: auto; background: <!-- $image-fallback-background-color -->; font-family: sans-serif; font-size: 15px; line-height: 20px; color: <!-- $image-fallback-alt-text-color -->;"/>
</div>
<div data-slot="text">
<p>Maecenas sed
ante
pellentesque,
posuere leo id,
eleifend
dolor. Class
aptent taciti
sociosqu
ad
litora torquent
per conubia
nostra,
per
inceptos
himenaeos.</p>
</div>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!--[if mso]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!--[if mso]>
</td></tr></table>
<![endif]-->
</div>
</div>
</div>
<!-- 3 Even Columns : END -->
<!-- Thumbnail Left, Text Right : BEGIN -->
<div data-section-wrapper="1">
<div style="max-width: 680px; margin: auto;" class="email-container">
<!--[if mso]>
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="680" align="center">
<tr>
<td>
<![endif]-->
<div data-section="1">
<table role="presentation" cellspacing="0" cellpadding="0" border="0" align="center"
width="100%"
style="max-width: 680px;" class="email-container">
<tr>
<!-- dir=ltr is where the magic happens. This can be changed to dir=rtl to swap the alignment on wide while maintaining stack order on narrow. -->
<td dir="ltr" bgcolor="<!-- $container-background-color -->" align="center" height="100%"
valign="top" width="100%"
style="padding: 10px 0;">
<!--[if mso]>
<table role="presentation" border="0" cellspacing="0" cellpadding="0" align="center"
width="660" style="width: 660px;">
<tr>
<td align="center" valign="top" width="660" style="width: 660px;">
<![endif]-->
<table role="presentation" border="0" cellpadding="0" cellspacing="0" align="center"
width="100%" style="max-width:660px;">
<tr>
<td align="center" valign="top" style="font-size:0; padding: 10px 0;">
<!--[if mso]>
<table role="presentation" border="0" cellspacing="0" cellpadding="0"
align="center" width="660" style="width: 660px;">
<tr>
<td align="left" valign="top" width="220"
style="width: 220px;">
<![endif]-->
<div style="display:inline-block; margin: 0 -2px; max-width: 200px; min-width:160px; vertical-align:top; width:100%;"
class="stack-column">
<div data-slot-container="1">
<table role="presentation" cellspacing="0" cellpadding="0"
border="0"
width="100%">
<tr>
<td dir="ltr" style="padding: 0 10px 10px 10px;">
<div data-slot="image">
<img
src="{{ getAssetUrl('themes/'~template~'/images/nigel-tadyanehondo-230499.jpg', null, null, true) }}"
width="200" height="auto"
border="0" alt="alt_text"
class="center-on-narrow"
style="width: 100%; max-width: 200px; height: auto; background: <!-- $image-fallback-background-color -->; font-family: sans-serif; font-size: 15px; line-height: 20px; color: <!-- $image-fallback-alt-text-color -->;"/>
</div>
</td>
</tr>
</table>
</div>
</div>
<!--[if mso]>
</td>
<td align="left" valign="top" width="440" style="width: 440px;">
<![endif]-->
<div style="display:inline-block; margin: 0 -2px; max-width:66.66%; min-width:320px; vertical-align:top;"
class="stack-column">
<table role="presentation" cellspacing="0" cellpadding="0"
border="0"
width="100%">
<tr>
<td dir="ltr"
style="font-family: sans-serif; font-size: <!-- $media-block-text-size -->; line-height: <!-- $media-block-text-line-height -->; color: <!-- $body-text-color -->; padding: 10px 10px 0; text-align:
<!-- $media-block-text-align -->;"
class="center-on-narrow">
<div data-slot-container="1">
<div data-slot="text">
<h2 style="margin: 0 0 10px 0; font-family: sans-serif; font-size: <!-- $h2-font-size -->; line-height: <!-- $h2-line-height -->; color: <!-- $h2-color -->; font-weight: <!-- $h2-font-weight -->">
Class aptent taciti sociosqu</h2>
<p>Maecenas sed ante
pellentesque, posuere leo id,
eleifend dolor.
Class
aptent taciti sociosqu ad litora
torquent per
conubia
nostra, per inceptos himenaeos.</p>
</div>
<!-- Button : BEGIN -->
<div data-slot="button"
data-param-float="1"
align="center"
data-param-padding-top="<!--$button-padding-top -->"
data-param-padding-bottom="<!--$button-padding-bottom -->"
data-param-border-radius="<!-- $button-border-radius -->"
data-param-background-color="<!-- $button-background -->"
data-param-color="<!-- $button-color -->"
data-param-button-size="1"
data-param-link-text="Check it out"
data-param-href="#"
style="padding-top: <!--$button-padding-top -->px;
padding-bottom: <!--$button-padding-bottom -->px;">
<a href="#" class="button"
target="_blank"
style="
font-family: sans-serif;
font-weight: <!--$button-font-weight -->;
line-height: 1.1;
border-color: <!-- $button-border-color -->;
border-width: <!--$button-border-top-bottom-width--> <!--$button-border-left-right-width-->;
border-style: <!--$button-border-style -->;
text-decoration: <!-- $button-text-decoration -->;
border-radius: <!--$button-border-radius -->px;
background-color: <!-- $button-background -->;
display: inline-block;
font-size: <!-- $button-font-size -->;
color: <!-- $button-color -->;"
background="<!-- $button-background -->">
Check it out
</a>
</div>
<!-- Button : END -->
</div>
</td>
</tr>
</table>
</div>
<!--[if mso]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>
</table>
<!--[if mso]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>
</table>
</div>
<!--[if mso]>
</td></tr></table>
<![endif]-->
</div>
</div>
<!-- Thumbnail Left, Text Right : END -->
<!-- Thumbnail Right, Text Left : BEGIN -->
<div data-section-wrapper="1">
<div style="max-width: 680px; margin: auto;" class="email-container">
<!--[if mso]>
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="680" align="center">
<tr>
<td>
<![endif]-->
<div data-section="1">
<table role="presentation" cellspacing="0" cellpadding="0" border="0" align="center"
width="100%"
style="max-width: 680px;" class="email-container">
<tr>
<!-- dir=rtl is where the magic happens. This can be changed to dir=ltr to swap the alignment on wide while maintaining stack order on narrow. -->
<td dir="rtl" bgcolor="<!-- $container-background-color -->" align="center" height="100%"
valign="top" width="100%"
style="padding: 10px 0;">
<!--[if mso]>
<table role="presentation" border="0" cellspacing="0" cellpadding="0" align="center"
width="660" style="width: 660px;">
<tr>
<td align="center" valign="top" width="660">
<![endif]-->
<table role="presentation" border="0" cellpadding="0" cellspacing="0" align="center"
width="100%" style="max-width:660px;">
<tr>
<td align="center" valign="top" style="font-size:0; padding: 10px 0;">
<div data-slot-container="1">
<!--[if mso]>
<table role="presentation" border="0" cellspacing="0"
cellpadding="0"
align="center" width="660" style="width: 660px;">
<tr>
<td align="left" valign="top" width="220"
style="width: 220px;">
<![endif]-->
<div style="display:inline-block; margin: 0 -2px; max-width: 200px; min-width:160px; vertical-align:top; width:100%;"
class="stack-column">
<table role="presentation" cellspacing="0" cellpadding="0"
border="0"
width="100%">
<tr>
<td dir="ltr" style="padding: 0 10px 10px 10px;">
<div data-slot="image">
<img
src="{{ getAssetUrl('themes/'~template~'/images/nadine-shaabana-291361.jpg', null, null, true) }}"
width="200"
height=""
border="0" alt="alt_text"
class="center-on-narrow"
style="width: 100%; max-width: 200px; height: auto; background: <!-- $image-fallback-background-color -->; font-family: sans-serif; font-size: 15px; line-height: 20px; color: <!--
$image-fallback-alt-text-color -->;"/>
</div>
</td>
</tr>
</table>
</div>
<!--[if mso]>
</td>
<td align="left" valign="top" width="440" style="width: 440px;">
<![endif]-->
<div style="display:inline-block; margin: 0 -2px; max-width:66.66%; min-width:320px; vertical-align:top;"
class="stack-column">
<table role="presentation" cellspacing="0" cellpadding="0"
border="0"
width="100%">
<tr>
<td dir="ltr"
style="font-family: sans-serif; font-size: <!-- $media-block-text-size -->; line-height: <!-- $media-block-text-line-height -->; color: <!-- $body-text-color -->; padding: 10px 10px 0; text-align:
<!-- $media-block-text-align -->;"
class="center-on-narrow">
<div data-slot="text">
<h2 style="margin: 0 0 10px 0; font-family: sans-serif; font-size: <!-- $h2-font-size -->; line-height: <!-- $h2-line-height -->; color: <!-- $h2-color -->; font-weight: <!-- $h2-font-weight -->">
Class aptent taciti sociosqu</h2>
<p>Maecenas sed ante
pellentesque, posuere leo id,
eleifend
dolor.
Class
aptent taciti sociosqu ad litora
torquent per
conubia
nostra, per inceptos himenaeos.</p>
</div>
<!-- Button : BEGIN -->
<div data-slot="button"
data-param-float="1"
align="center"
data-param-padding-top="<!--$button-padding-top -->"
data-param-padding-bottom="<!--$button-padding-bottom -->"
data-param-border-radius="<!-- $button-border-radius -->"
data-param-background-color="<!-- $button-background -->"
data-param-color="<!-- $button-color -->"
data-param-button-size="1"
data-param-link-text="Check it out"
data-param-href="#"
style="padding-top: <!--$button-padding-top -->px;
padding-bottom: <!--$button-padding-bottom -->px;">
<a href="#" class="button"
target="_blank"
style="
font-family: sans-serif;
font-weight: <!--$button-font-weight -->;
line-height: 1.1;
border-color: <!-- $button-border-color -->;
border-width: <!--$button-border-top-bottom-width--> <!--$button-border-left-right-width-->;
border-style: <!--$button-border-style -->;
text-decoration: <!-- $button-text-decoration -->;
border-radius: <!--$button-border-radius -->px;
background-color: <!-- $button-background -->;
display: inline-block;
font-size: <!-- $button-font-size -->;
color: <!-- $button-color -->;"
background="<!-- $button-background -->">
Check it out
</a>
</div>
<!-- Button : END -->
</td>
</tr>
</table>
</div>
<!--[if mso]>
</td>
</tr>
</table>
<![endif]-->
</div>
</td>
</tr>
</table>
<!--[if mso]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>
</table>
<!--[if mso]>
</td></tr></table>
<![endif]-->
</div>
</div>
</div>
<!-- Thumbnail Right, Text Left : END -->
<!-- Separator : BEGIN -->
<div data-section-wrapper="1">
<div style="max-width: 680px; margin: auto;" class="email-container" data-section="1">
<!--[if mso]>
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="680" align="center">
<tr>
<td>
<![endif]-->
<div data-slot-container="1">
<div data-section="1">
<table role="presentation" cellspacing="0" cellpadding="0" border="0" align="center"
width="100%"
style="max-width: 680px;" class="email-container">
<tr>
<td>
<div data-slot="separator"
data-param-separator-color="<!-- $separator-border-color -->"
data-param-separator-thickness="<!-- $separator-thickness -->"
data-param-padding-top="<!-- $separator-padding-top -->"
data-param-padding-bottom="<!-- $separator-padding-bottom -->"
style="
padding-top: <!-- $separator-padding-top -->px;
padding-bottom: <!-- $separator-padding-bottom -->px;">
<hr style="border: <!-- $separator-thickness -->px <!--
$separator-border-style
--> #<!-- $separator-border-color -->;">
</div>
</td>
</tr>
</table>
</div>
</div>
<!--[if mso]>
</td></tr></table>
<![endif]-->
</div>
</div>
<!-- Separator : END -->
<!-- 1 Column Text : BEGIN -->
<div data-section-wrapper="one-column">
<div data-section-wrapper="1">
<div style="max-width: 680px; margin: auto;" class="email-container" data-section="1">
<!--[if mso]>
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="680" align="center">
<tr>
<td>
<![endif]-->
<div data-slot-container="1">
<div data-section="1">
<table role="presentation" cellspacing="0" cellpadding="0" border="0" align="center"
width="100%"
style="max-width: 680px;" class="email-container">
<tr>
<td bgcolor="<!-- $container-background-color -->"
style="padding-left: 30px; padding-right: 30px;">
<table role="presentation" cellspacing="0" cellpadding="0" border="0"
width="100%">
<tr>
<td style="font-family: sans-serif; font-size: <!-- $one-column-text-size -->; line-height: <!-- $one-column-text-line-height-->; color:<!-- $body-text-color -->;">
<div data-slot="text"
data-param-padding-top="30"
data-param-padding-top="30"
style="padding-top: 30px; padding-bottom: 30px; font-family: sans-serif; font-size: <!-- $one-column-text-size -->; line-height: <!-- $one-column-text-line-height-->; color:<!-- $body-text-color -->;">
<p>Maecenas sed ante
pellentesque, posuere
leo
id,
eleifend dolor. Class aptent taciti sociosqu ad
litora
torquent
per
conubia
nostra, per inceptos himenaeos. Praesent laoreet
malesuada
cursus.
Maecenas
scelerisque congue eros eu posuere. Praesent in
felis
ut velit
pretium
lobortis rhoncus ut erat.</p>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
<!--[if mso]>
</td></tr></table>
<![endif]-->
</div>
</div>
</div>
<!-- 1 Column Text : END -->
<!-- Footer Background Section : BEGIN -->
<div data-section-wrapper="1">
<table role="presentation" bgcolor="<!-- $footer-background-color -->" cellspacing="0"
cellpadding="0"
border="0"
align="center"
width="100%">
<tr>
<td valign="top" align="center">
<div data-section="1">
<div style="max-width: 680px; margin: auto;" class="email-container">
<!--[if mso]>
<table role="presentation" cellspacing="0" cellpadding="0" border="0"
width="680"
align="center">
<tr>
<td>
<![endif]-->
<table role="presentation" cellspacing="0" cellpadding="0" border="0"
width="100%"
data-section="1">
<tr>
<td style="text-align: <!-- $footer-text-align -->; font-family: sans-serif; font-size: <!-- $footer-font-size -->; line-height: <!-- $footer-line-height -->; color: <!-- $footer-color -->;">
<div data-slot-container="1">
<div data-slot="text"
data-param-padding-top="<!--$footer-padding-top-->"
data-param-padding-bottom="<!--$footer-padding-bottom-->"
style="padding-top: <!--$footer-padding-top-->px;
padding-bottom: <!--$footer-padding-bottom-->px;">
<p>
<webversion
style="color:<!-- $webpage-link-color -->; text-decoration:<!-- $webpage-link-text-decoration -->; font-weight: <!-- $webpage-link-font-weight -->;">
{webpage_text}
</webversion>
</p>
<p>
Company Name<br>123 Fake Street,
SpringField, OR, 97477
US<br>(123)
456-7890
</p>
<p>
<unsubscribe
style="color:<!-- $unsubscribe-link-color -->; text-decoration:<!-- $unsubscribe-link-text-decoration -->; font-weight: <!-- $unsubscribe-link-font-weight -->;">
{unsubscribe_text}
</unsubscribe>
</p>
</div>
</div>
</td>
</tr>
</table>
<!--[if mso]>
</td>
</tr>
</table>
<![endif]-->
</div>
</div>
</td>
</tr>
</table>
</div>
<!-- Footer Background Section : END -->
<!-- Downloaded from https://github.com/hmaesta/simplect-email-template -->
</center>
</body>
</html> | Kit | 4 | smola/language-dataset | data/github.com/hmaesta/simplect-email-template/58942b86c52889844484c2b5f698282bec75aaed/kit/email.kit | [
"MIT"
] |
<!---================= Room Booking System / https://github.com/neokoenig =======================--->
<cfoutput>
<cfparam name="locations">
<!--- Get Buildings --->
<cfquery dbtype="query" name="buildings">
SELECT DISTINCT building FROM locations WHERE building IS NOT NULL;
</cfquery>
<!--- Inline CSS--->
<cfif application.rbs.setting.showlocationcolours>
<style>
<cfloop query="locations"><cfif len(colour)>.#class# {background: #colour#; border-color: #colour#;} .pending.#class# {color: #colour#;}</cfif>
</cfloop>
</style>
</cfif>
<div id="location-filter">
<div class="btn-group btn-group-justified building-row">
#linkTo(action="index", class="btn btn-primary btn-sm location-filter", data_id="all", text="All")#
<cfif buildings.recordcount>
<cfloop query="buildings">
#linkTo(controller="bookings", action="building", key=toTagSafe(building), class="#iif(params.key EQ toTagSafe(building), '"active"', '')# btn btn-sm btn-primary location-filter", data_id="#toTagSafe(building)#", text="#building#")#
</cfloop>
</cfif>
</div>
<div class="btn-group btn-group-justified location-row">
<cfloop query="locations">
#linkTo(controller="bookings", action="location", key=id, class="all #toTagSafe(building)# btn btn-sm location-filter btn-default #class# location#id#", text="#name#<br /><small>#description#</small>")#
</cfloop>
</div>
</div>
</cfoutput> | ColdFusion | 3 | fintecheando/RoomBooking | views/bookings/_locations.cfm | [
"Apache-1.1"
] |
// check-pass
// Regression test for issue #79152
//
// Tests that we can index an array in a const function
const fn foo() {
let mut array = [[0; 1]; 1];
array[0][0] = 1;
}
fn main() {}
| Rust | 3 | Eric-Arellano/rust | src/test/ui/consts/issue-79152-const-array-index.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
Import builder
Class AndroidBuilder Extends Builder
Method New( tcc:TransCC )
Super.New( tcc )
End
Method Config:String()
Local config:=New StringStack
For Local kv:=Eachin GetConfigVars()
config.Push "static final String "+kv.Key+"="+Enquote( kv.Value,"java" )+";"
Next
Return config.Join( "~n" )
End
Method IsValid:Bool()
Return tcc.ANDROID_PATH<>""
End
Method Begin:Void()
ENV_LANG="java"
_trans=New JavaTranslator
End
Method CreateDirRecursive:Bool( path:String )
Local i:=0
Repeat
i=path.Find( "/",i )
If i=-1
CreateDir( path )
Return FileType( path )=FILETYPE_DIR
Endif
Local t:=path[..i]
CreateDir( t )
If FileType( t )<>FILETYPE_DIR Return False
i+=1
Forever
End
Method MakeTarget:Void()
'create data dir
CreateDataDir "assets/monkey"
Local app_label:=GetConfigVar( "ANDROID_APP_LABEL" )
Local app_package:=GetConfigVar( "ANDROID_APP_PACKAGE" )
SetEnv "ANDROID_SDK_DIR",tcc.ANDROID_PATH.Replace( "\","\\" )
SetConfigVar "ANDROID_MANIFEST_MAIN",GetConfigVar( "ANDROID_MANIFEST_MAIN" ).Replace( ";","~n" )+"~n"
SetConfigVar "ANDROID_MANIFEST_APPLICATION",GetConfigVar( "ANDROID_MANIFEST_APPLICATION" ).Replace( ";","~n" )+"~n"
SetConfigVar "ANDROID_MANIFEST_ACTIVITY",GetConfigVar( "ANDROID_MANIFEST_ACTIVITY" ).Replace( ";","~n" )+"~n"
'create package
Local jpath:="src"
DeleteDir jpath,True
CreateDir jpath
For Local t:=Eachin app_package.Split(".")
jpath+="/"+t
CreateDir jpath
Next
jpath+="/MonkeyGame.java"
'template files
For Local file:=Eachin LoadDir( "templates",True )
'Recursive CreateDir...
Local i:=0
Repeat
i=file.Find( "/",i )
If i=-1 Exit
CreateDir file[..i]
If FileType( file[..i] )<>FILETYPE_DIR
file=""
Exit
Endif
i+=1
Forever
If Not file Continue
Select ExtractExt( file ).ToLower()
Case "xml","properties","java"
Local str:=LoadString( "templates/"+file )
str=ReplaceEnv( str )
SaveString str,file
Default
CopyFile "templates/"+file,file
End
Next
'create main source file
Local main:=LoadString( "MonkeyGame.java" )
main=ReplaceBlock( main,"TRANSCODE",transCode )
main=ReplaceBlock( main,"CONFIG",Config() )
'extract all imports
Local imps:=New StringStack
Local done:=New StringSet
Local out:=New StringStack
For Local line:=Eachin main.Split( "~n" )
If line.StartsWith( "import " )
Local i:=line.Find( ";",7 )
If i<>-1
Local id:=line[7..i+1]
If Not done.Contains( id )
done.Insert id
imps.Push "import "+id
Endif
Endif
Else
out.Push line
Endif
End
main=out.Join( "~n" )
main=ReplaceBlock( main,"IMPORTS",imps.Join( "~n" ) )
main=ReplaceBlock( main,"PACKAGE","package "+app_package+";" )
SaveString main,jpath
'create 'libs' dir
For Local lib:=Eachin GetConfigVar( "LIBS" ).Split( ";" )
Select ExtractExt( lib )
Case "jar","so"
Local tdir:=""
If lib.Contains( "/" )
tdir=ExtractDir( lib )
If tdir.Contains( "/" ) tdir=StripDir( tdir )
Select tdir
Case "x86","mips","armeabi","armeabi-v7a"
CreateDir "libs/"+tdir
tdir+="/"
Default
tdir=""
End
Endif
CopyFile lib,"libs/"+tdir+StripDir( lib )
End
Next
'copy src files
For Local src:=Eachin GetConfigVar( "SRCS" ).Split( ";" )
Select ExtractExt( src )
Case "java","aidl"
Local i:=src.FindLast( "/src/" )
If i<>-1
Local dst:=src[i+1..]
If CreateDirRecursive( ExtractDir( dst ) )
CopyFile src,dst
Endif
Endif
End
Next
If GetConfigVar( "ANDROID_LANGUTIL_ENABLED" )="1"
CopyDir "langutil/libs","libs",True
CreateDir "src/com"
CreateDir "src/com/monkey"
CopyFile "langutil/LangUtil.java","src/com/monkey/LangUtil.java"
Endif
If GetConfigVar( "ANDROID_NATIVE_GL_ENABLED" )="1"
CopyDir "nativegl/libs","libs",True
CreateDir "src/com"
CreateDir "src/com/monkey"
CopyFile "nativegl/NativeGL.java","src/com/monkey/NativeGL.java"
Endif
If tcc.opt_build
Local antcfg:="debug"
If GetConfigVar( "ANDROID_SIGN_APP" )="1" antcfg="release"
Local ant:="ant"
If tcc.ANT_PATH ant="~q"+tcc.ANT_PATH+"/bin/ant~q"
If Not (Execute( ant+" clean",False ) And Execute( ant+" "+antcfg+" install",False ))
Die "Android build failed."
Else If tcc.opt_run
Local adb:="adb"
If tcc.ANDROID_PATH adb="~q"+tcc.ANDROID_PATH+"/platform-tools/adb~q"
Execute adb+" logcat -c",False
Execute adb+" shell am start -n "+app_package+"/"+app_package+".MonkeyGame",False
Execute adb+" logcat [Monkey]:I *:E",False
' Execute "echo $PATH",False
' Execute "adb logcat -c",False
' Execute "adb shell am start -n "+app_package+"/"+app_package+".MonkeyGame",False
' Execute "adb logcat [Monkey]:I *:E",False
'
'NOTE: This leaves ADB server running which can LOCK the .build dir making it undeletable...
'
Endif
Endif
End
End
| Monkey | 4 | blitz-foundation/mungo-impress | src/transcc/builders/android.monkey | [
"Zlib"
] |
export { default } from './Rating';
export { default as ratingClasses } from './ratingClasses';
export * from './ratingClasses';
| JavaScript | 3 | good-gym/material-ui | packages/material-ui/src/Rating/index.js | [
"MIT"
] |
UniqueNames () = =>
unique = 0
self.generateName (name) =
unique := unique + 1
'gen' + unique + '_' + name
nil
SymbolScope = exports.SymbolScope (parentScope, uniqueNames: @new UniqueNames) = =>
variables = {}
tags = {}
self.define (name) =
variables.(name) = true
self.generateVariable (name) =
uniqueNames.generateName (name)
self.isDefined (name) =
self.is (name) definedInThisScope || (parentScope && parentScope.is (name) defined)
self.is (name) definedInThisScope =
variables.hasOwnProperty (name)
self.subScope () =
@new SymbolScope (self, uniqueNames: uniqueNames)
self.define (name) withTag (tag) =
self.define (name)
tags.(tag) = name
self.findTag (tag) =
tags.(tag) @or parentScope @and parentScope.findTag (tag)
self.names () =
[key <- Object.keys (variables), variables.hasOwnProperty (key), key]
nil
| PogoScript | 4 | Sotrek/Alexa | Alexa_Cookbook/Workshop/StatePop/4_IOT/tests/node_modules/aws-sdk/node_modules/cucumber/node_modules/pogo/lib/symbolScope.pogo | [
"MIT"
] |
[[heapdump]]
= Heap Dump (`heapdump`)
The `heapdump` endpoint provides a heap dump from the application's JVM.
[[heapdump.retrieving]]
== Retrieving the Heap Dump
To retrieve the heap dump, make a `GET` request to `/actuator/heapdump`.
The response is binary data and can be large.
Its format depends upon the JVM on which the application is running.
When running on a HotSpot JVM the format is https://docs.oracle.com/javase/8/docs/technotes/samples/hprof.html[HPROF]
and on OpenJ9 it is https://www.eclipse.org/openj9/docs/dump_heapdump/#portable-heap-dump-phd-format[PHD].
Typically, you should save the response to disk for subsequent analysis.
When using curl, this can be achieved by using the `-O` option, as shown in the following example:
include::{snippets}/heapdump/curl-request.adoc[]
The preceding example results in a file named `heapdump` being written to the current working directory.
| AsciiDoc | 4 | techAi007/spring-boot | spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/asciidoc/endpoints/heapdump.adoc | [
"Apache-2.0"
] |
<div class="mdl-cell mdl-cell--4-col mdl-cell--8-col-tablet mdl-cell--6-col-phone">
<h3>{{ title }}</h3>
<div>{{ text }}</div>
</div> | Liquid | 1 | noahcb/lit | website/src/_includes/partials/one-of-three-column.liquid | [
"Apache-2.0"
] |
* written by Brian Raiter
->+>+++>>+>++>+>+++>>+>++>>>+>+>+>++>+>>>>+++>+>>++>+>+++>>++>++>>+>>+>++>++>+>>>>+++>+>>>>++>++>>>>+>>++>+>+++>>>++>>++++++>>+>>++>+>>>>+++>>+++++>>+>+++>>>++>>++>>+>>++>+>+++>>>++>>+++++++++++++>>+>>++>+>+++>+>+++>>>++>>++++>>+>>++>+>>>>+++>>+++++>>>>++>>>>+>+>++>>+++>+>>>>+++>+>>>>+++>+>>>>+++>>++>++>+>+++>+>++>++>>>>>>++>+>+++>>>>>+++>>>++>+>+++>+>+>++>>>>>>++>>>+>>>++>+>>>>+++>+>>>+>>++>+>++++++++++++++++++>>>>+>+>>>+>>++>+>+++>>>++>>++++++++>>+>>++>+>>>>+++>>++++++>>>+>++>>+++>+>+>++>+>+++>>>>>+++>>>+>+>>++>+>+++>>>++>>++++++++>>+>>++>+>>>>+++>>++++>>+>+++>>>>>>++>+>+++>>+>++>>>>+>+>++>+>>>>+++>>+++>>>+[[->>+<<]<+]+++++[->+++++++++<]>.[+]>>[<<+++++++[->+++++++++<]>-.------------------->-[-<.<+>>]<[+]<+>>>]<<<[-[-[-[>>+<++++++[->+++++<]]>++++++++++++++<]>+++<]++++++[->+++++++<]>+<<<-[->>>++<<<]>[->>.<<]<<]
| Brainfuck | 2 | RubenNL/brainheck | examples/quine/quine-br.bf | [
"Apache-2.0"
] |
/*All Units in inches */
CylinderFaces = 100;
MMPerInch = 25.4;
ZF = 0.0002;
Screw632Diam = 0.138;
Screw632HeadDiam = .279;
BeltWidth = 3/8 + .02; // Adding .02" of wiggle room
BeltPlateZ = .25;
BeltPlateX = 4.4;
BeltPlateY = 1;
TeethY = BeltWidth;
TeethH = 1.27 / MMPerInch;
TeethPitch = .2;
TeethX = TeethPitch / 4;
BeltPlateScrewSpacingX = 1.25;
BeltPlateScrewSpacingY = .3125;
BeltBoltDiam = 1/4;
BeltBoltSpacingX = 1.825;
BeltBoltSpacingY = 1.116;
BeltBoltRiserDiam = .75;
BeltBoltRiserH = 1;
BeltBoltHeadThick = .25;
BearingX = (70 + 2)/ MMPerInch; //+2 mm wiggle room
BearingZ = (42 + 2)/ MMPerInch; //+2 mm wiggle room
BearingY = (28 + 2)/ MMPerInch; //+2 mm wiggle room
ChamferCubeSideLen = sqrt(2 * ( TeethX * TeethX));
CubeChamferTeeth = [ChamferCubeSideLen, TeethY, ChamferCubeSideLen];
difference(){
union(){
/*Create the Plate */
translate([0,0, BeltPlateZ/2]) cube(size = [BeltPlateX, BeltPlateY, BeltPlateZ], center = true);
/* Add the teeth */
for( TeethOffsetX = [-BeltPlateX/2 + .1: TeethPitch: BeltPlateX/2]){
/* Add main tooth */
translate([TeethOffsetX , 0, BeltPlateZ + TeethH/2]) cube(size = [TeethX, TeethY, TeethH], center = true);
/* Add chamfering */
translate([TeethOffsetX - (TeethX/2) , 0, BeltPlateZ]) rotate([0,45,0]) cube(size = CubeChamferTeeth, center = true);
translate([TeethOffsetX + (TeethX/2) , 0, BeltPlateZ]) rotate([0,45,0]) cube(size = CubeChamferTeeth, center = true);
}
}
/* Drill holes for the belt plate */
translate([BeltPlateScrewSpacingX, BeltPlateScrewSpacingY, 0]) cylinder(d = Screw632Diam, h = 10, $fn = CylinderFaces, center = true);
translate([BeltPlateScrewSpacingX, -BeltPlateScrewSpacingY, 0]) cylinder(d = Screw632Diam, h = 10, $fn = CylinderFaces, center = true);
translate([-BeltPlateScrewSpacingX, BeltPlateScrewSpacingY, 0]) cylinder(d = Screw632Diam, h = 10, $fn = CylinderFaces, center = true);
translate([-BeltPlateScrewSpacingX, -BeltPlateScrewSpacingY, 0]) cylinder(d = Screw632Diam, h = 10, $fn = CylinderFaces, center = true);
translate([0, BeltPlateScrewSpacingY, 0]) cylinder(d = Screw632Diam, h = 10, $fn = CylinderFaces, center = true);
translate([0, -BeltPlateScrewSpacingY, 0]) cylinder(d = Screw632Diam, h = 10, $fn = CylinderFaces, center = true);
/* Cut in a the ends so the bolt heads can fit */
translate([-BeltBoltSpacingX, BeltPlateY/2 - BeltBoltHeadThick/2 , 0]) cube(size = [BeltBoltRiserDiam + ZF, BeltBoltHeadThick + ZF, 10], center = true);
translate([BeltBoltSpacingX, BeltPlateY/2 - BeltBoltHeadThick/2 , 0]) cube(size = [BeltBoltRiserDiam + ZF, BeltBoltHeadThick + ZF, 10], center = true);
/* Cut out location where bearing where go */
translate([0,-(BeltWidth/2 + .113 + BearingY /2 + .25) , 0]) cube(size = [BearingX, BearingY, BearingZ], center = true);
}
| OpenSCAD | 4 | nygrenj/Windows-iotcore-samples | Demos/AirHockeyRobot/CS/Robot Parts/YCarriageBeltPlate.scad | [
"MIT"
] |
// https://dom.spec.whatwg.org/#slotable
interface mixin Slotable {
readonly attribute HTMLSlotElement? assignedSlot;
};
Element includes Slotable;
Text includes Slotable;
| WebIDL | 4 | wkh237/jsdom | lib/jsdom/living/nodes/Slotable.webidl | [
"MIT"
] |
ByJ A @A | PureBasic | 0 | cnheider/onnx | onnx/backend/test/data/node/test_scan9_sum/test_data_set_0/output_0.pb | [
"MIT"
] |
/*
* SRT - Secure, Reliable, Transport
* Copyright (c) 2018 Haivision Systems Inc.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*/
/*****************************************************************************
written by
Haivision Systems Inc.
2011-06-23 (jdube)
HaiCrypt initial implementation.
*****************************************************************************/
/*
* For now:
* Pre-shared or password derived KEK (Key Encrypting Key)
* Future:
* Certificate-based association
*/
#include <string.h> /* memcpy */
#include "hcrypt.h"
int hcryptCtx_SetSecret(hcrypt_Session *crypto, hcrypt_Ctx *ctx, const HaiCrypt_Secret *secret)
{
int iret;
(void)crypto;
switch(secret->typ) {
case HAICRYPT_SECTYP_PRESHARED:
ASSERT(secret->len <= HAICRYPT_KEY_MAX_SZ);
ctx->cfg.pwd_len = 0;
/* KEK: Key Encrypting Key */
if (0 > (iret = crypto->cryspr->km_setkey(crypto->cryspr_cb,
(HCRYPT_CTX_F_ENCRYPT & ctx->flags ? true : false),
secret->str, secret->len))) {
HCRYPT_LOG(LOG_ERR, "km_setkey(pdkek[%zd]) failed (rc=%d)\n", secret->len, iret);
return(-1);
}
ctx->status = HCRYPT_CTX_S_SARDY;
break;
case HAICRYPT_SECTYP_PASSPHRASE:
ASSERT(secret->len <= sizeof(ctx->cfg.pwd));
memcpy(ctx->cfg.pwd, secret->str, secret->len);
ctx->cfg.pwd_len = secret->len;
/* KEK will be derived from password with Salt */
ctx->status = HCRYPT_CTX_S_SARDY;
break;
default:
HCRYPT_LOG(LOG_ERR, "Unknown secret type %d\n",
secret->typ);
return(-1);
}
return(0);
}
int hcryptCtx_GenSecret(hcrypt_Session *crypto, hcrypt_Ctx *ctx)
{
/*
* KEK need same length as the key it protects (SEK)
* KEK = PBKDF2(Pwd, LSB(64, Salt), Iter, Klen)
*/
unsigned char kek[HAICRYPT_KEY_MAX_SZ];
size_t kek_len = ctx->sek_len;
size_t pbkdf_salt_len = (ctx->salt_len >= HAICRYPT_PBKDF2_SALT_LEN
? HAICRYPT_PBKDF2_SALT_LEN
: ctx->salt_len);
int iret = 0;
(void)crypto;
iret = crypto->cryspr->km_pbkdf2(crypto->cryspr_cb, ctx->cfg.pwd, ctx->cfg.pwd_len,
&ctx->salt[ctx->salt_len - pbkdf_salt_len], pbkdf_salt_len,
HAICRYPT_PBKDF2_ITER_CNT, kek_len, kek);
if(iret) {
HCRYPT_LOG(LOG_ERR, "km_pbkdf2() failed (rc=%d)\n", iret);
return(-1);
}
HCRYPT_PRINTKEY(ctx->cfg.pwd, ctx->cfg.pwd_len, "pwd");
HCRYPT_PRINTKEY(kek, kek_len, "kek");
/* KEK: Key Encrypting Key */
if (0 > (iret = crypto->cryspr->km_setkey(crypto->cryspr_cb, (HCRYPT_CTX_F_ENCRYPT & ctx->flags ? true : false), kek, kek_len))) {
HCRYPT_LOG(LOG_ERR, "km_setkey(pdkek[%zd]) failed (rc=%d)\n", kek_len, iret);
return(-1);
}
return(0);
}
| C | 4 | attenuation/srs | trunk/3rdparty/srt-1-fit/haicrypt/hcrypt_sa.c | [
"MIT"
] |
//===--- TerminatorUtils.h ------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
///
/// \file
///
/// ADTs for working with various forms of terminators.
///
//===----------------------------------------------------------------------===//
#ifndef SWIFT_SIL_TERMINATORUTILS_H
#define SWIFT_SIL_TERMINATORUTILS_H
#include "swift/Basic/LLVM.h"
#include "swift/SIL/SILInstruction.h"
#include "llvm/ADT/PointerUnion.h"
namespace swift {
/// An ADT for writing generic code against SwitchEnumAddrInst and
/// SwitchEnumInst.
///
/// We use this instead of SwitchEnumInstBase for this purpose in order to avoid
/// the need for templating SwitchEnumInstBase from causing this ADT type of
/// usage to require templates.
class SwitchEnumTermInst {
PointerUnion<SwitchEnumAddrInst *, SwitchEnumInst *> value;
public:
SwitchEnumTermInst(SwitchEnumAddrInst *seai) : value(seai) {}
SwitchEnumTermInst(SwitchEnumInst *seai) : value(seai) {}
SwitchEnumTermInst(SILInstruction *i) : value(nullptr) {
if (auto *seai = dyn_cast<SwitchEnumAddrInst>(i)) {
value = seai;
return;
}
if (auto *sei = dyn_cast<SwitchEnumInst>(i)) {
value = sei;
return;
}
}
SwitchEnumTermInst(const SILInstruction *i)
: SwitchEnumTermInst(const_cast<SILInstruction *>(i)) {}
operator TermInst *() const {
if (auto *seai = value.dyn_cast<SwitchEnumAddrInst *>())
return seai;
return value.get<SwitchEnumInst *>();
}
TermInst *operator*() const {
if (auto *seai = value.dyn_cast<SwitchEnumAddrInst *>())
return seai;
return value.get<SwitchEnumInst *>();
}
TermInst *operator->() const {
if (auto *seai = value.dyn_cast<SwitchEnumAddrInst *>())
return seai;
return value.get<SwitchEnumInst *>();
}
operator bool() const { return bool(value); }
SILValue getOperand() {
if (auto *sei = value.dyn_cast<SwitchEnumInst *>())
return sei->getOperand();
return value.get<SwitchEnumAddrInst *>()->getOperand();
}
unsigned getNumCases() {
if (auto *sei = value.dyn_cast<SwitchEnumInst *>())
return sei->getNumCases();
return value.get<SwitchEnumAddrInst *>()->getNumCases();
}
std::pair<EnumElementDecl *, SILBasicBlock *> getCase(unsigned i) const {
if (auto *sei = value.dyn_cast<SwitchEnumInst *>())
return sei->getCase(i);
return value.get<SwitchEnumAddrInst *>()->getCase(i);
}
SILBasicBlock *getCaseDestination(EnumElementDecl *decl) const {
if (auto *sei = value.dyn_cast<SwitchEnumInst *>())
return sei->getCaseDestination(decl);
return value.get<SwitchEnumAddrInst *>()->getCaseDestination(decl);
}
ProfileCounter getCaseCount(unsigned i) const {
if (auto *sei = value.dyn_cast<SwitchEnumInst *>())
return sei->getCaseCount(i);
return value.get<SwitchEnumAddrInst *>()->getCaseCount(i);
}
ProfileCounter getDefaultCount() const {
if (auto *sei = value.dyn_cast<SwitchEnumInst *>())
return sei->getDefaultCount();
return value.get<SwitchEnumAddrInst *>()->getDefaultCount();
}
bool hasDefault() const {
if (auto *sei = value.dyn_cast<SwitchEnumInst *>())
return sei->hasDefault();
return value.get<SwitchEnumAddrInst *>()->hasDefault();
}
SILBasicBlock *getDefaultBB() const {
if (auto *sei = value.dyn_cast<SwitchEnumInst *>())
return sei->getDefaultBB();
return value.get<SwitchEnumAddrInst *>()->getDefaultBB();
}
NullablePtr<SILBasicBlock> getDefaultBBOrNull() const {
if (auto *sei = value.dyn_cast<SwitchEnumInst *>())
return sei->getDefaultBBOrNull();
return value.get<SwitchEnumAddrInst *>()->getDefaultBBOrNull();
}
/// If the default refers to exactly one case decl, return it.
NullablePtr<EnumElementDecl> getUniqueCaseForDefault() const {
if (auto *sei = value.dyn_cast<SwitchEnumInst *>())
return sei->getUniqueCaseForDefault();
return value.get<SwitchEnumAddrInst *>()->getUniqueCaseForDefault();
}
/// If the given block only has one enum element decl matched to it,
/// return it.
NullablePtr<EnumElementDecl>
getUniqueCaseForDestination(SILBasicBlock *BB) const {
if (auto *sei = value.dyn_cast<SwitchEnumInst *>())
return sei->getUniqueCaseForDestination(BB);
return value.get<SwitchEnumAddrInst *>()->getUniqueCaseForDestination(BB);
}
};
} // namespace swift
#endif
| C | 5 | gandhi56/swift | include/swift/SIL/TerminatorUtils.h | [
"Apache-2.0"
] |
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This is a "No Compile Test" suite.
// http://dev.chromium.org/developers/testing/no-compile-tests
#include "base/task/task_traits.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
namespace content {
#if defined(NCTEST_BROWSER_TASK_TRAITS_MULTIPLE_THREADS) // [r"The traits bag contains multiple traits of the same type."]
constexpr base::TaskTraits traits = {BrowserThread::UI,
BrowserThread::IO};
#elif defined(NCTEST_BROWSER_TASK_TRAITS_MULTIPLE_TASK_TYPES) // [r"The traits bag contains multiple traits of the same type."]
constexpr base::TaskTraits traits = {BrowserTaskType::kBootstrap, BrowserTaskType::kPreconnect};
#endif
} // namespace content
| nesC | 3 | zealoussnow/chromium | content/browser/browser_task_traits_unittest.nc | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] |
v2 = g3
| Ninja | 0 | srid/shake | src/Test/Ninja/test6-sub.ninja | [
"BSD-3-Clause"
] |
{
"config": {
"abort": {
"already_configured": "El servicio ya est\u00e1 configurado"
},
"step": {
"user": {
"data": {
"name": "Nombre del sensor",
"power": "Potencia contratada (kW)",
"power_p3": "Potencia contratada para el per\u00edodo valle P3 (kW)",
"tariff": "Tarifa contratada (1, 2 o 3 per\u00edodos)"
},
"description": "Este sensor utiliza la API oficial para obtener [el precio horario de la electricidad (PVPC)](https://www.esios.ree.es/es/pvpc) en Espa\u00f1a.\nPara obtener una explicaci\u00f3n m\u00e1s precisa, visita los [documentos de la integraci\u00f3n](https://www.home-assistant.io/integrations/pvpc_hourly_pricing/).\n\nSelecciona la tarifa contratada en funci\u00f3n del n\u00famero de per\u00edodos de facturaci\u00f3n por d\u00eda:\n- 1 per\u00edodo: normal\n- 2 per\u00edodos: discriminaci\u00f3n (tarifa nocturna)\n- 3 per\u00edodos: coche el\u00e9ctrico (tarifa nocturna de 3 per\u00edodos)",
"title": "Selecci\u00f3n de tarifa"
}
}
},
"options": {
"step": {
"init": {
"data": {
"power": "Potencia contratada (kW)",
"power_p3": "Potencia contratada para el per\u00edodo valle P3 (kW)",
"tariff": "Tarifa aplicable por zona geogr\u00e1fica"
},
"description": "Este sensor utiliza la API oficial para obtener el [precio horario de la electricidad (PVPC)](https://www.esios.ree.es/es/pvpc) en Espa\u00f1a.\nPara una explicaci\u00f3n m\u00e1s precisa visita los [documentos de integraci\u00f3n](https://www.home-assistant.io/integrations/pvpc_hourly_pricing/).",
"title": "Configuraci\u00f3n del sensor"
}
}
}
} | JSON | 4 | MrDelik/core | homeassistant/components/pvpc_hourly_pricing/translations/es.json | [
"Apache-2.0"
] |
../coreplexip-e31-arty/flash.lds | Linker Script | 3 | Davidfind/rt-thread | bsp/hifive1/freedom-e-sdk/bsp/env/coreplexip-e51-arty/flash.lds | [
"Apache-2.0"
] |
; 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"
%printf_t.3 = type { i64 }
%printf_t.2 = type { i64 }
%printf_t.1 = type { i64 }
%printf_t.0 = type { i64 }
%printf_t = type { i64 }
; Function Attrs: nounwind
declare i64 @llvm.bpf.pseudo(i64 %0, i64 %1) #0
define i64 @BEGIN(i8* %0) section "s_BEGIN_1" {
entry:
%printf_args11 = alloca %printf_t.3, align 8
%printf_args8 = alloca %printf_t.2, align 8
%printf_args5 = alloca %printf_t.1, align 8
%printf_args2 = alloca %printf_t.0, align 8
%printf_args = alloca %printf_t, align 8
%"@i_val" = alloca i64, align 8
%"@i_key" = alloca i64, align 8
%1 = bitcast i64* %"@i_key" to i8*
call void @llvm.lifetime.start.p0i8(i64 -1, i8* %1)
store i64 0, i64* %"@i_key", align 8
%2 = bitcast i64* %"@i_val" to i8*
call void @llvm.lifetime.start.p0i8(i64 -1, i8* %2)
store i64 0, i64* %"@i_val", align 8
%pseudo = call i64 @llvm.bpf.pseudo(i64 1, i64 0)
%update_elem = call i64 inttoptr (i64 2 to i64 (i64, i64*, i64*, i64)*)(i64 %pseudo, i64* %"@i_key", i64* %"@i_val", i64 0)
%3 = bitcast i64* %"@i_val" to i8*
call void @llvm.lifetime.end.p0i8(i64 -1, i8* %3)
%4 = bitcast i64* %"@i_key" to i8*
call void @llvm.lifetime.end.p0i8(i64 -1, i8* %4)
%5 = bitcast %printf_t* %printf_args to i8*
call void @llvm.lifetime.start.p0i8(i64 -1, i8* %5)
%6 = bitcast %printf_t* %printf_args to i8*
call void @llvm.memset.p0i8.i64(i8* align 1 %6, i8 0, i64 8, i1 false)
%7 = getelementptr %printf_t, %printf_t* %printf_args, i32 0, i32 0
store i64 0, i64* %7, align 8
%pseudo1 = call i64 @llvm.bpf.pseudo(i64 1, i64 1)
%perf_event_output = call i64 inttoptr (i64 25 to i64 (i8*, i64, i64, %printf_t*, i64)*)(i8* %0, i64 %pseudo1, i64 4294967295, %printf_t* %printf_args, i64 8)
%8 = bitcast %printf_t* %printf_args to i8*
call void @llvm.lifetime.end.p0i8(i64 -1, i8* %8)
%9 = bitcast %printf_t.0* %printf_args2 to i8*
call void @llvm.lifetime.start.p0i8(i64 -1, i8* %9)
%10 = bitcast %printf_t.0* %printf_args2 to i8*
call void @llvm.memset.p0i8.i64(i8* align 1 %10, i8 0, i64 8, i1 false)
%11 = getelementptr %printf_t.0, %printf_t.0* %printf_args2, i32 0, i32 0
store i64 0, i64* %11, align 8
%pseudo3 = call i64 @llvm.bpf.pseudo(i64 1, i64 1)
%perf_event_output4 = call i64 inttoptr (i64 25 to i64 (i8*, i64, i64, %printf_t.0*, i64)*)(i8* %0, i64 %pseudo3, i64 4294967295, %printf_t.0* %printf_args2, i64 8)
%12 = bitcast %printf_t.0* %printf_args2 to i8*
call void @llvm.lifetime.end.p0i8(i64 -1, i8* %12)
%13 = bitcast %printf_t.1* %printf_args5 to i8*
call void @llvm.lifetime.start.p0i8(i64 -1, i8* %13)
%14 = bitcast %printf_t.1* %printf_args5 to i8*
call void @llvm.memset.p0i8.i64(i8* align 1 %14, i8 0, i64 8, i1 false)
%15 = getelementptr %printf_t.1, %printf_t.1* %printf_args5, i32 0, i32 0
store i64 0, i64* %15, align 8
%pseudo6 = call i64 @llvm.bpf.pseudo(i64 1, i64 1)
%perf_event_output7 = call i64 inttoptr (i64 25 to i64 (i8*, i64, i64, %printf_t.1*, i64)*)(i8* %0, i64 %pseudo6, i64 4294967295, %printf_t.1* %printf_args5, i64 8)
%16 = bitcast %printf_t.1* %printf_args5 to i8*
call void @llvm.lifetime.end.p0i8(i64 -1, i8* %16)
%17 = bitcast %printf_t.2* %printf_args8 to i8*
call void @llvm.lifetime.start.p0i8(i64 -1, i8* %17)
%18 = bitcast %printf_t.2* %printf_args8 to i8*
call void @llvm.memset.p0i8.i64(i8* align 1 %18, i8 0, i64 8, i1 false)
%19 = getelementptr %printf_t.2, %printf_t.2* %printf_args8, i32 0, i32 0
store i64 0, i64* %19, align 8
%pseudo9 = call i64 @llvm.bpf.pseudo(i64 1, i64 1)
%perf_event_output10 = call i64 inttoptr (i64 25 to i64 (i8*, i64, i64, %printf_t.2*, i64)*)(i8* %0, i64 %pseudo9, i64 4294967295, %printf_t.2* %printf_args8, i64 8)
%20 = bitcast %printf_t.2* %printf_args8 to i8*
call void @llvm.lifetime.end.p0i8(i64 -1, i8* %20)
%21 = bitcast %printf_t.3* %printf_args11 to i8*
call void @llvm.lifetime.start.p0i8(i64 -1, i8* %21)
%22 = bitcast %printf_t.3* %printf_args11 to i8*
call void @llvm.memset.p0i8.i64(i8* align 1 %22, i8 0, i64 8, i1 false)
%23 = getelementptr %printf_t.3, %printf_t.3* %printf_args11, i32 0, i32 0
store i64 0, i64* %23, align 8
%pseudo12 = call i64 @llvm.bpf.pseudo(i64 1, i64 1)
%perf_event_output13 = call i64 inttoptr (i64 25 to i64 (i8*, i64, i64, %printf_t.3*, i64)*)(i8* %0, i64 %pseudo12, i64 4294967295, %printf_t.3* %printf_args11, i64 8)
%24 = bitcast %printf_t.3* %printf_args11 to i8*
call void @llvm.lifetime.end.p0i8(i64 -1, i8* %24)
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
; Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly %0, i8 %1, i64 %2, i1 immarg %3) #2
attributes #0 = { nounwind }
attributes #1 = { argmemonly nofree nosync nounwind willreturn }
attributes #2 = { argmemonly nofree nosync nounwind willreturn writeonly }
| LLVM | 2 | casparant/bpftrace | tests/codegen/llvm/unroll_async_id.ll | [
"Apache-2.0"
] |
module fsieve
/*
The Fast Sieve of Eratosthenes.
A sequential and optimized version of the sieve of Eratosthenes.
The program calculates a list of the first NrOfPrime primes.
The result of the program is the NrOfPrimes'th prime.
Strictness annotations have been added because the strictness analyser
is not able to deduce all strictness information. Removal of these !'s
will make the program about 20% slower.
On a machine without a math coprocessor the execution of this
program might take a (very) long time. Set NrOfPrimes to a smaller value.
*/
import StdClass; // RWS
import StdInt, StdReal
NrOfPrimes :== 3000
// The sieve algorithm: generate an infinite list of all primes.
Primes::[Int]
Primes = pr where pr = [5 : Sieve 7 4 pr]
Sieve::Int !Int [Int] -> [Int]
Sieve g i prs
| IsPrime prs g (toInt (sqrt (toReal g))) = [g : Sieve` g i prs]
= Sieve (g + i) (6 - i) prs
Sieve`::Int Int [Int] -> [Int]
Sieve` g i prs = Sieve (g + i) (6 - i) prs
IsPrime::[Int] !Int Int -> Bool
IsPrime [f:r] pr bd | f>bd = True
| pr rem f==0 = False
= IsPrime r pr bd
// Select is used to get the NrOfPrimes'th prime from the infinite list.
Select::[x] Int -> x
Select [f:r] 1 = f
Select [f:r] n = Select r (n - 1)
/* The Start rule: Select the NrOfPrimes'th prime from the list of primes
generated by Primes.
*/
Start::Int
Start = Select [2, 3 : Primes] NrOfPrimes
| Clean | 5 | JavascriptID/sourcerer-app | src/test/resources/samples/langs/Clean/fsieve.icl | [
"MIT"
] |
#!/usr/bin/env awk -f
#
# @license Apache-2.0
#
# Copyright (c) 2017 The Stdlib Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Computes the median.
#
# Usage: median
#
# Input:
# - a sorted column of numbers
#
# Output:
# - median value
BEGIN {
i = 0
}
{
a[i++] = $1
}
END {
j = i/2
if (i%2 == 1) {
median = a[int(j)]
} else {
median = (a[j] + a[j-1])/2
}
print median
}
| Awk | 4 | ghalimi/stdlib | tools/awk/median.awk | [
"BSL-1.0"
] |
20 5 0 0 100
0 1 3 1 2 3 [0] [0] [0]
1 1 2 6 8 [24] [8]
2 1 5 17 16 19 18 20 [0] [3] [0] [0] [0]
3 1 2 8 7 [4] [7]
4 1 3 18 6 13 [11] [-126] [-114]
5 1 1 10 [0]
6 1 1 14 [20]
7 1 1 12 [13]
8 1 5 13 16 19 20 17 [13] [6] [3] [12] [-3]
9 1 3 6 13 16 [-139] [0] [2]
10 1 4 19 12 11 6 [-5] [-129] [-79] [6]
11 1 1 5 [4]
12 1 1 15 [24]
13 1 2 6 4 [-104] [-1]
14 1 2 20 9 [-9] [8]
15 1 3 11 17 7 [2] [-6] [-142]
16 1 3 15 21 1 [-107] [2] [-154]
17 1 1 21 [2]
18 1 4 21 2 5 13 [6] [-68] [-159] [-152]
19 1 3 21 11 3 [3] [-109] [-102]
20 1 1 21 [6]
21 1 0
0 1 0 0 0 0 0 0
1 1 8 4 5 3 4 2
2 1 1 3 4 5 5 4
3 1 3 1 4 2 4 3
4 1 10 3 3 2 3 5
5 1 8 1 4 5 3 3
6 1 9 2 5 3 5 1
7 1 6 1 5 5 3 2
8 1 6 3 2 1 4 3
9 1 5 1 5 1 2 2
10 1 8 5 4 3 4 5
11 1 4 1 4 3 5 2
12 1 10 5 5 1 5 1
13 1 2 1 2 2 1 3
14 1 10 3 1 5 5 5
15 1 7 4 2 2 1 2
16 1 2 5 4 5 1 2
17 1 2 5 5 2 5 3
18 1 6 3 5 1 5 1
19 1 3 2 5 1 3 5
20 1 6 3 3 3 3 5
21 1 0 0 0 0 0 0
2 1 7 2 2
| Eagle | 1 | klorel/or-tools | examples/data/rcpsp/single_mode_investment/rip20/rip176.sch | [
"Apache-2.0"
] |
SmalltalkCISpec {
#loading : [
SCIMetacelloLoadSpec {
#baseline : 'Tealight',
#directory : 'repository',
#platforms : [ #pharo ],
#load : [ 'all' ]
}
]
} | STON | 3 | badetitou/Tealight | .smalltalk.ston | [
"MIT"
] |
# This file is distributed under the same license as the Django package.
#
# Translators:
# F Wolff <friedel@translate.org.za>, 2019
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2019-01-04 18:57+0000\n"
"Last-Translator: F Wolff <friedel@translate.org.za>\n"
"Language-Team: Afrikaans (http://www.transifex.com/django/django/language/"
"af/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: af\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Sessions"
msgstr "Sessies"
msgid "session key"
msgstr "sessiesleutel"
msgid "session data"
msgstr "sessiedata"
msgid "expire date"
msgstr "vervaldatum"
msgid "session"
msgstr "sessie"
msgid "sessions"
msgstr "sessies"
| Gettext Catalog | 2 | jpmallarino/django | django/contrib/sessions/locale/af/LC_MESSAGES/django.po | [
"BSD-3-Clause",
"0BSD"
] |
package {{invokerPackage}}.auth;
public enum OAuthFlow {
accessCode, implicit, password, application
} | HTML+Django | 3 | MalcolmScoffable/openapi-generator | modules/openapi-generator/src/main/resources/Java/libraries/webclient/auth/OAuthFlow.mustache | [
"Apache-2.0"
] |
// Daniel Shiffman
// http://codingtra.in
// http://patreon.com/codingtrain
// Code for: https://youtu.be/jrk_lOg_pVA
import toxi.physics3d.*;
import toxi.physics3d.behaviors.*;
import toxi.physics3d.constraints.*;
import toxi.geom.*;
int cols = 40;
int rows = 40;
Particle[][] particles = new Particle[cols][rows];
ArrayList<Spring> springs;
float w = 10;
VerletPhysics3D physics;
void setup() {
size(600, 600, P3D);
springs = new ArrayList<Spring>();
physics = new VerletPhysics3D();
Vec3D gravity = new Vec3D(0, 1, 0);
GravityBehavior3D gb = new GravityBehavior3D(gravity);
physics.addBehavior(gb);
float x = -cols*w/2;
for (int i = 0; i < cols; i++) {
float z = 0;
for (int j = 0; j < rows; j++) {
Particle p = new Particle(x, -200, z);
particles[i][j] = p;
physics.addParticle(p);
z = z + w;
}
x = x + w;
}
for (int i = 0; i < cols; i++) {
for (int j = 0; j < rows; j++) {
Particle a = particles[i][j];
if (i != cols-1) {
Particle b1 = particles[i+1][j];
Spring s1 = new Spring(a, b1);
springs.add(s1);
physics.addSpring(s1);
}
if (j != rows-1) {
Particle b2 = particles[i][j+1];
Spring s2 = new Spring(a, b2);
springs.add(s2);
physics.addSpring(s2);
}
}
}
particles[0][0].lock();
particles[cols-1][0].lock();
}
float a = 0;
void draw() {
background(51);
translate(width/2, height/2);
rotateY(a);
a += 0.01;
physics.update();
for (int i = 0; i < cols; i++) {
for (int j = 0; j < rows; j++) {
//particles[i][j].display();
}
}
for (Spring s : springs) {
s.display();
}
} | Processing | 4 | aerinkayne/website | CodingChallenges/CC_020_ClothSimulation/Processing/CC_020_Cloth3D/Processing/CC_020_Cloth3D/CC_020_Cloth3D.pde | [
"MIT"
] |
#version 310 es
layout (local_size_x = 8, local_size_y = 8) in;
layout (binding = 0) readonly buffer In0BufY {
uvec2 data[];
} in0_buf_y;
layout (binding = 1) readonly buffer In0BufUV {
uvec2 data[];
} in0_buf_uv;
layout (binding = 2) readonly buffer In1BufY {
uvec2 data[];
} in1_buf_y;
layout (binding = 3) readonly buffer In1BufUV {
uvec2 data[];
} in1_buf_uv;
layout (binding = 4) writeonly buffer OutBufY {
uvec2 data[];
} out_buf_y;
layout (binding = 5) writeonly buffer OutBufUV {
uvec2 data[];
} out_buf_uv;
layout (binding = 6) readonly buffer MaskBuf {
uvec2 data[];
} mask_buf;
uniform uint in0_img_width;
uniform uint in1_img_width;
uniform uint out_img_width;
uniform uint blend_width;
uniform uint in0_offset_x;
uniform uint in1_offset_x;
uniform uint out_offset_x;
void main ()
{
uvec2 g_id = gl_GlobalInvocationID.xy;
g_id.x = clamp (g_id.x, 0u, blend_width - 1u);
uvec2 mask = mask_buf.data[g_id.x];
vec4 mask0 = unpackUnorm4x8 (mask.x);
vec4 mask1 = unpackUnorm4x8 (mask.y);
uvec3 img_width = uvec3 (in0_img_width, in1_img_width, out_img_width);
uvec3 offset_x = uvec3 (in0_offset_x, in1_offset_x, out_offset_x);
uvec3 y_idx = g_id.y * 2u * img_width + offset_x + g_id.x;
uvec2 in0_y = in0_buf_y.data[y_idx.x];
vec4 in0_y0 = unpackUnorm4x8 (in0_y.x);
vec4 in0_y1 = unpackUnorm4x8 (in0_y.y);
uvec2 in1_y = in1_buf_y.data[y_idx.y];
vec4 in1_y0 = unpackUnorm4x8 (in1_y.x);
vec4 in1_y1 = unpackUnorm4x8 (in1_y.y);
vec4 out_y0 = (in0_y0 - in1_y0) * mask0 + in1_y0;
vec4 out_y1 = (in0_y1 - in1_y1) * mask1 + in1_y1;
out_y0 = clamp (out_y0, 0.0f, 1.0f);
out_y1 = clamp (out_y1, 0.0f, 1.0f);
out_buf_y.data[y_idx.z] = uvec2 (packUnorm4x8 (out_y0), packUnorm4x8 (out_y1));
y_idx += img_width;
in0_y = in0_buf_y.data[y_idx.x];
in0_y0 = unpackUnorm4x8 (in0_y.x);
in0_y1 = unpackUnorm4x8 (in0_y.y);
in1_y = in1_buf_y.data[y_idx.y];
in1_y0 = unpackUnorm4x8 (in1_y.x);
in1_y1 = unpackUnorm4x8 (in1_y.y);
out_y0 = (in0_y0 - in1_y0) * mask0 + in1_y0;
out_y1 = (in0_y1 - in1_y1) * mask1 + in1_y1;
out_y0 = clamp (out_y0, 0.0f, 1.0f);
out_y1 = clamp (out_y1, 0.0f, 1.0f);
out_buf_y.data[y_idx.z] = uvec2 (packUnorm4x8 (out_y0), packUnorm4x8 (out_y1));
uvec3 uv_idx = g_id.y * img_width + offset_x + g_id.x;
uvec2 in0_uv = in0_buf_uv.data[uv_idx.x];
vec4 in0_uv0 = unpackUnorm4x8 (in0_uv.x);
vec4 in0_uv1 = unpackUnorm4x8 (in0_uv.y);
uvec2 in1_uv = in1_buf_uv.data[uv_idx.y];
vec4 in1_uv0 = unpackUnorm4x8 (in1_uv.x);
vec4 in1_uv1 = unpackUnorm4x8 (in1_uv.y);
mask0.yw = mask0.xz;
mask1.yw = mask1.xz;
vec4 out_uv0 = (in0_uv0 - in1_uv0) * mask0 + in1_uv0;
vec4 out_uv1 = (in0_uv1 - in1_uv1) * mask1 + in1_uv1;
out_uv0 = clamp (out_uv0, 0.0f, 1.0f);
out_uv1 = clamp (out_uv1, 0.0f, 1.0f);
out_buf_uv.data[uv_idx.z] = uvec2 (packUnorm4x8 (out_uv0), packUnorm4x8 (out_uv1));
}
| Slash | 3 | zongwave/libxcam | shaders/glsl/shader_blend_pyr.comp.sl | [
"Apache-2.0"
] |
#version 330
uniform vec3 light_source_position;
uniform float gloss;
uniform float shadow;
uniform float focal_distance;
uniform vec2 parameter;
uniform float opacity;
uniform float n_steps;
uniform float mandelbrot;
uniform vec3 color0;
uniform vec3 color1;
uniform vec3 color2;
uniform vec3 color3;
uniform vec3 color4;
uniform vec3 color5;
uniform vec3 color6;
uniform vec3 color7;
uniform vec3 color8;
uniform vec2 frame_shape;
in vec3 xyz_coords;
out vec4 frag_color;
#INSERT finalize_color.glsl
#INSERT complex_functions.glsl
const int MAX_DEGREE = 5;
void main() {
vec3 color_map[9] = vec3[9](
color0, color1, color2, color3,
color4, color5, color6, color7, color8
);
vec3 color;
vec2 z;
vec2 c;
if(bool(mandelbrot)){
c = xyz_coords.xy;
z = vec2(0.0, 0.0);
}else{
c = parameter;
z = xyz_coords.xy;
}
float outer_bound = 2.0;
bool stable = true;
for(int n = 0; n < int(n_steps); n++){
z = complex_mult(z, z) + c;
if(length(z) > outer_bound){
float float_n = float(n);
float_n += log(outer_bound) / log(length(z));
float_n += 0.5 * length(c);
color = float_to_color(sqrt(float_n), 1.5, 8.0, color_map);
stable = false;
break;
}
}
if(stable){
color = vec3(0.0, 0.0, 0.0);
}
frag_color = finalize_color(
vec4(color, opacity),
xyz_coords,
vec3(0.0, 0.0, 1.0),
light_source_position,
gloss,
shadow
);
} | GLSL | 4 | OrKedar/geo-manimgl-app | manimlib/shaders/mandelbrot_fractal/frag.glsl | [
"MIT"
] |
Extension { #name : #AsyncImageSortedMethodsStream }
{ #category : #'*GToolkit-Extensions' }
AsyncImageSortedMethodsStream >> gtCompositionChildren [
^ { stream }
]
| Smalltalk | 2 | feenkcom/gtoolk | src/GToolkit-Extensions/AsyncImageSortedMethodsStream.extension.st | [
"MIT"
] |
/******************************************************************************
* Copyright 2019 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus/vehicle/wey/protocol/fbs1_243.h"
#include "glog/logging.h"
#include "modules/drivers/canbus/common/byte.h"
#include "modules/drivers/canbus/common/canbus_consts.h"
namespace apollo {
namespace canbus {
namespace wey {
using ::apollo::drivers::canbus::Byte;
Fbs1243::Fbs1243() {}
const int32_t Fbs1243::ID = 0x243;
void Fbs1243::Parse(const std::uint8_t* bytes, int32_t length,
ChassisDetail* chassis) const {
chassis->mutable_wey()->mutable_fbs1_243()->set_longitudeacce(
longitudeacce(bytes, length));
chassis->mutable_wey()->mutable_fbs1_243()->set_lateralacce(
lateralacce(bytes, length));
chassis->mutable_wey()->mutable_fbs1_243()->set_vehdynyawrate(
vehdynyawrate(bytes, length));
chassis->mutable_wey()->mutable_fbs1_243()->set_flwheelspd(
flwheelspd(bytes, length));
chassis->mutable_wey()->mutable_fbs1_243()->set_frwheeldirection(
frwheeldirection(bytes, length));
}
// config detail: {'description': 'Longitude acceleration', 'offset': -21.592,
// 'precision': 0.00098, 'len': 16, 'name': 'longitudeacce', 'is_signed_var':
// False, 'physical_range': '[-21.592|21.592]', 'bit': 7, 'type': 'double',
// 'order': 'motorola', 'physical_unit': 'm/s^2'}
double Fbs1243::longitudeacce(const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 0);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 1);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
double ret = x * 0.000980 + -21.592000;
return ret;
}
// config detail: {'description': 'Indicates Lateral Acceleration', 'offset':
// -21.592, 'precision': 0.00098, 'len': 16, 'name': 'lateralacce',
// 'is_signed_var': False, 'physical_range': '[-21.592|21.592]', 'bit': 23,
// 'type': 'double', 'order': 'motorola', 'physical_unit': 'm/s^2'}
double Fbs1243::lateralacce(const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 2);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 3);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
double ret = x * 0.000980 + -21.592000;
return ret;
}
// config detail: {'description': 'Vehicle yaw rate', 'offset': -2.093,
// 'precision': 0.00024, 'len': 16, 'name': 'vehdynyawrate', 'is_signed_var':
// False, 'physical_range': '[-2.093|2.093]', 'bit': 39, 'type': 'double',
// 'order': 'motorola', 'physical_unit': 'rad/s'}
double Fbs1243::vehdynyawrate(const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 4);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 5);
int32_t t = t1.get_byte(0, 8);
x <<= 8;
x |= t;
double ret = x * 0.000240 + -2.093000;
return ret;
}
// config detail: {'description': 'Front left wheel speed', 'offset': 0.0,
// 'precision': 0.05625, 'len': 13, 'name': 'flwheelspd', 'is_signed_var':
// False, 'physical_range': '[0|299.98125]', 'bit': 55, 'type': 'double',
// 'order': 'motorola', 'physical_unit': 'Km/h'}
double Fbs1243::flwheelspd(const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 6);
int32_t x = t0.get_byte(0, 8);
Byte t1(bytes + 7);
int32_t t = t1.get_byte(3, 5);
x <<= 5;
x |= t;
double ret = x * 0.056250;
return ret;
}
// config detail: {'description': 'Front right wheel Moving direction',
// 'enum': {0: 'FRWHEELDIRECTION_INVALID', 1: 'FRWHEELDIRECTION_FORWARD',
// 2: 'FRWHEELDIRECTION_BACKWARD', 3: 'FRWHEELDIRECTION_STOP'}, 'precision':
// 1.0, 'len': 2, 'name': 'frwheeldirection', 'is_signed_var': False,
// 'offset': 0.0, 'physical_range': '[0|3]', 'bit': 57, 'type': 'enum',
// 'order': 'motorola', 'physical_unit': ''}
Fbs1_243::FrwheeldirectionType Fbs1243::frwheeldirection(
const std::uint8_t* bytes, int32_t length) const {
Byte t0(bytes + 7);
int32_t x = t0.get_byte(0, 2);
Fbs1_243::FrwheeldirectionType ret =
static_cast<Fbs1_243::FrwheeldirectionType>(x);
return ret;
}
} // namespace wey
} // namespace canbus
} // namespace apollo
| C++ | 5 | seeclong/apollo | modules/canbus/vehicle/wey/protocol/fbs1_243.cc | [
"Apache-2.0"
] |
= yield_content :foo
| Slim | 0 | kou/sinatra | sinatra-contrib/spec/content_for/layout.slim | [
"MIT"
] |
module.exports (terms) = terms.term {
constructor (args) =
self.is argument list = true
self.args = args
arguments () =
self.args
}
| PogoScript | 0 | Sotrek/Alexa | Alexa_Cookbook/Workshop/StatePop/4_IOT/tests/node_modules/aws-sdk/node_modules/cucumber/node_modules/pogo/lib/terms/argumentList.pogo | [
"MIT"
] |
package universe_test
import "testing"
option now = () => 2030-01-01T12:00:00Z
inData =
"
#datatype,string,long,dateTime:RFC3339,double,string,string,string,string
#group,false,false,false,false,true,true,true,true
#default,_result,,,,,,,
,result,table,_time,_value,_field,_measurement,cpu,host
,,0,2018-05-22T19:53:26Z,0,usage_guest,cpu,cpu-total,host.local
"
outData =
"
#datatype,string,long,string,string,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,double,string,string,dateTime:RFC3339
#group,false,false,true,true,false,true,true,false,true,true,false
#default,_result,,,,,,,,,,
,result,table,_field,_measurement,_time,_start,_stop,_value,cpu,host,today
,,0,usage_guest,cpu,2018-05-22T19:53:26Z,2018-05-22T19:53:26Z,2030-01-01T12:00:00Z,0,cpu-total,host.local,2030-01-01T00:00:00Z
"
t_today = (table=<-) =>
table
|> range(start: 2018-05-22T19:53:26Z)
|> map(fn: (r) => ({r with today: today()}))
test _today = () => ({input: testing.loadStorage(csv: inData), want: testing.loadMem(csv: outData), fn: t_today})
| FLUX | 4 | metrico/flux | stdlib/universe/today_test.flux | [
"MIT"
] |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'dart:async';
import 'package:meta/meta.dart';
import 'package:process/process.dart';
import '../application_package.dart';
import '../base/file_system.dart';
import '../base/logger.dart';
import '../base/os.dart';
import '../base/platform.dart';
import '../build_info.dart';
import '../desktop_device.dart';
import '../device.dart';
import '../ios/application_package.dart';
import '../ios/ios_workflow.dart';
import '../project.dart';
/// Represents an ARM macOS target that can run iPad apps.
///
/// https://developer.apple.com/documentation/apple-silicon/running-your-ios-apps-on-macos
class MacOSDesignedForIPadDevice extends DesktopDevice {
MacOSDesignedForIPadDevice({
@required ProcessManager processManager,
@required Logger logger,
@required FileSystem fileSystem,
@required OperatingSystemUtils operatingSystemUtils,
}) : _operatingSystemUtils = operatingSystemUtils,
super(
'designed-for-ipad',
platformType: PlatformType.macos,
ephemeral: false,
processManager: processManager,
logger: logger,
fileSystem: fileSystem,
operatingSystemUtils: operatingSystemUtils,
);
final OperatingSystemUtils _operatingSystemUtils;
@override
String get name => 'Mac Designed for iPad';
@override
Future<TargetPlatform> get targetPlatform async => TargetPlatform.darwin;
@override
bool isSupported() => _operatingSystemUtils.hostPlatform == HostPlatform.darwin_arm;
@override
bool isSupportedForProject(FlutterProject flutterProject) {
return flutterProject.ios.existsSync() && _operatingSystemUtils.hostPlatform == HostPlatform.darwin_arm;
}
@override
String executablePathForDevice(ApplicationPackage package, BuildMode buildMode) => null;
@override
Future<LaunchResult> startApp(
IOSApp package, {
String mainPath,
String route,
@required DebuggingOptions debuggingOptions,
Map<String, dynamic> platformArgs = const <String, dynamic>{},
bool prebuiltApplication = false,
bool ipv6 = false,
String userIdentifier,
}) async {
// Only attaching to a running app launched from Xcode is supported.
throw UnimplementedError('Building for "$name" is not supported.');
}
@override
Future<bool> stopApp(
IOSApp app, {
String userIdentifier,
}) async => false;
@override
Future<void> buildForDevice(
covariant IOSApp package, {
String mainPath,
BuildInfo buildInfo,
}) async {
// Only attaching to a running app launched from Xcode is supported.
throw UnimplementedError('Building for "$name" is not supported.');
}
}
class MacOSDesignedForIPadDevices extends PollingDeviceDiscovery {
MacOSDesignedForIPadDevices({
@required Platform platform,
@required IOSWorkflow iosWorkflow,
@required ProcessManager processManager,
@required Logger logger,
@required FileSystem fileSystem,
@required OperatingSystemUtils operatingSystemUtils,
}) : _logger = logger,
_platform = platform,
_iosWorkflow = iosWorkflow,
_processManager = processManager,
_fileSystem = fileSystem,
_operatingSystemUtils = operatingSystemUtils,
super('Mac designed for iPad devices');
final IOSWorkflow _iosWorkflow;
final Platform _platform;
final ProcessManager _processManager;
final Logger _logger;
final FileSystem _fileSystem;
final OperatingSystemUtils _operatingSystemUtils;
@override
bool get supportsPlatform => _platform.isMacOS;
/// iOS (not desktop macOS) development is enabled, the host is an ARM Mac,
/// and discovery is allowed for this command.
@override
bool get canListAnything =>
_iosWorkflow.canListDevices && _operatingSystemUtils.hostPlatform == HostPlatform.darwin_arm && allowDiscovery;
/// Set to show ARM macOS as an iOS device target.
static bool allowDiscovery = false;
@override
Future<List<Device>> pollingGetDevices({Duration timeout}) async {
if (!canListAnything) {
return const <Device>[];
}
return <Device>[
MacOSDesignedForIPadDevice(
processManager: _processManager,
logger: _logger,
fileSystem: _fileSystem,
operatingSystemUtils: _operatingSystemUtils,
),
];
}
@override
Future<List<String>> getDiagnostics() async => const <String>[];
@override
List<String> get wellKnownIds => const <String>['designed-for-ipad'];
}
| Dart | 4 | Mayb3Nots/flutter | packages/flutter_tools/lib/src/macos/macos_ipad_device.dart | [
"BSD-3-Clause"
] |
{-# LANGUAGE CPP, RankNTypes, UndecidableInstances, GADTs, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, ScopedTypeVariables #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.FileBrowser
(
-- * Hierarchy
--
-- $hierarchy
-- * Widget Functions
--
-- $functions
)
where
#include "Fl_ExportMacros.h"
#include "Fl_Types.h"
#include "Fl_File_BrowserC.h"
import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum)
import Graphics.UI.FLTK.LowLevel.Fl_Enumerations
import Graphics.UI.FLTK.LowLevel.Fl_Types
import Graphics.UI.FLTK.LowLevel.Utils
import Graphics.UI.FLTK.LowLevel.Dispatch
import Graphics.UI.FLTK.LowLevel.Hierarchy
{# fun Fl_File_Browser_draw as draw'' { id `Ptr ()' } -> `()' #}
instance (impl ~ ( IO ())) => Op (Draw ()) FileBrowser orig impl where
runOp _ _ fileBrowser = withRef fileBrowser $ \fileBrowserPtr -> draw'' fileBrowserPtr
{#fun Fl_File_Browser_handle as fileBrowserHandle' { id `Ptr ()', id `CInt' } -> `Int' #}
instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) FileBrowser orig impl where
runOp _ _ fileBrowser event = withRef fileBrowser (\p -> fileBrowserHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent
{# fun Fl_File_Browser_hide as hide' { id `Ptr ()' } -> `()' #}
instance (impl ~ ( IO ())) => Op (Hide ()) FileBrowser orig impl where
runOp _ _ fileBrowser = withRef fileBrowser $ \fileBrowserPtr -> hide' fileBrowserPtr
{# fun Fl_File_Browser_show as show' { id `Ptr ()' } -> `()' #}
instance (impl ~ ( IO ())) => Op (ShowWidget ()) FileBrowser orig impl where
runOp _ _ fileBrowser = withRef fileBrowser $ \fileBrowserPtr -> show' fileBrowserPtr
{# fun Fl_File_Browser_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #}
instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) FileBrowser orig impl where
runOp _ _ fileBrowser rectangle = withRef fileBrowser $ \fileBrowserPtr -> do
let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle
resize' fileBrowserPtr x_pos y_pos w_pos h_pos
-- $hierarchy
-- @
-- "Graphics.UI.FLTK.LowLevel.Base.Widget"
-- |
-- v
-- "Graphics.UI.FLTK.LowLevel.Base.Group"
-- |
-- v
-- "Graphics.UI.FLTK.LowLevel.Base.Browser"
-- |
-- v
-- "Graphics.UI.FLTK.LowLevel.Base.FileBrowser"
-- |
-- v
-- "Graphics.UI.FLTK.LowLevel.FileBrowser"
-- @
-- $functions
-- @
-- draw :: 'Ref' 'FileBrowser' -> 'IO' ()
--
-- handle :: 'Ref' 'FileBrowser' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ())
--
-- hide :: 'Ref' 'FileBrowser' -> 'IO' ()
--
-- resize :: 'Ref' 'FileBrowser' -> 'Rectangle' -> 'IO' ()
--
-- showWidget :: 'Ref' 'FileBrowser' -> 'IO' ()
-- @
| C2hs Haskell | 4 | ericu/fltkhs | src/Graphics/UI/FLTK/LowLevel/FileBrowser.chs | [
"MIT"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.