content
stringlengths 4
1.04M
| lang
stringclasses 358
values | score
int64 0
5
| repo_name
stringlengths 5
114
| repo_path
stringlengths 4
229
| repo_licenses
sequencelengths 1
8
|
---|---|---|---|---|---|
# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors
# Licensed under the MIT License:
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
using Cxx = import "/capnp/c++.capnp";
using Java = import "/capnp/java.capnp";
@0xff75ddc6a36723c9;
$Cxx.namespace("capnp::benchmark::capnp");
$Java.package("org.capnproto.benchmark");
$Java.outerClassname("CarSalesSchema");
struct ParkingLot {
cars@0: List(Car);
}
struct TotalValue {
amount@0: UInt64;
}
struct Car {
make@0: Text;
model@1: Text;
color@2: Color;
seats@3: UInt8;
doors@4: UInt8;
wheels@5: List(Wheel);
length@6: UInt16;
width@7: UInt16;
height@8: UInt16;
weight@9: UInt32;
engine@10: Engine;
fuelCapacity@11: Float32;
fuelLevel@12: Float32;
hasPowerWindows@13: Bool;
hasPowerSteering@14: Bool;
hasCruiseControl@15: Bool;
cupHolders@16: UInt8;
hasNavSystem@17: Bool;
}
enum Color {
black @0;
white @1;
red @2;
green @3;
blue @4;
cyan @5;
magenta @6;
yellow @7;
silver @8;
}
struct Wheel {
diameter@0: UInt16;
airPressure@1: Float32;
snowTires@2: Bool;
}
struct Engine {
horsepower@0: UInt16;
cylinders@1: UInt8;
cc@2: UInt32;
usesGas@3: Bool;
usesElectric@4: Bool;
}
| Cap'n Proto | 4 | litghost/capnproto-java | benchmark/src/main/schema/carsales.capnp | [
"MIT"
] |
REBOL [
Title: "Red/System source program loader"
Author: "Nenad Rakocevic"
File: %loader.r
Tabs: 4
Rights: "Copyright (C) 2011-2018 Red Foundation. All rights reserved."
License: "BSD-3 - https://github.com/red/red/blob/master/BSD-3-License.txt"
]
do-cache %lexer.r
loader: make-profilable context [
verbose: 0
include-list: make hash! 20
ssp-stack: make block! 5
defs: make block! 100
hex-chars: charset "0123456789ABCDEF"
ws-chars: charset " ^M^-"
ws-all: union ws-chars charset "^/"
hex-delim: charset "[]()/"
non-cbracket: complement charset "}^/"
scripts-stk: make block! 10
current-script: none
line: none
throw-error: func [err [string! block!]][
print [
"*** Loading Error:"
either word? err [
join uppercase/part mold err 1 " error"
][reform err]
"^/*** in file:" mold current-script
"^/*** at line:" line
]
compiler/quit-on-error
]
count-slash: func [file /local cnt][
cnt: 0
parse file [some [slash (cnt: cnt + 1) | skip]]
cnt
]
pop-encap-path: func [cnt [integer!]][
path: tail encap-fs/base
loop cnt + 1 [path: find/reverse path slash]
clear next path
]
init: does [
clear include-list
clear defs
clear ssp-stack
clear scripts-stk
current-script: line: none
insert defs <no-match> ;-- required to avoid empty rule (causes infinite loop)
]
relative-path?: func [file [file!]][
not find "/~" first file
]
included?: func [file [file!]][
all [
encap?
encap-fs/base
slash <> first file
file: join encap-fs/base file
]
attempt [file: get-modes file 'full-path]
either find include-list file [true][
append include-list file
false
]
]
push-system-path: func [file [file!] /local path][
append ssp-stack system/script/path
if relative-path? file [file: get-modes file 'full-path]
path: split-path file
system/script/path: path/1
path/2
]
pop-system-path: does [
system/script/path: take/last ssp-stack
]
check-macro-parameters: func [args [paren!]][
unless parse args [some word!][
throw-error ["only words can be used as macro parameters:" mold args]
]
unless empty? intersect to block! args compiler/keywords-list [
throw-error ["keywords cannot be used as macro parameters:" mold args]
]
]
check-marker: func [src [string!] /local pos][
unless parse/all src [any ws-all "Red/System" any ws-all #"[" to end][
throw-error "not a Red/System source program"
]
]
check-condition: func [type [word!] payload [block!]][
case [
type = 'switch [
any [
select payload/2 job/(payload/1)
select payload/2 #default
]
]
payload/2 = 'contains [
do bind/copy
compose/deep [all [(payload/1) find (payload/1) (payload/3)]]
job
]
'else [do bind/copy payload job]
]
]
copy-deep: func [s [series!]][
s: copy/deep s
forall s [
case [
find [path! set-path! lit-path!] type?/word s/1 [
s/1: copy/deep s/1
]
any [block? s/1 paren? s/1][
s/1: copy-deep s/1
]
]
]
s
]
inject: func [args [block!] 'macro s [block!] e [block!] /local rule pos i type value path][
unless equal? length? args length? s/2 [
throw-error ["invalid macro arguments count in:" mold s/2]
]
macro: copy-deep macro
parse :macro rule: [
some [
pos: set path [path! | set-path!] (
forall path [
if i: find args path/1 [
value: pick s/2 index? :i
change/part path value 1
]
]
)
| pos: [
word! (type: word!)
| set-word! (type: set-word!)
| get-word! (type: get-word!)
] (
if i: find args to word! pos/1 [
value: pick s/2 index? :i
change/only pos either type = word! [
value ;-- word! => pass-thru value
][
all [
path: find [path! set-path!] type?/word value
type: find [word! set-word!] to word! type
type: get pick head path index? type
]
to type value ;-- get/set => convert value
]
]
)
| into rule
| skip
]
]
either paren? :macro [
change/part/only s macro e
][
change/part s macro e
]
]
expand-string: func [src [string! binary!] /local value s e c lf-count ws i prev ins?][
if verbose > 0 [print "running string preprocessor..."]
line: 1 ;-- lines counter
lf-count: [lf s: (
if prev <> i: index? s [ ;-- workaround to avoid writing more complex rules
prev: i
line: line + 1
if ins? [s: insert s rejoin [" #L " line " "]]
]
)]
ws: [ws-chars | (ins?: yes) lf-count]
braces: ["{" any [(ins?: no) lf-count | non-cbracket] "}"]
parse/all/case src [ ;-- non-LOAD-able syntax preprocessing
any [
(c: 0)
#";" to lf
| {#"^^} skip thru {"}
| {"} thru {"}
| "{" any [(ins?: no) lf-count | braces | non-cbracket] "}"
| ws s: ">>>" e: ws (
e: change/part s "-**" e ;-- convert >>> to -**
) :e
| [hex-delim | ws]
s: copy value some [hex-chars (c: c + 1)] #"h" ;-- literal hexadecimal support
e: [hex-delim | ws-all | #";" to lf | end] (
either any [c < 2 c > 8][
throw-error ["invalid hex literal:" copy/part s 40]
][
e: change/part s to integer! to issue! value e
]
) :e
| (ins?: yes) lf-count
| skip
]
]
]
expand-block: func [
src [block!]
/own
/local blk rule name value args s e opr then-block else-block cases body p
saved stack header mark idx prev enum-value enum-name enum-names line-rule
recurse condition
][
if verbose > 0 [print "running block preprocessor..."]
stack: append/only clear [] make block! 100
append stack/1 1 ;-- insert root header starting size
line: 1
store-line: [
header: last stack
idx: index? s
mark: to pair! reduce [line idx]
either all [
prev: pick tail header -1
pair? prev
prev/2 = idx ;-- test if previous marker is at the same series position
][
change back tail header mark ;-- replace last marker by a more accurate one
][
append header mark ;-- append line marker to header
]
]
line-rule: [
s: #L set line integer! e: (
s: remove/part s 2
new-line s yes
do store-line
) :s
]
recurse: [
saved: reduce [s e]
parse/case value rule: [
some [defs | into rule | skip] ;-- resolve macros recursively
]
set [s e] saved
]
condition: [
opt 'not ['find block! skip | ['any | 'all] block!]
| set name word! set opr skip set value any-type!
]
parse/case src blk: [
s: (do store-line)
some [
defs ;-- resolve definitions in a single pass
| s: #define set name word! (args: none) [
set args paren! set value [block! | paren!]
| set value skip
] e: (
if paren? args [check-macro-parameters args]
if verbose > 0 [print [mold name #":" mold value]]
if find compiler/definitions name [
print ["*** Warning:" name "macro in R/S is redefined"]
]
append compiler/definitions name
case [
args [
do recurse
rule: copy/deep [s: _ paren! e: (e: inject _ _ s e) :s]
rule/5/3: to block! :args
rule/5/4: :value
]
block? value [
do recurse
rule: copy/deep [s: _ e: (e: change/part s copy/deep _ e) :s]
rule/4/5: :value
]
'else [
if word? value [value: to lit-word! value]
rule: copy/deep [s: _ e: (e: change/part s _ e) :s]
rule/4/4: :value
]
]
rule/2: to lit-word! name
either tag? defs/1 [remove defs][append defs '|]
append defs rule
remove/part s e
) :s
| s: #enum word! set value skip e: (
either block? value [
saved: reduce [s e]
parse value [
any [
any line-rule [
[word! | some [set-word! any line-rule][integer! | word!]]
| skip
]
]
]
set [s e] saved
][
throw-error ["invalid enumeration (block required!):" mold value]
]
s: e
) :s
| s: #include set name file! e: (
either included? name [
s: remove/part s e ;-- already included, drop it
][
if verbose > 0 [print ["...including file:" mold name]]
value: either all [encap? own][
mark: tail encap-fs/base
process/short/sub/own name
][
name: push-system-path name
process/short/sub name
]
e: change/part s skip value 2 e ;-- skip Red/System header
value: either all [encap? own not empty? mark][
count-slash mark
][
0
]
name: system/script/path/:name
insert e reduce [
#pop-path value
#script last scripts-stk ;-- put back the parent origin
]
insert s reduce [ ;-- mark code origin
#script name
]
append scripts-stk name
current-script: name
]
) :s
| s: #if condition set then-block block! e: (
either check-condition 'if copy/part next s back e [
change/part s then-block e
][
remove/part s e
]
) :s
| s: #either condition set then-block block! set else-block block! e: (
either check-condition 'either copy/part next s skip e -2 [
change/part s then-block e
][
change/part s else-block e
]
) :s
| s: #switch set name word! set cases block! e: (
either body: check-condition 'switch reduce [name cases][
change/part s body e
][
remove/part s e
]
) :s
| s: #case set cases block! e: (
either body: select reduce bind cases job true [
change/part s body e
][
remove/part s e
]
) :s
| s: #pop-path set value integer! e: (
either all [encap? own][
unless zero? value [pop-encap-path value]
][
pop-system-path
]
take/last scripts-stk
s: remove/part s 2
) :s
| line-rule
| s: issue! (
if s/1/1 = #"'" [
value: to integer! debase/base next s/1 16
either value > 255 [
throw-error ["unsupported literal byte:" next s/1]
][
s/1: to char! value
]
]
)
| p: [path! | set-path!] :p into [some [defs | skip]] ;-- process macros in paths
| s: (if any [block? s/1 paren? s/1][append/only stack copy [1]])
[into blk | block! | paren!] ;-- black magic...
s: (
if any [block? s/-1 paren? s/-1][
header: last stack
change header length? header ;-- update header size
s/-1: insert copy s/-1 header ;-- insert hidden header
remove back tail stack
]
)
| skip
]
]
change stack/1 length? stack/1 ;-- update root header size
insert src stack/1 ;-- return source with hidden root header
]
prefix-cache: func [file [file!] /local path][
path: either empty? ssp-stack [system/script/path][first ssp-stack]
path: skip system/script/path length? path
secure-clean-path join path file
]
process: func [
input [file! string! block!] /sub /with name [file!] /short /own
/local src err path ssp pushed? raw cache? new
][
if verbose > 0 [print ["processing" mold either file? input [input][any [name 'in-memory]]]]
cache?: all [
encap?
file? input
any [
exists?-cache input
exists?-cache new: prefix-cache input
]
]
if any [own cache?][raw: input]
if with [ ;-- push alternate filename on stack
push-system-path join first split-path name %.
pushed?: yes
]
if file? input [
if find input %/ [ ;-- is there a path in the filename?
either encap? [
raw: split-path input
if encap-fs/base [append encap-fs/base raw/1]
raw: raw/2
push-system-path input
][
input: push-system-path input
]
pushed?: yes
]
if error? set/any 'err try [ ;-- read source file
src: as-string either any [cache? all [encap? own]][
if all [cache? new][raw: new]
read-binary-cache raw
][
read/binary input
]
][
throw-error ["file access error:" mold input]
]
]
unless short [
current-script: case [
file? input [input]
with [name]
'else [any [select input #script 'in-memory]]
]
append clear scripts-stk current-script
]
src: any [src input]
if file? input [check-marker src] ;-- look for "Red/System" head marker
unless block? src [
expand-string src ;-- process string-level compiler directives
if error? set/any 'err try [src: lexer/process as-binary src][ ;-- convert source to blocks
throw-error ["syntax error during LOAD phase:" mold disarm err]
]
]
unless short [ ;-- process block-level compiler directives
src: either all [encap? own][
expand-block/own src
][
expand-block src
]
]
if pushed? [pop-system-path]
src
]
] | R | 4 | GalenIvanov/red | system/loader.r | [
"BSL-1.0",
"BSD-3-Clause"
] |
open util/ordering[Time]
sig Time {}
sig Key {
pressed: set Time
}
pred press[k: Key, t: Time] {
t not in k.pressed
t.next in k.pressed
}
pred release[k: Key, t: Time] {
t in k.pressed
t.next not in k.pressed
}
pred changed[k: Key, t: Time] {
press[k, t] or release[k, t]
}
fact Trace {
no first.~pressed
all t: Time - last |
some k: Key {
changed[k, t]
all k": Key - k |
not changed[k, t]
}
}
| Alloy | 3 | awwx/alloydocs | techniques/specs/dynamics/keyboard.als | [
"MIT"
] |
# Qt inputmethod module
HEADERS +=inputmethod/qinputcontextfactory.h \
inputmethod/qinputcontextplugin.h \
inputmethod/qinputcontext_p.h \
inputmethod/qinputcontext.h
SOURCES +=inputmethod/qinputcontextfactory.cpp \
inputmethod/qinputcontextplugin.cpp \
inputmethod/qinputcontext.cpp
x11 {
HEADERS += inputmethod/qximinputcontext_p.h
SOURCES += inputmethod/qximinputcontext_x11.cpp
}
win32 {
HEADERS += inputmethod/qwininputcontext_p.h
SOURCES += inputmethod/qwininputcontext_win.cpp
}
embedded {
HEADERS += inputmethod/qwsinputcontext_p.h
SOURCES += inputmethod/qwsinputcontext_qws.cpp
}
mac:!embedded:!qpa {
HEADERS += inputmethod/qmacinputcontext_p.h
SOURCES += inputmethod/qmacinputcontext_mac.cpp
}
symbian:contains(QT_CONFIG, s60) {
HEADERS += inputmethod/qcoefepinputcontext_p.h
SOURCES += inputmethod/qcoefepinputcontext_s60.cpp
LIBS += -lfepbase -lakninputlanguage
}
| QMake | 2 | hesslink111/node-qt | deps/qt-4.8.0/win32/ia32/src/gui/inputmethod/inputmethod.pri | [
"BSD-3-Clause-Clear"
] |
<!DOCTYPE html>
<head>
<meta charset=UTF-8/>
<title>CacheCloud应用日报</title>
</head>
<body>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<p>
<table style="width:100%; font-size:12px;" width="100%" cellpadding="0" cellspacing="0">
<colgroup>
<col style="width: 5px;">
</colgroup>
<tr>
<td></td>
<td style="padding-top:20px; padding-left:27px;">
<ul>
<li><span style="font-weight: bold; padding-top:20px; color:#3f3f3f;">应用详细信息:${appDesc.appId?c}</span></li>
</ul>
<table style="table-layout:fixed;width: 872px;border-collapse: collapse;word-break: break-all;word-wrap:break-word;border-top: 1px dotted #676767;text-align: center;color: #000; font-family:'宋体'; font-size:12px; margin-top:10px; margin-left: 24px">
<tr>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767;text-align: left; height:33px; width: 50px;">
应用名称:
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; height:33px; width: 140px;">
${appDesc.name!}
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767;text-align: left; height:33px; width: 50px;">
应用类型:
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; height:33px; width: 140px;">
${appDesc.typeDesc!}
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767;text-align: left; height:33px; width: 50px;">
应用状态:
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; height:33px; width: 140px;">
${appDesc.statusDesc!}
</td>
</tr>
<tr>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767;text-align: left; height:33px; width: 50px;">
应用描述:
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; height:33px; width: 140px;">
${appDesc.intro!}
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767;text-align: left; height:33px; width: 50px;">
应用负责人:
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; height:33px; width: 140px;">
${appDesc.officer!}
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767;text-align: left; height:33px; width: 50px;">
应用申请时间:
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; height:33px; width: 140px;">
${appDesc.createTime?string("yyyy-MM-dd HH:mm:ss")!}
</td>
</tr>
</table>
<ul>
<li><span style="font-weight: bold; padding-top:20px; color:#3f3f3f;">客户端相关(确保使用有客户端统计的版本):</span></li>
</ul>
<table style="table-layout:fixed;width: 872px;border-collapse: collapse;word-break: break-all;word-wrap:break-word;border-top: 1px dotted #676767;text-align: center;color: #000; font-family:'宋体'; font-size:12px; margin-top:10px; margin-left: 24px">
<tr>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767;text-align: left; height:33px; width: 50px;">
客户端值分布(全天):
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; height:33px; width: 140px;">
${appDailyData.valueSizeDistributeCountDesc!}
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; text-align: left;height:33px; width: 50px;">
客户端连接数(每分钟):
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; height:33px; width: 140px;">
最大值:${appDailyData.maxMinuteClientCount!} <br/>
平均值:${appDailyData.avgMinuteClientCount!}
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; text-align: left;height:33px; width: 50px;">
客户端延迟事件数(全天):
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; height:33px; width: 140px;">
${appDailyData.latencyCount!}
</td>
</tr>
<tr>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767;text-align: left; height:33px; width: 50px;">
命令调用统计(全天):
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; height:33px; width: 140px;">
次数:${appDailyData.clientCmdCount!}<br/>
平均耗时(ms):${appDailyData.clientAvgCmdCost!}
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; text-align: left;height:33px; width: 50px;">
连接异常统计(全天):
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; height:33px; width: 140px;">
次数:${appDailyData.clientConnExpCount!}<br/>
平均耗时(ms):${appDailyData.clientAvgConnExpCost!}
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; text-align: left;height:33px; width: 50px;">
命令超时统计(全天):
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; height:33px; width: 140px;">
次数:${appDailyData.clientCmdExpCount!} <br/>
平均耗时(ms):${appDailyData.clientAvgCmdExpCost!}
</td>
</tr>
</table>
<br/>
<ul>
<li><span style="font-weight: bold; padding-top:20px; color:#3f3f3f;">服务端相关:</span></li>
</ul>
<table style="table-layout:fixed;width: 872px;border-collapse: collapse;word-break: break-all;word-wrap:break-word;border-top: 1px dotted #676767;text-align: center;color: #000; font-family:'宋体'; font-size:12px; margin-top:10px; margin-left: 24px">
<tr>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767;text-align: left; height:33px; width: 50px;">
慢查询个数(全天):
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; height:33px; width: 140px;">
${appDailyData.slowLogCount!}
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767;text-align: left; height:33px; width: 50px;">
命令次数(每分钟):
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; height:33px; width: 140px;">
最大值:${appDailyData.maxMinuteCommandCount!} <br/>
平均值:${appDailyData.avgMinuteCommandCount!}
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767;text-align: left; height:33px; width: 50px;">
命中率(每分钟):
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; height:33px; width: 140px;">
最大值:${appDailyData.maxMinuteHitRatio!}% <br/>
最小值:${appDailyData.minMinuteHitRatio!}% <br/>
平均值:${appDailyData.avgHitRatio!}%
</td>
</tr>
<tr>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767;text-align: left; height:33px; width: 50px;">
内存使用量(全天):
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; height:33px; width: 140px;">
平均使用量:${appDailyData.avgUsedMemory!} M<br/>
最大使用量:${appDailyData.maxUsedMemory!} M
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767;text-align: left; height:33px; width: 50px;">
过期键数(全天):
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; height:33px; width: 140px;">
${appDailyData.expiredKeysCount!}
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767;text-align: left; height:33px; width: 50px;">
剔除键数(全天):
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; height:33px; width: 140px;">
${appDailyData.evictedKeysCount!}
</td>
</tr>
<tr>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767;text-align: left; height:33px; width: 50px;">
键个数(全天):
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; height:33px; width: 140px;">
平均值:${appDailyData.avgObjectSize!}<br/>
最大值:${appDailyData.maxObjectSize!}
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767;text-align: left; height:33px; width: 50px;">
input流量(每分钟):
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; height:33px; width: 140px;">
平均值:${appDailyData.avgMinuteNetInputByte!} M<br/>
最大值:${appDailyData.maxMinuteNetInputByte!} M<br/>
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767;text-align: left; height:33px; width: 50px;">
output流量(每分钟):
</td>
<td style="border-right: 1px dotted #676767; border-bottom: 1px dotted #676767; height:33px; width: 140px;">
平均:${appDailyData.avgMinuteNetOutputByte!} M<br/>
最大:${appDailyData.maxMinuteNetOutputByte!} M<br/>
</td>
</tr>
</table>
<br/>
</td>
</tr>
</table>
</p>
</body>
</html> | FreeMarker | 3 | JokerQueue/cachecloud | cachecloud-web/src/main/resources/templates/appDaily.ftl | [
"Apache-2.0"
] |
<!---================= Room Booking System / https://github.com/neokoenig =======================--->
<!--- Custom fields index --->
<cfparam name="customfields">
<cfparam name="customtemplates">
<cfoutput>
<!--- Custom Templates --->
#panel(title="All Custom Templates")#
<div class="row">
<div class="col-sm-9">
#startFormTag(method="GET", controller="customfields", action="addtemplate")#
#hiddenfieldTag(name="controller", value="customfields")#
#hiddenfieldTag(name="action", value="addtemplate")#
<div class="row">
<div class="col-sm-4">
#selectTag(name="key", options=application.rbs.modeltypes, label="Template")#
</div>
<div class="col-sm-4">
#selectTag(name="type", options=application.rbs.templatetypes, label="Type")#
</div>
<div class="col-sm-2">
#submitTag(class="pushdown btn btn-primary", value="Create Template")#
</div>
</div>
#endFormTag()#
<hr />
<cfif customtemplates.recordcount>
<table class="table">
<thead>
<tr>
<th>Model</th>
<th>Type</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<cfloop query="customtemplates">
<cfoutput>
<tr>
<td>#parentmodel#</td>
<td>#type#</td>
<td>
<div class="btn-group">
#linkTo(text="<i class='glyphicon glyphicon-edit'></i> Edit", class="btn btn-xs btn-info", action="edittemplate", params="type=#type#", key="#parentmodel#")#
#linkTo(text="<i class='glyphicon glyphicon-trash'></i> Delete", class="btn btn-xs btn-danger", action="deletetemplate", key="#parentmodel#", params="type=#type#", confirm='Are you Sure?')#
</div>
</td>
</tr>
</cfoutput>
</cfloop>
</tbody>
</table>
<cfelse>
<p>No Custom Templates have been added yet</p>
</cfif>
</div>
<div class="col-sm-3">
<div class="well well-small">
<p><strong>About Custom Templates</strong></p>
<p>You can override the standard templates for form inputs and modal outputs. Simply delete a template to revert back to the defaults.</p>
<p>You can add both 'system' fields, (i.e, model defaults), and any custom fields entered below</p>
<p>Remember, changes affect all instances of the model, and you will need to restart the application to see the effect</p>
</div>
</div>
</div>
#panelEnd()#
<!--- Custom Fields --->
#panel(title="All Custom Fields")#
<div class="row">
<div class="col-sm-9">
#linkTo(Text="<i class='glyphicon glyphicon-plus'></i> Create New Custom Field", class="btn btn-primary", action="add")#
<hr />
<cfif customfields.recordcount>
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Model</th>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<cfloop query="customfields">
<cfoutput>
<tr>
<td>#id#</td>
<td>#parentmodel#</td>
<td>#name#</td>
<td>#type#</td>
<td>#description#</td>
<td>
<div class="btn-group">
#linkTo(text="<i class='glyphicon glyphicon-edit'></i> Edit", class="btn btn-xs btn-info", action="edit", key=id)#
#linkTo(text="<i class='glyphicon glyphicon-trash'></i> Delete", class="btn btn-xs btn-danger", action="delete", key=id, confirm='Are you Sure?')#
</div>
</td>
</tr>
</cfoutput>
</cfloop>
</tbody>
</table>
<cfelse>
<hr />
<p>No Custom Fields have been added yet</p>
</cfif>
</div>
<div class="col-sm-3">
<div class="well well-small">
<p><strong>About Custom Fields</strong></p>
<p>You can use custom fields to collect and display data which isn't provided by the system (default) fields. Examples might include "Room Capacity" for locations, or a radio select for Dietary requirements when creating a booking.</p>
<p>Remember, changes affect all instances of the model, and you will need to restart the application to see the effect</p>
</div>
</div>
</div>
#panelEnd()#
</Cfoutput> | ColdFusion | 4 | fintecheando/RoomBooking | views/customfields/index.cfm | [
"Apache-1.1"
] |
// run-pass
use std::panic::Location;
extern "Rust" {
#[track_caller]
fn rust_track_caller_ffi_test_tracked() -> &'static Location<'static>;
fn rust_track_caller_ffi_test_untracked() -> &'static Location<'static>;
}
fn rust_track_caller_ffi_test_nested_tracked() -> &'static Location<'static> {
unsafe { rust_track_caller_ffi_test_tracked() }
}
mod provides {
use std::panic::Location;
#[track_caller] // UB if we did not have this!
#[no_mangle]
fn rust_track_caller_ffi_test_tracked() -> &'static Location<'static> {
Location::caller()
}
#[no_mangle]
fn rust_track_caller_ffi_test_untracked() -> &'static Location<'static> {
Location::caller()
}
}
fn main() {
let location = Location::caller();
assert_eq!(location.file(), file!());
assert_eq!(location.line(), 29);
assert_eq!(location.column(), 20);
let tracked = unsafe { rust_track_caller_ffi_test_tracked() };
assert_eq!(tracked.file(), file!());
assert_eq!(tracked.line(), 34);
assert_eq!(tracked.column(), 28);
let untracked = unsafe { rust_track_caller_ffi_test_untracked() };
assert_eq!(untracked.file(), file!());
assert_eq!(untracked.line(), 24);
assert_eq!(untracked.column(), 9);
let contained = rust_track_caller_ffi_test_nested_tracked();
assert_eq!(contained.file(), file!());
assert_eq!(contained.line(), 12);
assert_eq!(contained.column(), 14);
}
| Rust | 4 | Eric-Arellano/rust | src/test/ui/rfc-2091-track-caller/track-caller-ffi.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
import {Component, NgModule} from '@angular/core';
declare const animate: any;
declare const style: any;
declare const trigger: any;
declare const transition: any;
@Component({
selector: 'my-cmp',
template: `
<div
[@myAnimation]="exp"
(@myAnimation.start)="onStart($event)"
(@myAnimation.done)="onDone($event)"></div>
`,
animations: [
trigger(
'myAnimation',
[
transition(
'* => state', [style({'opacity': '0'}), animate(500, style({'opacity': '1'}))]),
]),
],
})
class MyComponent {
exp: any;
startEvent: any;
doneEvent: any;
onStart(event: any) {
this.startEvent = event;
}
onDone(event: any) {
this.doneEvent = event;
}
}
@NgModule({declarations: [MyComponent]})
export class MyModule {
}
| TypeScript | 4 | John-Cassidy/angular | packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/component_animations/animation_listeners.ts | [
"MIT"
] |
#NoEnv
SetBatchLines -1
SetWorkingDir %A_ScriptDir%
xlLastCell := 11
Clip := Clipboard
XL := ComObjCreate("Excel.Application")
XL.Workbooks.Open(A_ScriptDir "\Languages.xlsx")
XL.Sheets("Lang_Files").Activate
Xl.Range(Xl.Range("A1"), Xl.Range("A1").SpecialCells(xlLastCell)).Copy
ClipWait
Data := Clipboard, Clipboard := Clip
If (!InStr(Data, "Lang_") = 1)
{
MsgBox Error
return
}
PMC := {}, nLang := []
Loop, Parse, Data, `n, `r
{
Label := "", a := A_Index
StringSplit, Line, A_LoopField, `t
Loop, 2
Label .= (a = 1) ? Line%A_Index% : Line%A_Index% "`t"
Loop, % Line0 - 2
{
i := A_Index + 2
PMC.Lang[A_Index] .= Label . Trim(Line%i%) "`n"
If InStr(Label, "Lang_")
nLang[A_Index] := Line%i%
}
}
FileDelete, %A_ScriptDir%\Lang\*.Lang
For each, Lan in PMC.Lang
FileAppend, % Lan, % A_ScriptDir "\Lang\" nLang[A_Index] ".lang", UTF-8
XL.Application.CutCopyMode := False
XL.Workbooks(1).Close(0)
TrayTip,, Finished extracting Lang files.
Sleep, 2000
return
| AutoHotkey | 4 | standardgalactic/PuloversMacroCreator | ExtractLangFiles.ahk | [
"Unlicense"
] |
namespace OpenAPI.Tests
open System
open System.Net
open System.Net.Http
open System.IO
open Microsoft.AspNetCore.Builder
open Microsoft.AspNetCore.Hosting
open Microsoft.AspNetCore.TestHost
open Microsoft.Extensions.DependencyInjection
open FSharp.Control.Tasks.V2.ContextInsensitive
open Xunit
open System.Text
open TestHelper
open OpenAPI.StoreApiHandler
open OpenAPI.StoreApiHandlerParams
module StoreApiHandlerTestsHelper =
()
()
()
let mutable PlaceOrderExamples = Map.empty
let mutable PlaceOrderBody = ""
PlaceOrderBody <- WebUtility.HtmlDecode "{
"petId" : 6,
"quantity" : 1,
"id" : 0,
"shipDate" : "2000-01-23T04:56:07.000+00:00",
"complete" : false,
"status" : "placed"
}"
PlaceOrderExamples <- PlaceOrderExamples.Add("application/json", PlaceOrderBody)
let getPlaceOrderExample mediaType =
PlaceOrderExamples.[mediaType]
|> getConverter mediaType
| F# | 3 | MalcolmScoffable/openapi-generator | samples/server/petstore/fsharp-giraffe/OpenAPI.Tests/StoreApiTestsHelper.fs | [
"Apache-2.0"
] |
(load "../lib/all.gf")
(fun f (n (a 0) (b 1))
(if n
(if (= n 1)
b
(recall (- n 1) b (+ a b)))
a))
(dump (bench 10 (for 10000 (f 20)))) | Grammatical Framework | 4 | daota2/fffff | v1/bench/fib_tail.gf | [
"MIT"
] |
198
0 0
1 0.2
2 0.2
3 0
4 0.2
5 0.2
6 0
7 0.2
8 0.2
9 0
10 0.2
11 0.2
12 0
13 0.2
14 0.2
15 0
16 0.2
17 0.2
18 0
19 0.2
20 0.2
21 0
22 0.2
23 0.2
24 0
25 0.2
26 0.2
27 0
28 0.2
29 0.2
30 0
31 0.2
32 0.2
33 0
34 0.2
35 0.2
36 0
37 0.2
38 0.2
39 0
40 0.2
41 0.2
42 0
43 0.2
44 0.2
45 0
46 0.2
47 0.2
48 0
49 0.2
50 0.2
51 0
52 0.2
53 0.2
54 0
55 0.2
56 0.2
57 0
58 0.2
59 0.2
60 0
61 0.2
62 0.2
63 0
64 0.2
65 0.2
66 0
67 0.2
68 0.2
69 0
70 0.2
71 0.2
72 0
73 0.2
74 0.2
75 0
76 0.2
77 0.2
78 0
79 0.2
80 0.2
81 0
82 0.2
83 0.2
84 0
85 0.2
86 0.2
87 0
88 0.2
89 0.2
90 0
91 0.2
92 0.2
93 0
94 0.2
95 0.2
96 0
97 0.2
98 0.2
99 0
100 0.2
101 0.2
102 0
103 0.2
104 0.2
105 0
106 0.2
107 0.2
108 0
109 0.2
110 0.2
111 0
112 0.2
113 0.2
114 0
115 0.2
116 0.2
117 0
118 0.2
119 0.2
120 0
121 0.2
122 0.2
123 0
124 0.2
125 0.2
126 0
127 0.2
128 0.2
129 0
130 0.2
131 0.2
132 0
133 0.2
134 0.2
135 0
136 0.2
137 0.2
138 0
139 0.2
140 0.2
141 0
142 0.2
143 0.2
144 0
145 0.2
146 0.2
147 0
148 0.2
149 0.2
150 0
151 0.2
152 0.2
153 0
154 0.2
155 0.2
156 0
157 0.2
158 0.2
159 0
160 0.2
161 0.2
162 0
163 0.2
164 0.2
165 0
166 0.2
167 0.2
168 0
169 0.2
170 0.2
171 0
172 0.2
173 0.2
174 0
175 0.2
176 0.2
177 0
178 0.2
179 0.2
180 0
181 0.2
182 0.2
183 0
184 0.2
185 0.2
186 0
187 0.2
188 0.2
189 0
190 0.2
191 0.2
192 0
193 0.2
194 0.2
195 0
196 0.2
197 0.2
| IDL | 0 | ricortiz/OpenTissue | demos/data/dlm/198/factor.dlm | [
"Zlib"
] |
$TTL 300
@ IN MX 15 foo.com.
| DNS Zone | 2 | IT-Sumpfling/dnscontrol | pkg/js/parse_tests/013-mx/foo.com.zone | [
"MIT"
] |
<cfcomponent extends="ColdBricks.handlers.ehColdBricks">
<cffunction name="dspHome" access="public" returntype="void">
<cfscript>
var oSiteDAO = 0;
var oUserDAO = 0;
var qrySites = 0;
var oUser = getValue("oUser");
var aModules = arrayNew(1);
try {
// clear site from context (releases memory allocated to the site context)
getService("sessionContext").getContext().clearSiteContext();
// if this is a regular user then go to sites screen
if(not oUser.getIsAdministrator()) setNextEvent("sites.ehSites.dspMain");
oSiteDAO = getService("DAOFactory").getDAO("site");
oUserSiteDAO = getService("DAOFactory").getDAO("userSite");
qrySites = oSiteDAO.getAll();
qryUserSites = oUserSiteDAO.search(userID = oUser.getID());
// get features
aModules = getService("UIManager").getServerFeatures();
// get widgets
stWidgets = renderWidgets( getService("UIManager").getServerWidgets() );
setValue("qrySites",qrySites);
setValue("qryUserSites",qryUserSites);
setValue("aModules",aModules);
setValue("stWidgets",stWidgets);
setValue("showHomePortalsAsSite", getSetting("showHomePortalsAsSite"));
setValue("cbPageTitle", "Administration Dashboard");
setView("vwHome");
} catch(any e) {
setMessage("error",e.message);
getService("bugTracker").notifyService(e.message, e);
setView("");
}
</cfscript>
</cffunction>
<cffunction name="dspMain" access="public" returntype="void">
<cfscript>
var oSiteDAO = 0;
var oUserDAO = 0;
var qrySites = 0;
var oUser = getValue("oUser");
try {
oSiteDAO = getService("DAOFactory").getDAO("site");
oUserSiteDAO = getService("DAOFactory").getDAO("userSite");
qrySites = oSiteDAO.getAll();
qryUserSites = oUserSiteDAO.search(userID = oUser.getID());
// if this is a regular user that has only one site, then
// go directly to that site
if(not oUser.getIsAdministrator() and qryUserSites.recordCount eq 1)
setNextEvent("sites.ehSite.doLoadSite","siteID=#qryUserSites.siteID#");
setValue("qrySites",qrySites);
setValue("qryUserSites",qryUserSites);
setValue("showHomePortalsAsSite", getSetting("showHomePortalsAsSite"));
setValue("cbPageTitle", "Site Management");
setValue("cbPageIcon", "images/folder_desktop_48x48.png");
setView("vwMain");
} catch(any e) {
setMessage("error",e.message);
getService("bugTracker").notifyService(e.message, e);
}
</cfscript>
</cffunction>
<cffunction name="dspCreate" access="public" returntype="void">
<cfset var siteTemplatesRoot = getSetting("siteTemplatesRoot")>
<cfset var siteTemplate = getValue("siteTemplate")>
<cfset var name = getValue("name")>
<cfset var appRoot = getValue("appRoot")>
<cfscript>
// get registered site templates
aSites = getService("siteTemplates").getSiteTemplates();
// get default values for site name and path
if(siteTemplate neq "" and name eq "") {
keepLooping = true;
index = 1;
name = replaceNoCase(siteTemplate," ","","ALL");
oSiteDAO = getService("DAOFactory").getDAO("site");
checkName = name;
while(keepLooping and index lt 100) {
qry = oSiteDAO.search(siteName = checkName);
keepLooping = (qry.recordCount gt 0);
if(keepLooping) checkName = name & index;
index = index + 1;
}
name = checkName;
appRoot = "/" & checkName;
}
setValue("aSites", aSites);
setValue("name", name);
setValue("appRoot", appRoot);
setValue("siteTemplatesRoot", siteTemplatesRoot);
setValue("cbPageTitle", "Site Management > Create New Site");
setValue("cbPageIcon", "images/folder_desktop_48x48.png");
setView("vwCreate");
</cfscript>
</cffunction>
<cffunction name="dspCreateCustom" access="public" returntype="void">
<cfscript>
setValue("cbPageTitle", "Site Management > Create Custom Site");
setValue("cbPageIcon", "images/folder_desktop_48x48.png");
setView("vwCreateCustom");
</cfscript>
</cffunction>
<cffunction name="dspDelete" access="public" returntype="void">
<cfscript>
var siteID = getValue("siteID");
var oSiteDAO = 0;
var qrySite = 0;
var allowDeleteFiles = true;
try {
// get site information
oSiteDAO = getService("DAOFactory").getDAO("site");
qrySite = oSiteDAO.get(siteID);
if(qrySite.path eq "/") {
allowDeleteFiles = false;
setMessage("warning","You cannot delete files from sites located at root level. They can only be unregistered from ColdBricks.");
}
setValue("qrySite",qrySite);
setValue("allowDeleteFiles",allowDeleteFiles);
setValue("cbPageTitle", "Site Management > Confirm Site Deletion");
setValue("cbPageIcon", "images/folder_desktop_48x48.png");
setView("vwDelete");
} catch(coldBricks.validation e) {
setMessage("warning",e.message);
setNextEvent("sites.ehSites.dspMain");
} catch(any e) {
setMessage("error",e.message);
getService("bugTracker").notifyService(e.message, e);
setNextEvent("sites.ehSites.dspMain");
}
</cfscript>
</cffunction>
<cffunction name="dspRegister" access="public" returntype="void">
<cfset setValue("cbPageTitle", "Site Management > Register Existing Site")>
<cfset setValue("cbPageIcon", "images/folder_desktop_48x48.png")>
<cfset setView("vwRegister")>
</cffunction>
<cffunction name="dspEditXML" access="public" returntype="void">
<cfscript>
var xmlDocStr = "";
var oFormatter = createObject("component","ColdBricks.components.xmlStringFormatter").init();
var hpConfigPath = getSetting("homePortalsConfigPath");
var siteID = getValue("siteID");
var xmlContent = getValue("xmlContent");
var errorMessage = "";
var oConfig = 0;
try {
// get site information
oSiteDAO = getService("DAOFactory").getDAO("site");
qrySite = oSiteDAO.get(siteID);
configFile = qrySite.path & getSetting("homePortalsConfigPath");
if(xmlContent eq "") {
if(fileExists(expandPath(configFile))) {
try {
xmlDoc = xmlParse(expandPath(configFile));
} catch(any e) {
errorMessage = e.message;
}
} else {
errorMessage = "Config file does not exist";
}
} else {
xmlDoc = xmlContent;
try {
xmlDoc = xmlParse(xmlDoc);
} catch(any e) {
errorMessage = e.message;
}
}
if(errorMessage eq "") {
if(isXMLDoc(xmlDoc)) {
xmlDocStr = oFormatter.makePretty(xmlDoc.xmlRoot);
} else {
errorMessage = "The given content is not a valid XML document";
}
}
if(errorMessage eq "") {
try {
oConfig = createObject("component","homePortals.components.homePortalsConfigBean").init().loadXML(xmlDoc);
} catch(any e) {
errorMessage = "The given content is not a valid config file. #e.message#";
}
}
setView("vwEditXML");
setValue("xmlContent", xmlDocStr);
setValue("errorMessage", errorMessage);
setValue("siteID", siteID);
setValue("configFile", configFile);
setValue("cbPageTitle", "Site Management > Repair Site Config");
setValue("cbPageIcon", "images/configure_48x48.png");
} catch(any e) {
setMessage("error",e.message);
getService("bugTracker").notifyService(e.message, e);
setNextEvent("sites.ehSites.dspMain");
}
</cfscript>
</cffunction>
<cffunction name="dspHomePortalsCheck" access="public" returntype="void">
<cfscript>
var oHomePortals = 0;
setLayout("Layout.None");
try {
// check existence of homeportals engine
oHomePortals = createObject("Component","homePortals.components.homePortals").init("/homePortals");
setValue("hpVersion", oHomePortals.getConfig().getVersion());
setView("vwHomePortalsCheck");
} catch(any e) {
setValue("errorInfo",e);
setView("vwHomePortalsCheckError");
}
</cfscript>
</cffunction>
<cffunction name="doCreate" access="public" returntype="void">
<cfscript>
var name = getValue("name");
var appRoot = getValue("appRoot");
var contentRoot = getValue("contentRoot");
var resourcesRoot = getValue("resourcesRoot");
var oUser = getValue("oUser");
var deployToWebRoot = getValue("deployToWebRoot",false);
var siteTemplate = getValue("siteTemplate");
var accountsRoot = "accounts";
var siteTemplatePath = getSetting("siteTemplatesRoot");
var oSiteDAO = 0;
var qrySiteCheck = 0;
var siteID = 0;
try {
if(isBoolean(deployToWebRoot) and deployToWebRoot) appRoot = "/";
if(name eq "") throw("Site name cannot be empty","coldBricks.validation");
if(appRoot eq "") throw("Application root cannot be empty","coldBricks.validation");
if(siteTemplate eq "") throw("Please select a site template","coldBricks.validation");
// check that application root and name only contains valid characters
if(reFind("[^A-Za-z0-9_\ ]",name)) throw("The site name can only contain characters from the alphabet, digits, the underscore symbol and the space","coldbricks.validation");
if(reFind("[^A-Za-z0-9_/\-]",appRoot)) throw("The application root can only contain characters from the alphabet, digits, the underscore symbol and the backslash","coldbricks.validation");
// make sure the approot doesnt exist already
if(appRoot neq "/" and directoryExists(expandPath(appRoot)))
throw("The given application directory already exists. Please select a different directory","coldBricks.validation");
// check that the directory is not a restricted one
if(left(appRoot,6) eq "/homePortals/"
or appRoot eq "/homePortals"
or left(appRoot,11) eq "/ColdBricks") {
throw("You are trying to use a restricted directory as the application root. Please select a different application root.","coldBricks.validation");
}
// make sure application root path start and end with / for consistency and to avoid problems later
if(left(appRoot,1) neq "/") throw("All paths must be relative to the website root and start with '/'","coldBricks.validation");
if(right(appRoot,1) neq "/") appRoot = appRoot & "/";
// check if site is already registered in coldbricks
oSiteDAO = getService("DAOFactory").getDAO("site");
qrySiteCheck = oSiteDAO.search(siteName = name);
if(qrySiteCheck.recordCount gt 0)
throw("There is already another site registered with the name '#name#', please select a different site name.","coldBricks.validation");
// check if there is another site pointing to this path
qrySiteCheck = oSiteDAO.search(path = appRoot);
if(qrySiteCheck.recordCount gt 0)
throw("There is already another site pointing to the same directory '#appRoot#', please select a different application root.","coldBricks.validation");
resourcesRoot = appRoot & "resourceLibrary/";
contentRoot = appRoot & "content/";
srcAppRoot = siteTemplatePath & "/" & siteTemplate & "/appRoot";
srcResRoot = siteTemplatePath & "/" & siteTemplate & "/resourcesRoot";
srcContentRoot = siteTemplatePath & "/" & siteTemplate & "/contentRoot";
// copy application skeletons
directoryCopy(expandPath(srcAppRoot), expandPath(appRoot));
if(directoryExists(expandPath(srcResRoot))) {
directoryCopy(expandPath(srcResRoot), expandPath(resourcesRoot));
}
if(directoryExists(expandPath(srcContentRoot))) {
directoryCopy(expandPath(srcContentRoot), expandPath(contentRoot));
}
// replace tokens on copied files
replaceTokens(appRoot & "/Application.cfc", name, appRoot, accountsRoot, resourcesRoot, contentRoot);
// process all files in the config directory for Tokens
qryDir = listDir(expandPath(appRoot & "/config"));
for(i=1;i lte qryDir.recordCount;i=i+1) {
if(qryDir.type[i] eq "file") {
replaceTokens(appRoot & "/config/" & qryDir.name[i], name, appRoot, accountsRoot, resourcesRoot, contentRoot);
}
}
// create site record for coldbricks
siteID = oSiteDAO.save(id=0, siteName=name, path=appRoot, ownerUserID=oUser.getID(), createdDate=dateFormat(now(),"mm/dd/yyyy"), notes="");
setMessage("info", "The new site has been created.");
setNextEvent("sites.ehSites.dspHome","loadSiteID=#siteID#");
} catch(coldBricks.validation e) {
setMessage("warning",e.message);
setNextEvent("sites.ehSites.dspCreate","appRoot=#appRoot#&name=#name#&siteTemplate=#siteTemplate#");
} catch(any e) {
setMessage("error",e.message);
getService("bugTracker").notifyService(e.message, e);
setNextEvent("sites.ehSites.dspCreate","appRoot=#appRoot#&name=#name#&siteTemplate=#siteTemplate#");
}
</cfscript>
</cffunction>
<cffunction name="doCreateCustom" access="public" returntype="void">
<cfscript>
var name = getValue("name");
var appRoot = getValue("appRoot");
var contentRoot = getValue("contentRoot");
var resourcesRoot = getValue("resourcesRoot");
var useDefault_rl = getValue("useDefault_rl",0);
var oUser = getValue("oUser");
var deployToWebRoot = getValue("deployToWebRoot",false);
var bCreateResourceDir = false;
var bCreateContentDir = false;
var oSiteDAO = 0;
var qrySiteCheck = 0;
var siteID = 0;
var crlf = chr(10) & chr(13);
try {
if(isBoolean(deployToWebRoot) and deployToWebRoot) appRoot = "/";
if(name eq "") throw("Site name cannot be empty","coldBricks.validation");
if(appRoot eq "") throw("Application root cannot be empty","coldBricks.validation");
// check that application root and name only contains valid characters
if(reFind("[^A-Za-z0-9_\ ]",name)) throw("The site name can only contain characters from the alphabet, digits, the underscore symbol and the space","coldbricks.validation");
if(reFind("[^A-Za-z0-9_/\-]",appRoot)) throw("The application root can only contain characters from the alphabet, digits, the underscore symbol and the backslash","coldbricks.validation");
// make sure the approot doesnt exist already
if(appRoot neq "/" and directoryExists(expandPath(appRoot)))
throw("The given application directory already exists. Please select a different directory","coldBricks.validation");
// check that the directory is not a restricted one
if(left(appRoot,6) eq "/homePortals/"
or appRoot eq "/homePortals"
or left(appRoot,11) eq "/ColdBricks") {
throw("You are trying to use a restricted directory as the application root. Please select a different application root.","coldBricks.validation");
}
// make sure application root path start and end with / for consistency and to avoid problems later
if(left(appRoot,1) neq "/") throw("All paths must be relative to the website root and start with '/'","coldBricks.validation");
if(right(appRoot,1) neq "/") appRoot = appRoot & "/";
// check if site is already registered in coldbricks
oSiteDAO = getService("DAOFactory").getDAO("site");
qrySiteCheck = oSiteDAO.search(siteName = name);
if(qrySiteCheck.recordCount gt 0)
throw("There is already another site registered with the name '#name#', please select a different site name.","coldBricks.validation");
// check if there is another site pointing to this path
qrySiteCheck = oSiteDAO.search(path = appRoot);
if(qrySiteCheck.recordCount gt 0)
throw("There is already another site pointing to the same directory '#appRoot#', please select a different application root.","coldBricks.validation");
// create custom site
if(contentRoot eq "") throw("Content root cannot be empty","coldBricks.validation");
if(reFind("[^A-Za-z0-9_/\-]",contentRoot)) throw("The content root can only contain characters from the alphabet, digits, the underscore symbol and the backslash","coldbricks.validation");
if(useDefault_rl eq 1 and resourcesRoot eq "") throw("Resource Library root cannot be empty","coldBricks.validation");
if(useDefault_rl eq 0) resourcesRoot = "";
// check if we need to create the resources root
if(useDefault_rl eq 1 and not directoryExists(expandPath(resourcesRoot))) {
bCreateResourceDir = true;
}
if(useDefault_rl eq 1) {
if(left(resourcesRoot,1) neq "/") throw("All paths must be relative to the website root and start with '/'","coldBricks.validation");
if(right(resourcesRoot,1) neq "/") resourcesRoot = resourcesRoot & "/";
}
// check if we need to create the content root
if(left(contentRoot,1) neq "/") throw("All paths must be relative to the website root and start with '/'","coldBricks.validation");
if(right(contentRoot,1) neq "/") contentRoot = contentRoot & "/";
bCreateContentDir = (not directoryExists(expandPath(contentRoot)));
// create app directory structure
if(appRoot neq "/") createDir(expandPath(appRoot));
createDir(expandPath(appRoot & "/config"));
if(bCreateContentDir) createDir(expandPath(contentRoot));
if(bCreateResourceDir) createDir(expandPath(resourcesRoot));
// create config
oConfigBean = createObject("component","homePortals.components.homePortalsConfigBean").init();
oConfigBean.setAppRoot(appRoot);
oConfigBean.setContentRoot(contentRoot);
oConfigBean.setDefaultPage("default");
if(resourcesRoot neq "") oConfigBean.addResourceLibraryPath(resourcesRoot);
getService("configManager").saveHomePortalsConfigDoc(appRoot, oConfigBean.toXML());
// create Application.cfc
txt = fileRead(expandPath("/ColdBricks/modules/sites/files/Application.cfc.txt"));
txt = replace(txt, "$APP_NAME$", name, "ALL");
txt = replace(txt, "$APP_ROOT$", appRoot, "ALL");
fileWrite(expandPath(appRoot & "Application.cfc"), txt, "utf-8");
// create index.cfm
txt = fileRead(expandPath("/ColdBricks/modules/sites/files/index.cfm.txt"));
fileWrite(expandPath(appRoot & "index.cfm"), txt, "utf-8");
// create default.xml
if(not fileExists(expandPath(contentRoot & "default.xml"))) {
txt = fileRead(expandPath("/ColdBricks/modules/sites/files/default.xml.txt"));
fileWrite(expandPath(contentRoot & "default.xml"), txt, "utf-8");
}
// create site record for coldbricks
siteID = oSiteDAO.save(id=0,
siteName=name,
path=appRoot,
ownerUserID=oUser.getID(),
createdDate=dateFormat(now(),"mm/dd/yyyy"),
notes="");
setMessage("info", "The new site has been created.");
setNextEvent("sites.ehSites.dspHome","loadSiteID=#siteID#");
} catch(coldBricks.validation e) {
setMessage("warning",e.message);
setNextEvent("sites.ehSites.dspCreateCustom","appRoot=#appRoot#&name=#name#");
} catch(any e) {
setMessage("error",e.message);
getService("bugTracker").notifyService(e.message, e);
setNextEvent("sites.ehSites.dspCreateCustom","appRoot=#appRoot#&name=#name#");
}
</cfscript>
</cffunction>
<cffunction name="doDelete" access="public" returntype="void">
<cfscript>
var siteID = getValue("siteID");
var deleteFiles = getValue("deleteFiles", false);
var oSiteDAO = 0;
var qrySite = 0;
try {
// get site information
oSiteDAO = getService("DAOFactory").getDAO("site");
qrySite = oSiteDAO.get(siteID);
// delete files (if requested and directory exists)
if(isBoolean(deleteFiles) and deleteFiles and directoryExists( expandPath(qrySite.path))) {
// make sure we are deleting something safe (if directory exists at all)
if(qrySite.path neq "/"
and left(qrySite.path,6) neq "/homePortals/"
and qrySite.path neq "/homePortals"
and left(qrySite.path,11) neq "/ColdBricks"
and left(qrySite.path,1) eq "/" ) {
} else {
throw("You are trying to delete a restricted directory","coldBricks.validation");
}
deleteDir( expandPath(qrySite.path) );
}
// delete from local datastore
oSiteDAO.delete(siteID);
setMessage("info", "Site deleted");
setNextEvent("sites.ehSites.dspMain");
} catch(coldBricks.validation e) {
setMessage("warning",e.message);
setNextEvent("sites.ehSites.dspDelete","siteID=#siteID#");
} catch(any e) {
setMessage("error",e.message);
getService("bugTracker").notifyService(e.message, e);
setNextEvent("sites.ehSites.dspDelete");
}
</cfscript>
</cffunction>
<cffunction name="doRegister" access="public" returntype="void">
<cfscript>
var appRoot = getValue("appRoot");
var name = getValue("name");
var oUser = getValue("oUser");
var oSiteDAO = 0;
var qrySiteCheck = 0;
var siteID = 0;
try {
if(name eq "") throw("Site name cannot be empty","coldBricks.validation");
if(appRoot eq "") throw("Application root cannot be empty","coldBricks.validation");
// check if site is already registered in coldbricks
oSiteDAO = getService("DAOFactory").getDAO("site");
qrySiteCheck = oSiteDAO.search(siteName = name);
if(qrySiteCheck.recordCount gt 0)
throw("There is already another site registered with the name '#name#', please select a different site name.","coldBricks.validation");
// make sure the approot points to an existing directory
if(not directoryExists(expandPath(appRoot)))
throw("The given application directory does not exist. If you wish to create a new site use the 'Create Site' option.","coldBricks.validation");
// check that the directory is not a restricted one
if(left(appRoot,11) eq "/ColdBricks") {
throw("You are trying to use a restricted directory as the application root. Please select a different application root.","coldBricks.validation");
}
// check that the target directory points to a valid homeportals application
if( Not (directoryExists(expandPath(appRoot & "/config"))
and fileExists(expandPath(appRoot & "/config/homePortals-config.xml.cfm")))
and Not fileExists(expandPath(appRoot & "/homePortals-config.xml.cfm")))
throw("The given application directory does not see,s point to a standard HomePortals application. Please check the directory and try again.","coldBricks.validation");
// create site record for coldbricks
siteID = oSiteDAO.save(id=0, siteName=name, path=appRoot, ownerUserID=oUser.getID(), createdDate=dateFormat(now(),"mm/dd/yyyy"), notes="");
setMessage("info", "The site has been registered.");
setNextEvent("sites.ehSites.dspHome","loadSiteID=#siteID#");
} catch(coldBricks.validation e) {
setMessage("warning",e.message);
setNextEvent("sites.ehSites.dspRegister","appRoot=#appRoot#&name=#name#");
} catch(any e) {
setMessage("error",e.message);
getService("bugTracker").notifyService(e.message, e);
setNextEvent("sites.ehSites.dspRegister");
}
</cfscript>
</cffunction>
<cffunction name="doArchiveSite" access="public" returntype="void">
<cfset var siteID = getValue("siteID")>
<cfset var oSiteDAO = 0>
<cfset var qrySite = 0>
<cfset var dataRoot = getSetting("dataRoot")>
<cfset var archivesPath = dataRoot & "/archives">
<cfset var zipFilePath = "">
<cfset var zipFileName = "">
<cfset var deleteAfterDownload = getSetting("deleteAfterArchiveDownload")>
<cfset var oCF8Extras = 0>
<cftry>
<!--- get site information ---->
<cfset oSiteDAO = getService("DAOFactory").getDAO("site")>
<cfset qrySite = oSiteDAO.get(siteID)>
<!--- make sure the directory exists --->
<cfif not directoryExists(expandPath(qrySite.path))>
<cfthrow message="The application directory does not exist!" type="coldBricks.validation">
</cfif>
<!--- make sure the archives directory exists --->
<cfif not directoryExists(expandPath(archivesPath))>
<cfdirectory action="create" directory="#expandPath(archivesPath)#">
</cfif>
<!--- set name --->
<cfset zipFileName = qrySite.siteName & "_" & dateFormat(now(),"mmddyy") & "_" & timeFormat(now(),"hhmmss") & ".zip">
<cfset zipFilePath = expandPath( archivesPath & "/" & zipFileName)>
<!--- create zip file --->
<cfset oCF8Extras = createObject("component","ColdBricks.components.services.cf8extras").init()>
<cfset oCF8Extras.createZip(zipFilePath, expandPath(qrySite.path))>
<!--- download file --->
<cfheader name="content-disposition" value="inline; filename=#zipFileName#">
<cfif deleteAfterDownload>
<cfcontent file="#zipFilePath#" type="application/zip" deletefile="true">
<cfelse>
<cfcontent file="#zipFilePath#" type="application/zip">
</cfif>
<cfset setMessage("info","Archive of site #qrySite.siteName# has been created. Archive name: #zipFileName#")>
<cfcatch type="coldBricks.validation">
<cfset setMessage("warning",cfcatch.message)>
</cfcatch>
<cfcatch type="any">
<cfset setMessage("error",cfcatch.message)>
<cfset getService("bugTracker").notifyService(cfcatch.message, cfcatch)>
</cfcatch>
</cftry>
<cfset setNextEvent("sites.ehSites.dspMain")>
</cffunction>
<cffunction name="doSaveConfigFile" access="public" returntype="void">
<cfscript>
var xmlContent = getValue("xmlContent","");
var configFile = getValue("configFile","");
var oConfig = 0;
try {
// check if we can parse the xml as a valid config file
try {
oConfig = createObject("component","homePortals.components.homePortalsConfigBean").init().loadXML(xmlContent);
} catch(any e) {
setMessage("warning", "The given content is not a valid site config file.");
dspEditXML();
return;
}
fileWrite( expandPath( configFile ), xmlContent, "utf-8");
// go to the xml editor
setMessage("info", "Config file updated");
setNextEvent("sites.ehSites.dspEditXML","siteID=#siteID#");
} catch(any e) {
setMessage("error", e.message);
getService("bugTracker").notifyService(e.message, e);
dspEditXML();
}
</cfscript>
</cffunction>
<!--- Private Methods --->
<cffunction name="replaceTokens" access="private" returntype="void">
<cfargument name="path" type="string" required="true">
<cfargument name="name" type="string" required="true">
<cfargument name="appRoot" type="string" required="true">
<cfargument name="accountsRoot" type="string" required="true">
<cfargument name="resourcesRoot" type="string" required="true">
<cfargument name="contentRoot" type="string" required="true">
<cfscript>
var txtDoc = "";
var appRootDotted = replace(arguments.appRoot,"/",".","ALL");
if(len(appRootDotted) gt 1) {
if(left(appRootDotted,1) eq ".") appRootDotted = right(appRootDotted,len(appRootDotted)-1);
if(right(appRootDotted,1) neq ".") appRootDotted = appRootDotted & ".";
}
txtDoc = readFile(expandPath(arguments.path));
txtDoc = replace(txtDoc, "$APP_NAME$", arguments.name, "ALL");
txtDoc = replace(txtDoc, "$APP_ROOT$", arguments.appRoot, "ALL");
txtDoc = replace(txtDoc, "$APP.ROOT$", appRootDotted, "ALL");
txtDoc = replace(txtDoc, "$ACCOUNTS_ROOT$", arguments.accountsRoot, "ALL");
txtDoc = replace(txtDoc, "$RESOURCES_ROOT$", arguments.resourcesRoot, "ALL");
txtDoc = replace(txtDoc, "$CONTENT_ROOT$", arguments.contentRoot, "ALL");
writeFile(expandPath(arguments.path), txtDoc);
</cfscript>
</cffunction>
<cffunction name="writeFile" access="private" returntype="void">
<cfargument name="path" type="string" required="true">
<cfargument name="content" type="string" required="true">
<cffile action="write" file="#arguments.path#" output="#arguments.content#">
</cffunction>
<cffunction name="createDir" access="private" returntype="void">
<cfargument name="path" type="string" required="true">
<cfdirectory action="create" directory="#arguments.path#">
</cffunction>
<cffunction name="deleteDir" access="private" returntype="void">
<cfargument name="path" type="string" required="true">
<cfdirectory action="delete" recurse="true" directory="#arguments.path#">
</cffunction>
<cffunction name="readFile" access="private" returntype="string">
<cfargument name="path" type="string" required="true">
<cfset var txt = "">
<cffile action="read" file="#arguments.path#" variable="txt">
<cfreturn txt>
</cffunction>
<cffunction name="directoryCopy" output="true">
<cfargument name="source" required="true" type="string">
<cfargument name="destination" required="true" type="string">
<cfargument name="nameconflict" required="true" default="overwrite">
<!---
Copies a directory.
@param source Source directory. (Required)
@param destination Destination directory. (Required)
@param nameConflict What to do when a conflict occurs (skip, overwrite, makeunique). Defaults to overwrite. (Optional)
@return Returns nothing.
@author Joe Rinehart ([email protected])
@version 1, July 27, 2005
--->
<cfset var contents = "" />
<cfset var dirDelim = "/">
<cfif server.OS.Name contains "Windows">
<cfset dirDelim = "\" />
</cfif>
<cfif not(directoryExists(arguments.destination))>
<cfdirectory action="create" directory="#arguments.destination#">
</cfif>
<cfdirectory action="list" directory="#arguments.source#" name="contents">
<cfloop query="contents">
<cfif contents.type eq "file">
<cffile action="copy" source="#arguments.source##dirDelim##name#" destination="#arguments.destination##dirDelim##name#" nameconflict="#arguments.nameConflict#">
<cfelseif contents.type eq "dir" and name neq ".svn">
<cfset directoryCopy(arguments.source & dirDelim & name, arguments.destination & dirDelim & name) />
</cfif>
</cfloop>
</cffunction>
<cffunction name="listDir" access="private" returntype="query">
<cfargument name="path" type="string" required="true">
<cfset var qry = queryNew("")>
<cfdirectory action="list" directory="#arguments.path#" name="qry">
<cfreturn qry>
</cffunction>
</cfcomponent> | ColdFusion CFC | 5 | subethaedit/SubEthaEd | Documentation/ModeDevelopment/Reference Files/CFML/ehSites.cfc | [
"MIT"
] |
#pragma TextEncoding="UTF-8"
#pragma rtGlobals=3
#pragma ModuleName=SIDAMUtilControl
#include "SIDAM_Utilities_Panel"
#ifndef SIDAMshowProc
#pragma hide = 1
#endif
//******************************************************************************
// Change the disable state of controls and subwindows in a tab.
// Controls and subwindows to be changed must have userData(tab), where a tab
// number is recorded. The initial disable state of each control and subwindow
// specified when created reflects the disable state when a corresponding tab
// is opened first time.
//******************************************************************************
Function SIDAMTabControlProc(STRUCT WMTabControlAction &s)
int tabNum, disable_saved, i, n
// controls
String ctrlName, ctrlList = ControlNameList(s.win)
for (i = 0, n = ItemsInList(ctrlList); i < n; i++)
ctrlName = StringFromList(i,ctrlList)
tabNum = str2num(GetUserData(s.win, ctrlName, "tab"))
switch (whichTab(tabNum, s))
case INCLUDED_IN_PRESENT:
disable_saved = str2num(GetUserData(s.win, s.ctrlName, ctrlName))
ModifyControl/Z $ctrlName, disable=disable_saved, win=$s.win
break
case INCLUDED_IN_LAST:
ControlInfo/W=$s.win $ctrlName
TabControl $s.ctrlName userData($ctrlName)=num2istr(V_Disable), win=$s.win
ModifyControl/Z $ctrlName, disable=1, win=$s.win
break
endswitch
endfor
// subwindows
String subWinName, subWwinList = ChildWindowList(s.win)
for (i = 0, n = ItemsInList(subWwinList); i < n; i += 1)
subWinName = s.win + "#" + StringFromList(i, subWwinList)
tabNum = str2num(GetUserData(subWinName, "", "tab"))
switch (whichTab(tabNum, s))
case INCLUDED_IN_PRESENT:
disable_saved = str2num(GetUserData(s.win, s.ctrlName, subWinName))
SetWindow $subWinName hide=disable_saved
break
case INCLUDED_IN_LAST:
GetWindow $subWinName hide
TabControl $s.ctrlName userData($subWinName)=num2istr(V_value), win=$s.win
SetWindow $subWinName hide=1
break
endswitch
endfor
TabControl $s.ctrlName userData(SIDAMlastTab)=num2istr(s.tab), win=$s.win
End
Static Constant INCLUDED_IN_PRESENT = 1
Static Constant INCLUDED_IN_LAST = 2
Static Function whichTab(int tabNum, STRUCT WMTabControlAction &s)
int lastTab = str2num(GetUserData(s.win,s.ctrlName,"SIDAMlastTab"))
if (tabNum == s.tab)
return INCLUDED_IN_PRESENT
elseif (tabNum == lastTab)
return INCLUDED_IN_LAST
else
return 0
endif
End
//-------------------------------------------------------------
// Record the disable state of each control designated when
// a panel is created, and then show/hide controls and child
// windows correspondint to the selected tab.
//-------------------------------------------------------------
Function SIDAMInitializeTab(String pnlName, String tabName)
String listStr, tabInfo, ctrlName, cwinName
int i, n
ControlInfo/W=$pnlName $tabName
int tabNum = V_Value
// controls
listStr = ControlNameList(pnlName)
for (i = 0, n = ItemsInList(listStr); i < n; i++)
ctrlName = StringFromList(i,listStr)
tabInfo = GetUserData(pnlName,ctrlName,"tab")
if (!strlen(tabInfo))
continue
endif
ControlInfo/W=$pnlName $ctrlName
TabControl $tabName userData($ctrlName)=num2istr(V_Disable), win=$pnlName
if (str2num(tabInfo) != tabNum)
ModifyControl/Z $ctrlName, disable=1, win=$pnlName
endif
endfor
// subwindows
listStr = ChildWindowList(pnlName)
for (i = 0, n = ItemsInList(listStr); i < n; i++)
cwinName = pnlName + "#" + StringFromList(i, listStr)
tabInfo = GetUserData(cwinName, "", "tab")
if (!strlen(tabInfo))
continue
endif
GetWindow $cwinName hide
TabControl $tabName userData($cwinName)=num2istr(V_value), win=$pnlName
SetWindow $cwinName hide=(str2num(tabInfo) != tabNum)
endfor
TabControl $tabName userData(SIDAMlastTab)=num2str(tabNum), win=$pnlName
End
//******************************************************************************
// Validate if a string of SetVariable satisfies a condition specified by
// the mode parameter.
// When mode=0, check if the string is valid as a name of wave
// When mode=1, check if eval is possible.
//******************************************************************************
Function SIDAMValidateSetVariableString(String pnlName, String ctrlName,
int mode, [int minlength, int maxlength])
minlength = ParamIsDefault(minlength) ? 1 : minlength
maxlength = ParamIsDefault(maxlength) ? MAX_OBJ_NAME : maxlength
int hasProblem = 1
ControlInfo/W=$pnlName $ctrlName
if (abs(V_flag) != 5)
return 0
endif
int type = valueType(S_recreation)
int isInternalString = type == 2
int isExternalString = type == 3
String str
if (isInternalString)
str = S_Value
elseif (isExternalString)
str = StrVarOrDefault(S_DataFolder+S_value,"")
else
return 0
endif
if (mode)
hasProblem = numtype(eval(str))!=0
else
hasProblem = strlen(str) < minlength || strlen(str) > maxlength \
|| (CheckName(str, 1) && !WaveExists($str))
endif
if (hasProblem)
Variable clr_r = SIDAM_CLR_CAUTION_R, clr_g = SIDAM_CLR_CAUTION_G, clr_b = SIDAM_CLR_CAUTION_R
SetVariable $ctrlName valueBackColor=(clr_r,clr_g,clr_b), userData(check)="1", win=$pnlName
else
SetVariable $ctrlName valueBackColor=0, userData(check)="", win=$pnlName
endif
return hasProblem
End
Static Function eval(String str)
DFREF dfrSav = GetDataFolderDFR(), dfrTmp = NewFreeDataFolder()
SetDataFolder dfrTmp
Execute/Q/Z "Variable/G v=" + str
SetDataFolder dfrSav
if (V_flag)
return NaN
else
NVAR/SDFR=dfrTmp v
return v
endif
End
//******************************************************************************
// Retern a wave containing values of controls in a graph/panel
//******************************************************************************
// Return a numeric wave containing number values of controls in a graph/panel.
Function/WAVE SIDAMGetCtrlValues(String win, String ctrlList)
Make/D/N=(ItemsInList(ctrlList))/FREE resw
String ctrlName
int i, n
for (i = 0, n = ItemsInList(ctrlList); i < n; i++)
ctrlName = StringFromList(i, ctrlList)
SetDimLabel 0, i, $ctrlName, resw
ControlInfo/W=$win $ctrlName
switch (abs(V_Flag))
case 0: // not found
case 9: // Groupbox
case 10: // TitleBox
resw[i] = nan
break
case 5: // SetVariable
switch (valueType(S_recreation))
case 0:
case 1:
resw[i] = V_Value
break
case 2:
resw[i] = eval(S_Value)
break
case 3:
SVAR/SDFR=$S_DataFolder str = $S_value
resw[i] = eval(str)
break
default:
resw[i] = NaN
endswitch
break
default:
// 1: Button
// 2: CheckBox
// 3: PopupMenu
// 4: ValDisplay
// 6: Chart
// 7: Slider
// 8: TabControl
// 11: ListBox
// 12: CustomControl
resw[i] = V_Value
endswitch
endfor
return resw
End
// Return a text wave containing string values of controls in a graph/panel.
Function/WAVE SIDAMGetCtrlTexts(String win, String ctrlList)
Make/T/N=(ItemsInList(ctrlList))/FREE resw
String ctrlName
int i, n
for (i = 0, n = ItemsInList(ctrlList); i < n; i++)
ctrlName = StringFromList(i, ctrlList)
SetDimLabel 0, i, $ctrlName, resw
ControlInfo/W=$win $ctrlName
switch (abs(V_Flag))
case 3: // PopupMenu: text of the current item
case 9: // GroupBox: title text
resw[i] = S_Value
break
case 4: // ValDisplay
resw[i] = num2str(V_Value)
break
case 5: // SetVariable
switch (valueType(S_recreation))
case 0:
case 1:
resw[i] = num2str(V_Value)
break
case 2:
resw[i] = S_Value
break
case 3:
SVAR/SDFR=$S_DataFolder str = $S_Value
resw[i] = str
break
default:
resw[i] = ""
endswitch
break
case 7: // Slider
resw[i] = num2str(V_value)
break
case 10: // TitleBox
if (strlen(S_title)) // title is given directly
resw[i] = S_title
elseif (strlen(S_value)) // title is given by a string
SVAR/SDFR=$S_DataFolder str = $S_value
resw[i] = str
else
resw[i] = ""
endif
break
default:
// 0: not found
// 1: Button
// 2: CheckBox
// 6: Chart
// 8: TabControl
// 11: ListBox
// 12: CustomControl
resw[i] = ""
endswitch
endfor
return resw
End
// Return type of variable used for a SetVariable control
Static Function valueType(String recreationStr)
Variable n0 = strsearch(recreationStr, "value=", 0)
Variable n1 = strsearch(recreationStr, ",", n0)
Variable n2 = strsearch(recreationStr, "\r", n0)
Variable n3 = (n1 == -1) ? n2 : min(n1, n2)
String valueStr = recreationStr[n0+6,n3-1]
NVAR/Z npath = $valueStr
SVAR/Z spath = $valueStr
if (strsearch(valueStr, "_NUM:", 0) != -1)
return 0 // internal number
elseif (NVAR_Exists(npath))
return 1 // external number
elseif (strsearch(valueStr, "_STR:", 0) != -1)
return 2 // internal string
elseif (SVAR_Exists(spath))
return 3 // external string
else
return -1 // ?
endif
End
//******************************************************************************
// Run "To cmd line" or "To clip"
//******************************************************************************
Function SIDAMPopupTo(STRUCT WMPopupAction &s, String paramStr)
switch (s.popNum)
case 1:
ToCommandLine paramStr
break
case 2:
PutScrapText paramStr
break
endswitch
End
//******************************************************************************
// Bahave as if a checkbox is clicked
//******************************************************************************
Function SIDAMClickCheckBox(String pnlName, String ctrlName)
if (!SIDAMWindowExists(pnlName))
return 1
endif
ControlInfo/W=$pnlName $ctrlName
if (V_Flag != 2)
return 2
endif
// If the checkbox is a radio button, the new value is always 1.
// If the checkbox is a default checkbox, the new value is opposite to the initial value.
int isRadioButton = NumberByKey("mode",S_recreation,"=",",") == 1
int newValue = isRadioButton ? 1 : !V_Value
CheckBox $ctrlName value=newValue, win=$pnlName
// If there is no procedure, there is nothing to do more.
String fnName = getActionFunctionName(S_recreation)
if (!strlen(fnName))
return 3
endif
STRUCT WMCheckboxAction s
s.ctrlName = ctrlName
s.win = pnlName
getWinRect(pnlName, s.winRect) // winRect
getCtrlRect(pnlName, ctrlName, s.ctrlRect) // ctrlRect
//s.mouseLoc.v =
//s.mouseLoc.h =
s.eventCode = 2
s.eventMod = getEventMod()
s.userData = S_UserData
s.checked = newValue
FUNCREF SIDAMClickCheckBoxPrototype fn = $fnName
fn(s)
return 0
End
//-------------------------------------------------------------
// Prototypes of control procedure functions
//-------------------------------------------------------------
Function SIDAMClickCheckBoxPrototype(STRUCT WMCheckboxAction &s)
End
//-------------------------------------------------------------
// Return a name of procedure for a control
//-------------------------------------------------------------
Static Function/S getActionFunctionName(String recreationStr)
int i0 = strsearch(recreationStr,"proc=",0)
if (i0 == -1)
return ""
endif
int i1 = strsearch(recreationStr,",",i0+5)
int i2 = strsearch(recreationStr,"\r",i0+5)
if (i1 == -1)
return recreationStr[i0+5,i2-1]
else
return recreationStr[i0+5,min(i1,i2)-1]
endif
End
//-------------------------------------------------------------
// Put coordinates of a window
//-------------------------------------------------------------
Static Function getWinRect(String pnlName, STRUCT Rect &winRect)
GetWindow $pnlName wsizeDC
winRect.top = V_top
winRect.left = V_left
winRect.bottom = V_bottom
winRect.right = V_right
End
//-------------------------------------------------------------
// Put coordinates of a control to a structure
//-------------------------------------------------------------
Static Function getCtrlRect(String pnlName, String ctrlName, STRUCT Rect &ctrlRect)
ControlInfo/W=$pnlName $ctrlName
ctrlRect.top = V_top
ctrlRect.left = V_left
ctrlRect.bottom = V_top + V_Height
ctrlRect.right = V_left + V_Width
End
//-------------------------------------------------------------
// Return eventMod
//-------------------------------------------------------------
Static Function getEventMod()
int key = GetKeyState(1)
int isCtrlPressed = !!(key & 1)
int isAltPressed = !!(key & 2)
int isShiftPressed = !!(key & 4)
int eventMod = 0
eventMod += 1 // This function is used when a control is clicked
eventMod += isShiftPressed*2 + isAltPressed*4 + isCtrlPressed*8
return eventMod
End
| IGOR Pro | 4 | yuksk/SIDAM | src/SIDAM/func/SIDAM_Utilities_Control.ipf | [
"MIT"
] |
onmessage = () => {
postMessage({});
close();
};
| JavaScript | 3 | petamoriken/deno | cli/tests/testdata/workers/message_before_close.js | [
"MIT"
] |
@import url('https://fonts.googleapis.com/css?family=Roboto+Mono|Roboto:400,500,700');
body {
-moz-font-feature-settings: 'liga' on;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
color: #253858;
font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
Helvetica, sans-serif;
font-style: normal;
font-weight: 400;
margin: 0;
padding: 0;
text-rendering: optimizeLegibility;
}
p > a,
p > a:hover,
p > a:visited {
color: #2684ff;
}
code {
font-family: Roboto Mono, Monaco, monospace;
}
p > code {
white-space: nowrap;
}
p,
ul,
ol {
line-height: 1.5;
}
td p {
margin: 0;
}
h1,
h2,
h3,
h4,
h5 {
color: #091e42;
}
h6 {
color: #777;
margin-bottom: 0.25em;
text-transform: uppercase;
}
@keyframes dropIn {
from,
60%,
75%,
90%,
to {
animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
}
0% {
opacity: 0;
transform: translate3d(0, -1666px, 0);
}
60% {
opacity: 1;
transform: translate3d(0, 26px, 0);
}
75% {
transform: translate3d(0, -10px, 0);
}
90% {
transform: translate3d(0, 6px, 0);
}
to {
transform: translate3d(0, 0, 0);
}
}
.animate-dropin {
animation: dropIn 0.66s;
}
| CSS | 3 | nomuyoshi/react-select | docs/index.css | [
"MIT"
] |
create schema issue519;
| SQL | 1 | suryatmodulus/tidb | br/tests/lightning_issue_519/data/issue519-schema-create.sql | [
"Apache-2.0",
"BSD-3-Clause"
] |
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#define NEW_SIMD_CODE
#ifdef KERNEL_STATIC
#include "inc_vendor.h"
#include "inc_types.h"
#include "inc_platform.cl"
#include "inc_common.cl"
#include "inc_simd.cl"
#include "inc_hash_sha1.cl"
#endif
#define COMPARE_S "inc_comp_single.cl"
#define COMPARE_M "inc_comp_multi.cl"
typedef struct xmpp_tmp
{
u32 ipad[5];
u32 opad[5];
u32 dgst[32];
u32 out[32];
} xmpp_tmp_t;
DECLSPEC void hmac_sha1_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
{
digest[0] = ipad[0];
digest[1] = ipad[1];
digest[2] = ipad[2];
digest[3] = ipad[3];
digest[4] = ipad[4];
sha1_transform_vector (w0, w1, w2, w3, digest);
w0[0] = digest[0];
w0[1] = digest[1];
w0[2] = digest[2];
w0[3] = digest[3];
w1[0] = digest[4];
w1[1] = 0x80000000;
w1[2] = 0;
w1[3] = 0;
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 0;
w3[3] = (64 + 20) * 8;
digest[0] = opad[0];
digest[1] = opad[1];
digest[2] = opad[2];
digest[3] = opad[3];
digest[4] = opad[4];
sha1_transform_vector (w0, w1, w2, w3, digest);
}
KERNEL_FQ void m23200_init (KERN_ATTR_TMPS (xmpp_tmp_t))
{
/**
* base
*/
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
sha1_hmac_ctx_t sha1_hmac_ctx;
sha1_hmac_init_global_swap (&sha1_hmac_ctx, pws[gid].i, pws[gid].pw_len);
tmps[gid].ipad[0] = sha1_hmac_ctx.ipad.h[0];
tmps[gid].ipad[1] = sha1_hmac_ctx.ipad.h[1];
tmps[gid].ipad[2] = sha1_hmac_ctx.ipad.h[2];
tmps[gid].ipad[3] = sha1_hmac_ctx.ipad.h[3];
tmps[gid].ipad[4] = sha1_hmac_ctx.ipad.h[4];
tmps[gid].opad[0] = sha1_hmac_ctx.opad.h[0];
tmps[gid].opad[1] = sha1_hmac_ctx.opad.h[1];
tmps[gid].opad[2] = sha1_hmac_ctx.opad.h[2];
tmps[gid].opad[3] = sha1_hmac_ctx.opad.h[3];
tmps[gid].opad[4] = sha1_hmac_ctx.opad.h[4];
sha1_hmac_update_global_swap (&sha1_hmac_ctx, salt_bufs[DIGESTS_OFFSET].salt_buf, salt_bufs[SALT_POS].salt_len);
for (u32 i = 0, j = 1; i < 4; i += 5, j += 1)
{
sha1_hmac_ctx_t sha1_hmac_ctx2 = sha1_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = j;
w0[1] = 0;
w0[2] = 0;
w0[3] = 0;
w1[0] = 0;
w1[1] = 0;
w1[2] = 0;
w1[3] = 0;
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 0;
w3[3] = 0;
sha1_hmac_update_64 (&sha1_hmac_ctx2, w0, w1, w2, w3, 4);
sha1_hmac_final (&sha1_hmac_ctx2);
tmps[gid].dgst[i + 0] = sha1_hmac_ctx2.opad.h[0];
tmps[gid].dgst[i + 1] = sha1_hmac_ctx2.opad.h[1];
tmps[gid].dgst[i + 2] = sha1_hmac_ctx2.opad.h[2];
tmps[gid].dgst[i + 3] = sha1_hmac_ctx2.opad.h[3];
tmps[gid].dgst[i + 4] = sha1_hmac_ctx2.opad.h[4];
tmps[gid].out[i + 0] = tmps[gid].dgst[i + 0];
tmps[gid].out[i + 1] = tmps[gid].dgst[i + 1];
tmps[gid].out[i + 2] = tmps[gid].dgst[i + 2];
tmps[gid].out[i + 3] = tmps[gid].dgst[i + 3];
tmps[gid].out[i + 4] = tmps[gid].dgst[i + 4];
}
}
KERNEL_FQ void m23200_loop (KERN_ATTR_TMPS (xmpp_tmp_t))
{
const u64 gid = get_global_id (0);
if ((gid * VECT_SIZE) >= gid_max) return;
u32x ipad[5];
u32x opad[5];
ipad[0] = packv (tmps, ipad, gid, 0);
ipad[1] = packv (tmps, ipad, gid, 1);
ipad[2] = packv (tmps, ipad, gid, 2);
ipad[3] = packv (tmps, ipad, gid, 3);
ipad[4] = packv (tmps, ipad, gid, 4);
opad[0] = packv (tmps, opad, gid, 0);
opad[1] = packv (tmps, opad, gid, 1);
opad[2] = packv (tmps, opad, gid, 2);
opad[3] = packv (tmps, opad, gid, 3);
opad[4] = packv (tmps, opad, gid, 4);
for (u32 i = 0; i < 4; i += 5)
{
u32x dgst[5];
u32x out[5];
dgst[0] = packv (tmps, dgst, gid, i + 0);
dgst[1] = packv (tmps, dgst, gid, i + 1);
dgst[2] = packv (tmps, dgst, gid, i + 2);
dgst[3] = packv (tmps, dgst, gid, i + 3);
dgst[4] = packv (tmps, dgst, gid, i + 4);
out[0] = packv (tmps, out, gid, i + 0);
out[1] = packv (tmps, out, gid, i + 1);
out[2] = packv (tmps, out, gid, i + 2);
out[3] = packv (tmps, out, gid, i + 3);
out[4] = packv (tmps, out, gid, i + 4);
for (u32 j = 0; j < loop_cnt; j++)
{
u32x w0[4];
u32x w1[4];
u32x w2[4];
u32x w3[4];
w0[0] = dgst[0];
w0[1] = dgst[1];
w0[2] = dgst[2];
w0[3] = dgst[3];
w1[0] = dgst[4];
w1[1] = 0x80000000;
w1[2] = 0;
w1[3] = 0;
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 0;
w3[3] = (64 + 20) * 8;
hmac_sha1_run_V (w0, w1, w2, w3, ipad, opad, dgst);
out[0] ^= dgst[0];
out[1] ^= dgst[1];
out[2] ^= dgst[2];
out[3] ^= dgst[3];
out[4] ^= dgst[4];
}
unpackv (tmps, dgst, gid, i + 0, dgst[0]);
unpackv (tmps, dgst, gid, i + 1, dgst[1]);
unpackv (tmps, dgst, gid, i + 2, dgst[2]);
unpackv (tmps, dgst, gid, i + 3, dgst[3]);
unpackv (tmps, dgst, gid, i + 4, dgst[4]);
unpackv (tmps, out, gid, i + 0, out[0]);
unpackv (tmps, out, gid, i + 1, out[1]);
unpackv (tmps, out, gid, i + 2, out[2]);
unpackv (tmps, out, gid, i + 3, out[3]);
unpackv (tmps, out, gid, i + 4, out[4]);
}
}
KERNEL_FQ void m23200_comp (KERN_ATTR_TMPS (xmpp_tmp_t))
{
/**
* base
*/
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
const u64 lid = get_local_id (0);
u32 key[16];
key[ 0] = tmps[gid].out[0];
key[ 1] = tmps[gid].out[1];
key[ 2] = tmps[gid].out[2];
key[ 3] = tmps[gid].out[3];
key[ 4] = tmps[gid].out[4];
key[ 5] = 0;
key[ 6] = 0;
key[ 7] = 0;
key[ 8] = 0;
key[ 9] = 0;
key[10] = 0;
key[11] = 0;
key[12] = 0;
key[13] = 0;
key[14] = 0;
key[15] = 0;
sha1_hmac_ctx_t sha1_hmac_ctx;
sha1_hmac_init (&sha1_hmac_ctx, key, 20);
u32 data[16];
data[ 0] = 0x436c6965;
data[ 1] = 0x6e74204b;
data[ 2] = 0x65790000;
data[ 3] = 0;
data[ 4] = 0;
data[ 5] = 0;
data[ 6] = 0;
data[ 7] = 0;
data[ 8] = 0;
data[ 9] = 0;
data[10] = 0;
data[11] = 0;
data[12] = 0;
data[13] = 0;
data[14] = 0;
data[15] = 0;
sha1_hmac_update (&sha1_hmac_ctx, data, 10);
sha1_hmac_final (&sha1_hmac_ctx);
u32 final[16];
final[ 0] = sha1_hmac_ctx.opad.h[0];
final[ 1] = sha1_hmac_ctx.opad.h[1];
final[ 2] = sha1_hmac_ctx.opad.h[2];
final[ 3] = sha1_hmac_ctx.opad.h[3];
final[ 4] = sha1_hmac_ctx.opad.h[4];
final[ 5] = 0;
final[ 6] = 0;
final[ 7] = 0;
final[ 8] = 0;
final[ 9] = 0;
final[10] = 0;
final[11] = 0;
final[12] = 0;
final[13] = 0;
final[14] = 0;
final[15] = 0;
sha1_ctx_t ctx;
sha1_init (&ctx);
sha1_update (&ctx, final, 20);
sha1_final (&ctx);
const u32 r0 = hc_swap32_S (ctx.h[0]);
const u32 r1 = hc_swap32_S (ctx.h[1]);
const u32 r2 = hc_swap32_S (ctx.h[2]);
const u32 r3 = hc_swap32_S (ctx.h[3]);
#define il_pos 0
#ifdef KERNEL_STATIC
#include COMPARE_M
#endif
}
| OpenCL | 4 | Masha/hashcat | OpenCL/m23200-pure.cl | [
"MIT"
] |
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* Arrows */
.monaco-scrollable-element > .scrollbar > .scra {
cursor: pointer;
font-size: 11px !important;
}
.monaco-scrollable-element > .visible {
opacity: 1;
/* Background rule added for IE9 - to allow clicks on dom node */
background:rgba(0,0,0,0);
transition: opacity 100ms linear;
}
.monaco-scrollable-element > .invisible {
opacity: 0;
pointer-events: none;
}
.monaco-scrollable-element > .invisible.fade {
transition: opacity 800ms linear;
}
/* Scrollable Content Inset Shadow */
.monaco-scrollable-element > .shadow {
position: absolute;
display: none;
}
.monaco-scrollable-element > .shadow.top {
display: block;
top: 0;
left: 3px;
height: 3px;
width: 100%;
}
.monaco-scrollable-element > .shadow.left {
display: block;
top: 3px;
left: 0;
height: 100%;
width: 3px;
}
.monaco-scrollable-element > .shadow.top-left-corner {
display: block;
top: 0;
left: 0;
height: 3px;
width: 3px;
}
| CSS | 3 | sbj42/vscode | src/vs/base/browser/ui/scrollbar/media/scrollbars.css | [
"MIT"
] |
(module
(import "env" "printInt" (func $printInt (param i32)))
(func $add (param $lhs i32) (param $rhs i32) (result i32)
get_local $lhs
get_local $rhs
i32.add
)
(func $main
(call $printInt
(call $add (i32.const 9) (i32.const 8))))
(export "main" (func $main))
)
| WebAssembly | 4 | JavascriptID/sourcerer-app | src/test/resources/samples/langs/WebAssembly/add.wat | [
"MIT"
] |
using Shadowsocks.Interop.Utils;
using Shadowsocks.Models;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Json;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
namespace Shadowsocks.CLI
{
public class ConfigConverter
{
/// <summary>
/// Gets or sets whether to prefix group name to server names.
/// </summary>
public bool PrefixGroupName { get; set; }
/// <summary>
/// Gets or sets the list of servers that are not in any groups.
/// </summary>
public List<Server> Servers { get; set; } = new();
public ConfigConverter(bool prefixGroupName = false) => PrefixGroupName = prefixGroupName;
/// <summary>
/// Collects servers from ss:// links or SIP008 delivery links.
/// </summary>
/// <param name="uris">URLs to collect servers from.</param>
/// <param name="cancellationToken">A token that may be used to cancel the asynchronous operation.</param>
/// <returns>A task that represents the asynchronous operation.</returns>
public async Task FromUrls(IEnumerable<Uri> uris, CancellationToken cancellationToken = default)
{
var sip008Links = new List<Uri>();
foreach (var uri in uris)
{
switch (uri.Scheme)
{
case "ss":
{
if (Server.TryParse(uri, out var server))
Servers.Add(server);
break;
}
case "https":
sip008Links.Add(uri);
break;
}
}
if (sip008Links.Count > 0)
{
var httpClient = new HttpClient
{
Timeout = TimeSpan.FromSeconds(30.0)
};
var tasks = sip008Links.Select(async x => await httpClient.GetFromJsonAsync<Group>(x, JsonHelper.snakeCaseJsonDeserializerOptions, cancellationToken))
.ToList();
while (tasks.Count > 0)
{
var finishedTask = await Task.WhenAny(tasks);
var group = await finishedTask;
if (group != null)
Servers.AddRange(group.Servers);
tasks.Remove(finishedTask);
}
}
}
/// <summary>
/// Collects servers from SIP008 JSON files.
/// </summary>
/// <param name="paths">JSON file paths.</param>
/// <param name="cancellationToken">A token that may be used to cancel the read operation.</param>
/// <returns>A task that represents the asynchronous read operation.</returns>
public async Task FromSip008Json(IEnumerable<string> paths, CancellationToken cancellationToken = default)
{
foreach (var path in paths)
{
using var jsonFile = new FileStream(path, FileMode.Open);
var group = await JsonSerializer.DeserializeAsync<Group>(jsonFile, JsonHelper.snakeCaseJsonDeserializerOptions, cancellationToken);
if (group != null)
{
if (PrefixGroupName && !string.IsNullOrEmpty(group.Name))
group.Servers.ForEach(x => x.Name = $"{group.Name} - {x.Name}");
Servers.AddRange(group.Servers);
}
}
}
/// <summary>
/// Collects servers from outbounds in V2Ray JSON files.
/// </summary>
/// <param name="paths">JSON file paths.</param>
/// <param name="cancellationToken">A token that may be used to cancel the read operation.</param>
/// <returns>A task that represents the asynchronous read operation.</returns>
public async Task FromV2rayJson(IEnumerable<string> paths, CancellationToken cancellationToken = default)
{
foreach (var path in paths)
{
using var jsonFile = new FileStream(path, FileMode.Open);
var v2rayConfig = await JsonSerializer.DeserializeAsync<Interop.V2Ray.Config>(jsonFile, JsonHelper.camelCaseJsonDeserializerOptions, cancellationToken);
if (v2rayConfig?.Outbounds != null)
{
foreach (var outbound in v2rayConfig.Outbounds)
{
if (outbound.Protocol == "shadowsocks"
&& outbound.Settings is JsonElement jsonElement)
{
var jsonText = jsonElement.GetRawText();
var ssConfig = JsonSerializer.Deserialize<Interop.V2Ray.Protocols.Shadowsocks.OutboundConfigurationObject>(jsonText, JsonHelper.camelCaseJsonDeserializerOptions);
if (ssConfig != null)
foreach (var ssServer in ssConfig.Servers)
{
var server = new Server
{
Name = outbound.Tag,
Host = ssServer.Address,
Port = ssServer.Port,
Method = ssServer.Method,
Password = ssServer.Password
};
Servers.Add(server);
}
}
}
}
}
}
/// <summary>
/// Converts saved servers to ss:// URLs.
/// </summary>
/// <returns>A list of ss:// URLs.</returns>
public List<Uri> ToUrls()
{
var urls = new List<Uri>();
foreach (var server in Servers)
urls.Add(server.ToUrl());
return urls;
}
/// <summary>
/// Converts saved servers to SIP008 JSON.
/// </summary>
/// <param name="path">JSON file path.</param>
/// <param name="cancellationToken">A token that may be used to cancel the write operation.</param>
/// <returns>A task that represents the asynchronous write operation.</returns>
public Task ToSip008Json(string path, CancellationToken cancellationToken = default)
{
var group = new Group();
group.Servers.AddRange(Servers);
var fullPath = Path.GetFullPath(path);
var directoryPath = Path.GetDirectoryName(fullPath) ?? throw new ArgumentException("Invalid path", nameof(path));
Directory.CreateDirectory(directoryPath);
using var jsonFile = new FileStream(fullPath, FileMode.Create);
return JsonSerializer.SerializeAsync(jsonFile, group, JsonHelper.snakeCaseJsonSerializerOptions, cancellationToken);
}
/// <summary>
/// Converts saved servers to V2Ray outbounds.
/// </summary>
/// <param name="path">JSON file path.</param>
/// <param name="prefixGroupName">Whether to prefix group name to server names.</param>
/// <param name="cancellationToken">A token that may be used to cancel the write operation.</param>
/// <returns>A task that represents the asynchronous write operation.</returns>
public Task ToV2rayJson(string path, CancellationToken cancellationToken = default)
{
var v2rayConfig = new Interop.V2Ray.Config
{
Outbounds = new()
};
foreach (var server in Servers)
{
var ssOutbound = Interop.V2Ray.OutboundObject.GetShadowsocks(server);
v2rayConfig.Outbounds.Add(ssOutbound);
}
// enforce outbound tag uniqueness
var serversWithDuplicateTags = v2rayConfig.Outbounds.GroupBy(x => x.Tag)
.Where(x => x.Count() > 1);
foreach (var serversWithSameTag in serversWithDuplicateTags)
{
var duplicates = serversWithSameTag.ToList();
for (var i = 0; i < duplicates.Count; i++)
{
duplicates[i].Tag = $"{duplicates[i].Tag} {i}";
}
}
var fullPath = Path.GetFullPath(path);
var directoryPath = Path.GetDirectoryName(fullPath) ?? throw new ArgumentException("Invalid path", nameof(path));
Directory.CreateDirectory(directoryPath);
using var jsonFile = new FileStream(fullPath, FileMode.Create);
return JsonSerializer.SerializeAsync(jsonFile, v2rayConfig, JsonHelper.camelCaseJsonSerializerOptions, cancellationToken);
}
}
}
| C# | 5 | opwt/shadowsocks-windows | Shadowsocks.CLI/ConfigConverter.cs | [
"Apache-2.0"
] |
example.com. IN SOA ns.example.com. hostmaster.example.com. 1 3600 900 86400 3600
example.com. IN NS ns.example.net.
www.example.com. IN A 1.2.3.4
| DNS Zone | 1 | simplixcurrency/simplix | external/unbound/testdata/auth_https.tdir/127.0.0.1/example.com.zone | [
"BSD-3-Clause"
] |
#ifndef _CONNECTION_H_
#define _CONNECTION_H_
#include "datatypes.h"
void spc_interface_routine(int subsytem_nr, int routine_nr, spc_dictionary_t* msg, spc_dictionary_t** reply);
void spc_domain_routine(int routine_nr, spc_dictionary_t* msg, spc_dictionary_t** reply);
kern_return_t spc_look_up_endpoint(const char* name, uint64_t type, uint64_t handle, uint64_t lookup_handle, uint64_t flags, mach_port_t* remote_port);
spc_connection_t* spc_create_connection_mach_port(mach_port_t service_port);
spc_connection_t* spc_create_connection_mach_service(const char* service_name);
spc_connection_t* spc_accept_connection(mach_port_t port);
// Low-level send/recv API
void spc_send(spc_message_t* msg);
spc_message_t* spc_recv(mach_port_t port);
void spc_reply(spc_message_t* msg, spc_dictionary_t* reply);
// High-level send/recv API
void spc_connection_send(spc_connection_t* connection, spc_dictionary_t* msg);
spc_dictionary_t* spc_connection_send_with_reply(spc_connection_t* connection, spc_dictionary_t* msg);
spc_dictionary_t* spc_connection_recv(spc_connection_t* connection);
#endif
| C | 4 | OsmanDere/metasploit-framework | external/source/exploits/CVE-2018-4237/libspc/connection.h | [
"BSD-2-Clause",
"BSD-3-Clause"
] |
instruct!
person id: 123 do
name { cdata!('John Smith') }
age 37
nationality 'Canadian'
end
| Ox | 3 | JackDanger/ox-builder | benchmarks/templates/person.ox | [
"MIT"
] |
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 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
//
//===----------------------------------------------------------------------===//
import Swift
@_implementationOnly import _SwiftConcurrencyShims
@available(SwiftStdlib 5.1, *)
extension Task where Success == Never, Failure == Never {
@available(*, deprecated, renamed: "Task.sleep(nanoseconds:)")
/// Suspends the current task for at least the given duration
/// in nanoseconds.
///
/// This function doesn't block the underlying thread.
public static func sleep(_ duration: UInt64) async {
return await Builtin.withUnsafeContinuation { (continuation: Builtin.RawUnsafeContinuation) -> Void in
let job = _taskCreateNullaryContinuationJob(
priority: Int(Task.currentPriority.rawValue),
continuation: continuation)
_enqueueJobGlobalWithDelay(duration, job)
}
}
/// The type of continuation used in the implementation of
/// sleep(nanoseconds:).
private typealias SleepContinuation = UnsafeContinuation<(), Error>
/// Describes the state of a sleep() operation.
private enum SleepState {
/// The sleep continuation has not yet begun.
case notStarted
// The sleep continuation has been created and is available here.
case activeContinuation(SleepContinuation)
/// The sleep has finished.
case finished
/// The sleep was canceled.
case cancelled
/// The sleep was canceled before it even got started.
case cancelledBeforeStarted
/// Decode sleep state from the word of storage.
init(word: Builtin.Word) {
switch UInt(word) & 0x03 {
case 0:
let continuationBits = UInt(word) & ~0x03
if continuationBits == 0 {
self = .notStarted
} else {
let continuation = unsafeBitCast(
continuationBits, to: SleepContinuation.self)
self = .activeContinuation(continuation)
}
case 1:
self = .finished
case 2:
self = .cancelled
case 3:
self = .cancelledBeforeStarted
default:
fatalError("Bitmask failure")
}
}
/// Decode sleep state by loading from the given pointer
init(loading wordPtr: UnsafeMutablePointer<Builtin.Word>) {
self.init(word: Builtin.atomicload_seqcst_Word(wordPtr._rawValue))
}
/// Encode sleep state into a word of storage.
var word: UInt {
switch self {
case .notStarted:
return 0
case .activeContinuation(let continuation):
let continuationBits = unsafeBitCast(continuation, to: UInt.self)
return continuationBits
case .finished:
return 1
case .cancelled:
return 2
case .cancelledBeforeStarted:
return 3
}
}
}
/// Called when the sleep(nanoseconds:) operation woke up without being
/// canceled.
private static func onSleepWake(
_ wordPtr: UnsafeMutablePointer<Builtin.Word>
) {
while true {
let state = SleepState(loading: wordPtr)
switch state {
case .notStarted:
fatalError("Cannot wake before we even started")
case .activeContinuation(let continuation):
// We have an active continuation, so try to transition to the
// "finished" state.
let (_, won) = Builtin.cmpxchg_seqcst_seqcst_Word(
wordPtr._rawValue,
state.word._builtinWordValue,
SleepState.finished.word._builtinWordValue)
if Bool(_builtinBooleanLiteral: won) {
// The sleep finished, so invoke the continuation: we're done.
continuation.resume()
return
}
// Try again!
continue
case .finished:
fatalError("Already finished normally, can't do that again")
case .cancelled:
// The task was cancelled, which means the continuation was
// called by the cancellation handler. We need to deallocate the flag
// word, because it was left over for this task to complete.
wordPtr.deallocate()
return
case .cancelledBeforeStarted:
// Nothing to do;
return
}
}
}
/// Called when the sleep(nanoseconds:) operation has been canceled before
/// the sleep completed.
private static func onSleepCancel(
_ wordPtr: UnsafeMutablePointer<Builtin.Word>
) {
while true {
let state = SleepState(loading: wordPtr)
switch state {
case .notStarted:
// We haven't started yet, so try to transition to the cancelled-before
// started state.
let (_, won) = Builtin.cmpxchg_seqcst_seqcst_Word(
wordPtr._rawValue,
state.word._builtinWordValue,
SleepState.cancelledBeforeStarted.word._builtinWordValue)
if Bool(_builtinBooleanLiteral: won) {
return
}
// Try again!
continue
case .activeContinuation(let continuation):
// We have an active continuation, so try to transition to the
// "cancelled" state.
let (_, won) = Builtin.cmpxchg_seqcst_seqcst_Word(
wordPtr._rawValue,
state.word._builtinWordValue,
SleepState.cancelled.word._builtinWordValue)
if Bool(_builtinBooleanLiteral: won) {
// We recorded the task cancellation before the sleep finished, so
// invoke the continuation with the cancellation error.
continuation.resume(throwing: _Concurrency.CancellationError())
return
}
// Try again!
continue
case .finished, .cancelled, .cancelledBeforeStarted:
// The operation already finished, so there is nothing more to do.
return
}
}
}
/// Suspends the current task for at least the given duration
/// in nanoseconds.
///
/// If the task is canceled before the time ends,
/// this function throws `CancellationError`.
///
/// This function doesn't block the underlying thread.
public static func sleep(nanoseconds duration: UInt64) async throws {
// Allocate storage for the storage word.
let wordPtr = UnsafeMutablePointer<Builtin.Word>.allocate(capacity: 1)
// Initialize the flag word to "not started", which means the continuation
// has neither been created nor completed.
Builtin.atomicstore_seqcst_Word(
wordPtr._rawValue, SleepState.notStarted.word._builtinWordValue)
do {
// Install a cancellation handler to resume the continuation by
// throwing CancellationError.
try await withTaskCancellationHandler {
let _: () = try await withUnsafeThrowingContinuation { continuation in
while true {
let state = SleepState(loading: wordPtr)
switch state {
case .notStarted:
// The word that describes the active continuation state.
let continuationWord =
SleepState.activeContinuation(continuation).word
// Try to swap in the continuation word.
let (_, won) = Builtin.cmpxchg_seqcst_seqcst_Word(
wordPtr._rawValue,
state.word._builtinWordValue,
continuationWord._builtinWordValue)
if !Bool(_builtinBooleanLiteral: won) {
// Keep trying!
continue
}
// Create a task that resumes the continuation normally if it
// finishes first. Enqueue it directly with the delay, so it fires
// when we're done sleeping.
let sleepTaskFlags = taskCreateFlags(
priority: nil, isChildTask: false, copyTaskLocals: false,
inheritContext: false, enqueueJob: false,
addPendingGroupTaskUnconditionally: false)
let (sleepTask, _) = Builtin.createAsyncTask(sleepTaskFlags) {
onSleepWake(wordPtr)
}
_enqueueJobGlobalWithDelay(
duration, Builtin.convertTaskToJob(sleepTask))
return
case .activeContinuation, .finished:
fatalError("Impossible to have multiple active continuations")
case .cancelled:
fatalError("Impossible to have cancelled before we began")
case .cancelledBeforeStarted:
// Finish the continuation normally. We'll throw later, after
// we clean up.
continuation.resume()
return
}
}
}
} onCancel: {
onSleepCancel(wordPtr)
}
// Determine whether we got cancelled before we even started.
let cancelledBeforeStarted: Bool
switch SleepState(loading: wordPtr) {
case .notStarted, .activeContinuation, .cancelled:
fatalError("Invalid state for non-cancelled sleep task")
case .cancelledBeforeStarted:
cancelledBeforeStarted = true
case .finished:
cancelledBeforeStarted = false
}
// We got here without being cancelled, so deallocate the storage for
// the flag word and continuation.
wordPtr.deallocate()
// If we got cancelled before we even started, through the cancellation
// error now.
if cancelledBeforeStarted {
throw _Concurrency.CancellationError()
}
} catch {
// The task was cancelled; propagate the error. The "on wake" task is
// responsible for deallocating the flag word and continuation, if it's
// still running.
throw error
}
}
}
| Swift | 5 | xjc90s/swift | stdlib/public/BackDeployConcurrency/TaskSleep.swift | [
"Apache-2.0"
] |
[{"Name":"GraphqlPath","Enabled":true,"Scanner":3,"Author":"@Sy3Omda","UrlEncode":false,"Grep":["true,Or,All Request,Name,/graphql","true,Or,All Request,Name,/graphql/console","true,Or,All Request,Name,/graphql.php","true,Or,All Request,Name,/graphiql","true,Or,All Request,Name,/graphiql.php","true,Or,All Request,Name,/explorer","true,Or,All Request,Name,/altair","true,Or,All Request,Name,/playground","true,Or,All Request,Name,/v1/graphql","true,Or,All Request,Name,/v1/graphql/console","true,Or,All Request,Name,/v1/graphql.php","true,Or,All Request,Name,/v1/graphiql","true,Or,All Request,Name,/v1/graphiql.php","true,Or,All Request,Name,/v1/explorer","true,Or,All Request,Name,/v1/alt4ir","true,Or,All Request,Name,/v1/playground","true,Or,All Request,Name,/v2/graphql","true,Or,All Request,Name,/v2/graphql/console","true,Or,All Request,Name,/v2/graphql.php","true,Or,All Request,Name,/v2/graphiql","true,Or,All Request,Name,/v2/graphiql.php","true,Or,All Request,Name,/v2/explorer","true,Or,All Request,Name,/v2/altair","true,Or,All Request,Name,/v2/playground"],"Tags":["Graphql","All"],"PayloadResponse":false,"NotResponse":false,"isTime":false,"iscontentLength":false,"CaseSensitive":false,"ExcludeHTTP":false,"OnlyHTTP":false,"IsContentType":false,"NegativeCT":false,"IsResponseCode":false,"NegativeRC":false,"isurlextension":false,"NegativeUrlExtension":false,"MatchType":1,"RedirType":0,"MaxRedir":0,"payloadPosition":0,"grepsFile":"","IssueName":"Graphql Path Found","IssueSeverity":"Information","IssueConfidence":"Firm","IssueDetail":"Graphql Path Found","RemediationDetail":"","IssueBackground":"","RemediationBackground":"","VariationAttributes":[],"Scantype":0,"pathDiscovery":false}] | BitBake | 1 | 5m477/BurpBounty | profiles/GraphqlPath.bb | [
"Apache-2.0"
] |
= Documentation for JWT CORS Feature
The jwt_cors feature adds support for Cross-Origin Resource Sharing
to Rodauth's JSON API.
When this feature is used, CORS requests are handled. This includes
CORS preflight requests, which are required since Rodauth's JSON API
uses the application/json request content type.
This feature depends on the jwt feature.
== Auth Value Methods
jwt_cors_allow_headers :: For allowed CORS-preflight requests, the value returned in the Access-Control-Allow-Headers header (default: 'Content-Type, Authorization, Accept'). This specifies which headers can be included in CORS requests.
jwt_cors_allow_methods :: For allowed CORS-preflight requests, the value returned in the Access-Control-Allow-Methods header (default: 'POST'). This specifies which methods are allowed in CORS requests.
jwt_cors_allow_origin :: Which origins are allowed to perform CORS requests. The default is +false+. This can be a String, Array of Strings, Regexp, or +true+ to allow CORS requests from any domain.
jwt_cors_expose_headers :: For allowed CORS requests, the value returned in the Access-Control-Expose-Headers header (default: 'Authorization'). This specifies which headers the browser is allowed to access from a response to a CORS request.
jwt_cors_max_age :: For allowed CORS-preflight requests, the value returned in the Access-Control-Max-Age header (default: 86400). This specifies how long before the information returned should be considered stale and another CORS preflight request made.
== Auth Methods
jwt_cors_allow? :: Whether the request should be allowed. This is called for all requests for a Rodauth route that include an Origin header. It should return true or false for whether to specially handle the cross-origin request. By default, uses the +jwt_cors_allow_origin+ setting to check the origin.
| RDoc | 4 | monorkin/rodauth | doc/jwt_cors.rdoc | [
"MIT"
] |
#
context
iothreads = 1
verbose = 1 # Ask for a trace
main
type = zmq_queue
frontend
option
hwm = 1000
swap = 25000000
subscribe = "#2"
bind = tcp://eth0:5555
backend
bind = tcp://eth0:5556
| Zimpl | 3 | colstrom/zpl | docs/example.zpl | [
"MIT"
] |
'use strict'
define ['./editor', './editorSupport', './ui', './modes'], (Editor, EditorSupport, UI, Modes)->
{
findEditor
LeisureEditCore
preserveSelection
} = Editor
{
OrgEditing
editorForToolbar
basicDataFilter
} = EditorSupport
{
fancyMode
doSlideValue
} = Modes
{
addView
removeView
renderView
hasView
viewKey
addController
removeController
withContext
mergeContext
initializePendingViews
} = UI
searchToken = /[^\'\"]+|\'[^\']*\'|\"[^\"]*\"/g
editorCount = 0
normalize = (str)-> str && str.toLowerCase().replace(/([^a-z0-9]|\n)+/g, '').trim()
chr = (c)-> c.charCodeAt 0
grams = (str, gr = {})->
str = normalize str
if str
for cc in [chr('a')..chr('z')].concat [chr('0')..chr('9')]
c = String.fromCharCode cc
if str.indexOf(c) > -1 then gr[c] = true
if str && str.length >= 2
for i in [0...str.length - 3]
gr[str.substring i, i + 2] = true
if str && str.length >= 3
for i in [0...str.length - 2]
gr[str.substring i, i + 3] = true
gr
tokenize = (query)-> _.map query.match(searchToken) ? [], normalize
indexQuery = (query)->
tri = {}
tokens = {}
for token in tokenize query
if !tokens[token]
tokens[token] = true
grams token, tri
grams: tri
tokens: _.keys tokens
addSearchDataFilter = (data)->
updateEditors = _.throttle -> data.trigger 'updateSearch'
data.addFilter
__proto__: basicDataFilter
clear: (data)->
data.ftsIndex =
sizes: {}
gramBlocks: {}
replaceBlock: (data, oldBlock, newBlock)->
for gram of grams oldBlock?.text
if data.ftsIndex.gramBlocks[gram]?[oldBlock._id]
delete data.ftsIndex.gramBlocks[gram]?[oldBlock._id]
if ! --data.ftsIndex.sizes[gram]
delete data.ftsIndex.gramBlocks[gram]
delete data.ftsIndex.sizes[gram]
for gram of grams newBlock?.text
if !data.ftsIndex.gramBlocks[gram]?[newBlock._id]
if !data.ftsIndex.gramBlocks[gram]
data.ftsIndex.gramBlocks[gram] = {}
data.ftsIndex.sizes[gram] = 0
data.ftsIndex.gramBlocks[gram]?[newBlock._id] = true
++data.ftsIndex.sizes[gram]
setTimeout updateEditors, 1
searchForBlocks = (data, query)->
{tokens, grams: g} = indexQuery query
{gramBlocks, sizes} = data.ftsIndex
counts = []
for gram of g
if !sizes[gram] then return []
else counts.push gram: gram, size: sizes[gram]
if counts.length
counts.sort (a, b)-> b.size - a.size
results = _.keys gramBlocks[counts.pop().gram]
for count in counts by -1
blocks = gramBlocks[count.gram]
results = _.filter results, (x)-> blocks[x]
_.filter results, (id)->
text = normalize data.getBlock(id).text
_.every tokens, (tok)-> text.search(tok) >= 0
else []
class SearchEditor extends OrgEditing
constructor: (data, @text)->
super data
@data = data
@results = {}
@addDataCallbacks updateSearch: => @redisplay()
@setPrefix "search-#{editorCount++}-"
checkValid: ->
if !document.documentElement.contains $(@editor.node)[0]
@cleanup()
false
true
initToolbar: ->
setResults: (newResults)->
if changed = !_.isEqual newResults, @results
@results = newResults
@rerenderAll()
changed
renderBlock: (block)->
realBlock = @getBlock block
if @shouldRender realBlock
super realBlock
else ['', realBlock?.next]
shouldRender: (block)->
while block
if @results[block._id] then return true
block = @data.parent block
false
search: ->
if hits = searchForBlocks(@data, @text.val())
results = _.transform hits, ((obj, item)-> obj[item] = true), {}
@setResults results
redisplay: -> preserveSelection => @search()
openSearch = (event)->
editor = editorForToolbar(event.originalEvent.srcElement)
withContext {editor: editor}, =>
$(editor.node)
.append renderView 'leisure-search'
initializePendingViews()
configureSearch = (view)->
editor = UI.context.editor
output = $(view).find '.leisure-searchOutput'
input = $(view).find '.leisure-searchText'
output.parent().addClass 'flat'
searchEditor = new LeisureEditCore output, new SearchEditor(editor.options.data, input).setMode fancyMode
opts = searchEditor.options
Leisure.configureEmacsOpts opts
Leisure.configurePeerOpts opts
opts.data.openRegistration()
opts.data.registerCollaborativeCode 'doSlideValue', doSlideValue
opts.data.registerCollaborativeCode 'viewBoundSet', (context, name, data)-> options.setData name, data
opts.data.closeRegistration()
opts.hiding = false
output.prev().filter('[data-view=leisure-toolbar]').remove()
input.on 'input', (e)-> opts.search()
opts
Object.assign Leisure, {
openSearch
configureSearch
searchForBlocks
}
{
normalize
indexQuery
tokenize
addSearchDataFilter
grams
searchForBlocks
openSearch
}
| Literate CoffeeScript | 3 | zot/Leisure | src/search.litcoffee | [
"Zlib"
] |
\ require named-locals.fth
\ require masks.fth
private
create name 16 allot
: cpuid ( eax -- a b c d ) i,[ 31c031c94889f80fa24983ec18498944241049895c240849890c244889d7 ] ;
: serial 3 cpuid 32 << or nip nip ;
: basic 0 name 16 fill 0 cpuid rot name d! name 4 + d! name 8 + d! drop name .cstring ;
: vers-fields
dup [mask] 20 28
swap dup [mask] 16 20
swap dup [mask] 12 14
swap dup [mask] 8 12
swap dup [mask] 4 8
swap [mask] 0 4
;
: version ( -- famex type model stepping )
1 cpuid drop 2drop vers-fields
locals famex modex type family model stepping
\ processor type
type @ case
0 of s" Original OEM" endof
1 of s" Intel Overdrive" endof
2 of s" Dual Processor" endof
3 of s" Reserved" endof
endcase
\ processor family
family @ dup 15 =
if famex @ + then
\ processor model
model @ family @ dup 6 = swap 16 = or
if modex @ 4 << + then
\ processor stepping
stepping @
end-locals
." Stepping " . ." model " . ." family " . ." type " type
;
: serial 3 cpuid 32 << or hex . dec 2drop ;
: extended1 7 cpuid hex ." EDX: 0x" . ." ECX: 0x" . ." EBX: 0x" . dec drop ;
: extended2 $80000001 cpuid hex ." EDX: 0x" . ." ECX: 0x" . dec 2drop ;
: em ( fn -- )
+bold execute -bold
;
: b. ['] . em ;
public{
: cpuinfo
.pre -bold
." Basic Info: " ['] basic em cr
." Version Info: " ['] version em cr
." Serial#: " ['] serial em cr
." Extended Feat1: " ['] extended1 em cr
." Extended Feat2: " ['] extended2 em cr
.post
;
}public
| Forth | 4 | jephthai/EvilVM | samples/cpuid.fth | [
"MIT"
] |
function tf_prompt_info() {
# dont show 'default' workspace in home dir
[[ "$PWD" != ~ ]] || return
# check if in terraform dir and file exists
[[ -d .terraform && -r .terraform/environment ]] || return
local workspace="$(< .terraform/environment)"
echo "${ZSH_THEME_TF_PROMPT_PREFIX-[}${workspace:gs/%/%%}${ZSH_THEME_TF_PROMPT_SUFFIX-]}"
}
alias tf='terraform'
alias tfa='terraform apply'
alias tfd='terraform destroy'
alias tff='terraform fmt'
alias tfi='terraform init'
alias tfo='terraform output'
alias tfp='terraform plan'
alias tfv='terraform validate'
| Shell | 4 | residwi/ohmyzsh | plugins/terraform/terraform.plugin.zsh | [
"MIT"
] |
I-Logix-RPY-Archive version 8.7.1 C++ 5066837
{ IProject
- _id = GUID b335390e-08e9-4022-8204-5eefee0b3d18;
- _myState = 8192;
- _name = "LightSwitch";
- _lastID = 2;
- _UserColors = { IRPYRawContainer
- size = 16;
- value = 16777215; 16777215; 16777215; 16777215; 16777215; 16777215; 16777215; 16777215; 16777215; 16777215; 16777215; 16777215; 16777215; 16777215; 16777215; 16777215;
}
- _defaultSubsystem = { ISubsystemHandle
- _m2Class = "ISubsystem";
- _filename = "Default.sbs";
- _subsystem = "";
- _class = "";
- _name = "Default";
- _id = GUID 0a9b06d1-4e0d-4b7a-8283-f258a8ebe4ab;
}
- _component = { IHandle
- _m2Class = "IComponent";
- _filename = "DefaultComponent.cmp";
- _subsystem = "";
- _class = "";
- _name = "DefaultComponent";
- _id = GUID cb837cf4-3084-406e-b55f-52422035c34d;
}
- Multiplicities = { IRPYRawContainer
- size = 4;
- value =
{ IMultiplicityItem
- _name = "1";
- _count = 2;
}
{ IMultiplicityItem
- _name = "*";
- _count = -1;
}
{ IMultiplicityItem
- _name = "0,1";
- _count = -1;
}
{ IMultiplicityItem
- _name = "1..*";
- _count = -1;
}
}
- Subsystems = { IRPYRawContainer
- size = 1;
- value =
{ ISubsystem
- fileName = "Default";
- _id = GUID 0a9b06d1-4e0d-4b7a-8283-f258a8ebe4ab;
}
}
- Diagrams = { IRPYRawContainer
- size = 2;
- value =
{ IStructureDiagram
- _id = GUID b13ca61d-dd77-4305-8415-5a98ed2e93e8;
- _myState = 8192;
- _properties = { IPropertyContainer
- Subjects = { IRPYRawContainer
- size = 1;
- value =
{ IPropertySubject
- _Name = "Format";
- Metaclasses = { IRPYRawContainer
- size = 1;
- value =
{ IPropertyMetaclass
- _Name = "Object";
- Properties = { IRPYRawContainer
- size = 8;
- value =
{ IProperty
- _Name = "DefaultSize";
- _Value = "0,34,84,148";
- _Type = String;
}
{ IProperty
- _Name = "Fill.FillColor";
- _Value = "255,255,255";
- _Type = Color;
}
{ IProperty
- _Name = "Font.Font";
- _Value = "Tahoma";
- _Type = String;
}
{ IProperty
- _Name = "Font.Size";
- _Value = "8";
- _Type = Int;
}
{ IProperty
- _Name = "[email protected]@Name";
- _Value = "700";
- _Type = Int;
}
{ IProperty
- _Name = "Line.LineColor";
- _Value = "109,163,217";
- _Type = Color;
}
{ IProperty
- _Name = "Line.LineStyle";
- _Value = "0";
- _Type = Int;
}
{ IProperty
- _Name = "Line.LineWidth";
- _Value = "1";
- _Type = Int;
}
}
}
}
}
}
}
- _name = "Structure";
- _lastModifiedTime = "4.22.2013::19:10:3";
- _graphicChart = { CGIClassChart
- _id = GUID f69c35b3-b4c9-4c45-b665-2bfc5cbe4957;
- m_type = 0;
- m_pModelObject = { IHandle
- _m2Class = "IStructureDiagram";
- _id = GUID b13ca61d-dd77-4305-8415-5a98ed2e93e8;
}
- m_pParent = ;
- m_name = { CGIText
- m_str = "";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 0;
- m_bImplicitSetRectPoints = 0;
- m_nOrientationCtrlPt = 8;
}
- m_drawBehavior = 0;
- m_bIsPreferencesInitialized = 0;
- elementList = 3;
{ CGIClass
- _id = GUID 951b2d52-fe50-426c-a915-22fecaafaeaa;
- m_type = 78;
- m_pModelObject = { IHandle
- _m2Class = "IClass";
- _filename = "Default.sbs";
- _subsystem = "Default";
- _class = "";
- _name = "TopLevel";
- _id = GUID 6f4ec9d5-5ac7-4f64-9586-cc60ef76d8e1;
}
- m_pParent = ;
- m_name = { CGIText
- m_str = "TopLevel";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 0;
- m_bImplicitSetRectPoints = 0;
- m_nOrientationCtrlPt = 5;
}
- m_drawBehavior = 0;
- m_bIsPreferencesInitialized = 0;
- m_AdditionalLabel = { CGIText
- m_str = "";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 0;
- m_bImplicitSetRectPoints = 0;
- m_nOrientationCtrlPt = 1;
}
- m_polygon = 0 ;
- m_nNameFormat = 0;
- m_nIsNameFormat = 0;
- Compartments = { IRPYRawContainer
- size = 2;
- value =
{ CGICompartment
- _id = GUID f84782ae-3219-4896-9340-0e7a9605e8eb;
- m_name = "Attribute";
- m_displayOption = Explicit;
- m_bShowInherited = 0;
- m_bOrdered = 0;
- Items = { IRPYRawContainer
- size = 0;
}
}
{ CGICompartment
- _id = GUID 11138fbd-d8ce-4d08-8426-5fc7ce759045;
- m_name = "Operation";
- m_displayOption = Explicit;
- m_bShowInherited = 0;
- m_bOrdered = 0;
- Items = { IRPYRawContainer
- size = 0;
}
}
}
- Attrs = { IRPYRawContainer
- size = 0;
}
- Operations = { IRPYRawContainer
- size = 0;
}
}
{ CGIObjectInstance
- _id = GUID 16f96781-33e0-4103-9c98-d190f48366f6;
- m_type = 106;
- m_pModelObject = { IHandle
- _m2Class = "IPart";
- _filename = "Default.sbs";
- _subsystem = "Default";
- _class = "TopLevel";
- _name = "Light";
- _id = GUID 37189177-86f3-43ec-bfe6-90470598bf89;
}
- m_pParent = GUID 951b2d52-fe50-426c-a915-22fecaafaeaa;
- m_name = { CGIText
- m_str = "Light";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 0;
- m_bImplicitSetRectPoints = 0;
- m_nOrientationCtrlPt = 5;
}
- m_drawBehavior = 2824;
- m_transform = 0.0793201 0 0 0.101604 328 5 ;
- m_bIsPreferencesInitialized = 1;
- m_AdditionalLabel = { CGIText
- m_str = "";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 0;
- m_bImplicitSetRectPoints = 0;
- m_nOrientationCtrlPt = 1;
}
- m_polygon = 4 2 329 2 1451 1061 1451 1061 329 ;
- m_nNameFormat = 0;
- m_nIsNameFormat = 0;
- frameset = "<frameset rows=50%,50%>
<frame name=AttributeListCompartment>
<frame name=OperationListCompartment>";
- Compartments = { IRPYRawContainer
- size = 2;
- value =
{ CGICompartment
- _id = GUID 1e2a6884-49f8-477f-9183-a8aead6dd7b6;
- m_name = "Attribute";
- m_displayOption = Public;
- m_bShowInherited = 0;
- m_bOrdered = 0;
}
{ CGICompartment
- _id = GUID 017e6cbe-ba1a-49eb-959f-7d81c05591f4;
- m_name = "Operation";
- m_displayOption = Public;
- m_bShowInherited = 0;
- m_bOrdered = 0;
}
}
- Attrs = { IRPYRawContainer
- size = 0;
}
- Operations = { IRPYRawContainer
- size = 0;
}
- m_multiplicity = { CGIText
- m_str = "1";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 0;
- m_bImplicitSetRectPoints = 0;
- m_nOrientationCtrlPt = 8;
}
}
{ CGIObjectInstance
- _id = GUID 898c8986-36b1-4dec-8496-74a7dd8a72cc;
- m_type = 106;
- m_pModelObject = { IHandle
- _m2Class = "IPart";
- _filename = "Default.sbs";
- _subsystem = "Default";
- _class = "TopLevel";
- _name = "Switch";
- _id = GUID 5066a801-384d-42f2-8e01-b969b84407f7;
}
- m_pParent = GUID 951b2d52-fe50-426c-a915-22fecaafaeaa;
- m_name = { CGIText
- m_str = "Switch";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 0;
- m_bImplicitSetRectPoints = 0;
- m_nOrientationCtrlPt = 5;
}
- m_drawBehavior = 2824;
- m_transform = 0.0830973 0 0 0.101604 579 1 ;
- m_bIsPreferencesInitialized = 1;
- m_AdditionalLabel = { CGIText
- m_str = "";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 0;
- m_bImplicitSetRectPoints = 0;
- m_nOrientationCtrlPt = 1;
}
- m_polygon = 4 2 329 2 1451 1061 1451 1061 329 ;
- m_nNameFormat = 0;
- m_nIsNameFormat = 0;
- frameset = "<frameset rows=50%,50%>
<frame name=AttributeListCompartment>
<frame name=OperationListCompartment>";
- Compartments = { IRPYRawContainer
- size = 2;
- value =
{ CGICompartment
- _id = GUID b69e97ac-3da3-4702-930d-2f62d849a272;
- m_name = "Attribute";
- m_displayOption = Public;
- m_bShowInherited = 0;
- m_bOrdered = 0;
}
{ CGICompartment
- _id = GUID 39dc3f98-42aa-4083-bbea-a53a3c9826b5;
- m_name = "Operation";
- m_displayOption = Public;
- m_bShowInherited = 0;
- m_bOrdered = 0;
}
}
- Attrs = { IRPYRawContainer
- size = 0;
}
- Operations = { IRPYRawContainer
- size = 0;
}
- m_multiplicity = { CGIText
- m_str = "1";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 0;
- m_bImplicitSetRectPoints = 0;
- m_nOrientationCtrlPt = 8;
}
}
- m_access = 'Z';
- m_modified = 'N';
- m_fileVersion = "";
- m_nModifyDate = 0;
- m_nCreateDate = 0;
- m_creator = "";
- m_bScaleWithZoom = 1;
- m_arrowStyle = 'S';
- m_pRoot = GUID 951b2d52-fe50-426c-a915-22fecaafaeaa;
- m_currentLeftTop = 0 0 ;
- m_currentRightBottom = 0 0 ;
}
- _defaultSubsystem = { IHandle
- _m2Class = "ISubsystem";
- _filename = "Default.sbs";
- _subsystem = "";
- _class = "";
- _name = "Default";
- _id = GUID 0a9b06d1-4e0d-4b7a-8283-f258a8ebe4ab;
}
}
{ IDiagram
- _id = GUID d7648f51-030b-4efe-b2f6-4e0b52706c55;
- _myState = 8192;
- _properties = { IPropertyContainer
- Subjects = { IRPYRawContainer
- size = 1;
- value =
{ IPropertySubject
- _Name = "Format";
- Metaclasses = { IRPYRawContainer
- size = 3;
- value =
{ IPropertyMetaclass
- _Name = "Association";
- Properties = { IRPYRawContainer
- size = 4;
- value =
{ IProperty
- _Name = "Font.Font";
- _Value = "Tahoma";
- _Type = String;
}
{ IProperty
- _Name = "Font.Size";
- _Value = "8";
- _Type = Int;
}
{ IProperty
- _Name = "Line.LineColor";
- _Value = "128,128,128";
- _Type = Color;
}
{ IProperty
- _Name = "Line.LineWidth";
- _Value = "1";
- _Type = Int;
}
}
}
{ IPropertyMetaclass
- _Name = "Class";
- Properties = { IRPYRawContainer
- size = 8;
- value =
{ IProperty
- _Name = "DefaultSize";
- _Value = "0,34,84,148";
- _Type = String;
}
{ IProperty
- _Name = "Fill.FillColor";
- _Value = "255,255,255";
- _Type = Color;
}
{ IProperty
- _Name = "Font.Font";
- _Value = "Tahoma";
- _Type = String;
}
{ IProperty
- _Name = "Font.Size";
- _Value = "8";
- _Type = Int;
}
{ IProperty
- _Name = "[email protected]@Name";
- _Value = "700";
- _Type = Int;
}
{ IProperty
- _Name = "Line.LineColor";
- _Value = "109,163,217";
- _Type = Color;
}
{ IProperty
- _Name = "Line.LineStyle";
- _Value = "0";
- _Type = Int;
}
{ IProperty
- _Name = "Line.LineWidth";
- _Value = "1";
- _Type = Int;
}
}
}
{ IPropertyMetaclass
- _Name = "Object";
- Properties = { IRPYRawContainer
- size = 8;
- value =
{ IProperty
- _Name = "DefaultSize";
- _Value = "0,34,84,148";
- _Type = String;
}
{ IProperty
- _Name = "Fill.FillColor";
- _Value = "255,255,255";
- _Type = Color;
}
{ IProperty
- _Name = "Font.Font";
- _Value = "Tahoma";
- _Type = String;
}
{ IProperty
- _Name = "Font.Size";
- _Value = "8";
- _Type = Int;
}
{ IProperty
- _Name = "[email protected]@Name";
- _Value = "700";
- _Type = Int;
}
{ IProperty
- _Name = "Line.LineColor";
- _Value = "109,163,217";
- _Type = Color;
}
{ IProperty
- _Name = "Line.LineStyle";
- _Value = "0";
- _Type = Int;
}
{ IProperty
- _Name = "Line.LineWidth";
- _Value = "1";
- _Type = Int;
}
}
}
}
}
}
}
- _name = "Model";
- _lastModifiedTime = "5.1.2013::18:41:31";
- _graphicChart = { CGIClassChart
- _id = GUID 26adc395-6ad7-4421-9d17-1e7b3597bb31;
- m_type = 0;
- m_pModelObject = { IHandle
- _m2Class = "IDiagram";
- _id = GUID d7648f51-030b-4efe-b2f6-4e0b52706c55;
}
- m_pParent = ;
- m_name = { CGIText
- m_str = "";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 0;
- m_bImplicitSetRectPoints = 0;
- m_nOrientationCtrlPt = 8;
}
- m_drawBehavior = 0;
- m_bIsPreferencesInitialized = 0;
- elementList = 4;
{ CGIClass
- _id = GUID d2d95219-5107-47c6-b497-bbeb95870cd3;
- m_type = 78;
- m_pModelObject = { IHandle
- _m2Class = "IClass";
- _filename = "Default.sbs";
- _subsystem = "Default";
- _class = "";
- _name = "TopLevel";
- _id = GUID 6f4ec9d5-5ac7-4f64-9586-cc60ef76d8e1;
}
- m_pParent = ;
- m_name = { CGIText
- m_str = "TopLevel";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 0;
- m_bImplicitSetRectPoints = 0;
- m_nOrientationCtrlPt = 5;
}
- m_drawBehavior = 0;
- m_bIsPreferencesInitialized = 0;
- m_AdditionalLabel = { CGIText
- m_str = "";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 0;
- m_bImplicitSetRectPoints = 0;
- m_nOrientationCtrlPt = 1;
}
- m_polygon = 0 ;
- m_nNameFormat = 0;
- m_nIsNameFormat = 0;
- Compartments = { IRPYRawContainer
- size = 2;
- value =
{ CGICompartment
- _id = GUID b6b2f9ea-c28e-4da2-9e16-333daa7d663d;
- m_name = "Attribute";
- m_displayOption = Explicit;
- m_bShowInherited = 0;
- m_bOrdered = 0;
- Items = { IRPYRawContainer
- size = 0;
}
}
{ CGICompartment
- _id = GUID d89a4b98-c540-49f7-9678-7ddfb5ef3c39;
- m_name = "Operation";
- m_displayOption = Explicit;
- m_bShowInherited = 0;
- m_bOrdered = 0;
- Items = { IRPYRawContainer
- size = 0;
}
}
}
- Attrs = { IRPYRawContainer
- size = 0;
}
- Operations = { IRPYRawContainer
- size = 0;
}
}
{ CGIObjectInstance
- _id = GUID 6a0b0716-a8b9-4ccd-bac9-363ffd1f904d;
- m_type = 106;
- m_pModelObject = { IHandle
- _m2Class = "IPart";
- _filename = "Default.sbs";
- _subsystem = "Default";
- _class = "TopLevel";
- _name = "Light";
- _id = GUID 37189177-86f3-43ec-bfe6-90470598bf89;
}
- m_pParent = GUID d2d95219-5107-47c6-b497-bbeb95870cd3;
- m_name = { CGIText
- m_str = "Light";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 0;
- m_bImplicitSetRectPoints = 0;
- m_nOrientationCtrlPt = 5;
}
- m_drawBehavior = 2824;
- m_transform = 0.0793201 0 0 0.101604 201 74 ;
- m_bIsPreferencesInitialized = 1;
- m_AdditionalLabel = { CGIText
- m_str = "";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 0;
- m_bImplicitSetRectPoints = 0;
- m_nOrientationCtrlPt = 1;
}
- m_polygon = 4 2 329 2 1451 1061 1451 1061 329 ;
- m_nNameFormat = 0;
- m_nIsNameFormat = 0;
- frameset = "<frameset rows=50%,50%>
<frame name=AttributeListCompartment>
<frame name=OperationListCompartment>";
- Compartments = { IRPYRawContainer
- size = 2;
- value =
{ CGICompartment
- _id = GUID 62fe4356-67b8-4f3f-84d0-0c0ac63fc33c;
- m_name = "Attribute";
- m_displayOption = Public;
- m_bShowInherited = 0;
- m_bOrdered = 0;
}
{ CGICompartment
- _id = GUID 571db3ae-a30a-4487-9f8a-58586b30b11a;
- m_name = "Operation";
- m_displayOption = Public;
- m_bShowInherited = 0;
- m_bOrdered = 0;
}
}
- Attrs = { IRPYRawContainer
- size = 0;
}
- Operations = { IRPYRawContainer
- size = 0;
}
- m_multiplicity = { CGIText
- m_str = "1";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 0;
- m_bImplicitSetRectPoints = 0;
- m_nOrientationCtrlPt = 8;
}
}
{ CGIObjectInstance
- _id = GUID 98478d1b-77b8-4d19-979f-a969b432f421;
- m_type = 106;
- m_pModelObject = { IHandle
- _m2Class = "IPart";
- _filename = "Default.sbs";
- _subsystem = "Default";
- _class = "TopLevel";
- _name = "Switch";
- _id = GUID 5066a801-384d-42f2-8e01-b969b84407f7;
}
- m_pParent = GUID d2d95219-5107-47c6-b497-bbeb95870cd3;
- m_name = { CGIText
- m_str = "Switch";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 0;
- m_bImplicitSetRectPoints = 0;
- m_nOrientationCtrlPt = 5;
}
- m_drawBehavior = 2824;
- m_transform = 0.0793201 0 0 0.101604 430 85 ;
- m_bIsPreferencesInitialized = 1;
- m_AdditionalLabel = { CGIText
- m_str = "";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 0;
- m_bImplicitSetRectPoints = 0;
- m_nOrientationCtrlPt = 1;
}
- m_polygon = 4 2 329 2 1451 1061 1451 1061 329 ;
- m_nNameFormat = 0;
- m_nIsNameFormat = 0;
- frameset = "<frameset rows=50%,50%>
<frame name=AttributeListCompartment>
<frame name=OperationListCompartment>";
- Compartments = { IRPYRawContainer
- size = 2;
- value =
{ CGICompartment
- _id = GUID f0d225cb-d534-4b93-bbd7-a0bcea80b532;
- m_name = "Attribute";
- m_displayOption = Public;
- m_bShowInherited = 0;
- m_bOrdered = 0;
}
{ CGICompartment
- _id = GUID 32967403-d2bf-4254-8bcc-ea05c68760af;
- m_name = "Operation";
- m_displayOption = Public;
- m_bShowInherited = 0;
- m_bOrdered = 0;
}
}
- Attrs = { IRPYRawContainer
- size = 0;
}
- Operations = { IRPYRawContainer
- size = 0;
}
- m_multiplicity = { CGIText
- m_str = "1";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 0;
- m_bImplicitSetRectPoints = 0;
- m_nOrientationCtrlPt = 8;
}
}
{ CGIAssociationEnd
- _id = GUID 5a8919d7-9b3f-4326-94ea-dc9dd3d1ec5e;
- _properties = { IPropertyContainer
- Subjects = { IRPYRawContainer
- size = 1;
- value =
{ IPropertySubject
- _Name = "General";
- Metaclasses = { IRPYRawContainer
- size = 1;
- value =
{ IPropertyMetaclass
- _Name = "Graphics";
- Properties = { IRPYRawContainer
- size = 1;
- value =
{ IProperty
- _Name = "ShowLabels";
- _Value = "False";
- _Type = Bool;
}
}
}
}
}
}
}
- m_type = 92;
- m_pModelObject = { IHandle
- _m2Class = "IAssociationEnd";
- _filename = "Default.sbs";
- _subsystem = "Default";
- _class = "TopLevel.Switch";
- _name = "itsLight";
- _id = GUID 9d57cd55-dc36-47f0-8218-7d5b2154b3ba;
}
- m_pParent = ;
- m_name = { CGIText
- m_str = "";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 0;
- m_bImplicitSetRectPoints = 0;
- m_nOrientationCtrlPt = 8;
}
- m_drawBehavior = 4096;
- m_bIsPreferencesInitialized = 1;
- m_pSource = GUID 98478d1b-77b8-4d19-979f-a969b432f421;
- m_sourceType = 'F';
- m_pTarget = GUID 6a0b0716-a8b9-4ccd-bac9-363ffd1f904d;
- m_targetType = 'T';
- m_direction = ' ';
- m_rpn = { CGIText
- m_str = "";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 0;
- m_bImplicitSetRectPoints = 0;
- m_nOrientationCtrlPt = 7;
}
- m_arrow = 2 357 162 357 150 ;
- m_anglePoint1 = 0 0 ;
- m_anglePoint2 = 0 0 ;
- m_line_style = 2;
- m_SourcePort = 418 762 ;
- m_TargetPort = 443 752 ;
- m_pInverseModelObject = { IAssociationEndHandle
- _m2Class = "";
}
- m_pInstance = { IObjectLinkHandle
- _m2Class = "";
}
- m_pInverseInstance = { IObjectLinkHandle
- _m2Class = "";
}
- m_bShowSourceMultiplicity = 0;
- m_bShowSourceRole = 0;
- m_bShowTargetMultiplicity = 1;
- m_bShowTargetRole = 0;
- m_bShowLinkName = 1;
- m_bShowSpecificType = 0;
- m_bInstance = 0;
- m_bShowQualifier1 = 1;
- m_bShowQualifier2 = 1;
- m_sourceRole = { CGIText
- m_str = "";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 2;
- m_bImplicitSetRectPoints = 0;
}
- m_targetRole = { CGIText
- m_str = "";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 3;
- m_bImplicitSetRectPoints = 0;
}
- m_sourceMultiplicity = { CGIText
- m_str = "";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 4;
- m_bImplicitSetRectPoints = 0;
- m_nOrientationCtrlPt = 4;
}
- m_targetMultiplicity = { CGIText
- m_str = "1";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 5;
- m_bImplicitSetRectPoints = 0;
- m_nHorizontalSpacing = 7;
- m_nOrientationCtrlPt = 6;
}
- m_sourceQualifier = { CGIText
- m_str = "";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 6;
- m_bImplicitSetRectPoints = 0;
- m_nOrientationCtrlPt = 8;
}
- m_targetQualifier = { CGIText
- m_str = "";
- m_style = "Arial" 10 0 0 0 1 ;
- m_color = { IColor
- m_fgColor = 0;
- m_bgColor = 0;
- m_bgFlag = 0;
}
- m_position = 1 0 0 ;
- m_nIdent = 7;
- m_bImplicitSetRectPoints = 0;
- m_nOrientationCtrlPt = 8;
}
- m_specificType = type_122;
}
- m_access = 'Z';
- m_modified = 'N';
- m_fileVersion = "";
- m_nModifyDate = 0;
- m_nCreateDate = 0;
- m_creator = "";
- m_bScaleWithZoom = 1;
- m_arrowStyle = 'S';
- m_pRoot = GUID d2d95219-5107-47c6-b497-bbeb95870cd3;
- m_currentLeftTop = 0 0 ;
- m_currentRightBottom = 0 0 ;
}
- _defaultSubsystem = { IHandle
- _m2Class = "ISubsystem";
- _filename = "Default.sbs";
- _subsystem = "";
- _class = "";
- _name = "Default";
- _id = GUID 0a9b06d1-4e0d-4b7a-8283-f258a8ebe4ab;
}
}
}
- Components = { IRPYRawContainer
- size = 1;
- value =
{ IComponent
- fileName = "DefaultComponent";
- _id = GUID cb837cf4-3084-406e-b55f-52422035c34d;
}
}
}
| Ren'Py | 1 | boriel/parglare | examples/rhapsody/LightSwitch.rpy | [
"MIT"
] |
/*
* This file is part of the X10 project (http://x10-lang.org).
*
* This file is licensed to You under the Eclipse Public License (EPL);
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.opensource.org/licenses/eclipse-1.0.php
*
* (C) Copyright IBM Corporation 2006-2016.
*/
import x10.io.Console;
/**
* A simple illustration of loop parallelization within a single place.
*/
public class ArraySum {
var sum:Long;
val data:Rail[Long];
public def this(n:Long) {
// Create a Rail with n elements (0..(n-1)), all initialized to 1.
data = new Rail[Long](n, 1);
sum = 0;
}
def sum(a:Rail[Long], start:Long, last:Long) {
var mySum: Long = 0;
for (i in start..(last-1)) {
mySum += a(i);
}
return mySum;
}
def sum(numThreads:Long) {
val mySize = data.size/numThreads;
finish for (p in 0..(numThreads-1)) async {
val mySum = sum(data, p*mySize, (p+1)*mySize);
// Multiple activities will simultaneously update
// this location -- so use an atomic operation.
atomic sum += mySum;
}
}
public static def main(args:Rail[String]) {
var size:Long = 5*1000*1000;
if (args.size >=1)
size = Long.parse(args(0));
Console.OUT.println("Initializing.");
val a = new ArraySum(size);
val P = [1,2,4];
//warmup loop
Console.OUT.println("Warming up.");
for (numThreads in P)
a.sum(numThreads);
for (numThreads in P) {
Console.OUT.println("Starting with " + numThreads + " threads.");
a.sum=0;
var time: long = - System.nanoTime();
a.sum(numThreads);
time += System.nanoTime();
Console.OUT.println("For p=" + numThreads
+ " result: " + a.sum
+ ((size==a.sum)? " ok" : " bad")
+ " (time=" + (time/(1000*1000)) + " ms)");
}
}
}
| X10 | 5 | octonion/examples | languages/x10/ArraySum.x10 | [
"MIT"
] |
\begin{code}
module Literate where
postulate A : Set
\end{code}
\begin{code}
postulate a : A
\end{code}
| Literate Agda | 4 | shlevy/agda | test/interaction/Literate.lagda | [
"BSD-3-Clause"
] |
<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24" viewBox="0 0 24 24" width="24"><g><path d="M0,0h24v24H0V0z" fill="none"/></g><g><g><path d="M10,16H6.5v6H10c0.8,0,1.5-0.7,1.5-1.5v-3C11.5,16.7,10.8,16,10,16z M10,20.5H8v-3h2V20.5z"/><path d="M16.5,16H13v6h1.5v-2h1.1l0.9,2H18l-0.9-2.1c0.5-0.3,0.9-0.8,0.9-1.4v-1C18,16.7,17.3,16,16.5,16z M16.5,18.5h-2v-1h2 V18.5z"/><polygon points="3.5,18 1.5,18 1.5,16 0,16 0,22 1.5,22 1.5,19.5 3.5,19.5 3.5,22 5,22 5,16 3.5,16"/><polygon points="22,18.5 22,16.5 20.5,16.5 20.5,18.5 18.5,18.5 18.5,20 20.5,20 20.5,22 22,22 22,20 24,20 24,18.5"/><polygon points="11.97,5.3 10.95,8.19 13.05,8.19 12.03,5.3"/><path d="M12,2C8.69,2,6,4.69,6,8s2.69,6,6,6s6-2.69,6-6S15.31,2,12,2z M14.04,11l-0.63-1.79h-2.83L9.96,11H8.74l2.63-7h1.25 l2.63,7H14.04z"/></g></g></svg> | SVG | 1 | good-gym/material-ui | packages/material-ui-icons/material-icons/hdr_auto_select_24px.svg | [
"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.netbeans.modules.php.twig.editor.lexer;
import org.netbeans.spi.lexer.LexerInput;
import org.netbeans.spi.lexer.LexerRestartInfo;
import org.netbeans.modules.web.common.api.ByteStack;
@org.netbeans.api.annotations.common.SuppressWarnings({"SF_SWITCH_FALLTHROUGH", "URF_UNREAD_FIELD", "DLS_DEAD_LOCAL_STORE", "DM_DEFAULT_ENCODING"})
%%
%public
%class TwigVariableColoringLexer
%type TwigVariableTokenId
%function findNextToken
%unicode
%caseless
%char
%eofval{
if(input.readLength() > 0) {
// backup eof
input.backup(1);
//and return the text as error token
return TwigVariableTokenId.T_TWIG_OTHER;
} else {
return null;
}
%eofval}
%{
private ByteStack stack = new ByteStack();
private LexerInput input;
public TwigVariableColoringLexer(LexerRestartInfo info) {
this.input = info.input();
if(info.state() != null) {
//reset state
setState((LexerState) info.state());
} else {
zzState = zzLexicalState = YYINITIAL;
stack.clear();
}
}
public static final class LexerState {
final ByteStack stack;
/** the current state of the DFA */
final int zzState;
/** the current lexical state */
final int zzLexicalState;
LexerState(ByteStack stack, int zzState, int zzLexicalState) {
this.stack = stack;
this.zzState = zzState;
this.zzLexicalState = zzLexicalState;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || obj.getClass() != this.getClass()) {
return false;
}
LexerState state = (LexerState) obj;
return (this.stack.equals(state.stack)
&& (this.zzState == state.zzState)
&& (this.zzLexicalState == state.zzLexicalState));
}
@Override
public int hashCode() {
int hash = 11;
hash = 31 * hash + this.zzState;
hash = 31 * hash + this.zzLexicalState;
if (stack != null) {
hash = 31 * hash + this.stack.hashCode();
}
return hash;
}
}
public LexerState getState() {
return new LexerState(stack.copyOf(), zzState, zzLexicalState);
}
public void setState(LexerState state) {
this.stack.copyFrom(state.stack);
this.zzState = state.zzState;
this.zzLexicalState = state.zzLexicalState;
}
protected int getZZLexicalState() {
return zzLexicalState;
}
protected void popState() {
yybegin(stack.pop());
}
protected void pushState(final int state) {
stack.push(getZZLexicalState());
yybegin(state);
}
// End user code
%}
WHITESPACE=[ \t\r\n]+
OPERATOR=("as"|"="|"not"|"+"|"-"|"or"|"b-or"|"b-xor"|"and"|"b-and"|"=="|"!="|">"|"<"|">="|"<="|"in"|"~"|"*"|"/"|"//"|"%"|"is"|".."|"**")
OPEN_CURLY="{"
PUNCTUATION=("|"|"("|")"|"["|"]"|{OPEN_CURLY}|"}"|"?"|":"|"."|",")
NUMBER=[0-9]+(\.[0-9]+)?
NAME=[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*
D_STRING="\""([^"\"""\\"]|"\\"[^])*"\\"?"\""
S_STRING="'"([^"'""\\"]|"\\"[^])*"\\"?"'"
INTERPOLATION_START="#{"
INTERPOLATION_END="}"
D_NO_INTERPOLATION=([^"#""\"""\\"] | #[^"{""\""]|"\\"[^])*"\\"?
D_INTERPOLATION={D_NO_INTERPOLATION} {INTERPOLATION_START}
D_PRE_INTERPOLATION="\"" {D_INTERPOLATION}
D_NO_INTERPOLATION_INSIDE="\"" {D_NO_INTERPOLATION} "#"* "\""
D_POST_INTERPOLATION={D_NO_INTERPOLATION} "\""
%state ST_D_STRING
%state ST_S_STRING
%state ST_INTERPOLATION
%state ST_HIGHLIGHTING_ERROR
%%
<YYINITIAL, ST_D_STRING, ST_S_STRING, ST_INTERPOLATION>{WHITESPACE}+ {
return TwigVariableTokenId.T_TWIG_WHITESPACE;
}
<ST_INTERPOLATION> {
{INTERPOLATION_START} {
return TwigVariableTokenId.T_TWIG_INTERPOLATION_START;
}
{INTERPOLATION_END} {
popState();
return TwigVariableTokenId.T_TWIG_INTERPOLATION_END;
}
}
<YYINITIAL, ST_INTERPOLATION> {
{OPERATOR} {
return TwigVariableTokenId.T_TWIG_OPERATOR;
}
{PUNCTUATION} {
return TwigVariableTokenId.T_TWIG_PUNCTUATION;
}
{NUMBER} {
return TwigVariableTokenId.T_TWIG_NUMBER;
}
{D_STRING} {
yypushback(yylength());
pushState(ST_D_STRING);
}
{S_STRING} {
return TwigVariableTokenId.T_TWIG_STRING;
}
{NAME} {
return TwigVariableTokenId.T_TWIG_NAME;
}
}
<ST_D_STRING> {
{D_PRE_INTERPOLATION} | {D_INTERPOLATION} {
yypushback(2);
pushState(ST_INTERPOLATION);
return TwigVariableTokenId.T_TWIG_STRING;
}
{D_NO_INTERPOLATION_INSIDE} {
popState();
return TwigVariableTokenId.T_TWIG_STRING;
}
{D_POST_INTERPOLATION} {
popState();
return TwigVariableTokenId.T_TWIG_STRING;
}
}
/* ============================================
Stay in this state until we find a whitespace.
After we find a whitespace we go the the prev state and try again from the next token.
============================================ */
<ST_HIGHLIGHTING_ERROR> {
{WHITESPACE} {
popState();
return TwigVariableTokenId.T_TWIG_WHITESPACE;
}
. {
return TwigVariableTokenId.T_TWIG_OTHER;
}
}
/* ============================================
This rule must be the last in the section!!
it should contain all the states.
============================================ */
<YYINITIAL, ST_D_STRING, ST_S_STRING, ST_INTERPOLATION> {
. {
yypushback(yylength());
pushState(ST_HIGHLIGHTING_ERROR);
}
}
| JFlex | 5 | timfel/netbeans | php/php.twig/tools/TwigVariableColoringLexer.flex | [
"Apache-2.0"
] |
// https://dom.spec.whatwg.org/#childnode
interface mixin ChildNode {
[CEReactions, Unscopable] undefined before((Node or DOMString)... nodes);
[CEReactions, Unscopable] undefined after((Node or DOMString)... nodes);
[CEReactions, Unscopable] undefined replaceWith((Node or DOMString)... nodes);
[CEReactions, Unscopable] undefined remove();
};
DocumentType includes ChildNode;
Element includes ChildNode;
CharacterData includes ChildNode;
| WebIDL | 3 | Unique184/jsdom | lib/jsdom/living/nodes/ChildNode.webidl | [
"MIT"
] |
import QtQuick 2.0
import QtQuick.Controls 2.4
import QtGraphicalEffects 1.0
Item {
id: _root
property color mainColor: "#000000"
property color contentColor: "#FFFFFF"
property alias fontPointSize: zoomStatusTextItem.font.pointSize
property real zoomLevel: NaN
property alias zoomLevelVisible: zoomStatusItem.visible
property bool showZoomPrecision: true
property bool onlyContinousZoom: false
signal zoomIn()
signal zoomOut()
signal continuousZoomStart(var zoomIn)
signal continuousZoomStop()
//
// Beware the buttons were switched
//
//
height: zoomStatusTextItem.height * 2
width: (zoomLevelVisible ? (zoomStatusItem.width - zoomInButton.width/2) : 0) + zoomInButton.width + zoomOutButton.width
Rectangle {
id: zoomStatusItem
color: mainColor
opacity: 0.5
radius: height/2
anchors.left: _root.left
anchors.verticalCenter: _root.verticalCenter
width: height * 2
height: _root.height * 0.8
}
Item {
visible: zoomStatusItem.visible
anchors.left: zoomStatusItem.left
anchors.top: zoomStatusItem.top
anchors.right: zoomStatusItem.horizontalCenter
anchors.bottom: zoomStatusItem.bottom
z: zoomStatusItem.z + 1
Text {
id: zoomStatusTextItem
anchors.centerIn: parent
opacity: 2
color: _root.contentColor
text: isNaN(zoomLevel) ? "-" : "x" + _root.zoomLevel.toFixed(_root.showZoomPrecision ? 1 : 0)
}
}
Button {
id: zoomInButton
flat: true
anchors.left: zoomLevelVisible ? zoomStatusItem.horizontalCenter : _root.left
anchors.top: _root.top
width: height
height: _root.height
property bool holding: false
onPressed: {
if(onlyContinousZoom) {
holding = true
}
else {
_root.zoomOut()
}
}
onPressAndHold: {
holding = true
}
onReleased: {
holding = false
}
background: Rectangle {
anchors.fill: zoomInButton
radius: zoomInButton.width/10
color: _root.mainColor
}
contentItem: Item {
anchors.fill: zoomInButton
Rectangle {
id: zoomInMinusRectangle
anchors.centerIn: parent
width: zoomInButton.width * 0.4
height: zoomInButton.height * 0.05
color: _root.contentColor
}
}
}
Item {
id: buttonSeparator
anchors.left: zoomInButton.right
anchors.verticalCenter: zoomInButton.verticalCenter
width: zoomInButton.width * 0.05
height: zoomInButton.height * 0.8
Rectangle {
radius: width * 0.2
anchors.centerIn: parent
width: zoomInButton.width * 0.01
height: parent.height * 0.8
color: _root.contentColor
}
}
Button {
id: zoomOutButton
flat: true
anchors.left: buttonSeparator.right
anchors.top: zoomInButton.top
width: height
height: zoomInButton.height
property bool holding: false
onPressed: {
if(onlyContinousZoom) {
holding = true
}
else {
_root.zoomIn()
}
}
onPressAndHold: {
holding = true
}
onReleased: {
holding = false
}
background: Rectangle {
anchors.fill: zoomOutButton
radius: zoomOutButton.width/10
color: _root.mainColor
}
contentItem: Item {
anchors.fill: zoomOutButton
Rectangle {
id: zoomOutMinusRectangle
anchors.centerIn: parent
width: zoomInMinusRectangle.width
height: zoomInMinusRectangle.height
color: _root.contentColor
}
Rectangle {
anchors.centerIn: parent
width: zoomOutMinusRectangle.height
height: zoomOutMinusRectangle.width
color: _root.contentColor
}
}
}
// Zoom buttons background
Rectangle {
color: _root.mainColor
z: -1
anchors.left: zoomInButton.horizontalCenter
anchors.right: zoomOutButton.horizontalCenter
anchors.top: zoomInButton.top
anchors.bottom: zoomOutButton.bottom
}
onStateChanged: {
if(state == "ZoomingIn") {
_root.continuousZoomStart(true)
}
else if(state == "ZoomingOut") {
_root.continuousZoomStart(false)
}
else {
_root.continuousZoomStop()
}
}
state: "None"
states: [
State {
name: "None"
when: zoomInButton.holding === false && zoomOutButton.holding === false
},
State {
name: "ZoomingIn"
when: zoomOutButton.holding === true
},
State {
name: "ZoomingOut"
when: zoomInButton.holding === true
}
]
}
| QML | 4 | uav-operation-system/qgroundcontrol | custom-example/res/Custom/Camera/ZoomControl.qml | [
"Apache-2.0"
] |
# Copyright 2020 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import socket
cdef gpr_timespec _GPR_INF_FUTURE = gpr_inf_future(GPR_CLOCK_REALTIME)
cdef float _POLL_AWAKE_INTERVAL_S = 0.2
# This bool indicates if the event loop impl can monitor a given fd, or has
# loop.add_reader method.
cdef bint _has_fd_monitoring = True
IF UNAME_SYSNAME == "Windows":
cdef void _unified_socket_write(int fd) nogil:
win_socket_send(<WIN_SOCKET>fd, b"1", 1, 0)
ELSE:
from posix cimport unistd
cdef void _unified_socket_write(int fd) nogil:
unistd.write(fd, b"1", 1)
def _handle_callback_wrapper(CallbackWrapper callback_wrapper, int success):
CallbackWrapper.functor_run(callback_wrapper.c_functor(), success)
cdef class BaseCompletionQueue:
cdef grpc_completion_queue* c_ptr(self):
return self._cq
cdef class _BoundEventLoop:
def __cinit__(self, object loop, object read_socket, object handler):
global _has_fd_monitoring
self.loop = loop
self.read_socket = read_socket
reader_function = functools.partial(
handler,
loop
)
# NOTE(lidiz) There isn't a way to cleanly pre-check if fd monitoring
# support is available or not. Checking the event loop policy is not
# good enough. The application can has its own loop implementation, or
# uses different types of event loops (e.g., 1 Proactor, 3 Selectors).
if _has_fd_monitoring:
try:
self.loop.add_reader(self.read_socket, reader_function)
self._has_reader = True
except NotImplementedError:
_has_fd_monitoring = False
self._has_reader = False
def close(self):
if self.loop:
if self._has_reader:
self.loop.remove_reader(self.read_socket)
cdef class PollerCompletionQueue(BaseCompletionQueue):
def __cinit__(self):
self._cq = grpc_completion_queue_create_for_next(NULL)
self._shutdown = False
self._poller_thread = threading.Thread(target=self._poll_wrapper, daemon=True)
self._poller_thread.start()
self._read_socket, self._write_socket = socket.socketpair()
self._write_fd = self._write_socket.fileno()
self._loops = {}
# The read socket might be read by multiple threads. But only one of them will
# read the 1 byte sent by the poller thread. This setting is essential to allow
# multiple loops in multiple threads bound to the same poller.
self._read_socket.setblocking(False)
self._queue = cpp_event_queue()
def bind_loop(self, object loop):
if loop in self._loops:
return
else:
self._loops[loop] = _BoundEventLoop(loop, self._read_socket, self._handle_events)
cdef void _poll(self) nogil:
cdef grpc_event event
cdef CallbackContext *context
while not self._shutdown:
event = grpc_completion_queue_next(self._cq,
_GPR_INF_FUTURE,
NULL)
if event.type == GRPC_QUEUE_TIMEOUT:
with gil:
raise AssertionError("Core should not return GRPC_QUEUE_TIMEOUT!")
elif event.type == GRPC_QUEUE_SHUTDOWN:
self._shutdown = True
else:
self._queue_mutex.lock()
self._queue.push(event)
self._queue_mutex.unlock()
if _has_fd_monitoring:
_unified_socket_write(self._write_fd)
else:
with gil:
# Event loops can be paused or killed at any time. So,
# instead of deligate to any thread, the polling thread
# should handle the distribution of the event.
self._handle_events(None)
def _poll_wrapper(self):
with nogil:
self._poll()
cdef shutdown(self):
# Removes the socket hook from loops
for loop in self._loops:
self._loops.get(loop).close()
# TODO(https://github.com/grpc/grpc/issues/22365) perform graceful shutdown
grpc_completion_queue_shutdown(self._cq)
while not self._shutdown:
self._poller_thread.join(timeout=_POLL_AWAKE_INTERVAL_S)
grpc_completion_queue_destroy(self._cq)
# Clean up socket resources
self._read_socket.close()
self._write_socket.close()
def _handle_events(self, object context_loop):
cdef bytes data
if _has_fd_monitoring:
# If fd monitoring is working, clean the socket without blocking.
data = self._read_socket.recv(1)
cdef grpc_event event
cdef CallbackContext *context
while True:
self._queue_mutex.lock()
if self._queue.empty():
self._queue_mutex.unlock()
break
else:
event = self._queue.front()
self._queue.pop()
self._queue_mutex.unlock()
context = <CallbackContext *>event.tag
loop = <object>context.loop
if loop is context_loop:
# Executes callbacks: complete the future
CallbackWrapper.functor_run(
<grpc_completion_queue_functor *>event.tag,
event.success
)
else:
loop.call_soon_threadsafe(
_handle_callback_wrapper,
<CallbackWrapper>context.callback_wrapper,
event.success
)
| Cython | 4 | warlock135/grpc | src/python/grpcio/grpc/_cython/_cygrpc/aio/completion_queue.pyx.pxi | [
"Apache-2.0"
] |
=== MQL4/Scripts/OTMql4/OTMql4ZmqTest.mq4 ===
A simple test Script that doesn't do much, but it's a start.
Attach it to a chart, select the tests you want to run,
and a MessageBox will pop up to tell you if it passed or failed.
We will put each test as a boolean external input so the user
can select which tests to run.
{{{bool bAssertStrerrortEqual(int i, string u) }}}
{{{string eTestErrorMessages() }}}
{{{void OnStart() }}}
{{{void OnDeinit(const int reason) }}}
Source code: [[MQL4/Scripts/OTMql4/OTMql4ZmqTest.mq4|https://github.com/OpenTrading/OTMql4Zmq/raw/master/MQL4/Scripts/OTMql4/OTMql4ZmqTest.mq4]]
This file is automatically generated from the source code: do not edit.
----
Parent: [[CodeScripts]]
| Creole | 2 | lionelyoung/OTMql4Zmq | wiki/OTMql4ZmqTest.creole | [
"MIT"
] |
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon"));
var _jsxRuntime = require("react/jsx-runtime");
var _default = (0, _createSvgIcon.default)([/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
d: "M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6z"
}, "0"), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
d: "M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-5.99 13c-.59 0-1.05-.47-1.05-1.05 0-.59.47-1.04 1.05-1.04.59 0 1.04.45 1.04 1.04-.01.58-.45 1.05-1.04 1.05zm2.5-6.17c-.63.93-1.23 1.21-1.56 1.81-.13.24-.18.4-.18 1.18h-1.52c0-.41-.06-1.08.26-1.65.41-.73 1.18-1.16 1.63-1.8.48-.68.21-1.94-1.14-1.94-.88 0-1.32.67-1.5 1.23l-1.37-.57C11.51 5.96 12.52 5 13.99 5c1.23 0 2.08.56 2.51 1.26.37.61.58 1.73.01 2.57z"
}, "1")], 'Quiz');
exports.default = _default; | JavaScript | 3 | good-gym/material-ui | packages/material-ui-icons/lib/Quiz.js | [
"MIT"
] |
structure coding :=
(code : Type)
[code_dec_eq : decidable_eq code]
(decode : code → Type)
instance coding_code_has_dec_eq (β : coding) : decidable_eq β.code :=
β.code_dec_eq
@[reducible] def typeof (β : coding) (c : β.code) : Type :=
β.decode c
structure ref {code : Type} (c : code) :=
(idx : nat)
structure heap (β : coding) :=
(next : nat)
(mem : array next (Σ c : β.code, β.decode c))
def mk_heap (β : coding) : heap β :=
{ next := 0, mem := array.nil }
def mk_ref {β : coding} : heap β → Π c : β.code, typeof β c → ref c × heap β
| ⟨n, mem⟩ c v :=
({ idx := n }, ⟨n+1, mem.push_back ⟨c, v⟩⟩)
def read {β : coding} {c : β.code} (h : heap β) (r : ref c) : option (typeof β c) :=
match h, r with
| ⟨n, mem⟩, {idx := i} :=
if h₁ : i < n
then let ⟨c', v⟩ := mem.read ⟨i, h₁⟩ in
if h₂ : c' = c
then eq.rec_on h₂ v
else none
else none
end
def write {β : coding} {c : β.code} (h : heap β) (r : ref c) (v : typeof β c) : heap β :=
match h, v with
| ⟨n, mem⟩, v :=
if h₁ : r.idx < n
then ⟨n, mem.write ⟨r.idx, h₁⟩ ⟨c, v⟩⟩
else h
end
@[derive decidable_eq]
inductive simple_code
| Pair : simple_code → simple_code → simple_code
| Bool : simple_code
| Nat : simple_code
| Ref : simple_code → simple_code
open simple_code
def decode_simple_code : simple_code → Type
| Bool := bool
| Nat := nat
| (Ref c) := ref c
| (Pair c₁ c₂) := decode_simple_code c₁ × decode_simple_code c₂
def PairRefNat := Pair (Ref Nat) (Ref Nat)
def C : coding :=
{ code := simple_code, decode := decode_simple_code }
def h : heap C :=
let h₀ := mk_heap C in
let (r₀, h₁) := mk_ref h₀ Bool tt in
let (r₁, h₂) := mk_ref h₁ Nat (10:nat) in
let (r₂, h₃) := mk_ref h₂ PairRefNat (r₁, r₁) in
let h₄ := write h₃ r₀ ff in
let h₅ := write h₄ r₁ (20:nat) in
h₅
def r₀ : ref Bool := { idx := 0 }
def r₁ : ref Nat := { idx := 1 }
def r₂ : ref PairRefNat := { idx := 2 }
#eval @id (option nat) $ read h r₁
/- In the following example the type_context exposes the internal encoding of decode_simple_code.
TODO(Leo): fix this issue by using refl lemmas. -/
#eval
match read h r₂ : _ → option nat with
| some (r, _) := read h r -- to observe problem, hover over the first `r`
| none := some 0
end
| Lean | 5 | ericrbg/lean | tests/lean/run/heap_code.lean | [
"Apache-2.0"
] |
/**
* @file vector_ops.hpp
* @author [Deep Raval](https://github.com/imdeep2905)
*
* @brief Various functions for vectors associated with [NeuralNetwork (aka
* Multilayer Perceptron)]
* (https://en.wikipedia.org/wiki/Multilayer_perceptron).
*
*/
#ifndef VECTOR_OPS_FOR_NN
#define VECTOR_OPS_FOR_NN
#include <algorithm>
#include <chrono>
#include <iostream>
#include <random>
#include <valarray>
#include <vector>
/**
* @namespace machine_learning
* @brief Machine Learning algorithms
*/
namespace machine_learning {
/**
* Overloaded operator "<<" to print 2D vector
* @tparam T typename of the vector
* @param out std::ostream to output
* @param A 2D vector to be printed
*/
template <typename T>
std::ostream &operator<<(std::ostream &out,
std::vector<std::valarray<T>> const &A) {
// Setting output precision to 4 in case of floating point numbers
out.precision(4);
for (const auto &a : A) { // For each row in A
for (const auto &x : a) { // For each element in row
std::cout << x << ' '; // print element
}
std::cout << std::endl;
}
return out;
}
/**
* Overloaded operator "<<" to print a pair
* @tparam T typename of the pair
* @param out std::ostream to output
* @param A Pair to be printed
*/
template <typename T>
std::ostream &operator<<(std::ostream &out, const std::pair<T, T> &A) {
// Setting output precision to 4 in case of floating point numbers
out.precision(4);
// printing pair in the form (p, q)
std::cout << "(" << A.first << ", " << A.second << ")";
return out;
}
/**
* Overloaded operator "<<" to print a 1D vector
* @tparam T typename of the vector
* @param out std::ostream to output
* @param A 1D vector to be printed
*/
template <typename T>
std::ostream &operator<<(std::ostream &out, const std::valarray<T> &A) {
// Setting output precision to 4 in case of floating point numbers
out.precision(4);
for (const auto &a : A) { // For every element in the vector.
std::cout << a << ' '; // Print element
}
std::cout << std::endl;
return out;
}
/**
* Function to insert element into 1D vector
* @tparam T typename of the 1D vector and the element
* @param A 1D vector in which element will to be inserted
* @param ele element to be inserted
* @return new resultant vector
*/
template <typename T>
std::valarray<T> insert_element(const std::valarray<T> &A, const T &ele) {
std::valarray<T> B; // New 1D vector to store resultant vector
B.resize(A.size() + 1); // Resizing it accordingly
for (size_t i = 0; i < A.size(); i++) { // For every element in A
B[i] = A[i]; // Copy element in B
}
B[B.size() - 1] = ele; // Inserting new element in last position
return B; // Return resultant vector
}
/**
* Function to remove first element from 1D vector
* @tparam T typename of the vector
* @param A 1D vector from which first element will be removed
* @return new resultant vector
*/
template <typename T>
std::valarray<T> pop_front(const std::valarray<T> &A) {
std::valarray<T> B; // New 1D vector to store resultant vector
B.resize(A.size() - 1); // Resizing it accordingly
for (size_t i = 1; i < A.size();
i++) { // // For every (except first) element in A
B[i - 1] = A[i]; // Copy element in B with left shifted position
}
return B; // Return resultant vector
}
/**
* Function to remove last element from 1D vector
* @tparam T typename of the vector
* @param A 1D vector from which last element will be removed
* @return new resultant vector
*/
template <typename T>
std::valarray<T> pop_back(const std::valarray<T> &A) {
std::valarray<T> B; // New 1D vector to store resultant vector
B.resize(A.size() - 1); // Resizing it accordingly
for (size_t i = 0; i < A.size() - 1;
i++) { // For every (except last) element in A
B[i] = A[i]; // Copy element in B
}
return B; // Return resultant vector
}
/**
* Function to equally shuffle two 3D vectors (used for shuffling training data)
* @tparam T typename of the vector
* @param A First 3D vector
* @param B Second 3D vector
*/
template <typename T>
void equal_shuffle(std::vector<std::vector<std::valarray<T>>> &A,
std::vector<std::vector<std::valarray<T>>> &B) {
// If two vectors have different sizes
if (A.size() != B.size()) {
std::cerr << "ERROR (" << __func__ << ") : ";
std::cerr
<< "Can not equally shuffle two vectors with different sizes: ";
std::cerr << A.size() << " and " << B.size() << std::endl;
std::exit(EXIT_FAILURE);
}
for (size_t i = 0; i < A.size(); i++) { // For every element in A and B
// Genrating random index < size of A and B
std::srand(std::chrono::system_clock::now().time_since_epoch().count());
size_t random_index = std::rand() % A.size();
// Swap elements in both A and B with same random index
std::swap(A[i], A[random_index]);
std::swap(B[i], B[random_index]);
}
return;
}
/**
* Function to initialize given 2D vector using uniform random initialization
* @tparam T typename of the vector
* @param A 2D vector to be initialized
* @param shape required shape
* @param low lower limit on value
* @param high upper limit on value
*/
template <typename T>
void uniform_random_initialization(std::vector<std::valarray<T>> &A,
const std::pair<size_t, size_t> &shape,
const T &low, const T &high) {
A.clear(); // Making A empty
// Uniform distribution in range [low, high]
std::default_random_engine generator(
std::chrono::system_clock::now().time_since_epoch().count());
std::uniform_real_distribution<T> distribution(low, high);
for (size_t i = 0; i < shape.first; i++) { // For every row
std::valarray<T>
row; // Making empty row which will be inserted in vector
row.resize(shape.second);
for (auto &r : row) { // For every element in row
r = distribution(generator); // copy random number
}
A.push_back(row); // Insert new row in vector
}
return;
}
/**
* Function to Intialize 2D vector as unit matrix
* @tparam T typename of the vector
* @param A 2D vector to be initialized
* @param shape required shape
*/
template <typename T>
void unit_matrix_initialization(std::vector<std::valarray<T>> &A,
const std::pair<size_t, size_t> &shape) {
A.clear(); // Making A empty
for (size_t i = 0; i < shape.first; i++) {
std::valarray<T>
row; // Making empty row which will be inserted in vector
row.resize(shape.second);
row[i] = T(1); // Insert 1 at ith position
A.push_back(row); // Insert new row in vector
}
return;
}
/**
* Function to Intialize 2D vector as zeroes
* @tparam T typename of the vector
* @param A 2D vector to be initialized
* @param shape required shape
*/
template <typename T>
void zeroes_initialization(std::vector<std::valarray<T>> &A,
const std::pair<size_t, size_t> &shape) {
A.clear(); // Making A empty
for (size_t i = 0; i < shape.first; i++) {
std::valarray<T>
row; // Making empty row which will be inserted in vector
row.resize(shape.second); // By default all elements are zero
A.push_back(row); // Insert new row in vector
}
return;
}
/**
* Function to get sum of all elements in 2D vector
* @tparam T typename of the vector
* @param A 2D vector for which sum is required
* @return returns sum of all elements of 2D vector
*/
template <typename T>
T sum(const std::vector<std::valarray<T>> &A) {
T cur_sum = 0; // Initially sum is zero
for (const auto &a : A) { // For every row in A
cur_sum += a.sum(); // Add sum of that row to current sum
}
return cur_sum; // Return sum
}
/**
* Function to get shape of given 2D vector
* @tparam T typename of the vector
* @param A 2D vector for which shape is required
* @return shape as pair
*/
template <typename T>
std::pair<size_t, size_t> get_shape(const std::vector<std::valarray<T>> &A) {
const size_t sub_size = (*A.begin()).size();
for (const auto &a : A) {
// If supplied vector don't have same shape in all rows
if (a.size() != sub_size) {
std::cerr << "ERROR (" << __func__ << ") : ";
std::cerr << "Supplied vector is not 2D Matrix" << std::endl;
std::exit(EXIT_FAILURE);
}
}
return std::make_pair(A.size(), sub_size); // Return shape as pair
}
/**
* Function to scale given 3D vector using min-max scaler
* @tparam T typename of the vector
* @param A 3D vector which will be scaled
* @param low new minimum value
* @param high new maximum value
* @return new scaled 3D vector
*/
template <typename T>
std::vector<std::vector<std::valarray<T>>> minmax_scaler(
const std::vector<std::vector<std::valarray<T>>> &A, const T &low,
const T &high) {
std::vector<std::vector<std::valarray<T>>> B =
A; // Copying into new vector B
const auto shape = get_shape(B[0]); // Storing shape of B's every element
// As this function is used for scaling training data vector should be of
// shape (1, X)
if (shape.first != 1) {
std::cerr << "ERROR (" << __func__ << ") : ";
std::cerr
<< "Supplied vector is not supported for minmax scaling, shape: ";
std::cerr << shape << std::endl;
std::exit(EXIT_FAILURE);
}
for (size_t i = 0; i < shape.second; i++) {
T min = B[0][0][i], max = B[0][0][i];
for (size_t j = 0; j < B.size(); j++) {
// Updating minimum and maximum values
min = std::min(min, B[j][0][i]);
max = std::max(max, B[j][0][i]);
}
for (size_t j = 0; j < B.size(); j++) {
// Applying min-max scaler formula
B[j][0][i] =
((B[j][0][i] - min) / (max - min)) * (high - low) + low;
}
}
return B; // Return new resultant 3D vector
}
/**
* Function to get index of maximum element in 2D vector
* @tparam T typename of the vector
* @param A 2D vector for which maximum index is required
* @return index of maximum element
*/
template <typename T>
size_t argmax(const std::vector<std::valarray<T>> &A) {
const auto shape = get_shape(A);
// As this function is used on predicted (or target) vector, shape should be
// (1, X)
if (shape.first != 1) {
std::cerr << "ERROR (" << __func__ << ") : ";
std::cerr << "Supplied vector is ineligible for argmax" << std::endl;
std::exit(EXIT_FAILURE);
}
// Return distance of max element from first element (i.e. index)
return std::distance(std::begin(A[0]),
std::max_element(std::begin(A[0]), std::end(A[0])));
}
/**
* Function which applys supplied function to every element of 2D vector
* @tparam T typename of the vector
* @param A 2D vector on which function will be applied
* @param func Function to be applied
* @return new resultant vector
*/
template <typename T>
std::vector<std::valarray<T>> apply_function(
const std::vector<std::valarray<T>> &A, T (*func)(const T &)) {
std::vector<std::valarray<double>> B =
A; // New vector to store resultant vector
for (auto &b : B) { // For every row in vector
b = b.apply(func); // Apply function to that row
}
return B; // Return new resultant 2D vector
}
/**
* Overloaded operator "*" to multiply given 2D vector with scaler
* @tparam T typename of both vector and the scaler
* @param A 2D vector to which scaler will be multiplied
* @param val Scaler value which will be multiplied
* @return new resultant vector
*/
template <typename T>
std::vector<std::valarray<T>> operator*(const std::vector<std::valarray<T>> &A,
const T &val) {
std::vector<std::valarray<double>> B =
A; // New vector to store resultant vector
for (auto &b : B) { // For every row in vector
b = b * val; // Multiply row with scaler
}
return B; // Return new resultant 2D vector
}
/**
* Overloaded operator "/" to divide given 2D vector with scaler
* @tparam T typename of the vector and the scaler
* @param A 2D vector to which scaler will be divided
* @param val Scaler value which will be divided
* @return new resultant vector
*/
template <typename T>
std::vector<std::valarray<T>> operator/(const std::vector<std::valarray<T>> &A,
const T &val) {
std::vector<std::valarray<double>> B =
A; // New vector to store resultant vector
for (auto &b : B) { // For every row in vector
b = b / val; // Divide row with scaler
}
return B; // Return new resultant 2D vector
}
/**
* Function to get transpose of 2D vector
* @tparam T typename of the vector
* @param A 2D vector which will be transposed
* @return new resultant vector
*/
template <typename T>
std::vector<std::valarray<T>> transpose(
const std::vector<std::valarray<T>> &A) {
const auto shape = get_shape(A); // Current shape of vector
std::vector<std::valarray<T>> B; // New vector to store result
// Storing transpose values of A in B
for (size_t j = 0; j < shape.second; j++) {
std::valarray<T> row;
row.resize(shape.first);
for (size_t i = 0; i < shape.first; i++) {
row[i] = A[i][j];
}
B.push_back(row);
}
return B; // Return new resultant 2D vector
}
/**
* Overloaded operator "+" to add two 2D vectors
* @tparam T typename of the vector
* @param A First 2D vector
* @param B Second 2D vector
* @return new resultant vector
*/
template <typename T>
std::vector<std::valarray<T>> operator+(
const std::vector<std::valarray<T>> &A,
const std::vector<std::valarray<T>> &B) {
const auto shape_a = get_shape(A);
const auto shape_b = get_shape(B);
// If vectors don't have equal shape
if (shape_a.first != shape_b.first || shape_a.second != shape_b.second) {
std::cerr << "ERROR (" << __func__ << ") : ";
std::cerr << "Supplied vectors have different shapes ";
std::cerr << shape_a << " and " << shape_b << std::endl;
std::exit(EXIT_FAILURE);
}
std::vector<std::valarray<T>> C;
for (size_t i = 0; i < A.size(); i++) { // For every row
C.push_back(A[i] + B[i]); // Elementwise addition
}
return C; // Return new resultant 2D vector
}
/**
* Overloaded operator "-" to add subtract 2D vectors
* @tparam T typename of the vector
* @param A First 2D vector
* @param B Second 2D vector
* @return new resultant vector
*/
template <typename T>
std::vector<std::valarray<T>> operator-(
const std::vector<std::valarray<T>> &A,
const std::vector<std::valarray<T>> &B) {
const auto shape_a = get_shape(A);
const auto shape_b = get_shape(B);
// If vectors don't have equal shape
if (shape_a.first != shape_b.first || shape_a.second != shape_b.second) {
std::cerr << "ERROR (" << __func__ << ") : ";
std::cerr << "Supplied vectors have different shapes ";
std::cerr << shape_a << " and " << shape_b << std::endl;
std::exit(EXIT_FAILURE);
}
std::vector<std::valarray<T>> C; // Vector to store result
for (size_t i = 0; i < A.size(); i++) { // For every row
C.push_back(A[i] - B[i]); // Elementwise substraction
}
return C; // Return new resultant 2D vector
}
/**
* Function to multiply two 2D vectors
* @tparam T typename of the vector
* @param A First 2D vector
* @param B Second 2D vector
* @return new resultant vector
*/
template <typename T>
std::vector<std::valarray<T>> multiply(const std::vector<std::valarray<T>> &A,
const std::vector<std::valarray<T>> &B) {
const auto shape_a = get_shape(A);
const auto shape_b = get_shape(B);
// If vectors are not eligible for multiplication
if (shape_a.second != shape_b.first) {
std::cerr << "ERROR (" << __func__ << ") : ";
std::cerr << "Vectors are not eligible for multiplication ";
std::cerr << shape_a << " and " << shape_b << std::endl;
std::exit(EXIT_FAILURE);
}
std::vector<std::valarray<T>> C; // Vector to store result
// Normal matrix multiplication
for (size_t i = 0; i < shape_a.first; i++) {
std::valarray<T> row;
row.resize(shape_b.second);
for (size_t j = 0; j < shape_b.second; j++) {
for (size_t k = 0; k < shape_a.second; k++) {
row[j] += A[i][k] * B[k][j];
}
}
C.push_back(row);
}
return C; // Return new resultant 2D vector
}
/**
* Function to get hadamard product of two 2D vectors
* @tparam T typename of the vector
* @param A First 2D vector
* @param B Second 2D vector
* @return new resultant vector
*/
template <typename T>
std::vector<std::valarray<T>> hadamard_product(
const std::vector<std::valarray<T>> &A,
const std::vector<std::valarray<T>> &B) {
const auto shape_a = get_shape(A);
const auto shape_b = get_shape(B);
// If vectors are not eligible for hadamard product
if (shape_a.first != shape_b.first || shape_a.second != shape_b.second) {
std::cerr << "ERROR (" << __func__ << ") : ";
std::cerr << "Vectors have different shapes ";
std::cerr << shape_a << " and " << shape_b << std::endl;
std::exit(EXIT_FAILURE);
}
std::vector<std::valarray<T>> C; // Vector to store result
for (size_t i = 0; i < A.size(); i++) {
C.push_back(A[i] * B[i]); // Elementwise multiplication
}
return C; // Return new resultant 2D vector
}
} // namespace machine_learning
#endif
| C++ | 4 | icbdubey/C-Plus-Plus | machine_learning/vector_ops.hpp | [
"MIT"
] |
extends Test
var _do_raycasts = false
func _ready():
yield(start_timer(0.5), "timeout")
if is_timer_canceled():
return
_do_raycasts = true
func _physics_process(_delta):
if not _do_raycasts:
return
_do_raycasts = false
Log.print_log("* Start Raycasting...")
clear_drawn_nodes()
for node in $Shapes.get_children():
var body = node as PhysicsBody2D
var space_state = body.get_world_2d().direct_space_state
var body_name = String(body.name).substr("RigidBody".length())
Log.print_log("* Testing: %s" % body_name)
var center = body.position
# Raycast entering from the top.
var res = _add_raycast(space_state, center - Vector2(0, 100), center)
Log.print_log("Raycast in: %s" % ("HIT" if res else "NO HIT"))
# Raycast exiting from inside.
center.x -= 20
res = _add_raycast(space_state, center, center + Vector2(0, 200))
Log.print_log("Raycast out: %s" % ("HIT" if res else "NO HIT"))
# Raycast all inside.
center.x += 40
res = _add_raycast(space_state, center, center + Vector2(0, 40))
Log.print_log("Raycast inside: %s" % ("HIT" if res else "NO HIT"))
if String(body.name).ends_with("ConcavePolygon"):
# Raycast inside an internal face.
center.x += 20
res = _add_raycast(space_state, center, center + Vector2(0, 40))
Log.print_log("Raycast inside face: %s" % ("HIT" if res else "NO HIT"))
func _add_raycast(space_state, pos_start, pos_end):
var result = space_state.intersect_ray(pos_start, pos_end)
var color
if result:
color = Color.green
else:
color = Color.red.darkened(0.5)
# Draw raycast line.
add_line(pos_start, pos_end, color)
# Draw raycast arrow.
add_line(pos_end, pos_end + Vector2(-5, -10), color)
add_line(pos_end, pos_end + Vector2(5, -10), color)
return result
| GDScript | 4 | jonbonazza/godot-demo-projects | 2d/physics_tests/tests/functional/test_raycasting.gd | [
"MIT"
] |
--TEST--
Test mail() function : basic functionality
--INI--
sendmail_path={MAIL:mailBasic.out}
mail.add_x_header = Off
--FILE--
<?php
echo "*** Testing mail() : basic functionality ***\n";
// Initialise all required variables
$to = '[email protected]';
$subject = 'Test Subject';
$message = 'A Message';
$additional_headers = 'KHeaders';
$outFile = "mailBasic.out";
@unlink($outFile);
echo "-- All Mail Content Parameters --\n";
// Calling mail() with all additional headers
var_dump( mail($to, $subject, $message, $additional_headers) );
echo file_get_contents($outFile);
unlink($outFile);
echo "\n-- Mandatory Parameters --\n";
// Calling mail() with mandatory arguments
var_dump( mail($to, $subject, $message) );
echo file_get_contents($outFile);
unlink($outFile);
?>
--EXPECT--
*** Testing mail() : basic functionality ***
-- All Mail Content Parameters --
bool(true)
To: [email protected]
Subject: Test Subject
KHeaders
A Message
-- Mandatory Parameters --
bool(true)
To: [email protected]
Subject: Test Subject
A Message
| PHP | 4 | NathanFreeman/php-src | ext/standard/tests/mail/mail_basic.phpt | [
"PHP-3.01"
] |
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.monaco-workbench .notifications-list-container .notification-list-item .notification-list-item-toolbar-container .action-item,
.monaco-workbench > .notifications-center > .notifications-center-header > .notifications-center-header-toolbar .action-item {
margin-right: 4px;
}
.monaco-workbench .notifications-list-container .notification-list-item .notification-list-item-toolbar-container .action-item:first-child,
.monaco-workbench > .notifications-center > .notifications-center-header > .notifications-center-header-toolbar .action-item:first-child {
margin-left: 4px;
}
| CSS | 2 | sbj42/vscode | src/vs/workbench/browser/parts/notifications/media/notificationsActions.css | [
"MIT"
] |
# Makefile for gzip (GNU zip) -*- Indented-Text -*-
# Copyright (C) 1992-1993 Jean-loup Gailly and the Free Software Foundation
# VMS version made by Klaus Reimann <[email protected]>,
# revised by Roland B Roberts <[email protected]>
# and Karl-Jose Filler <[email protected]>
# This version is for VAXC with MMS.
# After constructing gzip.exe with this Makefile, you should set up
# symbols for gzip.exe. Edit the example below, changing
# "disk:[directory]" as appropriate.
#
# $ gzip == "$disk:[directory]gzip.exe"
# $ gunzip == "$disk:[directory]gunzip.exe"
# $ zcat == "$disk:[directory]zcat.exe"
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#### Start of system configuration section. ####
CC = cc
LINK = link
CFLAGS =
# CFLAGS = /warning
LDFLAGS =
# Things you might add to DEFS
# -DDIRENT Use <dirent.h> for recursion (-r)
# -DSYSDIR Use <sys/dir.h> for recursion (-r)
# -DSYSNDIR Use <sys/ndir.h> for recursion (-r)
# -DNDIR Use <ndir.h> for recursion (-r)
# -DSTDC_HEADERS Use <stdlib.h>
# -DHAVE_UNISTD_H Use <unistd.h>
# -DNO_UTIME_H Don't use <utime.h>
# -DHAVE_SYSUTIME_H Use <sys/utime.h>
# -DNO_MEMORY_H Don't use <memory.h>. Not needed if STDC_HEADERS.
# -DNO_STRING_H Use strings.h, not string.h. Not needed if STDC_HEADERS
# -DRETSIGTYPE=int Define this if signal handlers must return an int.
# -DNO_SYMLINK OS defines S_IFLNK but does not support symbolic links
# -DNO_MULTIPLE_DOTS System does not allow file names with multiple dots
# -DNO_UTIME System does not support setting file modification time
# -DNO_CHOWN System does not support setting file owner
# -DNO_DIR System does not support readdir()
# -DPROTO Force function prototypes even if __STDC__ not defined
# -DASMV Use asm version match.S
# -DMSDOS MSDOS specific
# -DOS2 OS/2 specific
# -DVAXC Vax/VMS with Vax C compiler
# -DVMS Vax/VMS with gcc
# -DDEBUG Debug code
# -DDYN_ALLOC Use dynamic allocation of large data structures
# -DMAXSEG_64K Maximum array size is 64K (for 16 bit system)
# -DRECORD_IO read() and write() are rounded to record sizes.
# -DNO_STDIN_FSTAT fstat() is not available on stdin
# -DNO_SIZE_CHECK stat() does not give a reliable file size
# DEFS = /define=(VAXC)
DEFS =
LIBS =
X=.exe
O=.obj
# additional assembly sources for particular systems be required.
OBJA =
#### End of system configuration section. ####
OBJS = gzip.obj zip.obj deflate.obj trees.obj bits.obj unzip.obj inflate.obj \
util.obj crypt.obj lzw.obj unlzw.obj unpack.obj unlzh.obj getopt.obj \
vms.obj $(OBJA)
# --- rules ---
.c.obj :
define/user sys sys$library
$(CC) $* $(DEFS) $(CFLAGS)
# create sys.output
# $(CC) $* $(DEFS) $(CFLAGS)$
gzip.exe : $(OBJS)
define lnk$library sys$share:vaxcrtl
$(LINK) $(LDFLAGS) /exec=gzip $+
#
# Create a hard link. To remove both files, use "make clean". Using a hard
# link saves disk space, by the way. Note, however, that copying a hard link
# copies the data, not just the link. Therefore, set up the link in the
# directory in which the executable is to reside, or else rename (move) the
# executables into the directory.
#
set file/enter=gunzip.exe gzip.exe
set file/enter=zcat.exe gzip.exe
clean :
set file/remove gunzip.exe;0
set file/remove zcat.exe;0
delete gzip.exe;0
delete *.obj;0
# Actual build-related targets
gzip.obj zip.obj deflate.obj trees.obj bits.obj unzip.obj inflate.obj : gzip.h tailor.h
util.obj lzw.obj unlzw.obj unpack.obj unlzh.obj crypt.obj : gzip.h tailor.h
gzip.obj unlzw.obj : revision.h lzw.h
bits.obj unzip.obj util.obj zip.obj : crypt.h
gzip.obj getopt.obj : getopt.h
| Module Management System | 4 | GYJQTYL2/DoubleTake | tests/realapplications/bugbench/gzip-1.2.4/otherstuff/vms/Makefile.mms | [
"MIT"
] |
/* #docregion */
.cross-validation-error input {
border-left: 5px solid #a94442;
}
| CSS | 2 | John-Cassidy/angular | aio/content/examples/form-validation/src/app/template/hero-form-template.component.css | [
"MIT"
] |
###
Public: DraftStoreExtension is deprecated. Use {ComposerExtension} instead.
Section: Extensions
###
class DraftStoreExtension
module.exports = DraftStoreExtension
| CoffeeScript | 1 | cnheider/nylas-mail | packages/client-app/src/flux/stores/draft-store-extension.coffee | [
"MIT"
] |
github "CanyFrog/HIComponents" "HQFoundation.2018.6.16" | Self | 3 | CanyFrog/HIComponents | HQKit/Cartfile.self | [
"MIT"
] |
[Exposed=Window]
interface MutationRecord {
readonly attribute DOMString type;
[SameObject] readonly attribute Node target;
[SameObject] readonly attribute NodeList addedNodes;
[SameObject] readonly attribute NodeList removedNodes;
readonly attribute Node? previousSibling;
readonly attribute Node? nextSibling;
readonly attribute DOMString? attributeName;
readonly attribute DOMString? attributeNamespace;
readonly attribute DOMString? oldValue;
};
| WebIDL | 4 | Unique184/jsdom | lib/jsdom/living/mutation-observer/MutationRecord.webidl | [
"MIT"
] |
--TEST--
Bug #53437 (Crash when using unserialized DatePeriod instance), variation 2
--FILE--
<?php
$s = 'O:10:"DatePeriod":0:{}';
$dp = unserialize($s);
var_dump($dp);
?>
==DONE==
--EXPECTF--
Fatal error: Uncaught Error: Invalid serialization data for DatePeriod object in %sbug53437_var1.php:%d
Stack trace:
#0 [internal function]: DatePeriod->__wakeup()
#1 %sbug53437_var1.php(%d): unserialize('O:10:"DatePerio...')
#2 {main}
thrown in %sbug53437_var1.php on line %d
| PHP | 2 | thiagooak/php-src | ext/date/tests/bug53437_var1.phpt | [
"PHP-3.01"
] |
" Vim filetype plugin file
" Language: Mathematica
" Maintainer: Ian Ford <[email protected]>
" Last Change: 22 January 2019
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
finish
endif
" Don't load another plugin for this buffer
let b:did_ftplugin = 1
let b:undo_ftplugin = "setlocal commentstring<"
setlocal commentstring=\(*%s*\)
| VimL | 4 | uga-rosa/neovim | runtime/ftplugin/mma.vim | [
"Vim"
] |
D:/gitee/tmp/tinyriscv/tests/riscv-compliance/build_generated/rv32Zicsr/I-CSRRW-01.elf: file format elf32-littleriscv
Disassembly of section .text.init:
00000000 <_start>:
0: 04c0006f j 4c <reset_vector>
00000004 <trap_vector>:
4: 34202f73 csrr t5,mcause
8: 00800f93 li t6,8
c: 03ff0a63 beq t5,t6,40 <write_tohost>
10: 00900f93 li t6,9
14: 03ff0663 beq t5,t6,40 <write_tohost>
18: 00b00f93 li t6,11
1c: 03ff0263 beq t5,t6,40 <write_tohost>
20: 00000f17 auipc t5,0x0
24: fe0f0f13 addi t5,t5,-32 # 0 <_start>
28: 000f0463 beqz t5,30 <trap_vector+0x2c>
2c: 000f0067 jr t5
30: 34202f73 csrr t5,mcause
34: 000f5463 bgez t5,3c <handle_exception>
38: 0040006f j 3c <handle_exception>
0000003c <handle_exception>:
3c: 5391e193 ori gp,gp,1337
00000040 <write_tohost>:
40: 00001f17 auipc t5,0x1
44: fc3f2023 sw gp,-64(t5) # 1000 <tohost>
48: ff9ff06f j 40 <write_tohost>
0000004c <reset_vector>:
4c: 00000193 li gp,0
50: 00000297 auipc t0,0x0
54: fb428293 addi t0,t0,-76 # 4 <trap_vector>
58: 30529073 csrw mtvec,t0
5c: 30005073 csrwi mstatus,0
60: 00000297 auipc t0,0x0
64: 02028293 addi t0,t0,32 # 80 <begin_testcode>
68: 34129073 csrw mepc,t0
6c: 00000293 li t0,0
70: 10000337 lui t1,0x10000
74: 01030313 addi t1,t1,16 # 10000010 <_end+0xfffde0c>
78: 00532023 sw t0,0(t1)
7c: 30200073 mret
00000080 <begin_testcode>:
80: 00002797 auipc a5,0x2
84: f8078793 addi a5,a5,-128 # 2000 <begin_signature>
88: 00100093 li ra,1
8c: 00000193 li gp,0
90: fff00293 li t0,-1
94: 80000db7 lui s11,0x80000
98: fffd8d93 addi s11,s11,-1 # 7fffffff <_end+0x7fffddfb>
9c: 80000eb7 lui t4,0x80000
a0: 34001073 csrw mscratch,zero
a4: 34009173 csrrw sp,mscratch,ra
a8: 34019273 csrrw tp,mscratch,gp
ac: 34029373 csrrw t1,mscratch,t0
b0: 340d9e73 csrrw t3,mscratch,s11
b4: 340e9f73 csrrw t5,mscratch,t4
b8: 34001ff3 csrrw t6,mscratch,zero
bc: 0027a023 sw sp,0(a5)
c0: 0047a223 sw tp,4(a5)
c4: 0067a423 sw t1,8(a5)
c8: 01c7a623 sw t3,12(a5)
cc: 01e7a823 sw t5,16(a5)
d0: 01f7aa23 sw t6,20(a5)
d4: 00002d17 auipc s10,0x2
d8: f44d0d13 addi s10,s10,-188 # 2018 <test_B_res>
dc: 123450b7 lui ra,0x12345
e0: 67808093 addi ra,ra,1656 # 12345678 <_end+0x12343474>
e4: 9abce137 lui sp,0x9abce
e8: ef010113 addi sp,sp,-272 # 9abcdef0 <_end+0x9abcbcec>
ec: 34009073 csrw mscratch,ra
f0: 340111f3 csrrw gp,mscratch,sp
f4: 34019273 csrrw tp,mscratch,gp
f8: 340212f3 csrrw t0,mscratch,tp
fc: 34001373 csrrw t1,mscratch,zero
100: 003d2023 sw gp,0(s10)
104: 004d2223 sw tp,4(s10)
108: 005d2423 sw t0,8(s10)
10c: 006d2623 sw t1,12(s10)
110: 00002097 auipc ra,0x2
114: f1808093 addi ra,ra,-232 # 2028 <test_C_res>
118: 42727137 lui sp,0x42727
11c: e6f10113 addi sp,sp,-401 # 42726e6f <_end+0x42724c6b>
120: 34011073 csrw mscratch,sp
124: 34001073 csrw mscratch,zero
128: 0000a023 sw zero,0(ra)
12c: 00002117 auipc sp,0x2
130: f0010113 addi sp,sp,-256 # 202c <test_D_res>
134: f7ff9db7 lui s11,0xf7ff9
138: 818d8d93 addi s11,s11,-2024 # f7ff8818 <_end+0xf7ff6614>
13c: 340d9073 csrw mscratch,s11
140: 34001073 csrw mscratch,zero
144: 34001073 csrw mscratch,zero
148: 340012f3 csrrw t0,mscratch,zero
14c: 00012023 sw zero,0(sp)
150: 00512223 sw t0,4(sp)
154: 00002117 auipc sp,0x2
158: ee010113 addi sp,sp,-288 # 2034 <test_E_res>
15c: 321653b7 lui t2,0x32165
160: 49838393 addi t2,t2,1176 # 32165498 <_end+0x32163294>
164: 14726337 lui t1,0x14726
168: 83630313 addi t1,t1,-1994 # 14725836 <_end+0x14723632>
16c: 963852b7 lui t0,0x96385
170: 27428293 addi t0,t0,628 # 96385274 <_end+0x96383070>
174: 34031073 csrw mscratch,t1
178: 340292f3 csrrw t0,mscratch,t0
17c: 340393f3 csrrw t2,mscratch,t2
180: 34001473 csrrw s0,mscratch,zero
184: 00512023 sw t0,0(sp)
188: 00712223 sw t2,4(sp)
18c: 00812423 sw s0,8(sp)
190: 00002297 auipc t0,0x2
194: e7028293 addi t0,t0,-400 # 2000 <begin_signature>
198: 10000337 lui t1,0x10000
19c: 00830313 addi t1,t1,8 # 10000008 <_end+0xfffde04>
1a0: 00532023 sw t0,0(t1)
1a4: 00002297 auipc t0,0x2
1a8: e9c28293 addi t0,t0,-356 # 2040 <end_signature>
1ac: 10000337 lui t1,0x10000
1b0: 00c30313 addi t1,t1,12 # 1000000c <_end+0xfffde08>
1b4: 00532023 sw t0,0(t1)
1b8: 00100293 li t0,1
1bc: 10000337 lui t1,0x10000
1c0: 01030313 addi t1,t1,16 # 10000010 <_end+0xfffde0c>
1c4: 00532023 sw t0,0(t1)
1c8: 00000013 nop
1cc: 00100193 li gp,1
1d0: 00000073 ecall
000001d4 <end_testcode>:
1d4: c0001073 unimp
...
Disassembly of section .tohost:
00001000 <tohost>:
...
00001100 <fromhost>:
...
Disassembly of section .data:
00002000 <begin_signature>:
2000: ffff 0xffff
2002: ffff 0xffff
2004: ffff 0xffff
2006: ffff 0xffff
2008: ffff 0xffff
200a: ffff 0xffff
200c: ffff 0xffff
200e: ffff 0xffff
2010: ffff 0xffff
2012: ffff 0xffff
2014: ffff 0xffff
2016: ffff 0xffff
00002018 <test_B_res>:
2018: ffff 0xffff
201a: ffff 0xffff
201c: ffff 0xffff
201e: ffff 0xffff
2020: ffff 0xffff
2022: ffff 0xffff
2024: ffff 0xffff
2026: ffff 0xffff
00002028 <test_C_res>:
2028: ffff 0xffff
202a: ffff 0xffff
0000202c <test_D_res>:
202c: ffff 0xffff
202e: ffff 0xffff
2030: ffff 0xffff
2032: ffff 0xffff
00002034 <test_E_res>:
2034: ffff 0xffff
2036: ffff 0xffff
2038: ffff 0xffff
203a: ffff 0xffff
203c: ffff 0xffff
203e: ffff 0xffff
00002040 <end_signature>:
...
00002100 <begin_regstate>:
2100: 0080 addi s0,sp,64
...
00002200 <end_regstate>:
2200: 0004 0x4
...
| ObjDump | 2 | DuBirdFly/TinyRISCV_Learn | tests/riscv-compliance/build_generated/rv32Zicsr/I-CSRRW-01.elf.objdump | [
"Apache-2.0"
] |
# Copyright (c) 1997- .SE (The Internet Infrastructure Foundation).
# All rights reserved.
# The information obtained through searches, or otherwise, is protected
# by the Swedish Copyright Act (1960:729) and international conventions.
# It is also subject to database protection according to the Swedish
# Copyright Act.
# Any use of this material to target advertising or
# similar activities is forbidden and will be prosecuted.
# If any of the information below is transferred to a third
# party, it must be done in its entirety. This server must
# not be used as a backend for a search engine.
# Result of search for registered domain names under
# the .nu top level domain.
# The data is in the UTF-8 character set and the result is
# printed with eight bits.
state: active
domain: xn--alliancefranaise-npb.nu (alliancefrançaise.nu)
holder: qi9c3zbvhr
admin-c: qi9c3zbvhr
tech-c: qi9c3zbvhr
billing-c: qi9c3zbvhr
created: 2010-03-02
modified: 2014-01-24
expires: 2021-06-02
nserver: ns01.hostcontrol.com
nserver: ns02.hostcontrol.com
dnssec: unsigned delegation
status: ok
registrar: Worldnames, Inc.
| Nu | 0 | joepie91/python-whois | test/data/alliancefrançaise.nu | [
"WTFPL"
] |
using Uno;
using Uno.Collections;
using Uno.Compiler.ExportTargetInterop;
using Uno.Reflection;
using Outracks.Simulator.Runtime;
namespace Outracks.Simulator.Client
{
using Bytecode;
extern(CPLUSPLUS && REFLECTION) internal static class ReflectionExtensions
{
static readonly string PropGetPrefix = "get_";
static readonly string PropSetPrefix = "set_";
static readonly string EventAdderPrefix = "add_";
static readonly string EventRemovePrefix = "remove_";
static readonly TypeMemberName ConstructorName = new TypeMemberName(".ctor");
public static Type[] GetTypes(this object[] objects)
{
if (objects == null)
return null;
var types = new Type[objects.Length];
for (int i = 0; i < objects.Length; i++)
types[i] = objects[i].GetType();
return types;
}
public static Type[] FindTypes(this TypeName[] typeName)
{
var types = new Type[typeName.Length];
for (int i = 0; i < typeName.Length; i++)
types[i] = typeName[i].FindType();
return types;
}
public static Type FindType(this TypeName typeName)
{
return ReflectionCache.GetType(typeName) ?? Type.GetType(typeName.FullName, true);
}
public static CppFunction FindConstructor(this Type type, params Type[] paramTypes)
{
return type.FindFunction(ConstructorName, paramTypes);
}
public static CppFunction FindPropertyGetter(this Type type, TypeMemberName typeMemberName)
{
var getterName = new TypeMemberName(PropGetPrefix + typeMemberName.Name);
return type.FindFunction(getterName);
}
public static CppFunction FindPropertySetter(this Type type, TypeMemberName typeMemberName, Type argType)
{
var setterName = new TypeMemberName(PropSetPrefix + typeMemberName.Name);
return type.FindFunction(setterName, argType);
}
public static CppFunction FindEventAddFunction(this Type type, TypeMemberName typeMemberName, object delegateObj)
{
var eventAddName = new TypeMemberName(EventAdderPrefix + typeMemberName.Name);
return type.FindFunction(eventAddName, delegateObj.GetType());
}
public static CppFunction FindEventRemoveFunction(this Type type, TypeMemberName typeMemberName, object delegateObj)
{
var eventRemoveName = new TypeMemberName(EventRemovePrefix + typeMemberName.Name);
return type.FindFunction(eventRemoveName, delegateObj.GetType());
}
public static CppField FindField(this Type type, TypeMemberName fieldName)
{
var fields = ReflectionCache.GetFields(type);
for (int i = 0; i < fields.Length; i++)
{
var f = fields[i];
if (f.Name == fieldName.Name)
return f;
}
return CppField.Null;
}
public static Type[] GetParameterTypes(this Signature methodSignature)
{
var parameters = methodSignature.Parameters;
var types = new Type[parameters.Count];
for (int i = 0; i < parameters.Count; i++)
{
types[i] = parameters[i].Type.FindType();
}
return types;
}
public static CppFunction FindFunction(this Type type, TypeMemberName memberName, params Type[] paramTypes)
{
return FindFunctionOverload(FindFunctionsByName(type, memberName), paramTypes);
}
static CppFunction FindFunctionOverload(CppFunction[] functions, Type[] paramTypes)
{
for (int i = 0; i < functions.Length; i++)
{
if (CheckArgumentTypes(functions[i].ParameterTypes, paramTypes))
return functions[i];
}
return CppFunction.Null;
}
static bool CheckArgumentTypes(Type[] paramTypes, Type[] argumentTypes)
{
if (paramTypes.Length != argumentTypes.Length)
return false;
for (int i = 0; i < paramTypes.Length; i++)
{
var param = paramTypes[i];
var arg = argumentTypes[i];
if (!arg.IsSubclassOf(param))
return false;
}
return true;
}
static CppFunction[] FindFunctionsByName(Type type, TypeMemberName memberName)
{
var name = memberName.Name;
var functions = ReflectionCache.GetFunctions(type);
var matchingFunctions = new List<CppFunction>();
for (int i = 0; i < functions.Length; i++)
{
if (functions[i].Name == name)
matchingFunctions.Add(functions[i]);
}
return matchingFunctions.ToArray();
}
}
}
| Uno | 4 | mortend/fuse-studio | Source/Preview/Core/Reflection/ReflectionExtensions.uno | [
"MIT"
] |
# Copyright (c) 2018-2021, Carnegie Mellon University
# See LICENSE for details
Declare(ISA_Bridge);
IsISABridge := (obj) -> IsRec(obj) and IsBound(obj._ISABridge) and obj._ISABridge=true;
#F VCvt(<n>, <ISA_Bridge>)
#F data type conversion from one ISA into another.
#F
# OBSOLETE, will be removed
Class(VCvt, TCast, rec(
abbrevs := [],
def := (n, brige) -> Perm((), n),
dmn := self >> [ TArray(self.params[2].isa_from.gt(), self._spl().dims()[2]) ],
rng := self >> [ TArray(self.params[2].isa_to.gt(), self._spl().dims()[1]) ],
toAMat := self >> self._spl().toAMat(),
_spl := self >> self.params[2].splVCvt(self.params[1]),
));
Class(Cvt, SumsBase, Sym, rec(
abbrevs := [ (isa_bridge) -> Checked(IsISABridge(isa_bridge), [isa_bridge]) ],
def := (isa_bridge) -> Perm((), isa_bridge.granularity()),
n := self >> self.params[1].granularity(),
isa_to := self >> self.params[1].isa_to,
isa_from := self >> self.params[1].isa_from,
dmn := self >> [ TArray(self.isa_from().t.base_t(), self.n()) ],
rng := self >> [ TArray(self.isa_to().t.base_t(), self.n()) ],
isPermutation := False,
toAMat := self >> self.params[1].toAMat(),
#doNotMeasure := true
));
Class(TCvt, Tagged_tSPL, rec(
abbrevs := [
(n, isa_to, isa_from) -> Checked(IsPosIntSym(n), IsISA(isa_to), IsISA(isa_from), [n, isa_to, isa_from, []]),
(n, isa_to, isa_from, props) -> Checked(IsPosIntSym(n), IsISA(isa_to), IsISA(isa_from), IsList(props), [n, isa_to, isa_from, props]),
],
#def := (n, isa_to, isa_from) -> Perm((), n),
n := self >> self.params[1],
isa_to := self >> self.params[2],
isa_from := self >> self.params[3],
props := self >> self.params[4],
dmn := self >> [ TArray(self.isa_from().t.base_t(), self.n()) ],
rng := self >> [ TArray(self.isa_to().t.base_t(), self.n()) ],
toAMat := self >> I(self.n()).toAMat(),
isReal := self >> true,
isAuxNonTerminal := true,
hashAs := self >> ObjId(self)(8*Lcm(self.isa_to().v, self.isa_from().v), self.isa_to(), self.isa_from(), self.props()).takeTA(self),
));
#
# ISA_Bridge: represents conversion from one SIMD_ISA to another.
# Each descendant implements particular conversion case and registered in
# the ISA_Bridge object by [source ISA, destination ISA] pair.
#
# <props> field
# "wraparound" | "saturation"
# "trunc" | "round" | "ceil" | "floor"
Class(ISA_Bridge, rec(
_ISABridge := true,
_table := rec(),
__call__ := meth(self)
local inst;
inst := WithBases(self);
if not IsBound(self._table.(inst.isa_from.id())) then
self._table.(inst.isa_from.id()) := rec();
fi;
if not IsBound(self._table.(inst.isa_from.id()).(inst.isa_to.id())) then
self._table.(inst.isa_from.id()).(inst.isa_to.id()) := [];
fi;
Add(self._table.(inst.isa_from.id()).(inst.isa_to.id()), inst);
return inst;
end,
add := (self, class) >> class(),
printAvailableBridges := meth(self)
local all;
all := Flat(List(UserRecValues(self._table), r -> UserRecValues(r)));
Sort(all, (a,b) -> let(a1 := StringPrint(a.isa_from), b1 := StringPrint(b.isa_from), When(a1=b1, StringPrint(a.isa_to)<StringPrint(b.isa_to), a1<b1)));
Print(PrintPad("From", 27), PrintPad("To", 27), "Props\n", Replicate(60, '-'), "\n");
DoForAll(all, e -> Print(PrintPad(StringPrint(e.isa_from), 26), " ", PrintPad(StringPrint(e.isa_to), 26), " ", e.props, "\n"));
end,
_applicable_cvt := (props, min_range, range_in, bridge) -> let(
range_from := bridge.isa_from.t.range(),
range_to := bridge.isa_to.t.range(),
range_mid := bridge.range(),
range := Cond( range_in=false, range_from, range_from * range_in),
range_req := Cond( range_in=false, min_range, min_range * range_in),
range_mul := range_to * range_mid * range_from,
class_range := Cond( range.min >= range_to.min and range.max <= range_to.max and
range.min >= range_mid.min and range.max <= range_mid.max, [], ["saturation", "wraparound"]),
class_prec := Cond( range_from.eps = range_to.eps and range_from.eps = range_mid.eps, [], ["round", "trunc", "ceil", "floor"]),
bridge_class_range := Intersection(class_range, props),
bridge_class_prec := Intersection(class_prec, props),
Intersection(bridge_class_range, bridge.props) = bridge_class_range
and Intersection(bridge_class_prec, bridge.props) = bridge_class_prec
and range_mul.min <= range_req.min and range_mul.max >= range_req.max
and range_mul.eps <= range_req.eps
),
# bridge: returns ISA_Bridge objects list which implement conversion from isa_from to isa_to
find := (arg) >> let(
self := arg[1],
isa_to := arg[2],
isa_from := arg[3],
props := arg[4],
min_range:= Cond( Length(arg)>4, arg[5], isa_to.t.range() * isa_from.t.range() ),
range_in := Cond( Length(arg)>5, arg[6], isa_from.t.range()),
Cond( IsBound(self._table.(isa_from.id())) and IsBound(self._table.(isa_from.id()).(isa_to.id())),
Filtered(self._table.(isa_from.id()).(isa_to.id()),
e -> self._applicable_cvt(props, min_range, range_in, e)),
[] )
),
#######################
# descendants should define the fields listed below.
# isa_from: source SIMD_ISA
isa_from := false,
# isa_to: destination SIMD_ISA
isa_to := false,
# minimal range
range := (self) >> self.isa_to.t.range() * self.isa_to.t.range(),
# NOTE: bridge conversion properties, explain
# For example float-to-int conversion can be implemented with different rounding methods bla bla bla
props := [],
# code(<y>, <x>, <opts>): called from codegen to get code that implements Cvt(...);
code := (self, y, x, opts) >> Error("not implemented"),
# granularity: Cvt object height and width (which are the same).
granularity := self >> Lcm(self.isa_to.v, self.isa_from.v),
# toAMat: implements Cvt.toAMat()
toAMat := abstract(),
# toSpl: conversion block formula NOTE: explain
toSpl := abstract(),
##############################################
# helpers
_x := (self, x, offs) >> vtref(self.isa_from.t, x, offs),
_y := (self, y, offs) >> vtref(self.isa_to.t, y, offs),
_mkTL := meth(self, isa, n, s)
local t, hentry, sums;
t := TL(n, s).withTags(isa.getTags());
hentry := HashLookup(SIMD_ISA_DB.getHash(), t);
if hentry=false then
#return Error("SIMD_ISA_DB lookup failed, tried ", t);
return Prm(L(n, s));
else
sums := _SPLRuleTree(hentry[1].ruletree).sums();
sums := When(IsBound(sums.unroll), sums.unroll(), sums);
return sums;
fi;
end,
));
# ISA_Bridge base class for bridges for which Cvt object is identity
Class(ISA_Bridge_I, ISA_Bridge, rec(
toAMat := (self) >> I(self.granularity()).toAMat(),
toSpl := (self) >> Cvt(self),
));
Class(ISA_Bridge_VvL, ISA_Bridge, rec(
toAMat := (self) >> L(self.granularity(), self.isa_from.v).toAMat(),
toSpl := (self) >> Cvt(self)*self._mkTL(self.isa_to, self.granularity(), div(self.granularity(), self.isa_from.v)),
));
Class(ISA_Bridge_VvR, ISA_Bridge, rec(
toAMat := (self) >> L(self.granularity(), self.isa_from.v).toAMat(),
toSpl := (self) >> self._mkTL(self.isa_to, self.granularity(), div(self.granularity(), self.isa_from.v)) * Cvt(self),
));
# plain conversion from one scalar data type to another,
# assuming isa_to type range includes isa_from type range
Class(ISA_Bridge_tcast, ISA_Bridge_I, rec(
code := (self, y, x, opts) >> assign( self._y(y,0), tcast(self.isa_to.t, self._x(x,0)) ),
));
# reinterpretation
Class(ISA_Bridge_wrap, ISA_Bridge_I, rec(
range := (self) >> self.isa_to.t.range(),
props := ["wraparound"],
code := (self, y, x, opts) >> assign( self._y(y,0), tcast(self.isa_to.t, self._x(x,0)) ),
));
_debug_print_cvt_chains := false;
DebugCVT := function(value)
_debug_print_cvt_chains := value;
end;
# _cvt_build_chains( <TCvt non terminal> ) returns all data conversion chains available for given
# TCvt object.
#
Declare(_cvt_build_chains_rec);
_cvt_build_chains_rec := function(chain, isa, min_range, range, props, available_isa)
local ifrom, fr, r, b, dbg_print;
ifrom := Last(chain).isa_to;
if ifrom = isa then
if _debug_print_cvt_chains then
Print(GreenStr("CVT: "), ConcatSepList(chain, e -> e.__name__, " -> "), "\n");
fi;
return [chain];
else
r := [];
fr := ConcatList( available_isa, isa -> ISA_Bridge.find( isa, ifrom, props, min_range, range ));
dbg_print := fr = [] and _debug_print_cvt_chains;
for b in fr do
Append(r, _cvt_build_chains_rec(chain :: [b], isa, min_range, b.range()*range, props, RemoveList(available_isa, b.isa_to)));
od;
fi;
if dbg_print then
Print(RedStr("Dead CVT: "), ConcatSepList(chain, e -> e.__name__, " -> "), "\n");
fi;
return r;
end;
_cvt_build_chains := function(t)
local available_isa, r, range, fr, b, min_range;
available_isa := Set(t.firstTag().params[1] :: [t.isa_from(), t.isa_to()]);#Set(RemoveList(t.firstTag().params[1], t.isa_from()) :: [t.isa_to()]);
r := [];
range := StripList(t.getA("r_in", [t.isa_from().t.range()]));
min_range := t.isa_to().t.range() * t.isa_from().t.range();
fr := ConcatList( available_isa, isa -> ISA_Bridge.find( isa, t.isa_from(), t.props(), min_range, range ));
for b in fr do
Append(r, _cvt_build_chains_rec([b], t.isa_to(), min_range, b.range()*range, t.props(), RemoveList(available_isa, b.isa_to)));
od;
return Sort(r);
end;
NewRulesFor( TCvt, rec(
TCvt_Term := rec(
forTransposition := false,
applicable := t -> t.firstTagIs(AMultiVec),
freedoms := t -> [ _cvt_build_chains(t) ],
child := (t, fr) -> [InfoNt(Reversed(fr[1]))],
apply := (self, t, C, nt) >> let(
# merge adjasent loops when possible
l := self._merge_loops(List(nt[1].params[1], b -> rec(
# NOTE: need ESReduce here to deal with symbolic expressions
# this way can figure out divisibility at least some times
its := ESReduce(div(t.n(), b.granularity()), spiral.SpiralDefaults), bridge := b
))),
Compose(List(l, e -> self._to_ISum(e)))
),
_to_ISum := (self, r) >> let(
ch := Cond( IsBound(r.bridge), [r.bridge.toSpl()], List(r.children, e -> self._to_ISum(e))),
cols := Cols(Last(ch)),
rows := Rows(ch[1]),
i := Ind(r.its),
ISum(i, Compose( [Scat(H(r.its*rows, rows, rows*i, 1))] :: ch :: [Gath(H(r.its*cols, cols, cols*i, 1))]))
),
_merge_loops := meth(self, l)
local c, e, new_ch, r;
r := [];
c := l[1];
for e in Drop(l, 1) do
if c.its <> 1 and _divides(c.its, e.its) then
new_ch := rec(its := ESReduce(div(e.its, c.its), spiral.SpiralDefaults), bridge := e.bridge);
if IsBound(c.bridge) then
# it's a single bridge, creating new node and making this one child
c := rec(
its := c.its,
children := [rec(its := 1, bridge := c.bridge), new_ch]
);
else
Add(c.children, new_ch);
fi;
elif e.its<>1 and _divides(e.its, c.its) then
new_ch := rec(its := ESReduce(div(c.its, e.its), spiral.SpiralDefaults));
if IsBound(c.bridge) then
new_ch.bridge := c.bridge;
else
new_ch.children := c.children;
fi;
c := rec(
its := e.its,
children := [new_ch, rec(its := 1, bridge := e.bridge)]
);
else
Add(r, c);
c := e;
fi;
od;
Add(r, c);
# recurse on children
return List(r, e -> Cond(IsBound(e.children), CopyFields(e, rec(children := self._merge_loops(e.children))), e));
end,
),
));
| GAP | 4 | sr7cb/spiral-software | namespaces/spiral/paradigms/vector/cvt.gi | [
"BSD-2-Clause-FreeBSD"
] |
@page :first { margin: 0 }
@page {
@top-left-corner { content: 'tlc' }
@top-left { content: 'tl' }
@top-center { content: 'tc' }
@top-right { content: 'tr' }
@top-right-corner { content: 'trc' }
@bottom-left-corner { content: 'blc' }
@bottom-left { content: 'bl' }
@bottom-center { content: 'bc' }
@bottom-right { content: 'br' }
@bottom-right-corner { content: 'brc' }
@left-top { content: 'lt' }
@left-middle { content: 'lm' }
@left-bottom { content: 'lb' }
@right-top { content: 'rt' }
@right-middle { content: 'rm' }
@right-bottom { content: 'rb' }
}
| CSS | 4 | mengxy/swc | crates/swc_css_parser/tests/fixture/esbuild/misc/VOQJsreB5pi_yJysozWgcA/input.css | [
"Apache-2.0"
] |
// no-prefer-dynamic
#![crate_type = "lib"]
#![no_std]
#![feature(lang_items)]
use core::panic::PanicInfo;
use core::sync::atomic::{self, Ordering};
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {
atomic::compiler_fence(Ordering::SeqCst);
}
}
#[lang = "eh_personality"]
fn foo() {}
| Rust | 3 | mbc-git/rust | src/test/rustdoc-ui/auxiliary/panic-item.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
#tag Class
Protected Class LocaleInformationWFS
#tag Method, Flags = &h21
Private Shared Function CommonLocaleInfoProc(idStr as String) As Boolean
dim localID as Integer
if Left( idStr, 1 ) = "0" then
localID = Val( "&h" + idStr )
else
localID = Val( idStr )
end if
sLocales.Append( new LocaleInformationWFS( localID ) )
return true
End Function
#tag EndMethod
#tag Method, Flags = &h0
Sub Constructor(localeID as Integer = - 1)
#if TargetWin32
Dim mb as new MemoryBlock( 2048 )
Dim ret as Integer
Dim retVal as String
Const LOCALE_USER_DEFAULT = &H400
if localeID = -1 then localeID = LOCALE_USER_DEFAULT
LCID = localeID
Const LOCALE_ICENTURY = &h00000024
ret = GetLocaleInfo( LOCALE_ICENTURY, mb, retVal )
UseFourDigitCentury = retVal = "1"
Const LOCALE_SENGCOUNTRY = &H1002 ' English name of country
ret = GetLocaleInfo( LOCALE_SENGCOUNTRY, mb, EnglishCountryName )
Const LOCALE_SENGLANGUAGE = &H1001 ' English name of language
ret = GetLocaleInfo( LOCALE_SENGLANGUAGE, mb, EnglishLanguageName )
Const LOCALE_SNATIVELANGNAME = &H4 ' native name of language
ret = GetLocaleInfo( LOCALE_SNATIVELANGNAME, mb, NativeLanguageName )
Const LOCALE_SNATIVECTRYNAME = &H8 ' native name of country
ret = GetLocaleInfo( LOCALE_SNATIVECTRYNAME, mb, NativeCountryName )
Const LOCALE_IDIGITS = &h0000011
ret = GetLocaleInfo( LOCALE_IDIGITS, mb, retVal )
NumberOfFractionalDigits = Val( retVal )
Const LOCALE_ILZERO = &h0000012
ret = GetLocaleInfo( LOCALE_ILZERO, mb, retVal )
UseLeadingZeros = retVal = "1"
Const LOCALE_IMEASURE = &h000000D
ret = GetLocaleInfo( LOCALE_IMEASURE, mb, retVal )
UseMetricMeasurements = retVal = "0"
Const LOCALE_ITIME = &h0000023
ret = GetLocaleInfo( LOCALE_ITIME, mb, retVal )
Use24HourClock = retVal = "1"
Const LOCALE_S1159 = &h0000028
ret = GetLocaleInfo( LOCALE_S1159, mb, Am )
Const LOCALE_S2359 = &h0000029
ret = GetLocaleInfo( LOCALE_S2359, mb, Pm )
Const LOCALE_SDAYNAME1 = 42'&h0000002A
Const LOCALE_SDAYNAME2 = &h0000002B
Const LOCALE_SDAYNAME3 = &h0000002C
Const LOCALE_SDAYNAME4 = &h0000002D
Const LOCALE_SDAYNAME5 = &h0000002E
Const LOCALE_SDAYNAME6 = &h0000002F
Const LOCALE_SDAYNAME7 = &h00000030
dim dayConst( 7 ) as Integer
dayConst = Array( LOCALE_SDAYNAME1, LOCALE_SDAYNAME2, LOCALE_SDAYNAME3, _
LOCALE_SDAYNAME4, LOCALE_SDAYNAME5, LOCALE_SDAYNAME6, LOCALE_SDAYNAME7 )
dim i as Integer
for i = 0 to 6
ret = GetLocaleInfo( dayConst( i ), mb, retVal )
DayNames.Append( retVal )
next
Const LOCALE_SABBREVDAYNAME1 = 49'&h00000031
Const LOCALE_SABBREVDAYNAME2 = &h00000032
Const LOCALE_SABBREVDAYNAME3 = &h00000033
Const LOCALE_SABBREVDAYNAME4 = &h00000034
Const LOCALE_SABBREVDAYNAME5 = &h00000035
Const LOCALE_SABBREVDAYNAME6 = &h00000036
Const LOCALE_SABBREVDAYNAME7 = &h00000037
dim dayAbbrConst( 7 ) as Integer
dayAbbrConst = Array( LOCALE_SABBREVDAYNAME1, LOCALE_SABBREVDAYNAME2, LOCALE_SABBREVDAYNAME3, _
LOCALE_SABBREVDAYNAME4, LOCALE_SABBREVDAYNAME5, LOCALE_SABBREVDAYNAME6, LOCALE_SABBREVDAYNAME7 )
for i = 0 to 6
ret = GetLocaleInfo( dayAbbrConst( i ), mb, retVal )
AbbreviatedDayNames.Append( retVal )
next
Const LOCALE_SMONTHNAME1 = 56'&h00000038
Const LOCALE_SMONTHNAME2 = &h00000039
Const LOCALE_SMONTHNAME3 = &h0000003A
Const LOCALE_SMONTHNAME4 = &h0000003B
Const LOCALE_SMONTHNAME5 = &h0000003C
Const LOCALE_SMONTHNAME6 = &h0000003D
Const LOCALE_SMONTHNAME7 = &h0000003E
Const LOCALE_SMONTHNAME8 = &h0000003F
Const LOCALE_SMONTHNAME9 = &h00000040
Const LOCALE_SMONTHNAME10 = &h00000041
Const LOCALE_SMONTHNAME11 = &h00000042
Const LOCALE_SMONTHNAME12 = &h00000043
Const LOCALE_SMONTHNAME13 = &h0000100E
dim monthConst( 13 ) as Integer
monthConst = Array( LOCALE_SMONTHNAME1, LOCALE_SMONTHNAME2, LOCALE_SMONTHNAME3, _
LOCALE_SMONTHNAME4, LOCALE_SMONTHNAME5, LOCALE_SMONTHNAME6, LOCALE_SMONTHNAME7, _
LOCALE_SMONTHNAME8, LOCALE_SMONTHNAME9, LOCALE_SMONTHNAME10, LOCALE_SMONTHNAME11, _
LOCALE_SMONTHNAME12, LOCALE_SMONTHNAME13 )
for i = 0 to 12
ret = GetLocaleInfo( monthConst( i ), mb, retVal )
MonthNames.Append( retVal )
next
Const LOCALE_SABBREVMONTHNAME1 = 68'&h00000044
Const LOCALE_SABBREVMONTHNAME2 = &h00000045
Const LOCALE_SABBREVMONTHNAME3 = &h00000046
Const LOCALE_SABBREVMONTHNAME4 = &h00000047
Const LOCALE_SABBREVMONTHNAME5 = &h00000048
Const LOCALE_SABBREVMONTHNAME6 = &h00000049
Const LOCALE_SABBREVMONTHNAME7 = &h0000004A
Const LOCALE_SABBREVMONTHNAME8 = &h0000004B
Const LOCALE_SABBREVMONTHNAME9 = &h0000004C
Const LOCALE_SABBREVMONTHNAME10 = &h0000004D
Const LOCALE_SABBREVMONTHNAME11 = &h0000004E
Const LOCALE_SABBREVMONTHNAME12 = &h0000004F
Const LOCALE_SABBREVMONTHNAME13 = &h0000100F
dim monthConstAbbr( 13 ) as Integer
monthConstAbbr = Array( LOCALE_SABBREVMONTHNAME1, LOCALE_SABBREVMONTHNAME2, LOCALE_SABBREVMONTHNAME3, _
LOCALE_SABBREVMONTHNAME4, LOCALE_SABBREVMONTHNAME5, LOCALE_SABBREVMONTHNAME6, LOCALE_SABBREVMONTHNAME7, _
LOCALE_SABBREVMONTHNAME8, LOCALE_SABBREVMONTHNAME9, LOCALE_SABBREVMONTHNAME10, LOCALE_SABBREVMONTHNAME11, _
LOCALE_SABBREVMONTHNAME12, LOCALE_SABBREVMONTHNAME13 )
for i = 0 to 12
ret = GetLocaleInfo( monthConstAbbr( i ), mb, retVal )
AbbreviatedMonthNames.Append( retVal )
next
Const LOCALE_SCURRENCY = &h00000014
ret = GetLocaleInfo( LOCALE_SCURRENCY, mb, CurrencySymbol )
Const LOCALE_SDATE = &h0000001D
ret = GetLocaleInfo( LOCALE_SDATE, mb, DateSeparator )
Const LOCALE_STIME = &h0000001E
ret = GetLocaleInfo( LOCALE_STIME, mb, TimeSeparator )
Const LOCALE_ICALENDARTYPE = &h1009
ret = GetLocaleInfo( LOCALE_ICALENDARTYPE, mb, retVal )
CalendarType = Val( retVal )
Const LOCALE_ICOUNTRY = &h5
ret = GetLocaleInfo( LOCALE_ICOUNTRY, mb, CountryCode )
Const LOCALE_ICURRDIGITS = &h19
ret = GetLocaleInfo( LOCALE_ICURRDIGITS, mb, retVal )
NumberOfCurrencyDigits = Val( retVal )
Const LOCALE_ICURRENCY = &h1B
ret = GetLocaleInfo( LOCALE_ICURRENCY, mb, retVal )
select case retVal
case "0"
PositiveCurrencyDisplayFormat = "$X.Y"
case "1"
PositiveCurrencyDisplayFormat = "X.Y$"
case "2"
PositiveCurrencyDisplayFormat = "$ X.Y"
case "3"
PositiveCurrencyDisplayFormat = "X.Y $"
end select
Const LOCALE_INEGCURR = &h1C
ret = GetLocaleInfo( LOCALE_INEGCURR, mb, retVal )
select case retVal
case "0"
NegativeCurrencyDisplayFormat = "($X.Y)"
case "1"
NegativeCurrencyDisplayFormat = "-$X.Y"
case "2"
NegativeCurrencyDisplayFormat = "$-X.Y"
case "3"
NegativeCurrencyDisplayFormat = "$X.Y-"
case "4"
NegativeCurrencyDisplayFormat = "(X.Y$)"
case "5"
NegativeCurrencyDisplayFormat = "-X.Y$"
case "6"
NegativeCurrencyDisplayFormat = "X.Y-$"
case "7"
NegativeCurrencyDisplayFormat = "X.Y$-"
case "8"
NegativeCurrencyDisplayFormat = "-X.Y $"
case "9"
NegativeCurrencyDisplayFormat = "-$ X.Y"
case "10"
NegativeCurrencyDisplayFormat = "X.Y $-"
case "11"
NegativeCurrencyDisplayFormat = "$ X.Y-"
case "12"
NegativeCurrencyDisplayFormat = "$ -X.Y"
case "13"
NegativeCurrencyDisplayFormat = "X.Y- $"
case "14"
NegativeCurrencyDisplayFormat = "($ X.Y)"
case "15"
NegativeCurrencyDisplayFormat = "(X.Y $)"
end select
Const LOCALE_SDECIMAL = &hE
ret = GetLocaleInfo( LOCALE_SDECIMAL, mb, DecimalSeparator )
Const LOCALE_IDATE = &h21
ret = GetLocaleInfo( LOCALE_IDATE, mb, retVal )
select case retVal
case "0"
ShortDateFormat = "Month-Day-Year"
case "1"
ShortDateFormat = "Day-Month-Year"
case "2"
ShortDateFormat = "Year-Month-Day"
end select
Const LOCALE_IDAYLZERO = &h26
ret = GetLocaleInfo( LOCALE_IDAYLZERO, mb, retVal )
UseLeadingZerosForDay = retVal = "1"
Const LOCALE_IMONTHLZERO = &h27
ret = GetLocaleInfo( LOCALE_IMONTHLZERO, mb, retVal )
UseLeadingZerosForMonth = retVal = "1"
Const LOCALE_ITLZERO = &h25
ret = GetLocaleInfo( LOCALE_ITLZERO, mb, retVal )
Const LOCALE_IDEFAULTCOUNTRY = &hA
ret = GetLocaleInfo( LOCALE_IDEFAULTCOUNTRY, mb, DefaultCountryCode )
UseLeadingZerosForHour = retVal = "1"
Const LOCALE_IDEFAULTLANGUAGE = &h9
ret = GetLocaleInfo( LOCALE_IDEFAULTLANGUAGE, mb, DefaultLanguage )
Const LOCALE_IFIRSTDAYOFWEEK = &h100C
ret = GetLocaleInfo( LOCALE_IFIRSTDAYOFWEEK, mb, retVal )
FirstDayOfWeek = Val( retVal )
Const LOCALE_IFIRSTWEEKOFYEAR = &h100D
ret = GetLocaleInfo( LOCALE_IFIRSTWEEKOFYEAR, mb, retVal )
FirstWeekOfYear = Val( retVal )
Const LOCALE_IINTLCURRDIGITS = &h1A
ret = GetLocaleInfo( LOCALE_IINTLCURRDIGITS, mb, retVal )
NumberOfInternationalCurrencyDigits = Val( retVal )
Const LOCALE_ILDATE = &h22
ret = GetLocaleInfo( LOCALE_ILDATE, mb, retVal )
select case retVal
case "0"
LongDateFormat = "Month-Day-Year"
case "1"
LongDateFormat = "Day-Month-Year"
case "2"
LongDateFormat = "Year-Month-Day"
end select
Const LOCALE_SNEGATIVESIGN = &h51
ret = GetLocaleInfo( LOCALE_SNEGATIVESIGN, mb, NegativeSymbol )
Const LOCALE_SPOSITIVESIGN = &h50
ret = GetLocaleInfo( LOCALE_SPOSITIVESIGN, mb, PositiveSymbol )
Const LOCALE_ITIMEMARKPOSN = &h1005
ret = GetLocaleInfo( LOCALE_ITIMEMARKPOSN, mb, retVal )
TimeMarkerIsPrefix = retVal = "1"
Const LOCALE_SABBREVCTRYNAME = &h7
ret = GetLocaleInfo( LOCALE_SABBREVCTRYNAME, mb, AbbreviatedCountry )
Const LOCALE_SABBREVLANGNAME = &h3
ret = GetLocaleInfo( LOCALE_SABBREVLANGNAME, mb, AbbreviatedLanguage )
Const LOCALE_SENGCURRNAME = &h1007
ret = GetLocaleInfo( LOCALE_SENGCURRNAME, mb, EnglishCurrencyName )
Const LOCALE_SNATIVECURRNAME = &h1008
ret = GetLocaleInfo( LOCALE_SNATIVECURRNAME, mb, NativeCurrencyName )
Const LOCALE_SINTLSYMBOL = &h15
ret = GetLocaleInfo( LOCALE_SINTLSYMBOL, mb, InternationalMonetarySymbol )
Const LOCALE_SLIST = &hC
ret = GetLocaleInfo( LOCALE_SLIST, mb, ListSymbol )
Const LOCALE_SMONDECIMALSEP = &h16
ret = GetLocaleInfo( LOCALE_SMONDECIMALSEP, mb, MonetaryDecimalSeparator )
Const LOCALE_SNATIVEDIGITS = &h13
ret = GetLocaleInfo( LOCALE_SNATIVEDIGITS, mb, retVal )
for i = 0 to 9
NativeDigits.Append( Mid( retVal, i + 1, 1 ) )
next i
Const LOCALE_STHOUSAND = &hF
ret = GetLocaleInfo( LOCALE_STHOUSAND, mb, ThousandsSeparator )
Const LOCALE_SYEARMONTH = &h1006
ret = GetLocaleInfo( LOCALE_SYEARMONTH, mb, YearMonthFormat )
Const LOCALE_SMONTHOUSANDSEP = &h17
ret = GetLocaleInfo( LOCALE_SMONTHOUSANDSEP, mb, MonetaryThousandsSeparator )
#else
#pragma unused localeID
#endif
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Function CurrencyDisplayString(value as Double) As String
Soft Declare Sub GetCurrencyFormatW Lib "Kernel32" ( local as Integer, flags as Integer, num as WString, formatting as Integer, out as Ptr, size as Integer )
Soft Declare Sub GetCurrencyFormatA Lib "Kernel32" ( local as Integer, flags as Integer, num as CString, formatting as Integer, out as Ptr, size as Integer )
if System.IsFunctionAvailable( "GetCurrencyFormatW", "Kernel32" ) then
dim mb as new MemoryBlock( 1024 )
GetCurrencyFormatW( LCID, 0, Str( value ), 0, mb, mb.Size )
return mb.WString( 0 )
else
dim mb as new MemoryBlock( 1024 )
GetCurrencyFormatA( LCID, 0, Str( value ), 0, mb, mb.Size )
return mb.CString( 0 )
end if
End Function
#tag EndMethod
#tag Method, Flags = &h21
Private Function CurrencyDisplayStringByHand(currencyValue as Double) As String
'// We're given a monetary value that we want to display to the user
'// in the proper format.
'
'dim form as String
'if currencyValue >= 0 then
'// We're going to use the positive currency format
'form = PositiveCurrencyDisplayFormat
'else
'// We have a negative currency, so use that format instead
'form = NegativeCurrencyDisplayFormat
'end if
'
'// We use the Str function because we don't want it to be
'// i8n savvy yet. We'll take care of making it savvy ourselves
'dim dataStr as String = Str( currencyValue )
'
'// Split our string into two parts -- prior to the . and after the .
'dim whole, partial as String
'whole = NthField( dataStr, ".", 1 )
'partial = NthField( dataStr, ".", 2 )
'
'// Now we want to truncate the partial down to the proper
'// number of digits. Or, it could grow it up to the proper number
'// of digits as well.
'partial = Left( partial, NumCurrencyDigits )
'if Len( partial ) < NumCurrencyDigits then partial = partial + Mid( "0000000000", 1, NumCurrencyDigits - Len( partial ) )
'
'// Now, based on our form string, let's do some replacements.
'// First, replace "X" with the whole value
'form = Replace( form, "X", Replace( whole, "-", "" ) )
'
'// Next, replace the . with the separator value, but
'// only if we've got a partial to deal with
'if Len( partial ) > 0 then
'form = Replace( form, ".", MonetaryDecimalSeparator )
'else
'form = Replace( form, ".", "" )
'end if
'
'// Then replace "Y" with the partial value
'form = Replace( form, "Y", partial )
'
'// And then, do the currency symbol
'form = Replace( form, "$", CurrencySymbol )
'
'// If we have a negative symbol, then we need to replace
'// that with the locale's negative symbol.
'if currencyValue < 0 then
'form = Replace( form, "-", NegativeSymbol )
'end if
'
'return form
#pragma unused currencyValue
End Function
#tag EndMethod
#tag Method, Flags = &h0
Function DayName(i as Integer, abbr as Boolean = false) As String
// Days are one-based, but the array is 0-based
i = i - 1
if abbr then
return AbbreviatedDayNames( i )
else
return DayNames( i )
end if
End Function
#tag EndMethod
#tag Method, Flags = &h0
Shared Function DefaultLocale() As LocaleInformationWFS
static s as new LocaleInformationWFS
return s
End Function
#tag EndMethod
#tag Method, Flags = &h0
Shared Function GetAllLocales() As LocaleInformationWFS()
Soft Declare Sub EnumSystemLocalesW Lib "Kernel32" ( proc as Ptr, flags as Integer )
Soft Declare Sub EnumSystemLocalesA Lib "Kernel32" ( proc as Ptr, flags as Integer )
// Clear out all our information
Redim sLocales( -1 )
// Enumerate over the system information
// Due to a bug with RB2006r3 and earlier, we can't use the WString version
// of the callback. So we will fall back on the CString version, which should
// work just as well given the fact that the string passed to the callback only
// contains numeric information.
Const LCID_SUPPORTED = &h2
if RBVersion > 2006.3 and System.IsFunctionAvailable( "EnumSystemLocalesW", "Kernel32" ) then
EnumSystemLocalesW( AddressOf LocaleInfoProcW, LCID_SUPPORTED )
else
EnumSystemLocalesA( AddressOf LocaleInfoProcA, LCID_SUPPORTED )
end if
// Return the data we found
return sLocales
End Function
#tag EndMethod
#tag Method, Flags = &h21
Private Function GetLocaleInfo(type as Integer, mb as MemoryBlock, ByRef retVal as String) As Integer
Soft Declare Function GetLocaleInfoA Lib "kernel32" (Locale As integer, LCType As integer, lpLCData As ptr, cchData As integer) As Integer
Soft Declare Function GetLocaleInfoW Lib "kernel32" (Locale As integer, LCType As integer, lpLCData As ptr, cchData As integer) As Integer
dim returnValue as Integer
dim size as Integer
if mb <> nil then size = mb.Size
if System.IsFunctionAvailable( "GetLocaleInfoW", "Kernel32" ) then
if mb <> nil then
returnValue = GetLocaleInfoW( LCID, type, mb, size ) * 2
retVal = ReplaceAll( DefineEncoding( mb.StringValue( 0, returnValue ), Encodings.UTF16 ), Chr( 0 ), "" )
else
returnValue = GetLocaleInfoW( LCID, type, nil, size ) * 2
end if
else
if mb <> nil then
returnValue = GetLocaleInfoA( LCID, type, mb, size ) * 2
retVal = ReplaceAll( DefineEncoding( mb.StringValue( 0, returnValue ), Encodings.ASCII ), Chr( 0 ), "" )
else
returnValue = GetLocaleInfoA( LCID, type, nil, size ) * 2
end if
end if
return returnValue
End Function
#tag EndMethod
#tag Method, Flags = &h21
Private Shared Function LocaleInfoProcA(idStr as CString) As Boolean
#pragma X86CallingConvention StdCall
// Append the data to our shared property
dim data as String = idStr
return CommonLocaleInfoProc( data )
End Function
#tag EndMethod
#tag Method, Flags = &h21
Private Shared Function LocaleInfoProcW(idStr as WString) As Boolean
#pragma X86CallingConvention StdCall
// Append the data to our shared property
dim data as String
#if RBVersion >= 2006.3
data = idStr
#endif
return CommonLocaleInfoProc( data )
End Function
#tag EndMethod
#tag Method, Flags = &h0
Function MonthName(i as Integer, abbr as Boolean = false) As String
// Months are one-based, but the array is 0-based
i = i - 1
if abbr then
return AbbreviatedMonthNames( i )
else
return MonthNames( i )
end if
End Function
#tag EndMethod
#tag Method, Flags = &h0
Function NumberDisplayString(value as Double) As String
Soft Declare Sub GetNumberFormatW Lib "Kernel32" ( local as Integer, flags as Integer, num as WString, formatting as Integer, out as Ptr, size as Integer )
Soft Declare Sub GetNumberFormatA Lib "Kernel32" ( local as Integer, flags as Integer, num as CString, formatting as Integer, out as Ptr, size as Integer )
if System.IsFunctionAvailable( "GetNumberFormatW", "Kernel32" ) then
dim mb as new MemoryBlock( 1024 )
GetNumberFormatW( LCID, 0, Str( value ), 0, mb, mb.Size )
return mb.WString( 0 )
else
dim mb as new MemoryBlock( 1024 )
GetNumberFormatA( LCID, 0, Str( value ), 0, mb, mb.Size )
return mb.CString( 0 )
end if
End Function
#tag EndMethod
#tag Property, Flags = &h0
AbbreviatedCountry As String
#tag EndProperty
#tag Property, Flags = &h0
AbbreviatedDayNames() As String
#tag EndProperty
#tag Property, Flags = &h0
AbbreviatedLanguage As String
#tag EndProperty
#tag Property, Flags = &h0
AbbreviatedMonthNames() As String
#tag EndProperty
#tag Property, Flags = &h0
AM As String
#tag EndProperty
#tag Property, Flags = &h0
CalendarType As Integer
#tag EndProperty
#tag ComputedProperty, Flags = &h0
#tag Getter
Get
select case CalendarType
case kCalendarTypeTangunEra
return "Tangun Era (Korea)"
case kCalendarTypeArabicGregorian
return "Gregorian Arabic calendar"
case kCalendarTypeEnglishGregorian
return "Gregorian (English strings always)"
case kCalendarTypeHebrew
return "Hebrew (Lunar)"
case kCalendarTypeHijri
return "Hijri (Arabic lunar)"
case kCalendarTypeLocalizedGregorian
return "Gregorian (localized)"
case kCalendarTypeMiddleEastFrenchGregorian
return "Gregorian Middle East French calendar"
case kCalendarTypeTaiwan
return "Taiwan Calendar"
case kCalendarTypeThai
return "Thai"
case kCalendarTypeTransliteratedEnglishGregorian
return "Gregorian Transliterated English calendar"
case kCalendarTypeTransliteratedFrenchGregorian
return "Gregorian Transliterated French calendar"
case kCalendarTypeYearOfTheEmporer
return "Year of the Emperor (Japan)"
end select
End Get
#tag EndGetter
CalendarTypeString As String
#tag EndComputedProperty
#tag Property, Flags = &h0
CountryCode As String
#tag EndProperty
#tag Property, Flags = &h0
CurrencySymbol As String
#tag EndProperty
#tag Property, Flags = &h0
DateSeparator As String
#tag EndProperty
#tag Property, Flags = &h0
DayNames() As String
#tag EndProperty
#tag Property, Flags = &h0
DecimalSeparator As String
#tag EndProperty
#tag Property, Flags = &h0
DefaultCountryCode As String
#tag EndProperty
#tag Property, Flags = &h0
DefaultLanguage As String
#tag EndProperty
#tag Property, Flags = &h0
EnglishCountryName As String
#tag EndProperty
#tag Property, Flags = &h0
EnglishCurrencyName As String
#tag EndProperty
#tag Property, Flags = &h0
EnglishLanguageName As String
#tag EndProperty
#tag Property, Flags = &h0
FirstDayOfWeek As Integer
#tag EndProperty
#tag Property, Flags = &h0
FirstWeekOfYear As Integer
#tag EndProperty
#tag Property, Flags = &h0
InternationalMonetarySymbol As String
#tag EndProperty
#tag Property, Flags = &h0
LCID As Integer
#tag EndProperty
#tag Property, Flags = &h0
ListSymbol As String
#tag EndProperty
#tag Property, Flags = &h0
LongDateFormat As String
#tag EndProperty
#tag Property, Flags = &h0
MonetaryDecimalSeparator As String
#tag EndProperty
#tag Property, Flags = &h0
MonetaryThousandsSeparator As String
#tag EndProperty
#tag Property, Flags = &h0
MonthNames() As String
#tag EndProperty
#tag Property, Flags = &h0
NativeCountryName As String
#tag EndProperty
#tag Property, Flags = &h0
NativeCurrencyName As String
#tag EndProperty
#tag Property, Flags = &h0
NativeDigits() As String
#tag EndProperty
#tag Property, Flags = &h0
NativeLanguageName As String
#tag EndProperty
#tag Property, Flags = &h0
NegativeCurrencyDisplayFormat As String
#tag EndProperty
#tag Property, Flags = &h0
NegativeSymbol As String
#tag EndProperty
#tag Property, Flags = &h0
NumberOfCurrencyDigits As Integer
#tag EndProperty
#tag Property, Flags = &h0
NumberOfFractionalDigits As Integer
#tag EndProperty
#tag Property, Flags = &h0
NumberOfInternationalCurrencyDigits As Integer
#tag EndProperty
#tag Property, Flags = &h0
PM As String
#tag EndProperty
#tag Property, Flags = &h0
PositiveCurrencyDisplayFormat As String
#tag EndProperty
#tag Property, Flags = &h0
PositiveSymbol As String
#tag EndProperty
#tag Property, Flags = &h0
ShortDateFormat As String
#tag EndProperty
#tag Property, Flags = &h21
Private Shared sLocales(-1) As LocaleInformationWFS
#tag EndProperty
#tag Property, Flags = &h0
ThousandsSeparator As String
#tag EndProperty
#tag Property, Flags = &h0
TimeMarkerIsPrefix As Boolean
#tag EndProperty
#tag Property, Flags = &h0
TimeSeparator As String
#tag EndProperty
#tag Property, Flags = &h0
Use24HourClock As Boolean
#tag EndProperty
#tag Property, Flags = &h0
UseFourDigitCentury As Boolean
#tag EndProperty
#tag Property, Flags = &h0
UseLeadingZeros As Boolean
#tag EndProperty
#tag Property, Flags = &h0
UseLeadingZerosForDay As Boolean
#tag EndProperty
#tag Property, Flags = &h0
UseLeadingZerosForHour As Boolean
#tag EndProperty
#tag Property, Flags = &h0
UseLeadingZerosForMonth As Boolean
#tag EndProperty
#tag Property, Flags = &h0
UseMetricMeasurements As Boolean
#tag EndProperty
#tag Property, Flags = &h0
YearMonthFormat As String
#tag EndProperty
#tag Constant, Name = kCalendarTypeArabicGregorian, Type = Double, Dynamic = False, Default = \"10", Scope = Public
#tag EndConstant
#tag Constant, Name = kCalendarTypeEnglishGregorian, Type = Double, Dynamic = False, Default = \"2", Scope = Public
#tag EndConstant
#tag Constant, Name = kCalendarTypeHebrew, Type = Double, Dynamic = False, Default = \"8", Scope = Public
#tag EndConstant
#tag Constant, Name = kCalendarTypeHijri, Type = Double, Dynamic = False, Default = \"6", Scope = Public
#tag EndConstant
#tag Constant, Name = kCalendarTypeLocalizedGregorian, Type = Double, Dynamic = False, Default = \"1", Scope = Public
#tag EndConstant
#tag Constant, Name = kCalendarTypeMiddleEastFrenchGregorian, Type = Double, Dynamic = False, Default = \"9", Scope = Public
#tag EndConstant
#tag Constant, Name = kCalendarTypeTaiwan, Type = Double, Dynamic = False, Default = \"4", Scope = Public
#tag EndConstant
#tag Constant, Name = kCalendarTypeTangunEra, Type = Double, Dynamic = False, Default = \"5", Scope = Public
#tag EndConstant
#tag Constant, Name = kCalendarTypeThai, Type = Double, Dynamic = False, Default = \"7", Scope = Public
#tag EndConstant
#tag Constant, Name = kCalendarTypeTransliteratedEnglishGregorian, Type = Double, Dynamic = False, Default = \"11", Scope = Public
#tag EndConstant
#tag Constant, Name = kCalendarTypeTransliteratedFrenchGregorian, Type = Double, Dynamic = False, Default = \"12", Scope = Public
#tag EndConstant
#tag Constant, Name = kCalendarTypeYearOfTheEmporer, Type = Double, Dynamic = False, Default = \"3", Scope = Public
#tag EndConstant
#tag Constant, Name = kFirstWeekContaining11, Type = Double, Dynamic = False, Default = \"0", Scope = Public
#tag EndConstant
#tag Constant, Name = kFirstWeekFollowing11, Type = Double, Dynamic = False, Default = \"1", Scope = Public
#tag EndConstant
#tag Constant, Name = kFirstWeekWithFourDays, Type = Double, Dynamic = False, Default = \"2", Scope = Public
#tag EndConstant
#tag ViewBehavior
#tag ViewProperty
Name="AbbreviatedCountry"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="AbbreviatedLanguage"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="AM"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="CalendarType"
Group="Behavior"
InitialValue="0"
Type="Integer"
#tag EndViewProperty
#tag ViewProperty
Name="CalendarTypeString"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="CountryCode"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="CurrencySymbol"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="DateSeparator"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="DecimalSeparator"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="DefaultCountryCode"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="DefaultLanguage"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="EnglishCountryName"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="EnglishCurrencyName"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="EnglishLanguageName"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="FirstDayOfWeek"
Group="Behavior"
InitialValue="0"
Type="Integer"
#tag EndViewProperty
#tag ViewProperty
Name="FirstWeekOfYear"
Group="Behavior"
InitialValue="0"
Type="Integer"
#tag EndViewProperty
#tag ViewProperty
Name="Index"
Visible=true
Group="ID"
InitialValue="-2147483648"
InheritedFrom="Object"
#tag EndViewProperty
#tag ViewProperty
Name="InternationalMonetarySymbol"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="LCID"
Group="Behavior"
InitialValue="0"
Type="Integer"
#tag EndViewProperty
#tag ViewProperty
Name="Left"
Visible=true
Group="Position"
InitialValue="0"
InheritedFrom="Object"
#tag EndViewProperty
#tag ViewProperty
Name="ListSymbol"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="LongDateFormat"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="MonetaryDecimalSeparator"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="MonetaryThousandsSeparator"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="Name"
Visible=true
Group="ID"
InheritedFrom="Object"
#tag EndViewProperty
#tag ViewProperty
Name="NativeCountryName"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="NativeCurrencyName"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="NativeLanguageName"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="NegativeCurrencyDisplayFormat"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="NegativeSymbol"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="NumberOfCurrencyDigits"
Group="Behavior"
InitialValue="0"
Type="Integer"
#tag EndViewProperty
#tag ViewProperty
Name="NumberOfFractionalDigits"
Group="Behavior"
InitialValue="0"
Type="Integer"
#tag EndViewProperty
#tag ViewProperty
Name="NumberOfInternationalCurrencyDigits"
Group="Behavior"
InitialValue="0"
Type="Integer"
#tag EndViewProperty
#tag ViewProperty
Name="PM"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="PositiveCurrencyDisplayFormat"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="PositiveSymbol"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="ShortDateFormat"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="Super"
Visible=true
Group="ID"
InheritedFrom="Object"
#tag EndViewProperty
#tag ViewProperty
Name="ThousandsSeparator"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="TimeMarkerIsPrefix"
Group="Behavior"
InitialValue="0"
Type="Boolean"
#tag EndViewProperty
#tag ViewProperty
Name="TimeSeparator"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="Top"
Visible=true
Group="Position"
InitialValue="0"
InheritedFrom="Object"
#tag EndViewProperty
#tag ViewProperty
Name="Use24HourClock"
Group="Behavior"
InitialValue="0"
Type="Boolean"
#tag EndViewProperty
#tag ViewProperty
Name="UseFourDigitCentury"
Group="Behavior"
InitialValue="0"
Type="Boolean"
#tag EndViewProperty
#tag ViewProperty
Name="UseLeadingZeros"
Group="Behavior"
InitialValue="0"
Type="Boolean"
#tag EndViewProperty
#tag ViewProperty
Name="UseLeadingZerosForDay"
Group="Behavior"
InitialValue="0"
Type="Boolean"
#tag EndViewProperty
#tag ViewProperty
Name="UseLeadingZerosForHour"
Group="Behavior"
InitialValue="0"
Type="Boolean"
#tag EndViewProperty
#tag ViewProperty
Name="UseLeadingZerosForMonth"
Group="Behavior"
InitialValue="0"
Type="Boolean"
#tag EndViewProperty
#tag ViewProperty
Name="UseMetricMeasurements"
Group="Behavior"
InitialValue="0"
Type="Boolean"
#tag EndViewProperty
#tag ViewProperty
Name="YearMonthFormat"
Group="Behavior"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag EndViewBehavior
End Class
#tag EndClass
| REALbasic | 3 | bskrtich/WFS | Windows Functionality Suite/UI Extras/System Information/Classes/LocaleInformationWFS.rbbas | [
"MIT"
] |
#include "pch.h"
#include "CppUnitTest.h"
#include "powerrename/lib/Settings.h"
#include <PowerRenameInterfaces.h>
#include <PowerRenameRegEx.h>
#include "MockPowerRenameRegExEvents.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace PowerRenameRegExBoostTests
{
struct SearchReplaceExpected
{
PCWSTR search;
PCWSTR replace;
PCWSTR test;
PCWSTR expected;
};
TEST_CLASS(SimpleTests)
{
public:
TEST_CLASS_INITIALIZE(ClassInitialize)
{
CSettingsInstance().SetUseBoostLib(true);
}
TEST_CLASS_CLEANUP(ClassCleanup)
{
CSettingsInstance().SetUseBoostLib(false);
}
TEST_METHOD(GeneralReplaceTest)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(L"foo") == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(L"big") == S_OK);
Assert::IsTrue(renameRegEx->Replace(L"foobar", &result) == S_OK);
Assert::IsTrue(wcscmp(result, L"bigbar") == 0);
CoTaskMemFree(result);
}
TEST_METHOD(ReplaceNoMatch)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(L"notfound") == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(L"big") == S_OK);
Assert::IsTrue(renameRegEx->Replace(L"foobar", &result) == S_OK);
Assert::IsTrue(wcscmp(result, L"foobar") == 0);
CoTaskMemFree(result);
}
TEST_METHOD(ReplaceNoSearchOrReplaceTerm)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->Replace(L"foobar", &result) == S_OK);
Assert::IsTrue(result == nullptr);
CoTaskMemFree(result);
}
TEST_METHOD(ReplaceNoReplaceTerm)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(L"foo") == S_OK);
Assert::IsTrue(renameRegEx->Replace(L"foobar", &result) == S_OK);
Assert::IsTrue(wcscmp(result, L"bar") == 0);
CoTaskMemFree(result);
}
TEST_METHOD(ReplaceEmptyStringReplaceTerm)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(L"foo") == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(L"") == S_OK);
Assert::IsTrue(renameRegEx->Replace(L"foobar", &result) == S_OK);
Assert::IsTrue(wcscmp(result, L"bar") == 0);
CoTaskMemFree(result);
}
TEST_METHOD(VerifyDefaultFlags)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
DWORD flags = 0;
Assert::IsTrue(renameRegEx->GetFlags(&flags) == S_OK);
Assert::IsTrue(flags == MatchAllOccurences);
}
TEST_METHOD(VerifyCaseSensitiveSearch)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
DWORD flags = CaseSensitive;
Assert::IsTrue(renameRegEx->PutFlags(flags) == S_OK);
SearchReplaceExpected sreTable[] = {
{ L"Foo", L"Foo", L"FooBar", L"FooBar" },
{ L"Foo", L"boo", L"FooBar", L"booBar" },
{ L"Foo", L"boo", L"foobar", L"foobar" },
{ L"123", L"654", L"123456", L"654456" },
};
for (int i = 0; i < ARRAYSIZE(sreTable); i++)
{
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(sreTable[i].search) == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(sreTable[i].replace) == S_OK);
Assert::IsTrue(renameRegEx->Replace(sreTable[i].test, &result) == S_OK);
Assert::IsTrue(wcscmp(result, sreTable[i].expected) == 0);
CoTaskMemFree(result);
}
}
TEST_METHOD(VerifyReplaceFirstOnly)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
DWORD flags = 0;
Assert::IsTrue(renameRegEx->PutFlags(flags) == S_OK);
SearchReplaceExpected sreTable[] = {
{ L"B", L"BB", L"ABA", L"ABBA" },
{ L"B", L"A", L"ABBBA", L"AABBA" },
{ L"B", L"BBB", L"ABABAB", L"ABBBABAB" },
};
for (int i = 0; i < ARRAYSIZE(sreTable); i++)
{
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(sreTable[i].search) == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(sreTable[i].replace) == S_OK);
Assert::IsTrue(renameRegEx->Replace(sreTable[i].test, &result) == S_OK);
Assert::IsTrue(wcscmp(result, sreTable[i].expected) == 0);
CoTaskMemFree(result);
}
}
TEST_METHOD(VerifyReplaceAll)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
DWORD flags = MatchAllOccurences;
Assert::IsTrue(renameRegEx->PutFlags(flags) == S_OK);
SearchReplaceExpected sreTable[] = {
{ L"B", L"BB", L"ABA", L"ABBA" },
{ L"B", L"A", L"ABBBA", L"AAAAA" },
{ L"B", L"BBB", L"ABABAB", L"ABBBABBBABBB" },
};
for (int i = 0; i < ARRAYSIZE(sreTable); i++)
{
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(sreTable[i].search) == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(sreTable[i].replace) == S_OK);
Assert::IsTrue(renameRegEx->Replace(sreTable[i].test, &result) == S_OK);
Assert::IsTrue(wcscmp(result, sreTable[i].expected) == 0);
CoTaskMemFree(result);
}
}
TEST_METHOD(VerifyReplaceAllCaseInsensitive)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
DWORD flags = MatchAllOccurences | CaseSensitive;
Assert::IsTrue(renameRegEx->PutFlags(flags) == S_OK);
SearchReplaceExpected sreTable[] = {
{ L"B", L"BB", L"ABA", L"ABBA" },
{ L"B", L"A", L"ABBBA", L"AAAAA" },
{ L"B", L"BBB", L"ABABAB", L"ABBBABBBABBB" },
{ L"b", L"BBB", L"AbABAb", L"ABBBABABBB" },
};
for (int i = 0; i < ARRAYSIZE(sreTable); i++)
{
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(sreTable[i].search) == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(sreTable[i].replace) == S_OK);
Assert::IsTrue(renameRegEx->Replace(sreTable[i].test, &result) == S_OK);
Assert::IsTrue(wcscmp(result, sreTable[i].expected) == 0);
CoTaskMemFree(result);
}
}
TEST_METHOD(VerifyReplaceFirstOnlyUseRegEx)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
DWORD flags = UseRegularExpressions;
Assert::IsTrue(renameRegEx->PutFlags(flags) == S_OK);
SearchReplaceExpected sreTable[] = {
{ L"B", L"BB", L"ABA", L"ABBA" },
{ L"B", L"A", L"ABBBA", L"AABBA" },
{ L"B", L"BBB", L"ABABAB", L"ABBBABAB" },
};
for (int i = 0; i < ARRAYSIZE(sreTable); i++)
{
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(sreTable[i].search) == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(sreTable[i].replace) == S_OK);
Assert::IsTrue(renameRegEx->Replace(sreTable[i].test, &result) == S_OK);
Assert::IsTrue(wcscmp(result, sreTable[i].expected) == 0);
CoTaskMemFree(result);
}
}
TEST_METHOD(VerifyReplaceAllUseRegEx)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
DWORD flags = MatchAllOccurences | UseRegularExpressions;
Assert::IsTrue(renameRegEx->PutFlags(flags) == S_OK);
SearchReplaceExpected sreTable[] = {
{ L"B", L"BB", L"ABA", L"ABBA" },
{ L"B", L"A", L"ABBBA", L"AAAAA" },
{ L"B", L"BBB", L"ABABAB", L"ABBBABBBABBB" },
};
for (int i = 0; i < ARRAYSIZE(sreTable); i++)
{
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(sreTable[i].search) == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(sreTable[i].replace) == S_OK);
Assert::IsTrue(renameRegEx->Replace(sreTable[i].test, &result) == S_OK);
Assert::IsTrue(wcscmp(result, sreTable[i].expected) == 0);
CoTaskMemFree(result);
}
}
TEST_METHOD(VerifyReplaceAllUseRegExCaseSensitive)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
DWORD flags = MatchAllOccurences | UseRegularExpressions | CaseSensitive;
Assert::IsTrue(renameRegEx->PutFlags(flags) == S_OK);
SearchReplaceExpected sreTable[] = {
{ L"B", L"BB", L"ABA", L"ABBA" },
{ L"B", L"A", L"ABBBA", L"AAAAA" },
{ L"b", L"BBB", L"AbABAb", L"ABBBABABBB" },
};
for (int i = 0; i < ARRAYSIZE(sreTable); i++)
{
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(sreTable[i].search) == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(sreTable[i].replace) == S_OK);
Assert::IsTrue(renameRegEx->Replace(sreTable[i].test, &result) == S_OK);
Assert::IsTrue(wcscmp(result, sreTable[i].expected) == 0);
CoTaskMemFree(result);
}
}
TEST_METHOD(VerifyMatchAllWildcardUseRegEx)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
DWORD flags = MatchAllOccurences | UseRegularExpressions;
Assert::IsTrue(renameRegEx->PutFlags(flags) == S_OK);
// This differs from the Standard Library: .* has two matches (all and nothing).
SearchReplaceExpected sreTable[] = {
//search, replace, test, result
{ L".*", L"Foo", L"AAAAAA", L"FooFoo" },
{ L".+", L"Foo", L"AAAAAA", L"Foo" },
};
for (int i = 0; i < ARRAYSIZE(sreTable); i++)
{
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(sreTable[i].search) == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(sreTable[i].replace) == S_OK);
Assert::IsTrue(renameRegEx->Replace(sreTable[i].test, &result) == S_OK);
Assert::IsTrue(wcscmp(result, sreTable[i].expected) == 0);
CoTaskMemFree(result);
}
}
void VerifyReplaceFirstWildcard(SearchReplaceExpected sreTable[], int tableSize, DWORD flags)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
Assert::IsTrue(renameRegEx->PutFlags(flags) == S_OK);
for (int i = 0; i < tableSize; i++)
{
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(sreTable[i].search) == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(sreTable[i].replace) == S_OK);
Assert::IsTrue(renameRegEx->Replace(sreTable[i].test, &result) == S_OK);
Assert::AreEqual(sreTable[i].expected, result);
CoTaskMemFree(result);
}
}
TEST_METHOD(VerifyReplaceFirstWildCardUseRegex)
{
SearchReplaceExpected sreTable[] = {
//search, replace, test, result
{ L".*", L"Foo", L"AAAAAA", L"Foo" },
};
VerifyReplaceFirstWildcard(sreTable, ARRAYSIZE(sreTable), UseRegularExpressions);
}
TEST_METHOD(VerifyReplaceFirstWildCardUseRegexMatchAllOccurrences)
{
// This differs from the Standard Library: .* has two matches (all and nothing).
SearchReplaceExpected sreTable[] = {
//search, replace, test, result
{ L".*", L"Foo", L"AAAAAA", L"FooFoo" },
{ L".+", L"Foo", L"AAAAAA", L"Foo" },
};
VerifyReplaceFirstWildcard(sreTable, ARRAYSIZE(sreTable), UseRegularExpressions | MatchAllOccurences);
}
TEST_METHOD(VerifyReplaceFirstWildCardMatchAllOccurrences)
{
SearchReplaceExpected sreTable[] = {
//search, replace, test, result
{ L".*", L"Foo", L"AAAAAA", L"AAAAAA" },
{ L".*", L"Foo", L".*", L"Foo" },
{ L".*", L"Foo", L".*Bar.*", L"FooBarFoo" },
};
VerifyReplaceFirstWildcard(sreTable, ARRAYSIZE(sreTable), MatchAllOccurences);
}
TEST_METHOD(VerifyReplaceFirstWildNoFlags)
{
SearchReplaceExpected sreTable[] = {
//search, replace, test, result
{ L".*", L"Foo", L"AAAAAA", L"AAAAAA" },
{ L".*", L"Foo", L".*", L"Foo" },
};
VerifyReplaceFirstWildcard(sreTable, ARRAYSIZE(sreTable), 0);
}
TEST_METHOD(VerifyHandleCapturingGroups)
{
// This differs from the Standard Library: Boost does not recognize $123 as $1 and "23".
// To use a capturing group followed by numbers as replacement curly braces are needed.
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
DWORD flags = MatchAllOccurences | UseRegularExpressions | CaseSensitive;
Assert::IsTrue(renameRegEx->PutFlags(flags) == S_OK);
SearchReplaceExpected sreTable[] = {
//search, replace, test, result
{ L"(foo)(bar)", L"$1_$002_$223_$001021_$00001", L"foobar", L"foo_$002__$001021_$00001" },
{ L"(foo)(bar)", L"$1_$002_${2}23_$001021_$00001", L"foobar", L"foo_$002_bar23_$001021_$00001" },
{ L"(foo)(bar)", L"_$1$2_$123$040", L"foobar", L"_foobar_$040" },
{ L"(foo)(bar)", L"_$1$2_${1}23$040", L"foobar", L"_foobar_foo23$040" },
{ L"(foo)(bar)", L"$$$1", L"foobar", L"$foo" },
{ L"(foo)(bar)", L"$$1", L"foobar", L"$1" },
{ L"(foo)(bar)", L"$12", L"foobar", L"" },
{ L"(foo)(bar)", L"${1}2", L"foobar", L"foo2" },
{ L"(foo)(bar)", L"$10", L"foobar", L"" },
{ L"(foo)(bar)", L"${1}0", L"foobar", L"foo0" },
{ L"(foo)(bar)", L"$01", L"foobar", L"$01" },
{ L"(foo)(bar)", L"$$$11", L"foobar", L"$" },
{ L"(foo)(bar)", L"$$${1}1", L"foobar", L"$foo1" },
{ L"(foo)(bar)", L"$$$$113a", L"foobar", L"$$113a" },
};
for (int i = 0; i < ARRAYSIZE(sreTable); i++)
{
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(sreTable[i].search) == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(sreTable[i].replace) == S_OK);
Assert::IsTrue(renameRegEx->Replace(sreTable[i].test, &result) == S_OK);
Assert::IsTrue(wcscmp(result, sreTable[i].expected) == 0);
CoTaskMemFree(result);
}
}
TEST_METHOD(VerifyLookbehind)
{
SearchReplaceExpected sreTable[] = {
//search, replace, test, result
{ L"(?<=E12).*", L"Foo", L"AAE12BBB", L"AAE12Foo" },
{ L"(?<=E12).+", L"Foo", L"AAE12BBB", L"AAE12Foo" },
{ L"(?<=E\\d\\d).+", L"Foo", L"AAE12BBB", L"AAE12Foo" },
{ L"(?<!E12).*", L"Foo", L"AAE12BBB", L"Foo" },
{ L"(?<!E12).+", L"Foo", L"AAE12BBB", L"Foo" },
{ L"(?<!E\\d\\d).+", L"Foo", L"AAE12BBB", L"Foo" },
};
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
Assert::IsTrue(renameRegEx->PutFlags(UseRegularExpressions) == S_OK);
for (int i = 0; i < ARRAYSIZE(sreTable); i++)
{
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(sreTable[i].search) == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(sreTable[i].replace) == S_OK);
Assert::IsTrue(renameRegEx->Replace(sreTable[i].test, &result) == S_OK);
Assert::IsTrue(wcscmp(result, sreTable[i].expected) == 0);
CoTaskMemFree(result);
}
}
TEST_METHOD(VerifyEventsFire)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
CMockPowerRenameRegExEvents* mockEvents = new CMockPowerRenameRegExEvents();
CComPtr<IPowerRenameRegExEvents> regExEvents;
Assert::IsTrue(mockEvents->QueryInterface(IID_PPV_ARGS(®ExEvents)) == S_OK);
DWORD cookie = 0;
Assert::IsTrue(renameRegEx->Advise(regExEvents, &cookie) == S_OK);
DWORD flags = MatchAllOccurences | UseRegularExpressions | CaseSensitive;
Assert::IsTrue(renameRegEx->PutFlags(flags) == S_OK);
Assert::IsTrue(renameRegEx->PutSearchTerm(L"FOO") == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(L"BAR") == S_OK);
Assert::IsTrue(renameRegEx->PutFileTime(SYSTEMTIME{0}) == S_OK);
Assert::IsTrue(renameRegEx->ResetFileTime() == S_OK);
Assert::IsTrue(lstrcmpi(L"FOO", mockEvents->m_searchTerm) == 0);
Assert::IsTrue(lstrcmpi(L"BAR", mockEvents->m_replaceTerm) == 0);
Assert::IsTrue(flags == mockEvents->m_flags);
Assert::IsTrue(renameRegEx->UnAdvise(cookie) == S_OK);
mockEvents->Release();
}
};
}
| C++ | 5 | tameemzabalawi/PowerToys | src/modules/powerrename/unittests/PowerRenameRegExBoostTests.cpp | [
"MIT"
] |
Note 'References'
[1] Pattern Recognition and Machine Learning, Cristopher M. Bishop (Chapter 2)
[2] A tutorial on Kernel Density Estimation and Recent Advances, Yen-Chi Chen [arXiv:1704.03924]
)
coclass 'KDE'
create=: 3 : 0
)
fit=: 3 : 0
)
sample=: 3 : 0
)
destroy=: codestroy | J | 2 | jonghough/jlearn | densityestimation/kde.ijs | [
"MIT"
] |
@media screen and (color) {}
@media only screen and (color) {}
@media only screen and (min-width: 800px) {}
@media screen and (min-width : 800px ) {}
@media screen and (min-width: 800px) and (min-width: 800px) and (min-width: 800px) {}
@media screen and (min-width: 800px) and (min-width: 800px) and (min-width: 800px) and (min-width: 800px){}
| CSS | 1 | mengxy/swc | crates/swc_css_parser/tests/fixture/rome/media/feature/input.css | [
"Apache-2.0"
] |
<div xmlns:py="http://purl.org/kid/ns#" >
<div id="admin" py:if="tg.identity.anonymous">
Welcome, guest,
<a href='/${site.name}/site/login'>login</a>
<p/>
</div>
<div id="admin" py:if="not tg.identity.anonymous">
Welcome, ${tg.identity.user.display_name},
<a href='/${site.name}/site/logout'>logout</a>
<p/>
</div>
<div id="admin" py:if="'admin' in tg.identity.groups">
<h1>administer your site</h1>
<dl>
<dt>New Post:</dt>
<dd><a href="/${site.name}/blog/new_post">Create</a></dd>
<dt>New Page:</dt>
<dd><a href="/${site.name}/page/new_page">Create</a></dd>
<dt>New User:</dt>
<dd><a href="/${site.name}/users/new">Create</a></dd>
<dt>Edit Site:</dt>
<dd><a href="/${site.name}/site/edit_site">Edit</a></dd>
<dt>New Site:</dt>
<dd><a href="/${site.name}/site/new_site">Create</a></dd>
</dl>
</div>
</div> | Genshi | 3 | CarlosGabaldon/calabro | calabro/widgets/templates/admin.kid | [
"MIT"
] |
"""Tests for the input_datetime component."""
| Python | 0 | domwillcode/home-assistant | tests/components/input_datetime/__init__.py | [
"Apache-2.0"
] |
---
title: "Chapter 6"
output:
html_document:
css: style.css
highlight: tango
---
```{r, include=FALSE}
knitr::opts_chunk$set(cache = FALSE, echo = TRUE, fig.align = "center", comment = "#>", message = FALSE)
```
```{r}
require(data.table)
require(ggplot2)
require(gridExtra)
theme_set(
theme_bw(base_size = 14, base_family = "Lato") +
theme(panel.grid = element_blank(), panel.border = element_blank())
)
```
We're going to go back to our weather data from Chapter 5, here.
```{r}
weather_2012_final <- fread("../data/weather_2012.csv")
weather_2012_final[, `Date/Time` := as.POSIXct(`Date/Time`)]
str(weather_2012_final)
weather_2012_final[1:5]
```
# 6.1 String Operations
You'll see that the 'Weather' column has a text description of the weather that
was going on each hour. We'll assume it's snowing if the text description
contains "Snow".
We are going to use string processing functions from R's `base`.
```{r}
weather_description <- weather_2012_final[, .(`Date/Time`, Weather)]
is_snowing <- weather_description[grepl("Snow", Weather)]
head(is_snowing)
## let us see when there is snow of the year
ggplot(is_snowing, aes(`Date/Time`, 1)) +
geom_jitter(shape = 21, color = "white", fill = "palegreen4", size = 2) +
labs(x = NULL, y = NULL) +
theme(axis.title.y.left = element_blank(),
axis.text.y.left = element_blank(),
axis.ticks.y.left = element_blank(),
panel.grid = element_line(size = 0.3, color = "gray90"))
```
# 6.2 Use resampling to find the snowiest month
```{r}
monthly_temp <- weather_2012_final[, .(median_temp = median(`Temp (C)`)), by = .(month(`Date/Time`))]
print(monthly_temp)
p1 <- ggplot(monthly_temp, aes(factor(month), median_temp)) +
geom_col(fill = "darkorange") +
labs(x = NULL, y = "temperature (C)", title = "Temperature") +
theme(panel.grid.major.y = element_line(size = 0.3, color = "gray90"))
p1
```
Unsurprisingly, July and August are the warmest.
Now we want to know what is the percentage of time it was snowing each month.
```{r}
monthly_snow <- weather_description[, .(snowing_freq = mean(grepl("Snow", Weather))), by = .(month(`Date/Time`))]
print(monthly_snow)
p2 <- ggplot(monthly_snow, aes(factor(month), snowing_freq)) +
geom_col(fill = "palegreen4") +
labs(x = NULL, y = NULL, title = "Snowiness") +
theme(panel.grid.major.y = element_line(size = 0.3, color = "gray90"))
p2
```
So now we know! In 2012, December was the snowiest month. Also, this graph
suggests something that I feel -- it starts snowing pretty abruptly in November,
and then tapers off slowly and takes a long time to stop, with the last snow
usually being in April or May.
# 6.3 Plotting temperature and snowiness stats together
We can also combine these two statistics (temperature, and snowiness) into one
dataframe and plot them together:
```{r}
weather_stats <- merge(monthly_temp, monthly_snow, by = "month")
print(weather_stats)
grid.arrange(p1, p2, ncol = 1)
```
| RMarkdown | 5 | chuvanan/rdatatable-cookbook | cookbook/chapter6-string-operation.rmd | [
"CC-BY-4.0"
] |
# some vcl content
| VCL | 0 | bbutkovic/fastly-cli | pkg/vcl/snippet/testdata/snippet.vcl | [
"Apache-2.0"
] |
#+TITLE: ui/doom-dashboard
#+DATE: October 9, 2019
#+SINCE: v1.3
#+STARTUP: inlineimages nofold
* Table of Contents :TOC_3:noexport:
- [[#description][Description]]
- [[#module-flags][Module Flags]]
- [[#prerequisites][Prerequisites]]
- [[#configuration][Configuration]]
- [[#a-custom-banner][A custom banner]]
- [[#adding-text-to-the-dashboard][Adding text to the dashboard]]
- [[#customizing-faces][Customizing Faces]]
* Description
This module adds a minimalistic, Atom-inspired dashboard to Emacs.
Besides eye candy, the dashboard serves two other purposes:
1. To improve Doom's startup times (the dashboard is lighter than the scratch
buffer in many cases).
2. And to preserve the "last open directory" you were in. Occasionally, I kill
the last buffer in my project and I end up who-knows-where (in the working
directory of another buffer/project). It can take some work to find my way
back to where I was. Not with the Dashboard.
Since the dashboard cannot be killed, and it remembers the working directory
of the last open buffer, ~M-x find-file~ will work from the directory I
expect.
** Module Flags
This module provides no flags.
* Prerequisites
This module only requires that ~all-the-icons~'s icon fonts are installed.
It should've been installed when you first installed Doom, but ~M-x
all-the-icons-install-fonts~ will install them again.
* Configuration
** A custom banner
To use a custom image as your banner, change ~fancy-splash-image~:
#+BEGIN_SRC elisp
(setq fancy-splash-image "~/my/banners/image.png")
#+END_SRC
#+begin_quote
Doom will fall back to its ASCII banner in Terminal Emacs. To replace the ASCII
banner, replace the ~doom-dashboard-widget-banner~ function in
~+doom-dashboard-functions~ with a function that inserts your new banner into
the current file.
#+end_quote
** Adding text to the dashboard
Doom's dashboard iterates over ~+doom-dashboard-functions~ when it is told to
redraw. Add your own functions to operate on the buffer and potentially add
whatever you like to Doom's splash screen.
#+begin_quote
Keep in mind that inserting text from expensive sources, e.g. your org agenda,
will negate most of Doom's startup benefits.
#+end_quote
** Customizing Faces
Doom's dashboard defaults to inheriting faces set by the current theme. If you wish
to customize it independently of the theme (or just inherit a different color
from the theme) you can make use of ~custom-set-faces!~ or ~custom-theme-set-faces!~
#+BEGIN_SRC elisp
(custom-set-faces!
'(doom-dashboard-banner :foreground "red" :background "#000000" :weight bold)
'(doom-dashboard-footer :inherit font-lock-constant-face)
'(doom-dashboard-footer-icon :inherit all-the-icons-red)
'(doom-dashboard-loaded :inherit font-lock-warning-face)
'(doom-dashboard-menu-desc :inherit font-lock-string-face)
'(doom-dashboard-menu-title :inherit font-lock-function-name-face))
#+END_SRC
or for a per-theme setting
#+BEGIN_SRC elisp
(custom-theme-set-faces! 'doom-tomorrow-night
'(doom-dashboard-banner :foreground "red" :background "#000000" :weight bold)
'(doom-dashboard-footer :inherit font-lock-constant-face)
'(doom-dashboard-footer-icon :inherit all-the-icons-red)
'(doom-dashboard-loaded :inherit font-lock-warning-face)
'(doom-dashboard-menu-desc :inherit font-lock-string-face)
'(doom-dashboard-menu-title :inherit font-lock-function-name-face))
#+END_SRC
| Org | 5 | leezu/doom-emacs | modules/ui/doom-dashboard/README.org | [
"MIT"
] |
//*****************************************************************************
// (c) Copyright 2009 - 2011 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a license and does not grant any
// rights to the materials distributed herewith. Except as
// otherwise provided in a valid license issued to you by
// Xilinx, and to the maximum extent permitted by applicable
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
// (2) Xilinx shall not be liable (whether in contract or tort,
// including negligence, or under any other theory of
// liability) for any loss or damage of any kind or nature
// related to, arising under or in connection with these
// materials, including for any direct, or any indirect,
// special, incidental, or consequential loss or damage
// (including loss of data, profits, goodwill, or any type of
// loss or damage suffered as a result of any action brought
// by a third party) even if such damage or loss was
// reasonably foreseeable or Xilinx had been advised of the
// possibility of the same.
//
// CRITICAL APPLICATIONS
// Xilinx products are not designed or intended to be fail-
// safe, or for use in any application requiring fail-safe
// performance, such as life-support or safety devices or
// systems, Class III medical devices, nuclear facilities,
// applications related to the deployment of airbags, or any
// other applications that could lead to death, personal
// injury, or severe property or environmental damage
// (individually and collectively, "Critical
// Applications"). Customer assumes the sole risk and
// liability of any use of Xilinx products in Critical
// Applications, subject only to applicable laws and
// regulations governing limitations on product liability.
//
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
// PART OF THIS FILE AT ALL TIMES.
//
//*****************************************************************************
// ____ ____
// / /\/ /
// /___/ \ / Vendor : Xilinx
// \ \ \/ Version : 1.9
// \ \ Application : MIG
// / / Filename : ddr.veo
// /___/ /\ Date Last Modified : $Date: 2011/06/02 08:34:47 $
// \ \ / \ Date Created : Fri Oct 14 2011
// \___\/\___\
//
// Device : 7 Series
// Design Name : DDR2 SDRAM
// Purpose : Template file containing code that can be used as a model
// for instantiating a CORE Generator module in a HDL design.
// Revision History :
//*****************************************************************************
// The following must be inserted into your Verilog file for this
// core to be instantiated. Change the instance name and port connections
// (in parentheses) to your own signal names.
//----------- Begin Cut here for INSTANTIATION Template ---// INST_TAG
ddr # (
//***************************************************************************
// The following parameters refer to width of various ports
//***************************************************************************
.BANK_WIDTH (3),
// # of memory Bank Address bits.
.CK_WIDTH (1),
// # of CK/CK# outputs to memory.
.COL_WIDTH (10),
// # of memory Column Address bits.
.CS_WIDTH (1),
// # of unique CS outputs to memory.
.nCS_PER_RANK (1),
// # of unique CS outputs per rank for phy
.CKE_WIDTH (1),
// # of CKE outputs to memory.
.DATA_BUF_ADDR_WIDTH (4),
.DQ_CNT_WIDTH (4),
// = ceil(log2(DQ_WIDTH))
.DQ_PER_DM (8),
.DM_WIDTH (2),
// # of DM (data mask)
.DQ_WIDTH (16),
// # of DQ (data)
.DQS_WIDTH (2),
.DQS_CNT_WIDTH (1),
// = ceil(log2(DQS_WIDTH))
.DRAM_WIDTH (8),
// # of DQ per DQS
.ECC ("OFF"),
.DATA_WIDTH (16),
.ECC_TEST ("OFF"),
.PAYLOAD_WIDTH (16),
.ECC_WIDTH (8),
.MC_ERR_ADDR_WIDTH (31),
.nBANK_MACHS (4),
.RANKS (1),
// # of Ranks.
.ODT_WIDTH (1),
// # of ODT outputs to memory.
.ROW_WIDTH (13),
// # of memory Row Address bits.
.ADDR_WIDTH (27),
// # = RANK_WIDTH + BANK_WIDTH
// + ROW_WIDTH + COL_WIDTH;
// Chip Select is always tied to low for
// single rank devices
.USE_CS_PORT (1),
// # = 1, When Chip Select (CS#) output is enabled
// = 0, When Chip Select (CS#) output is disabled
// If CS_N disabled, user must connect
// DRAM CS_N input(s) to ground
.USE_DM_PORT (1),
// # = 1, When Data Mask option is enabled
// = 0, When Data Mask option is disbaled
// When Data Mask option is disabled in
// MIG Controller Options page, the logic
// related to Data Mask should not get
// synthesized
.USE_ODT_PORT (1),
// # = 1, When ODT output is enabled
// = 0, When ODT output is disabled
.PHY_CONTROL_MASTER_BANK (0),
// The bank index where master PHY_CONTROL resides,
// equal to the PLL residing bank
//***************************************************************************
// The following parameters are mode register settings
//***************************************************************************
.AL ("0"),
// DDR3 SDRAM:
// Additive Latency (Mode Register 1).
// # = "0", "CL-1", "CL-2".
// DDR2 SDRAM:
// Additive Latency (Extended Mode Register).
.nAL (0),
// # Additive Latency in number of clock
// cycles.
.BURST_MODE ("8"),
// DDR3 SDRAM:
// Burst Length (Mode Register 0).
// # = "8", "4", "OTF".
// DDR2 SDRAM:
// Burst Length (Mode Register).
// # = "8", "4".
.BURST_TYPE ("SEQ"),
// DDR3 SDRAM: Burst Type (Mode Register 0).
// DDR2 SDRAM: Burst Type (Mode Register).
// # = "SEQ" - (Sequential),
// = "INT" - (Interleaved).
.CL (5),
// in number of clock cycles
// DDR3 SDRAM: CAS Latency (Mode Register 0).
// DDR2 SDRAM: CAS Latency (Mode Register).
.OUTPUT_DRV ("HIGH"),
// Output Drive Strength (Extended Mode Register).
// # = "HIGH" - FULL,
// = "LOW" - REDUCED.
.RTT_NOM (1),
// RTT (Nominal) (Extended Mode Register).
// = "150" - 150 Ohms,
// = "75" - 75 Ohms,
// = "50" - 50 Ohms.
.ADDR_CMD_MODE ("1T" ),
// # = "1T", "2T".
.REG_CTRL ("OFF"),
// # = "ON" - RDIMMs,
// = "OFF" - Components, SODIMMs, UDIMMs.
//***************************************************************************
// The following parameters are multiplier and divisor factors for PLLE2.
// Based on the selected design frequency these parameters vary.
//***************************************************************************
.CLKIN_PERIOD (4999),
// Input Clock Period
.CLKFBOUT_MULT (6),
// write PLL VCO multiplier
.DIVCLK_DIVIDE (1),
// write PLL VCO divisor
.CLKOUT0_DIVIDE (2),
// VCO output divisor for PLL output clock (CLKOUT0)
.CLKOUT1_DIVIDE (4),
// VCO output divisor for PLL output clock (CLKOUT1)
.CLKOUT2_DIVIDE (64),
// VCO output divisor for PLL output clock (CLKOUT2)
.CLKOUT3_DIVIDE (8),
// VCO output divisor for PLL output clock (CLKOUT3)
//***************************************************************************
// Memory Timing Parameters. These parameters varies based on the selected
// memory part.
//***************************************************************************
.tCKE (7500),
// memory tCKE paramter in pS.
.tFAW (45000),
// memory tRAW paramter in pS.
.tPRDI (1_000_000),
// memory tPRDI paramter in pS.
.tRAS (40000),
// memory tRAS paramter in pS.
.tRCD (15000),
// memory tRCD paramter in pS.
.tREFI (7800000),
// memory tREFI paramter in pS.
.tRFC (127500),
// memory tRFC paramter in pS.
.tRP (12500),
// memory tRP paramter in pS.
.tRRD (10000),
// memory tRRD paramter in pS.
.tRTP (7500),
// memory tRTP paramter in pS.
.tWTR (7500),
// memory tWTR paramter in pS.
.tZQI (128_000_000),
// memory tZQI paramter in nS.
.tZQCS (64),
// memory tZQCS paramter in clock cycles.
//***************************************************************************
// Simulation parameters
//***************************************************************************
.SIM_BYPASS_INIT_CAL ("OFF"),
// # = "OFF" - Complete memory init &
// calibration sequence
// # = "SKIP" - Not supported
// # = "FAST" - Complete memory init & use
// abbreviated calib sequence
.SIMULATION ("FALSE"),
// Should be TRUE during design simulations and
// FALSE during implementations
//***************************************************************************
// The following parameters varies based on the pin out entered in MIG GUI.
// Do not change any of these parameters directly by editing the RTL.
// Any changes required should be done through GUI and the design regenerated.
//***************************************************************************
.BYTE_LANES_B0 (4'b1111),
// Byte lanes used in an IO column.
.BYTE_LANES_B1 (4'b0000),
// Byte lanes used in an IO column.
.BYTE_LANES_B2 (4'b0000),
// Byte lanes used in an IO column.
.BYTE_LANES_B3 (4'b0000),
// Byte lanes used in an IO column.
.BYTE_LANES_B4 (4'b0000),
// Byte lanes used in an IO column.
.DATA_CTL_B0 (4'b0101),
// Indicates Byte lane is data byte lane
// or control Byte lane. '1' in a bit
// position indicates a data byte lane and
// a '0' indicates a control byte lane
.DATA_CTL_B1 (4'b0000),
// Indicates Byte lane is data byte lane
// or control Byte lane. '1' in a bit
// position indicates a data byte lane and
// a '0' indicates a control byte lane
.DATA_CTL_B2 (4'b0000),
// Indicates Byte lane is data byte lane
// or control Byte lane. '1' in a bit
// position indicates a data byte lane and
// a '0' indicates a control byte lane
.DATA_CTL_B3 (4'b0000),
// Indicates Byte lane is data byte lane
// or control Byte lane. '1' in a bit
// position indicates a data byte lane and
// a '0' indicates a control byte lane
.DATA_CTL_B4 (4'b0000),
// Indicates Byte lane is data byte lane
// or control Byte lane. '1' in a bit
// position indicates a data byte lane and
// a '0' indicates a control byte lane
.PHY_0_BITLANES (48'hFFC3F7FFF3FE),
.PHY_1_BITLANES (48'h000000000000),
.PHY_2_BITLANES (48'h000000000000),
.CK_BYTE_MAP (144'h000000000000000000000000000000000003),
.ADDR_MAP (192'h00000000001003301A01903203A034018036012011017015),
.BANK_MAP (36'h01301601B),
.CAS_MAP (12'h039),
.CKE_ODT_BYTE_MAP (8'h00),
.CKE_MAP (96'h000000000000000000000038),
.ODT_MAP (96'h000000000000000000000035),
.CS_MAP (120'h000000000000000000000000000037),
.PARITY_MAP (12'h000),
.RAS_MAP (12'h014),
.WE_MAP (12'h03B),
.DQS_BYTE_MAP (144'h000000000000000000000000000000000200),
.DATA0_MAP (96'h008004009007005001006003),
.DATA1_MAP (96'h022028020024027025026021),
.DATA2_MAP (96'h000000000000000000000000),
.DATA3_MAP (96'h000000000000000000000000),
.DATA4_MAP (96'h000000000000000000000000),
.DATA5_MAP (96'h000000000000000000000000),
.DATA6_MAP (96'h000000000000000000000000),
.DATA7_MAP (96'h000000000000000000000000),
.DATA8_MAP (96'h000000000000000000000000),
.DATA9_MAP (96'h000000000000000000000000),
.DATA10_MAP (96'h000000000000000000000000),
.DATA11_MAP (96'h000000000000000000000000),
.DATA12_MAP (96'h000000000000000000000000),
.DATA13_MAP (96'h000000000000000000000000),
.DATA14_MAP (96'h000000000000000000000000),
.DATA15_MAP (96'h000000000000000000000000),
.DATA16_MAP (96'h000000000000000000000000),
.DATA17_MAP (96'h000000000000000000000000),
.MASK0_MAP (108'h000000000000000000000029002),
.MASK1_MAP (108'h000000000000000000000000000),
.SLOT_0_CONFIG (8'b00000001),
// Mapping of Ranks.
.SLOT_1_CONFIG (8'b0000_0000),
// Mapping of Ranks.
.MEM_ADDR_ORDER ("BANK_ROW_COLUMN"),
//***************************************************************************
// IODELAY and PHY related parameters
//***************************************************************************
.IODELAY_HP_MODE ("ON"),
// to phy_top
.IBUF_LPWR_MODE ("OFF"),
// to phy_top
.DATA_IO_IDLE_PWRDWN ("ON"),
// # = "ON", "OFF"
.DATA_IO_PRIM_TYPE ("HR_LP"),
// # = "HP_LP", "HR_LP", "DEFAULT"
.CKE_ODT_AUX ("FALSE"),
.USER_REFRESH ("OFF"),
.WRLVL ("OFF"),
// # = "ON" - DDR3 SDRAM
// = "OFF" - DDR2 SDRAM.
.ORDERING ("STRICT"),
// # = "NORM", "STRICT", "RELAXED".
.CALIB_ROW_ADD (16'h0000),
// Calibration row address will be used for
// calibration read and write operations
.CALIB_COL_ADD (12'h000),
// Calibration column address will be used for
// calibration read and write operations
.CALIB_BA_ADD (3'h0),
// Calibration bank address will be used for
// calibration read and write operations
.TCQ (100),
.IODELAY_GRP ("IODELAY_MIG"),
// It is associated to a set of IODELAYs with
// an IDELAYCTRL that have same IODELAY CONTROLLER
// clock frequency.
.SYSCLK_TYPE ("NO_BUFFER"),
// System clock type DIFFERENTIAL or SINGLE_ENDED
.REFCLK_TYPE ("USE_SYSTEM_CLOCK"),
// Reference clock type DIFFERENTIAL or SINGLE_ENDED
.CMD_PIPE_PLUS1 ("ON"),
// add pipeline stage between MC and PHY
.DRAM_TYPE ("DDR2"),
.CAL_WIDTH ("HALF"),
.STARVE_LIMIT (2),
// # = 2,3,4.
//***************************************************************************
// Referece clock frequency parameters
//***************************************************************************
.REFCLK_FREQ (200.0),
// IODELAYCTRL reference clock frequency
.DIFF_TERM_REFCLK ("TRUE"),
// Differential Termination for idelay
// reference clock input pins
//***************************************************************************
// System clock frequency parameters
//***************************************************************************
.tCK (3333),
// memory tCK paramter.
// # = Clock Period in pS.
.nCK_PER_CLK (2),
// # of memory CKs per fabric CLK
.DIFF_TERM_SYSCLK ("TRUE"),
// Differential Termination for System
// clock input pins
//***************************************************************************
// Debug parameters
//***************************************************************************
.DEBUG_PORT ("OFF"),
// # = "ON" Enable debug signals/controls.
// = "OFF" Disable debug signals/controls.
.RST_ACT_LOW (1)
// =1 for active low reset,
// =0 for active high.
)
u_ddr (
// Memory interface ports
.ddr2_dq (ddr2_dq),
.ddr2_dqs_n (ddr2_dqs_n),
.ddr2_dqs_p (ddr2_dqs_p),
.ddr2_addr (ddr2_addr),
.ddr2_ba (ddr2_ba),
.ddr2_ras_n (ddr2_ras_n),
.ddr2_cas_n (ddr2_cas_n),
.ddr2_we_n (ddr2_we_n),
.ddr2_ck_p (ddr2_ck_p),
.ddr2_ck_n (ddr2_ck_n),
.ddr2_cke (ddr2_cke),
.ddr2_cs_n (ddr2_cs_n),
.ddr2_dm (ddr2_dm),
.ddr2_odt (ddr2_odt),
// Application interface ports
.app_addr (app_addr),
.app_cmd (app_cmd),
.app_en (app_en),
.app_wdf_data (app_wdf_data),
.app_wdf_end (app_wdf_end),
.app_wdf_mask (app_wdf_mask),
.app_wdf_wren (app_wdf_wren),
.app_rd_data (app_rd_data),
.app_rd_data_end (app_rd_data_end),
.app_rd_data_valid (app_rd_data_valid),
.app_rdy (app_rdy),
.app_wdf_rdy (app_wdf_rdy),
.app_sr_req (app_sr_req),
.app_sr_active (app_sr_active),
.app_ref_req (app_ref_req),
.app_ref_ack (app_ref_ack),
.app_zq_req (app_zq_req),
.app_zq_ack (app_zq_ack),
.ui_clk (ui_clk),
.ui_clk_sync_rst (ui_clk_sync_rst),
.init_calib_complete (init_calib_complete),
.sys_rst (sys_rst)
);
// INST_TAG_END ------ End INSTANTIATION Template ---------
// You must compile the wrapper file ddr.v when simulating
// the core, ddr. When compiling the wrapper file, be sure to
// reference the XilinxCoreLib Verilog simulation library. For detailed
// instructions, please refer to the "CORE Generator Help".
| Verilog | 5 | ckdur/mriscv_vivado_arty | mriscv_vivado.srcs/sources_1/imports/Ram2Ddr_RefComp/ipcore_dir/ddr.veo | [
"MIT"
] |
open tactic
meta def nat.to_expr (n : nat) : expr := reflect n
run_cmd attribute.fingerprint `reducible >>= trace
definition ex0 : nat :=
by nat.to_expr <$> attribute.fingerprint `reducible >>= exact
attribute [reducible]
definition f : nat := 10
run_cmd attribute.fingerprint `reducible >>= trace
definition ex1 : nat :=
by nat.to_expr <$> attribute.fingerprint `reducible >>= exact
#eval ex1
definition g : nat := 20
run_cmd attribute.fingerprint `reducible >>= trace
definition ex2 : nat :=
by nat.to_expr <$> attribute.fingerprint `reducible >>= exact
#eval ex2
example : ex1 = ex2 :=
rfl
definition h : nat := 20
definition ex3 : nat :=
by nat.to_expr <$> attribute.fingerprint `reducible >>= exact
example : ex1 = ex3 :=
rfl
| Lean | 3 | ericrbg/lean | tests/lean/run/fingerprint.lean | [
"Apache-2.0"
] |
#ifndef CAFFE2_OPERATORS_ROI_ALIGN_OP_H_
#define CAFFE2_OPERATORS_ROI_ALIGN_OP_H_
#include "caffe2/core/context.h"
#include "caffe2/core/export_caffe2_op_to_c10.h"
#include "caffe2/core/logging.h"
#include "caffe2/core/operator.h"
C10_DECLARE_EXPORT_CAFFE2_OP_TO_C10(RoIAlign)
namespace caffe2 {
template <typename T, class Context>
class RoIAlignOp final : public Operator<Context> {
public:
USE_OPERATOR_CONTEXT_FUNCTIONS;
template <class... Args>
explicit RoIAlignOp(Args&&... args)
: Operator<Context>(std::forward<Args>(args)...),
order_(StringToStorageOrder(
this->template GetSingleArgument<string>("order", "NCHW"))),
OP_SINGLE_ARG(float, "spatial_scale", spatial_scale_, 1.0f),
OP_SINGLE_ARG(int, "pooled_h", pooled_h_, 1),
OP_SINGLE_ARG(int, "pooled_w", pooled_w_, 1),
OP_SINGLE_ARG(int, "sampling_ratio", sampling_ratio_, -1),
OP_SINGLE_ARG(bool, "aligned", aligned_, false) {
DCHECK_GT(spatial_scale_, 0.0f);
DCHECK_GT(pooled_h_, 0);
DCHECK_GT(pooled_w_, 0);
DCHECK(order_ == StorageOrder::NCHW || order_ == StorageOrder::NHWC);
}
bool RunOnDevice() override {
const auto& X = Input(0);
const auto& R = Input(1);
CAFFE_ENFORCE_EQ(X.dim(), 4);
CAFFE_ENFORCE_EQ(R.dim(), 2);
const int64_t roi_cols = R.size(1);
CAFFE_ENFORCE(roi_cols == 4 || roi_cols == 5);
const int64_t N = R.size(0);
const int64_t C = X.size(order_ == StorageOrder::NCHW ? 1 : 3);
const int64_t H = X.size(order_ == StorageOrder::NCHW ? 2 : 1);
const int64_t W = X.size(order_ == StorageOrder::NCHW ? 3 : 2);
const std::vector<int64_t> Y_sizes = order_ == StorageOrder::NCHW
? std::vector<int64_t>{N, C, pooled_h_, pooled_w_}
: std::vector<int64_t>{N, pooled_h_, pooled_w_, C};
auto* Y = Output(0, Y_sizes, at::dtype<T>());
if (N == 0) {
return true;
}
const T* X_data = X.template data<T>();
const T* R_data = R.template data<T>();
T* Y_data = Y->template mutable_data<T>();
return order_ == StorageOrder::NCHW
? RunOnDeviceWithOrderNCHW(N, C, H, W, roi_cols, X_data, R_data, Y_data)
: RunOnDeviceWithOrderNHWC(
N, C, H, W, roi_cols, X_data, R_data, Y_data);
}
private:
bool RunOnDeviceWithOrderNCHW(
int64_t N,
int64_t C,
int64_t H,
int64_t W,
int64_t roi_cols,
const T* X,
const T* R,
T* Y);
bool RunOnDeviceWithOrderNHWC(
int64_t N,
int64_t C,
int64_t H,
int64_t W,
int64_t roi_cols,
const T* X,
const T* R,
T* Y);
const StorageOrder order_;
const float spatial_scale_;
const int pooled_h_;
const int pooled_w_;
const int sampling_ratio_;
const bool aligned_;
};
} // namespace caffe2
#endif // CAFFE2_OPERATORS_ROI_ALIGN_OP_H_
| C | 5 | Hacky-DH/pytorch | caffe2/operators/roi_align_op.h | [
"Intel"
] |
#!/bin/bash
echo "Testing ${docker_image:=grpc_interop_python:797ca293-94e8-48d4-92e9-a4d52fcfcca9}"
docker run -i --rm=true -e PYTHONPATH=/var/local/git/grpc/src/python/gens -e LD_LIBRARY_PATH=/var/local/git/grpc/libs/opt -w /var/local/git/grpc --net=host $docker_image bash -c "py27/bin/python src/python/grpcio_tests/setup.py run_interop --client --args=\"--server_host=grpc-test.sandbox.googleapis.com --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=large_unary\""
docker run -i --rm=true -e PYTHONPATH=/var/local/git/grpc/src/python/gens -e LD_LIBRARY_PATH=/var/local/git/grpc/libs/opt -w /var/local/git/grpc --net=host $docker_image bash -c "py27/bin/python src/python/grpcio_tests/setup.py run_interop --client --args=\"--server_host=grpc-test.sandbox.googleapis.com --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=empty_unary\""
docker run -i --rm=true -e PYTHONPATH=/var/local/git/grpc/src/python/gens -e LD_LIBRARY_PATH=/var/local/git/grpc/libs/opt -w /var/local/git/grpc --net=host $docker_image bash -c "py27/bin/python src/python/grpcio_tests/setup.py run_interop --client --args=\"--server_host=grpc-test.sandbox.googleapis.com --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=ping_pong\""
docker run -i --rm=true -e PYTHONPATH=/var/local/git/grpc/src/python/gens -e LD_LIBRARY_PATH=/var/local/git/grpc/libs/opt -w /var/local/git/grpc --net=host $docker_image bash -c "py27/bin/python src/python/grpcio_tests/setup.py run_interop --client --args=\"--server_host=grpc-test.sandbox.googleapis.com --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=empty_stream\""
docker run -i --rm=true -e PYTHONPATH=/var/local/git/grpc/src/python/gens -e LD_LIBRARY_PATH=/var/local/git/grpc/libs/opt -w /var/local/git/grpc --net=host $docker_image bash -c "py27/bin/python src/python/grpcio_tests/setup.py run_interop --client --args=\"--server_host=grpc-test.sandbox.googleapis.com --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=client_streaming\""
docker run -i --rm=true -e PYTHONPATH=/var/local/git/grpc/src/python/gens -e LD_LIBRARY_PATH=/var/local/git/grpc/libs/opt -w /var/local/git/grpc --net=host $docker_image bash -c "py27/bin/python src/python/grpcio_tests/setup.py run_interop --client --args=\"--server_host=grpc-test.sandbox.googleapis.com --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=server_streaming\""
docker run -i --rm=true -e PYTHONPATH=/var/local/git/grpc/src/python/gens -e LD_LIBRARY_PATH=/var/local/git/grpc/libs/opt -w /var/local/git/grpc --net=host $docker_image bash -c "py27/bin/python src/python/grpcio_tests/setup.py run_interop --client --args=\"--server_host=grpc-test.sandbox.googleapis.com --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=cancel_after_begin\""
docker run -i --rm=true -e PYTHONPATH=/var/local/git/grpc/src/python/gens -e LD_LIBRARY_PATH=/var/local/git/grpc/libs/opt -w /var/local/git/grpc --net=host $docker_image bash -c "py27/bin/python src/python/grpcio_tests/setup.py run_interop --client --args=\"--server_host=grpc-test.sandbox.googleapis.com --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=cancel_after_first_response\""
docker run -i --rm=true -e PYTHONPATH=/var/local/git/grpc/src/python/gens -e LD_LIBRARY_PATH=/var/local/git/grpc/libs/opt -w /var/local/git/grpc --net=host $docker_image bash -c "py27/bin/python src/python/grpcio_tests/setup.py run_interop --client --args=\"--server_host=grpc-test.sandbox.googleapis.com --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=timeout_on_sleeping_server\""
docker run -i --rm=true -e PYTHONPATH=/var/local/git/grpc/src/python/gens -e LD_LIBRARY_PATH=/var/local/git/grpc/libs/opt -w /var/local/git/grpc --net=host $docker_image bash -c "py27/bin/python src/python/grpcio_tests/setup.py run_interop --client --args=\"--server_host=grpc-test4.sandbox.googleapis.com --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=large_unary\""
docker run -i --rm=true -e PYTHONPATH=/var/local/git/grpc/src/python/gens -e LD_LIBRARY_PATH=/var/local/git/grpc/libs/opt -w /var/local/git/grpc --net=host $docker_image bash -c "py27/bin/python src/python/grpcio_tests/setup.py run_interop --client --args=\"--server_host=grpc-test4.sandbox.googleapis.com --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=empty_unary\""
docker run -i --rm=true -e PYTHONPATH=/var/local/git/grpc/src/python/gens -e LD_LIBRARY_PATH=/var/local/git/grpc/libs/opt -w /var/local/git/grpc --net=host $docker_image bash -c "py27/bin/python src/python/grpcio_tests/setup.py run_interop --client --args=\"--server_host=grpc-test4.sandbox.googleapis.com --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=ping_pong\""
docker run -i --rm=true -e PYTHONPATH=/var/local/git/grpc/src/python/gens -e LD_LIBRARY_PATH=/var/local/git/grpc/libs/opt -w /var/local/git/grpc --net=host $docker_image bash -c "py27/bin/python src/python/grpcio_tests/setup.py run_interop --client --args=\"--server_host=grpc-test4.sandbox.googleapis.com --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=empty_stream\""
docker run -i --rm=true -e PYTHONPATH=/var/local/git/grpc/src/python/gens -e LD_LIBRARY_PATH=/var/local/git/grpc/libs/opt -w /var/local/git/grpc --net=host $docker_image bash -c "py27/bin/python src/python/grpcio_tests/setup.py run_interop --client --args=\"--server_host=grpc-test4.sandbox.googleapis.com --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=client_streaming\""
docker run -i --rm=true -e PYTHONPATH=/var/local/git/grpc/src/python/gens -e LD_LIBRARY_PATH=/var/local/git/grpc/libs/opt -w /var/local/git/grpc --net=host $docker_image bash -c "py27/bin/python src/python/grpcio_tests/setup.py run_interop --client --args=\"--server_host=grpc-test4.sandbox.googleapis.com --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=server_streaming\""
docker run -i --rm=true -e PYTHONPATH=/var/local/git/grpc/src/python/gens -e LD_LIBRARY_PATH=/var/local/git/grpc/libs/opt -w /var/local/git/grpc --net=host $docker_image bash -c "py27/bin/python src/python/grpcio_tests/setup.py run_interop --client --args=\"--server_host=grpc-test4.sandbox.googleapis.com --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=cancel_after_begin\""
docker run -i --rm=true -e PYTHONPATH=/var/local/git/grpc/src/python/gens -e LD_LIBRARY_PATH=/var/local/git/grpc/libs/opt -w /var/local/git/grpc --net=host $docker_image bash -c "py27/bin/python src/python/grpcio_tests/setup.py run_interop --client --args=\"--server_host=grpc-test4.sandbox.googleapis.com --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=cancel_after_first_response\""
docker run -i --rm=true -e PYTHONPATH=/var/local/git/grpc/src/python/gens -e LD_LIBRARY_PATH=/var/local/git/grpc/libs/opt -w /var/local/git/grpc --net=host $docker_image bash -c "py27/bin/python src/python/grpcio_tests/setup.py run_interop --client --args=\"--server_host=grpc-test4.sandbox.googleapis.com --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=timeout_on_sleeping_server\""
| Logos | 3 | samotarnik/grpc | tools/interop_matrix/testcases/python__v1.0.x | [
"Apache-2.0"
] |
---
simple-sidebar: true
social-image: social-logo-heart.png
description: End-to-end developer tools
layout: layouts/base.liquid
---
<div class="hero hero-funding">
<h1>
<div>
<div class="left"></div>
<span class="text long-text">The Road to Rome</span>
<span class="text short-text" aria-hidden="true">Road to Rome</span>
<div class="right"></div>
</div>
</h1>
<h2>Fundraising and Project Goals</h2>
</div>
<main id="main-content" class="content split funding">
{{ content | safe }}
</main>
{% capture script %}{% include scripts/funding.js %}{% endcapture %}
<script>{{ script | jsmin | safe }}</script>
| Liquid | 2 | ViGi-P/rome | website/src/_includes/layouts/funding.liquid | [
"MIT"
] |
require(httr)
res <- httr::GET(url = 'https://api.test.com/', httr::authenticate('', 'some_password'))
| R | 3 | kado0413/curlconverter | fixtures/r/get_basic_auth_no_user.r | [
"MIT"
] |
Mozilla/5.0 (Linux; Android 6.0.1; SAMSUNG SM-G570M Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/5.4 Chrome/51.0.2704.106 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 6.0.1; SM-G570M Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 7.0; SM-G570M Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 6.0.1; SAMSUNG SM-G570M Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/7.4 Chrome/59.0.3071.125 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 7.0; SM-G570M Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/65.0.3325.109 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 7.0; SAMSUNG SM-G570M Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/7.2 Chrome/59.0.3071.125 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 6.0.1; SAMSUNG SM-G570M Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/6.2 Chrome/56.0.2924.87 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 7.0; SM-G570M Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.158 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 6.0.1; SM-G570M Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.98 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 7.0; SM-G570M Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.109 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 7.0; SM-G570M Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 7.0; SAMSUNG SM-G570M Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/7.4 Chrome/59.0.3071.125 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 7.0; SM-G570M Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 6.0.1; SAMSUNG SM-G570M Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/4.0 Chrome/44.0.2403.133 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 7.0; SAMSUNG SM-G570M Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/6.4 Chrome/56.0.2924.87 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 6.0.1; SM-G570M Build/MMB29K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/61.0.3163.98 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 7.0; SM-G570M Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.91 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 7.0; SAMSUNG SM-G570M Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/6.2 Chrome/56.0.2924.87 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 7.0; SM-G570M Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/62.0.3202.84 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 6.0.1; SM-G570M Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.83 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 6.0.1; SM-G570M Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.0 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 6.0.1; SM-G570M Build/MMB29K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/62.0.3202.84 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 7.0; SM-G570M Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.70 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 6.0.1; SM-G570M Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.91 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 7.0; SM-G570M Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.126 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 6.0.1; SM-G570M Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.137 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 7.0; SM-G570M Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.137 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 7.0; SM-G570M Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.116 Mobile Safari/537.36
Mozilla/5.0 (Linux; U; Android 7.0; es-LA; SM-G570M Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 UCBrowser/12.8.0.1120 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 6.0.1; SM-G570M Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 7.0; SM-G570M Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/64.0.3282.137 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 6.0.1; SM-G570M Build/MMB29K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/55.0.2883.91 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 6.0.1; SM-G570M Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.107 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 6.0.1; SM-G570M Build/MMB29K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/59.0.3071.125 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 6.0.1; SM-G570M Build/MMB29K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/63.0.3239.111 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 7.0; SM-G570M Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.86 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 7.0; SM-G570M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.80 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 6.0.1; SM-G570M Build/MMB29K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/64.0.3282.137 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 6.0.1; SM-G570M Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 6.0.1; SM-G570M Build/MMB29K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/64.0.3282.137 Mobile Safari/537.36 [Pinterest/Android]
| Text | 0 | 5tr1x/SecLists | Fuzzing/User-Agents/operating-platform/samsung-sm-g570m.txt | [
"MIT"
] |
// Copyright 2021 The Google Research 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.
// A FlumeC++ pipeline that merges measurements tables.
#include <gflags/gflags.h>
#include "pipeline/flume/public/flume.h"
#include "pipeline/flume/public/sstableio.h"
#include "xxx/preprocess/merge/merge_measurements.h"
DEFINE_string(output_filename,
"",
"output filename for sstable");
namespace research_biology {
namespace aptamers {
// Run the merge on the input files, specified by <argc, argv>.
void Run(int argc, char **argv) {
// Initialize Flume now, and automatically clean up at the end of
// this scope.
flume::Flume flume;
// Open the sstable inputs and construct the join table.
std::vector<JoinTag> tags;
flume::JoinOp<string> join("Merge");
for (int i = 1; i < argc; i++) {
const string key(argv[i]);
MeasurementTable input =
MeasurementTable::Read(
key,
flume::SSTableSource<string, Measurement>(
key,
flume::Strings(),
flume::Protos<Measurement>()));
JoinTag tag(key);
tags.push_back(tag);
join = join.With(flume::JoinArg::Of(tag, input));
}
JoinTable table = join.Join();
// Transform the collection.
MeasurementTable merged = MergeMeasurements(tags, table);
// Write to the specified output file.
flume::PSink<MeasurementEntry> output =
flume::SSTableSink<string, Measurement>(
FLAGS_output_filename,
flume::Strings(),
flume::Protos<Measurement>());
// Write it out.
merged.Write("Write", output);
}
} // namespace aptamers
} // namespace research_biology
int main(int argc, char** argv) {
gflags::ParseCommandLineFlags(&argc, &argv, true);
if (base::GetFlag(FLAGS_output_filename).empty()) {
LOG(ERROR) << "--output_filename is required";
return 1;
}
// Copy the file.
research_biology::aptamers::Run(argc, argv);
return 0;
}
| C++ | 4 | DionysisChristopoulos/google-research | aptamers_mlpd/preprocess/merge/merge_measurements_main.cc | [
"Apache-2.0"
] |
# The INPUT HEADER is scanned for declarations
# LIBNAME INPUT HEADER ERROR-TABLE FILE
L CAPI e_capi_err.h e_capi_err.c
| eC | 2 | xumia/debian-openssl | engines/e_capi.ec | [
"OpenSSL"
] |
# ====================[ use.mask ]====================
#
# --------------------( SYNOPSIS )--------------------
# List of ebuild-specific USE flags to be disabled for this architecture.
# ....................{ UNSUPPORTED }....................
# "app-shells/rc" has yet to be ported to PowerPC.
app-misc/powerline rc
| Mask | 3 | Ferroin/raiagent | profiles/arch/powerpc/package.use.mask | [
"FTL"
] |
discard """
errormsg: "invalid indentation"
file: "tinvwhen.nim"
line: 11
"""
# This was parsed even though it should not!
proc chdir(path: cstring): cint {.importc: "chdir", header: "dirHeader".}
proc getcwd(buf: cstring, buflen: cint): cstring
when defined(unix): {.importc: "getcwd", header: "<unistd.h>".} #ERROR_MSG invalid indentation
elif defined(windows): {.importc: "getcwd", header: "<direct.h>"}
else: {.error: "os library not ported to your OS. Please help!".}
| Nimrod | 3 | JohnAD/Nim | tests/parser/tinvwhen.nim | [
"MIT"
] |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
Describe 'Command error handling in general' -Tag 'CI' {
BeforeAll {
$pwsh = [PowerShell]::Create()
$pwsh.AddScript(@'
function ThrowTerminatingError {
[CmdletBinding()]
param()
$ex = [System.ArgumentException]::new('terminating-exception')
$er = [System.Management.Automation.ErrorRecord]::new($ex, 'ThrowTerminatingError:error', 'InvalidArgument', $null)
$PSCmdlet.ThrowTerminatingError($er)
Write-Verbose -Verbose "verbose-message"
}
function ErrorActionStop {
[CmdletBinding()]
param()
Get-Command NonExist -ErrorAction Stop
Write-Verbose -Verbose "verbose-message"
}
function ThrowException {
[CmdletBinding()]
param()
throw 'throw-exception'
Write-Verbose -Verbose "verbose-message"
}
function WriteErrorAPI {
[CmdletBinding()]
param()
$ex = [System.ArgumentException]::new('arg-exception')
$er = [System.Management.Automation.ErrorRecord]::new($ex, 'WriteErrorAPI:error', 'InvalidArgument', $null)
$PSCmdlet.WriteError($er)
Write-Verbose -Verbose "verbose-message"
}
function WriteErrorCmdlet {
[CmdletBinding()]
param()
Write-Error 'write-error-cmdlet'
Write-Verbose -Verbose "verbose-message"
}
function MethodInvocationThrowException {
[CmdletBinding()]
param()
## This method call throws exception.
$iss = [initialsessionstate]::Create()
$iss.ImportPSModule($null)
Write-Verbose -Verbose "verbose-message"
}
function ExpressionThrowException {
[CmdletBinding()]
param()
1/0 ## throw exception.
Write-Verbose -Verbose "verbose-message"
}
'@).Invoke()
function RunCommand {
param(
[string] $Command,
[ValidateSet('Continue', 'Ignore', 'SilentlyContinue', 'Stop')]
[string] $ErrorAction
)
$pwsh.Commands.Clear()
$pwsh.Streams.ClearStreams()
$pwsh.AddCommand($command).AddParameter('ErrorAction', $ErrorAction).Invoke()
}
function RunScript {
param([string] $Script)
$pwsh.Commands.Clear()
$pwsh.Streams.ClearStreams()
$pwsh.AddScript($Script).Invoke()
}
function GetLastError {
$pwsh.Commands.Clear()
$pwsh.AddCommand('Get-Error').Invoke()
}
function ClearDollarError {
$pwsh.Commands.Clear()
$pwsh.AddScript('$Error.Clear()').Invoke()
}
}
AfterAll {
$pwsh.Dispose()
}
Context 'Terminating error' {
It "'ThrowTerminatingError' should always stop execution even when the error action is '<ErrorAction>'" -TestCases @(
@{ ErrorAction = 'Continue' }
@{ ErrorAction = 'Ignore' }
@{ ErrorAction = 'SilentlyContinue' }
) {
param ($ErrorAction)
$failure = $null
try {
RunCommand -Command 'ThrowTerminatingError' -ErrorAction $ErrorAction
} catch {
$failure = $_
}
$failure | Should -Not -BeNullOrEmpty
$failure.Exception | Should -BeOfType 'System.Management.Automation.MethodInvocationException'
$failure.Exception.InnerException | Should -BeOfType 'System.Management.Automation.CmdletInvocationException'
$failure.Exception.InnerException.InnerException | Should -BeOfType 'System.ArgumentException'
$failure.Exception.InnerException.InnerException.Message | Should -BeExactly 'terminating-exception'
$pwsh.Streams.Verbose | Should -HaveCount 0
}
It "'-ErrorAction Stop' should always stop execution even when the error action is '<ErrorAction>'" -TestCases @(
@{ ErrorAction = 'Continue' }
@{ ErrorAction = 'Ignore' }
@{ ErrorAction = 'SilentlyContinue' }
) {
param ($ErrorAction)
$failure = $null
try {
RunCommand -Command 'ErrorActionStop' -ErrorAction $ErrorAction
} catch {
$failure = $_
}
$failure | Should -Not -BeNullOrEmpty
$failure.Exception | Should -BeOfType 'System.Management.Automation.MethodInvocationException'
$failure.Exception.InnerException | Should -BeOfType 'System.Management.Automation.ActionPreferenceStopException'
$failure.Exception.InnerException.ErrorRecord.FullyQualifiedErrorId | Should -BeExactly 'CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand'
$pwsh.Streams.Verbose | Should -HaveCount 0
}
It "'throw' statement should stop execution when running with the default error action ('Continue')" {
$failure = $null
try {
RunCommand -Command 'ThrowException' -ErrorAction 'Continue'
} catch {
$failure = $_
}
$failure | Should -Not -BeNullOrEmpty
$failure.Exception | Should -BeOfType 'System.Management.Automation.MethodInvocationException'
$failure.Exception.InnerException | Should -BeOfType 'System.Management.Automation.RuntimeException'
$failure.Exception.InnerException.Message | Should -BeExactly 'throw-exception'
$pwsh.Streams.Verbose | Should -HaveCount 0
}
<# The 'throw' statement is special, in that it can be suppressed by '-ErrorAction SilentlyContinue/Ignore' #>
It "'throw' statement doesn't stop execution when the error action is '<ErrorAction>'" -TestCases @(
@{ ErrorAction = 'Ignore' }
@{ ErrorAction = 'SilentlyContinue' }
) {
param ($ErrorAction)
$failure = $null
try {
RunCommand -Command 'ThrowException' -ErrorAction $ErrorAction
} catch {
$failure = $_
}
$failure | Should -BeNullOrEmpty
$pwsh.Streams.Verbose | Should -HaveCount 1
$pwsh.Streams.Verbose | Should -BeExactly 'verbose-message'
## The suppressed 'throw' exception is not written to the error stream, not sure why but it's the current behavior.
$pwsh.Streams.Error | Should -HaveCount 0
## The suppressed 'throw' exception is kept in '$Error'
$err = GetLastError
$err | Should -Not -BeNullOrEmpty
$err.FullyQualifiedErrorId | Should -BeExactly 'throw-exception'
}
It "'throw' statement should stop execution with the error action '<ErrorAction>' when it's wrapped in 'try/catch'" -TestCases @(
@{ ErrorAction = 'Ignore' }
@{ ErrorAction = 'SilentlyContinue' }
) {
param ($ErrorAction)
RunScript -Script "try { ThrowException -ErrorAction $ErrorAction } catch { Write-Debug -Debug `$_.FullyQualifiedErrorId }"
$pwsh.Streams.Verbose | Should -HaveCount 0
$pwsh.Streams.Debug | Should -HaveCount 1
$pwsh.Streams.Debug | Should -BeExactly 'throw-exception'
}
It "'throw' statement should stop execution with the error action '<ErrorAction>' when it's accompanied by 'trap' statement" -TestCases @(
@{ ErrorAction = 'Ignore' }
@{ ErrorAction = 'SilentlyContinue' }
) {
param ($ErrorAction)
RunScript -Script "trap { Write-Debug -Debug `$_.FullyQualifiedErrorId; continue } ThrowException -ErrorAction $ErrorAction"
$pwsh.Streams.Verbose | Should -HaveCount 0
$pwsh.Streams.Debug | Should -HaveCount 1
$pwsh.Streams.Debug | Should -BeExactly 'throw-exception'
}
}
Context 'Non-terminating error' {
It "'WriteErrorAPI' doesn't stop execution with the default error action ('Continue')" {
RunCommand -Command 'WriteErrorAPI' -ErrorAction Continue
$pwsh.Streams.Error | Should -HaveCount 1
$pwsh.Streams.Error[0].Exception.Message | Should -BeExactly 'arg-exception'
$pwsh.Streams.Error[0].FullyQualifiedErrorId | Should -BeExactly 'WriteErrorAPI:error,WriteErrorAPI'
$pwsh.Streams.Verbose | Should -HaveCount 1
$pwsh.Streams.Verbose | Should -BeExactly 'verbose-message'
}
It "'WriteErrorAPI' doesn't stop execution with the error action 'Ignore' and the error doesn't get logged in `$Error" {
ClearDollarError
RunCommand -Command 'WriteErrorAPI' -ErrorAction Ignore
$pwsh.Streams.Error | Should -HaveCount 0
$pwsh.Streams.Verbose | Should -HaveCount 1
$pwsh.Streams.Verbose | Should -BeExactly 'verbose-message'
$lastErr = GetLastError
$lastErr | Should -BeNullOrEmpty
}
It "'WriteErrorAPI' doesn't stop execution with the error action 'SilentlyContinue' and the error gets logged in `$Error" {
ClearDollarError
RunCommand -Command 'WriteErrorAPI' -ErrorAction SilentlyContinue
$pwsh.Streams.Error | Should -HaveCount 0
$pwsh.Streams.Verbose | Should -HaveCount 1
$pwsh.Streams.Verbose | Should -BeExactly 'verbose-message'
$lastErr = GetLastError
$lastErr | Should -Not -BeNullOrEmpty
$lastErr.Exception.Message | Should -BeExactly 'arg-exception'
$lastErr.FullyQualifiedErrorId | Should -BeExactly 'WriteErrorAPI:error,WriteErrorAPI'
}
It "'WriteErrorCmdlet' doesn't stop execution with the default error action ('Continue')" {
RunCommand -Command 'WriteErrorCmdlet' -ErrorAction Continue
$pwsh.Streams.Error | Should -HaveCount 1
$pwsh.Streams.Error[0].Exception.Message | Should -BeExactly 'write-error-cmdlet'
$pwsh.Streams.Error[0].FullyQualifiedErrorId | Should -BeExactly 'Microsoft.PowerShell.Commands.WriteErrorException,WriteErrorCmdlet'
$pwsh.Streams.Verbose | Should -HaveCount 1
$pwsh.Streams.Verbose | Should -BeExactly 'verbose-message'
}
It "'WriteErrorCmdlet' doesn't stop execution with the error action 'Ignore' and the error doesn't get logged in `$Error" {
ClearDollarError
RunCommand -Command 'WriteErrorCmdlet' -ErrorAction Ignore
$pwsh.Streams.Error | Should -HaveCount 0
$pwsh.Streams.Verbose | Should -HaveCount 1
$pwsh.Streams.Verbose | Should -BeExactly 'verbose-message'
$lastErr = GetLastError
$lastErr | Should -BeNullOrEmpty
}
It "'WriteErrorCmdlet' doesn't stop execution with the error action 'SilentlyContinue' and the error gets logged in `$Error" {
ClearDollarError
RunCommand -Command 'WriteErrorCmdlet' -ErrorAction SilentlyContinue
$pwsh.Streams.Error | Should -HaveCount 0
$pwsh.Streams.Verbose | Should -HaveCount 1
$pwsh.Streams.Verbose | Should -BeExactly 'verbose-message'
$lastErr = GetLastError
$lastErr | Should -Not -BeNullOrEmpty
$lastErr.Exception.Message | Should -BeExactly 'write-error-cmdlet'
$lastErr.FullyQualifiedErrorId | Should -BeExactly 'Microsoft.PowerShell.Commands.WriteErrorException,WriteErrorCmdlet'
}
}
Context 'Exception thrown from the method invocation or expression' {
#region MethodInvocationThrowException
It "'MethodInvocationThrowException' emits non-terminating error with the default error action ('Continue')" {
RunCommand -Command 'MethodInvocationThrowException' -ErrorAction 'Continue'
$pwsh.Streams.Error | Should -HaveCount 1
$pwsh.Streams.Error[0].FullyQualifiedErrorId | Should -BeExactly 'ArgumentNullException'
$pwsh.Streams.Verbose | Should -HaveCount 1
$pwsh.Streams.Verbose | Should -BeExactly 'verbose-message'
}
It "'MethodInvocationThrowException' emits no error with the error action '<ErrorAction>'" -TestCases @(
@{ ErrorAction = 'Ignore' }
@{ ErrorAction = 'SilentlyContinue' }
) {
param ($ErrorAction)
RunCommand -Command 'MethodInvocationThrowException' -ErrorAction $ErrorAction
$pwsh.Streams.Error | Should -HaveCount 0
$pwsh.Streams.Verbose | Should -HaveCount 1
$pwsh.Streams.Verbose | Should -BeExactly 'verbose-message'
## The suppressed exception is kept in '$Error'
$err = GetLastError
$err | Should -Not -BeNullOrEmpty
$err.FullyQualifiedErrorId | Should -BeExactly 'ArgumentNullException'
}
It "'MethodInvocationThrowException' emits terminating error with the error action 'Stop'" {
$failure = $null
try {
RunCommand -Command 'MethodInvocationThrowException' -ErrorAction Stop
} catch {
$failure = $_
}
$failure | Should -Not -BeNullOrEmpty
$failure.Exception | Should -BeOfType 'System.Management.Automation.MethodInvocationException'
$failure.Exception.InnerException | Should -BeOfType 'System.Management.Automation.CmdletInvocationException'
$failure.Exception.InnerException.InnerException.InnerException | Should -BeOfType 'System.ArgumentNullException'
$pwsh.Streams.Verbose | Should -HaveCount 0
}
It "'MethodInvocationThrowException' emits terminating error with the error action '<ErrorAction>' when it's wrapped in 'try/catch'" -TestCases @(
@{ ErrorAction = 'Continue' }
@{ ErrorAction = 'Ignore' }
@{ ErrorAction = 'SilentlyContinue' }
) {
param ($ErrorAction)
RunScript -Script "try { MethodInvocationThrowException -ErrorAction $ErrorAction } catch { Write-Debug -Debug `$_.Exception.InnerException.GetType().FullName }"
$pwsh.Streams.Error | Should -HaveCount 0
$pwsh.Streams.Verbose | Should -HaveCount 0
$pwsh.Streams.Debug | Should -HaveCount 1
$pwsh.Streams.Debug | Should -BeExactly 'System.ArgumentNullException'
}
It "'MethodInvocationThrowException' emits terminating error with the error action '<ErrorAction>' when it's accompanied by 'trap' statement" -TestCases @(
@{ ErrorAction = 'Continue' }
@{ ErrorAction = 'Ignore' }
@{ ErrorAction = 'SilentlyContinue' }
) {
param ($ErrorAction)
RunScript -Script "trap { Write-Debug -Debug `$_.Exception.InnerException.GetType().FullName; continue } MethodInvocationThrowException -ErrorAction $ErrorAction"
$pwsh.Streams.Error | Should -HaveCount 0
$pwsh.Streams.Verbose | Should -HaveCount 0
$pwsh.Streams.Debug | Should -HaveCount 1
$pwsh.Streams.Debug | Should -BeExactly 'System.ArgumentNullException'
}
#endregion
#region ExpressionThrowException
It "'ExpressionThrowException' emits non-terminating error with the default error action ('Continue')" {
RunCommand -Command 'ExpressionThrowException' -ErrorAction 'Continue'
$pwsh.Streams.Error | Should -HaveCount 1
$pwsh.Streams.Error[0].Exception.InnerException | Should -BeOfType 'System.DivideByZeroException'
$pwsh.Streams.Verbose | Should -HaveCount 1
$pwsh.Streams.Verbose | Should -BeExactly 'verbose-message'
}
It "'ExpressionThrowException' emits no error with the error action '<ErrorAction>'" -TestCases @(
@{ ErrorAction = 'Ignore' }
@{ ErrorAction = 'SilentlyContinue' }
) {
param ($ErrorAction)
RunCommand -Command 'ExpressionThrowException' -ErrorAction $ErrorAction
$pwsh.Streams.Error | Should -HaveCount 0
$pwsh.Streams.Verbose | Should -HaveCount 1
$pwsh.Streams.Verbose | Should -BeExactly 'verbose-message'
## The suppressed exception is kept in '$Error'
$err = GetLastError
$err | Should -Not -BeNullOrEmpty
$err.Exception.InnerException | Should -BeOfType 'System.DivideByZeroException'
}
It "'ExpressionThrowException' emits terminating error with the error action 'Stop'" {
$failure = $null
try {
RunCommand -Command 'ExpressionThrowException' -ErrorAction Stop
} catch {
$failure = $_
}
$failure | Should -Not -BeNullOrEmpty
$failure.Exception | Should -BeOfType 'System.Management.Automation.MethodInvocationException'
$failure.Exception.InnerException | Should -BeOfType 'System.Management.Automation.CmdletInvocationException'
$failure.Exception.InnerException.InnerException.InnerException | Should -BeOfType 'System.DivideByZeroException'
$pwsh.Streams.Verbose | Should -HaveCount 0
}
It "'ExpressionThrowException' emits terminating error with the error action '<ErrorAction>' when it's wrapped in 'try/catch'" -TestCases @(
@{ ErrorAction = 'Continue' }
@{ ErrorAction = 'Ignore' }
@{ ErrorAction = 'SilentlyContinue' }
) {
param ($ErrorAction)
RunScript -Script "try { ExpressionThrowException -ErrorAction $ErrorAction } catch { Write-Debug -Debug `$_.Exception.InnerException.GetType().FullName }"
$pwsh.Streams.Error | Should -HaveCount 0
$pwsh.Streams.Verbose | Should -HaveCount 0
$pwsh.Streams.Debug | Should -HaveCount 1
$pwsh.Streams.Debug | Should -BeExactly 'System.DivideByZeroException'
}
It "'ExpressionThrowException' emits terminating error with the error action '<ErrorAction>' when it's accompanied by 'trap' statement" -TestCases @(
@{ ErrorAction = 'Continue' }
@{ ErrorAction = 'Ignore' }
@{ ErrorAction = 'SilentlyContinue' }
) {
param ($ErrorAction)
RunScript -Script "trap { Write-Debug -Debug `$_.Exception.InnerException.GetType().FullName; continue } ExpressionThrowException -ErrorAction $ErrorAction"
$pwsh.Streams.Error | Should -HaveCount 0
$pwsh.Streams.Verbose | Should -HaveCount 0
$pwsh.Streams.Debug | Should -HaveCount 1
$pwsh.Streams.Debug | Should -BeExactly 'System.DivideByZeroException'
}
#endregion
}
}
| PowerShell | 5 | dahlia/PowerShell | test/powershell/Language/Scripting/CommandErrorHandling.Tests.ps1 | [
"MIT"
] |
class S0<B, A> {
set S1(S2: S0<any,any>) {
}
constructor(public S17: S0<any, (S18) => A>) { }
}
| TypeScript | 1 | nilamjadhav/TypeScript | tests/cases/compiler/recursiveSpecializationOfSignatures.ts | [
"Apache-2.0"
] |
-- SCHEMA_NAME(..)
SELECT ISNULL(
(SELECT object.name, object.schema_id, object.object_id, object.type_desc,
JSON_QUERY([schema].json) AS [joined_sys_schema],
JSON_QUERY([column].json) AS [joined_sys_column],
JSON_QUERY([primary_key].json) AS [joined_sys_primary_key]
FROM sys.objects object
CROSS APPLY (SELECT [column].name, [column].column_id, [column].is_nullable, [column].is_identity, [column].user_type_id,
JSON_QUERY([types].json) AS [joined_sys_type],
JSON_QUERY(ISNULL([relationships].json,'[]')) AS [joined_foreign_key_columns]
FROM sys.columns [column]
CROSS APPLY (SELECT name, schema_id, user_type_id FROM sys.types [type]
WHERE [type].user_type_id = [column].user_type_id
FOR JSON PATH, WITHOUT_ARRAY_WRAPPER)
AS [types](json)
CROSS APPLY (SELECT fk.*,
referenced_table.name AS joined_referenced_table_name,
referenced_column.name AS joined_referenced_column_name,
JSON_QUERY([schema].json) AS [joined_referenced_sys_schema]
FROM sys.foreign_key_columns [fk],
sys.objects AS referenced_table,
sys.columns AS referenced_column
CROSS APPLY (SELECT [schema].name, [schema].schema_id
FROM sys.schemas [schema]
WHERE [schema].schema_id = object.schema_id
FOR JSON PATH, WITHOUT_ARRAY_WRAPPER)
AS [schema](json)
WHERE [object].object_id = fk.parent_object_id
AND [referenced_table].object_id = fk.referenced_object_id
AND [referenced_column].object_id = [referenced_table].object_id
AND [referenced_column].column_id = fk.referenced_column_id
AND [column].column_id = fk.parent_column_id
FOR JSON PATH)
AS [relationships](json)
WHERE [column].object_id = object.object_id
FOR JSON PATH)
AS [column](json)
CROSS APPLY (SELECT [schema].name, [schema].schema_id
FROM sys.schemas [schema]
WHERE [schema].schema_id = object.schema_id
FOR JSON PATH, WITHOUT_ARRAY_WRAPPER)
AS [schema](json)
CROSS APPLY (SELECT pk.name, pk.index_id, JSON_QUERY([cols].json) AS columns
FROM sys.indexes pk
CROSS APPLY (SELECT col.name
FROM sys.index_columns ic
INNER JOIN sys.columns col
ON col.column_id = ic.column_id
AND col.object_id = ic.object_id
WHERE ic.object_id = pk.object_id
AND ic.index_id = pk.index_id
FOR JSON PATH)
AS [cols](json)
WHERE pk.object_id = object.object_id
AND pk.is_primary_key = 1
FOR JSON PATH, WITHOUT_ARRAY_WRAPPER)
AS [primary_key](json)
WHERE object.type_desc IN ('USER_TABLE', 'VIEW')
FOR JSON PATH)
, '[]')
| SQL | 3 | devrsi0n/graphql-engine | server/src-rsr/mssql_table_metadata.sql | [
"Apache-2.0",
"MIT"
] |
#import <ATen/native/metal/mpscnn/MPSCNNOp.h>
@interface MPSCNNClampOp : NSObject<MPSCNNShaderOp>
@end
| C | 1 | Hacky-DH/pytorch | aten/src/ATen/native/metal/mpscnn/MPSCNNClampOp.h | [
"Intel"
] |
<mt:Ignore>
# =======================
#
# デバッグ-ページ
#
# =======================
</mt:Ignore>
<mt:If name="ec_debug" eq="1">
<div class="ec-debug p-y-lg">
<div class="container">
<p class="h3">デバッグモード</p>
<div class="card ec-debug">
<div class="card-header">META</div>
<div class="card-block">
<dl>
<dt>ec_meta_title</dt>
<dd><mt:Var name="ec_meta_title" _default="(none)" /></dd>
<dt>ec_meta_description</dt>
<dd><mt:Var name="ec_meta_description" _default="(none)" /></dd>
<dt>ec_meta_permalink</dt>
<dd><mt:Var name="ec_meta_permalink" _default="(none)" /></dd>
<dt>ec_meta_publish</dt>
<dd><mt:Var name="ec_meta_publish" _default="(none)" /></dd>
<dt>ec_meta_category</dt>
<dd><mt:Var name="ec_meta_category" _default="(none)" /></dd>
<dt>ec_meta_eyecatch</dt>
<dd>
<mt:If name="ec_meta_eyecatch">
<img src="<mt:Var name="ec_meta_eyecatch" />" style="width: 150px; height: auto;">
<mt:Else>
(none)
</mt:If>
</dd>
<dt>ec_meta_noindex</dt>
<dd><mt:Var name="ec_meta_noindex" _default="0" /></dd>
</dl>
<!-- /.card-block --></div>
<!-- /.card ec-debug --></div>
<div class="card ec-debug">
<div class="card-header">Post</div>
<div class="card-block">
<dl>
<dt>ec_post_id</dt>
<dd><mt:Var name="ec_post_id" _default="(none)" /></dd>
<dt>ec_post_basename</dt>
<dd><mt:Var name="ec_post_basename" _default="(none)" /></dd>
</dl>
<!-- /.card-block --></div>
<!-- /.card ec-debug --></div>
<div class="card ec-debug">
<div class="card-header">Taxonomy</div>
<div class="card-block">
<dl>
<dt>ec_taxonomy_basename</dt>
<dd><mt:Var name="ec_taxonomy_basename" _default="(none)" /></dd>
<dt>ec_taxonomy_label</dt>
<dd><mt:Var name="ec_taxonomy_label" _default="(none)" /></dd>
<dt>ec_taxonomy_path</dt>
<dd><mt:Var name="ec_taxonomy_path" _default="(none)" /></dd>
<dt>ec_taxonomy_parent_basename</dt>
<dd><mt:Var name="ec_taxonomy_parent_basename" _default="(none)" /></dd>
<dt>ec_taxonomy_parent_label</dt>
<dd><mt:Var name="ec_taxonomy_parent_label" _default="(none)" /></dd>
<dt>ec_taxonomy_parent_path</dt>
<dd><mt:Var name="ec_taxonomy_parent_path" _default="(none)" /></dd>
<dt>ec_taxonomy_ancestor_basename</dt>
<dd><mt:Var name="ec_taxonomy_ancestor_basename" _default="(none)" /></dd>
<dt>ec_taxonomy_ancestor_label</dt>
<dd><mt:Var name="ec_taxonomy_ancestor_label" _default="(none)" /></dd>
<dt>ec_taxonomy_ancestor_path</dt>
<dd><mt:Var name="ec_taxonomy_ancestor_path" _default="(none)" /></dd>
</dl>
<!-- /.card-block --></div>
<!-- /.card ec-debug --></div>
<div class="card ec-debug">
<div class="card-header">Website,Blog</div>
<div class="card-block">
<dl>
<dt>ec_website_name</dt>
<dd><mt:Var name="ec_website_name" _default="(none)" /></dd>
<dt>ec_website_suffix</dt>
<dd><mt:Var name="ec_website_suffix" _default="(none)" /></dd>
<dt>ec_website_description</dt>
<dd><mt:Var name="ec_website_description" _default="(none)" /></dd>
<dt>ec_website_path</dt>
<dd><mt:Var name="ec_website_path" _default="(none)" /></dd>
<dt>ec_website_fullpath</dt>
<dd><mt:Var name="ec_website_fullpath" _default="(none)" /></dd>
<dt>ec_website_ogimage</dt>
<dd>
<mt:If name="ec_website_ogimage">
<img src="<mt:Var name="ec_website_ogimage" />" style="width: 150px; height: auto;">
<mt:Else>
(none)
</mt:If>
</dd>
<dt>ec_website_twitter</dt>
<dd><mt:Var name="ec_website_twitter" _default="(none)" /></dd>
<dt>ec_website_fbpage</dt>
<dd><mt:Var name="ec_website_fbpage" _default="(none)" /></dd>
<dt>ec_website_fbappid</dt>
<dd><mt:Var name="ec_website_fbappid" _default="(none)" /></dd>
<dt>ec_website_url</dt>
<dd><mt:Var name="ec_website_url" _default="(none)" /></dd>
</dl>
<!-- /.card-block --></div>
<!-- /.card ec-debug --></div>
<div class="card ec-debug">
<div class="card-header">Other</div>
<div class="card-block">
<dl>
<dt>ec_body_class</dt>
<dd><mt:Var name="ec_body_class" _default="(none)" /></dd>
<dt>ec_blog_contents_label</dt>
<dd><mt:Var name="ec_blog_contents_label" _default="(none)" /></dd>
<dt>ec_breadcrumb_home_label</dt>
<dd><mt:Var name="ec_breadcrumb_home_label" _default="(none)" /></dd>
<dt>ec_page_layout</dt>
<dd><mt:Var name="ec_page_layout" _default="(none)" /></dd>
</dl>
<!-- /.card-block --></div>
<!-- /.card ec-debug --></div>
<!-- /.container --></div>
<!-- /.ec-debug p-y-lg --></div>
</mt:If> | MTML | 3 | webbingstudio/mt_theme_echo_bootstrap | dist/themes/echo_bootstrap/templates/debug_page.mtml | [
"MIT"
] |
0 reg32_t "dword"
1 code_t "proc*"
2 num32_t "int"
3 uint32_t "size_t"
4 ptr(num8_t) "char*"
5 ptr(TOP) "void*"
6 ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(struct(0:num32_t,4:ptr(reg8_t),8:ptr(reg8_t),12:ptr(reg8_t),16:ptr(reg8_t),20:ptr(reg8_t),24:ptr(reg8_t),28:ptr(reg8_t),32:ptr(reg8_t),36:ptr(reg8_t),40:ptr(reg8_t),44:ptr(reg8_t),48:ptr(TOP),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),8:num32_t)),52:ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(TOP),8:num32_t)),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))) "FILE*"
7 ptr(array(reg8_t,16)) "unknown_128*"
8 ptr(array(reg8_t,56)) "unknown_448*"
9 ptr(array(reg8_t,132)) "unknown_1056*"
10 ptr(array(reg8_t,58)) "unknown_464*"
11 num8_t "char"
12 union(ptr(num8_t),ptr(struct(0:reg16_t,2:num8_t))) "Union_0"
13 ptr(struct(0:reg16_t,2:num8_t)) "StructFrag_0*"
14 ptr(struct(0:ptr(TOP),4:reg32_t,8:ptr(num8_t))) "Struct_2*"
15 ptr(struct(0:array(reg8_t,38),38:num8_t)) "StructFrag_8*"
16 ptr(reg32_t) "dword[]"
16 ptr(reg32_t) "dword*"
4 ptr(num8_t) "char[]"
17 ptr(struct(0:array(reg8_t,6),6:num8_t)) "StructFrag_10*"
18 ptr(struct(0:num32_t,4:ptr(struct(0:ptr(num8_t),8:ptr(num8_t))),4294967292:reg32_t)) "Struct_5*"
19 ptr(struct(0:ptr(num8_t),4:num32_t,8:ptr(num32_t),12:num32_t)) "option*"
20 ptr(struct(0:ptr(num8_t),8:ptr(num8_t))) "Struct_6*"
21 ptr(struct(0:reg32_t,40:ptr(num8_t),44:ptr(num8_t))) "Struct_1*"
22 ptr(struct(40:ptr(num8_t),44:ptr(num8_t))) "Struct_3*"
3 uint32_t "unsigned int"
23 ptr(uint32_t) "size_t*"
24 array(reg8_t,3) "unknown_24"
25 ptr(struct(0:reg32_t,4:ptr(TOP))) "Struct_0*"
26 reg64_t "qword"
27 array(reg8_t,32) "unknown_256"
28 int32_t "signed int"
29 array(reg8_t,16) "unknown_128"
30 array(reg8_t,80) "unknown_640"
23 ptr(uint32_t) "unsigned int*"
31 union(ptr(struct(0:reg32_t,40:ptr(num8_t),44:ptr(num8_t))),ptr(reg32_t)) "Union_1"
32 ptr(struct(0:reg32_t,4:reg32_t)) "StructFrag_2*"
33 union(ptr(num8_t),ptr(struct(0:reg16_t,2:num8_t)),ptr(struct(0:ptr(TOP),4:reg32_t,8:ptr(num8_t)))) "Union_2"
34 ptr(num32_t) "int*"
35 ptr(ptr(uint16_t)) "unsigned short**"
36 ptr(struct(0:array(reg8_t,16),16:uint32_t)) "StructFrag_11*"
37 ptr(code_t) "proc**"
38 ptr(uint16_t) "unsigned short*"
39 ptr(reg16_t) "word*"
40 ptr(struct(0:array(reg8_t,59122),59122:reg32_t)) "StructFrag_4*"
41 ptr(struct(0:array(reg8_t,536870908),4294967292:reg32_t)) "StructFrag_5*"
18 ptr(struct(0:num32_t,4:ptr(struct(0:ptr(num8_t),8:ptr(num8_t))),4294967292:reg32_t)) "Struct_7*"
42 ptr(struct(0:array(reg8_t,29628),29628:reg32_t)) "StructFrag_6*"
43 ptr(struct(0:array(reg8_t,584),584:reg32_t)) "StructFrag_7*"
44 array(reg8_t,4096) "unknown_32768"
45 array(reg8_t,135168) "unknown_1081344"
46 array(reg8_t,30) "unknown_240"
47 array(reg8_t,5) "unknown_40"
48 array(reg8_t,17) "unknown_136"
49 array(reg8_t,41) "unknown_328"
50 array(reg8_t,7) "unknown_56"
51 array(reg8_t,51) "unknown_408"
52 array(reg8_t,13) "unknown_104"
53 array(reg8_t,27) "unknown_216"
54 array(reg8_t,36) "unknown_288"
55 array(reg8_t,23) "unknown_184"
56 reg16_t "word"
57 array(reg8_t,6) "unknown_48"
58 array(reg8_t,48) "unknown_384"
59 array(reg8_t,142) "unknown_1136"
60 array(reg8_t,53) "unknown_424"
61 array(reg8_t,55) "unknown_440"
62 array(reg8_t,248) "unknown_1984"
63 array(reg8_t,11) "unknown_88"
64 array(reg8_t,39) "unknown_312"
65 array(reg8_t,93) "unknown_744"
66 array(reg8_t,179) "unknown_1432"
67 array(reg8_t,57) "unknown_456"
68 array(reg8_t,40) "unknown_320"
69 array(reg8_t,29) "unknown_232"
70 array(reg8_t,22) "unknown_176"
71 array(reg8_t,118) "unknown_944"
72 array(reg8_t,54) "unknown_432"
73 array(reg8_t,19) "unknown_152"
74 array(reg8_t,79) "unknown_632"
75 array(reg8_t,38) "unknown_304"
76 array(reg8_t,26) "unknown_208"
77 array(reg8_t,74) "unknown_592"
78 array(reg8_t,114) "unknown_912"
79 array(reg8_t,34) "unknown_272"
80 array(reg8_t,18) "unknown_144"
81 array(reg8_t,31) "unknown_248"
82 array(reg8_t,56) "unknown_448"
83 array(reg8_t,21) "unknown_168"
84 array(reg8_t,66) "unknown_528"
85 array(reg8_t,72) "unknown_576"
86 array(reg8_t,95) "unknown_760"
87 array(reg8_t,69) "unknown_552"
88 array(reg8_t,10) "unknown_80"
89 array(reg8_t,14) "unknown_112"
90 array(reg8_t,155) "unknown_1240"
91 array(reg8_t,132) "unknown_1056"
92 array(reg8_t,12) "unknown_96"
93 array(reg8_t,44) "unknown_352"
94 array(reg8_t,58) "unknown_464"
95 array(reg8_t,35) "unknown_280"
96 array(reg8_t,15) "unknown_120"
97 array(reg8_t,24) "unknown_192"
98 array(reg8_t,33) "unknown_264"
99 array(reg8_t,92) "unknown_736"
100 array(reg8_t,20) "unknown_160"
101 array(reg8_t,91) "unknown_728"
102 array(reg8_t,126) "unknown_1008"
103 array(reg8_t,59) "unknown_472"
104 array(reg8_t,45) "unknown_360"
105 array(reg8_t,70) "unknown_560"
106 array(reg8_t,89) "unknown_712"
107 array(reg8_t,9) "unknown_72"
108 array(reg8_t,52) "unknown_416"
109 array(reg8_t,61) "unknown_488"
110 array(reg8_t,28) "unknown_224"
111 array(reg8_t,25) "unknown_200"
112 array(reg8_t,50) "unknown_400"
113 array(reg8_t,190) "unknown_1520"
114 array(reg8_t,42) "unknown_336"
115 array(reg8_t,49) "unknown_392"
116 array(reg8_t,173) "unknown_1384"
117 array(reg8_t,46) "unknown_368"
118 array(reg8_t,47) "unknown_376"
119 array(reg8_t,149) "unknown_1192"
120 array(reg8_t,146) "unknown_1168"
121 array(reg8_t,37) "unknown_296"
122 array(reg8_t,94) "unknown_752"
123 array(reg8_t,140) "unknown_1120"
124 array(reg8_t,102) "unknown_816"
125 array(reg8_t,98) "unknown_784"
126 array(reg8_t,86) "unknown_688"
127 array(reg8_t,113) "unknown_904"
128 array(reg8_t,60) "unknown_480"
129 array(reg8_t,100) "unknown_800"
130 array(reg8_t,77) "unknown_616"
131 array(reg8_t,62) "unknown_496"
132 array(reg8_t,129) "unknown_1032"
133 array(num8_t,23) "char[23]"
134 array(num8_t,39) "char[39]"
135 array(num8_t,14) "char[14]"
136 array(num8_t,4) "char[4]"
137 array(num8_t,69) "char[69]"
138 array(num8_t,65) "char[65]"
139 struct(0:ptr(num8_t),4:num32_t,8:ptr(num32_t),12:num32_t) "option"
140 array(reg8_t,64) "unknown_512"
141 array(num8_t,60) "char[60]"
142 array(num8_t,111) "char[111]"
143 array(num8_t,45) "char[45]"
144 array(num8_t,54) "char[54]"
145 array(num8_t,44) "char[44]"
146 array(num8_t,191) "char[191]"
147 array(num8_t,3) "char[3]"
148 array(num8_t,25) "char[25]"
149 array(num8_t,22) "char[22]"
150 array(num8_t,2) "char[2]"
151 array(num8_t,18) "char[18]"
152 array(num8_t,21) "char[21]"
153 array(num8_t,57) "char[57]"
154 array(num8_t,31) "char[31]"
155 array(num8_t,16) "char[16]"
156 array(num8_t,90) "char[90]"
157 array(num8_t,10) "char[10]"
158 array(num8_t,13) "char[13]"
159 array(num8_t,30) "char[30]"
160 array(num8_t,12) "char[12]"
161 array(num8_t,7) "char[7]"
162 array(num8_t,56) "char[56]"
163 array(num8_t,8) "char[8]"
164 array(num8_t,6) "char[6]"
165 array(reg32_t,127) "dword[127]"
166 array(reg32_t,30) "dword[30]"
167 array(reg32_t,34) "dword[34]"
168 array(num8_t,203) "char[203]"
169 array(num8_t,28) "char[28]"
170 array(num8_t,32) "char[32]"
171 array(num8_t,36) "char[36]"
172 array(num8_t,40) "char[40]"
173 array(num8_t,48) "char[48]"
174 array(num8_t,52) "char[52]"
175 array(num8_t,20) "char[20]"
176 array(num8_t,64) "char[64]"
177 array(num8_t,47) "char[47]"
178 array(num8_t,17) "char[17]"
179 array(num8_t,81) "char[81]"
180 array(reg8_t,836) "unknown_6688"
181 array(reg8_t,3452) "unknown_27616"
182 array(reg8_t,6204) "unknown_49632"
1 code_t "(void -?-> dword)*"
183 array(reg8_t,232) "unknown_1856"
184 array(reg8_t,256) "unknown_2048"
| BlitzBasic | 2 | matt-noonan/retypd-data | data/pwd.decls | [
"MIT"
] |
/*
* Copyright (c) 2021, Tim Flynn <[email protected]>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibJS/Forward.h>
#include <LibJS/Runtime/Completion.h>
#include <LibJS/Runtime/NativeFunction.h>
namespace JS::Intl {
class DateTimeFormatFunction final : public NativeFunction {
JS_OBJECT(DateTimeFormatFunction, NativeFunction);
public:
static DateTimeFormatFunction* create(GlobalObject&, DateTimeFormat&);
explicit DateTimeFormatFunction(DateTimeFormat&, Object& prototype);
virtual ~DateTimeFormatFunction() override = default;
virtual void initialize(GlobalObject&) override;
virtual ThrowCompletionOr<Value> call() override;
private:
virtual void visit_edges(Visitor&) override;
DateTimeFormat& m_date_time_format; // [[DateTimeFormat]]
};
}
| C | 4 | r00ster91/serenity | Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.h | [
"BSD-2-Clause"
] |
# Swagger Petstore
#
# This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
#
# OpenAPI spec version: 1.0.0
# Contact: [email protected]
# Generated by: https://github.com/swagger-api/swagger-codegen.git
StoreApi <- R6::R6Class(
'StoreApi',
public = list(
userAgent = "Swagger-Codegen/1.0.0/r",
basePath = "http://petstore.swagger.io/v2",
initialize = function(basePath){
if (!missing(basePath)) {
stopifnot(is.character(basePath), length(basePath) == 1)
self$basePath <- basePath
}
},
delete_order = function(order_id){
resp <- httr::DELETE(paste0(self$basePath, order_id),
httr::add_headers("User-Agent" = self$userAgent, "content-type" = "application/xml")
)
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
# void response, no need to return anything
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499){
Response$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599){
Response$new("API server error", resp)
}
},
get_inventory = function(){
resp <- httr::GET(paste0(self$basePath),
httr::add_headers("User-Agent" = self$userAgent, "content-type" = "application/json")
)
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
result <- Integer$new()$fromJSON(httr::content(resp, "text", encoding = "UTF-8"), simplifyVector = FALSE)
Response$new(result, resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499){
Response$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599){
Response$new("API server error", resp)
}
},
get_order_by_id = function(order_id){
resp <- httr::GET(paste0(self$basePath, order_id),
httr::add_headers("User-Agent" = self$userAgent, "content-type" = "application/xml")
)
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
result <- Order$new()$fromJSON(httr::content(resp, "text", encoding = "UTF-8"), simplifyVector = FALSE)
Response$new(result, resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499){
Response$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599){
Response$new("API server error", resp)
}
},
place_order = function(body){
resp <- httr::POST(paste0(self$basePath),
httr::add_headers("User-Agent" = self$userAgent, "content-type" = "application/xml")
,body = body$toJSON()
)
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
result <- Order$new()$fromJSON(httr::content(resp, "text", encoding = "UTF-8"), simplifyVector = FALSE)
Response$new(result, resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499){
Response$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599){
Response$new("API server error", resp)
}
}
)
)
| R | 4 | derBiggi/swagger-codegen | samples/client/petstore/R/R/StoreApi.r | [
"Apache-2.0"
] |
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2018-2020 Intel Corporation
#include "precomp.hpp"
#include <cassert>
#include <opencv2/gapi/cpu/gcpukernel.hpp>
const cv::Mat& cv::GCPUContext::inMat(int input)
{
return inArg<cv::Mat>(input);
}
cv::Mat& cv::GCPUContext::outMatR(int output)
{
return *util::get<cv::Mat*>(m_results.at(output));
}
const cv::Scalar& cv::GCPUContext::inVal(int input)
{
return inArg<cv::Scalar>(input);
}
cv::Scalar& cv::GCPUContext::outValR(int output)
{
return *util::get<cv::Scalar*>(m_results.at(output));
}
cv::detail::VectorRef& cv::GCPUContext::outVecRef(int output)
{
return util::get<cv::detail::VectorRef>(m_results.at(output));
}
cv::detail::OpaqueRef& cv::GCPUContext::outOpaqueRef(int output)
{
return util::get<cv::detail::OpaqueRef>(m_results.at(output));
}
cv::MediaFrame& cv::GCPUContext::outFrame(int output)
{
return *util::get<cv::MediaFrame*>(m_results.at(output));
}
cv::GCPUKernel::GCPUKernel()
{
}
cv::GCPUKernel::GCPUKernel(const GCPUKernel::RunF &runF, const GCPUKernel::SetupF &setupF)
: m_runF(runF), m_setupF(setupF), m_isStateful(m_setupF != nullptr)
{
}
| C++ | 3 | pazamelin/openvino | thirdparty/fluid/modules/gapi/src/backends/cpu/gcpukernel.cpp | [
"Apache-2.0"
] |
-include ../tools.mk
# The rust crate foo will link to the native library foo, while the rust crate
# bar will link to the native library bar. There is also a dependency between
# the native library bar to the natibe library foo.
#
# This test ensures that the ordering of -lfoo and -lbar on the command line is
# correct to complete the linkage. If passed as "-lfoo -lbar", then the 'foo'
# library will be stripped out, and the linkage will fail.
all: $(call NATIVE_STATICLIB,foo) $(call NATIVE_STATICLIB,bar)
$(RUSTC) foo.rs
$(RUSTC) bar.rs
$(RUSTC) main.rs -Z print-link-args
| Makefile | 4 | Eric-Arellano/rust | src/test/run-make-fulldeps/interdependent-c-libraries/Makefile | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
--TEST--
Test possible constant naming regression on procedural scope
--FILE--
<?php
class Obj
{
const return = 'yep';
}
const return = 'nope';
?>
--EXPECTF--
Parse error: syntax error, unexpected token "return", expecting identifier in %s on line %d
| PHP | 2 | NathanFreeman/php-src | Zend/tests/grammar/regression_005.phpt | [
"PHP-3.01"
] |
lexer grammar ApiLexer;
// Keywords
ATDOC: '@doc';
ATHANDLER: '@handler';
INTERFACE: 'interface{}';
ATSERVER: '@server';
// Whitespace and comments
WS: [ \t\r\n\u000C]+ -> channel(HIDDEN);
COMMENT: '/*' .*? '*/' -> channel(88);
LINE_COMMENT: '//' ~[\r\n]* -> channel(88);
STRING: '"' (~["\\] | EscapeSequence)* '"';
RAW_STRING: '`' (~[`\\\r\n] | EscapeSequence)+ '`';
LINE_VALUE: ':' [ \t]* (STRING|(~[\r\n"`]*));
ID: Letter LetterOrDigit*;
fragment ExponentPart
: [eE] [+-]? Digits
;
fragment EscapeSequence
: '\\' [btnfr"'\\]
| '\\' ([0-3]? [0-7])? [0-7]
| '\\' 'u'+ HexDigit HexDigit HexDigit HexDigit
;
fragment HexDigits
: HexDigit ((HexDigit | '_')* HexDigit)?
;
fragment HexDigit
: [0-9a-fA-F]
;
fragment Digits
: [0-9] ([0-9_]* [0-9])?
;
fragment LetterOrDigit
: Letter
| [0-9]
;
fragment Letter
: [a-zA-Z$_] // these are the "java letters" below 0x7F
| ~[\u0000-\u007F\uD800-\uDBFF] // covers all characters above 0x7F which are not a surrogate
| [\uD800-\uDBFF] [\uDC00-\uDFFF] // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF
; | ANTLR | 4 | July1921/go-zero | tools/goctl/api/parser/g4/ApiLexer.g4 | [
"MIT"
] |
--TEST--
Closure $this unbinding deprecation
--FILE--
<?php
class Test {
public function method() {
echo "instance scoped, non-static, \$this used\n";
$fn = function() {
var_dump($this);
};
$fn->bindTo(null);
echo "instance scoped, static, \$this used\n";
$fn = static function() {
var_dump($this);
};
$fn->bindTo(null);
echo "instance scoped, non-static, \$this not used\n";
$fn = function() {
var_dump($notThis);
};
$fn->bindTo(null);
}
public static function staticMethod() {
echo "static scoped, non-static, \$this used\n";
$fn = function() {
var_dump($this);
};
$fn->bindTo(null);
echo "static scoped, static, \$this used\n";
$fn = static function() {
var_dump($this);
};
$fn->bindTo(null);
echo "static scoped, static, \$this not used\n";
$fn = function() {
var_dump($notThis);
};
$fn->bindTo(null);
}
}
(new Test)->method();
Test::staticMethod();
?>
--EXPECTF--
instance scoped, non-static, $this used
Warning: Cannot unbind $this of closure using $this in %s on line %d
instance scoped, static, $this used
instance scoped, non-static, $this not used
static scoped, non-static, $this used
static scoped, static, $this used
static scoped, static, $this not used
| PHP | 3 | thiagooak/php-src | Zend/tests/closure_062.phpt | [
"PHP-3.01"
] |
-#
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.
-@ val title: String
-@ val body: String
!!!
%html
%head
%title= title
%link(href="css/bootstrap.min.css" rel="stylesheet" media="screen")
%body
!= body
| Scaml | 3 | skyportsystems/incubator-samza | samza-yarn/src/main/resources/scalate/WEB-INF/layouts/default.scaml | [
"Apache-2.0"
] |
"""
before
after
end
"""
f = def ():
print('before')
goto exit
print('skipped')
:exit
print('after')
f()
goto exit
print('skipped')
:exit
print("end")
| Boo | 0 | popcatalin81/boo | tests/testcases/integration/statements/goto-4.boo | [
"BSD-3-Clause"
] |
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.20506</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{bd5d51e2-b11a-4356-9450-64566f8cdc38}</ProjectGuid>
<ProjectTypeGuids>{89896941-7261-4476-8385-4DA3CE9FDB83};{C089C8C0-30E0-4E22-80C0-CE093F111A43};{656346D9-4656-40DA-A068-22D5425D4639}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sugar.Echoes.WP8</RootNamespace>
<AssemblyName>Sugar</AssemblyName>
<TargetFrameworkIdentifier>WindowsPhone</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
<SilverlightApplication>false</SilverlightApplication>
<ValidateXaml>true</ValidateXaml>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
<Name>Sugar.Echoes.WP8</Name>
<AllowLegacyCreate>False</AllowLegacyCreate>
<AllowLegacyOutParams>False</AllowLegacyOutParams>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Bin\WP8</OutputPath>
<DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>Bin\WP8</OutputPath>
<DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\WP8</OutputPath>
<DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<XmlDocWarningLevel>WarningOnPublicMembers</XmlDocWarningLevel>
<CpuType>anycpu</CpuType>
<GeneratePDB>True</GeneratePDB>
<GenerateMDB>True</GenerateMDB>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>Bin\WP8</OutputPath>
<DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|ARM' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Bin\WP8</OutputPath>
<DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|ARM' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>Bin\WP8</OutputPath>
<DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="AutoreleasePool.pas" />
<Compile Include="Binary.pas" />
<Compile Include="Collections\Dictionary.pas" />
<Compile Include="Collections\HashSet.pas" />
<Compile Include="Collections\KeyValue.pas" />
<Compile Include="Collections\List.pas" />
<Compile Include="Collections\Queue.pas" />
<Compile Include="Collections\Stack.pas" />
<Compile Include="Color.pas" />
<None Include="Cryptography\Cipher.pas" />
<Compile Include="Cryptography\MessageDigest.pas" />
<Compile Include="Cryptography\MD5Managed.pas" />
<Compile Include="Cryptography\SHA384Managed.pas" />
<Compile Include="Cryptography\SHA512Managed.pas" />
<Compile Include="Cryptography\Utils.pas" />
<Compile Include="Consts.pas" />
<Compile Include="Convert.pas" />
<Compile Include="DateTime.pas" />
<Compile Include="DateFormatter.pas" />
<Compile Include="Encoding.pas" />
<Compile Include="CustomEncodings.pas" />
<Compile Include="HTTP.pas" />
<Compile Include="IO\File.pas" />
<Compile Include="IO\FileHandle.pas" />
<Compile Include="IO\FileUtils.pas" />
<Compile Include="IO\Folder.pas" />
<Compile Include="IO\FolderUtils.pas" />
<Compile Include="IO\Path.pas" />
<Compile Include="Random.pas" />
<Compile Include="Environment.pas" />
<Compile Include="Exceptions.pas" />
<Compile Include="Extensions.pas" />
<Compile Include="Guid.pas" />
<None Include="Threading\AutoResetEvent.pas" />
<None Include="Threading\ManualResetEvent.pas" />
<None Include="Threading\Semaphore.pas" />
<None Include="Threading\Thread.pas" />
<None Include="Threading\ThreadPool.pas" />
<Compile Include="UserSettings.pas" />
<Compile Include="Math.pas" />
<Compile Include="Properties\AssemblyInfo_WP8.pas" />
<Compile Include="String.pas" />
<Compile Include="StringBuilder.pas" />
<Compile Include="StringFormatter.pas" />
<Compile Include="Url.pas" />
<Compile Include="XML\XmlAttribute.pas" />
<Compile Include="XML\XmlCharacterData.pas" />
<Compile Include="XML\XmlDocument.pas" />
<Compile Include="XML\XmlDocumentType.pas" />
<Compile Include="XML\XmlElement.pas" />
<Compile Include="XML\XmlNode.pas" />
<Compile Include="XML\XmlProcessingInstruction.pas" />
<Compile Include="JSON\JsonDocument.pas" />
<Compile Include="JSON\Exceptions.pas" />
<Compile Include="JSON\JsonArray.pas" />
<Compile Include="JSON\JsonConsts.pas" />
<Compile Include="JSON\JsonDeserializer.pas" />
<Compile Include="JSON\JsonObject.pas" />
<Compile Include="JSON\JsonSerializer.pas" />
<Compile Include="JSON\JsonTokenizer.pas" />
<Compile Include="JSON\JsonValue.pas" />
</ItemGroup>
<ProjectExtensions />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Net" />
<Reference Include="System.Net.Requests" />
<Reference Include="Windows" />
<Reference Include="System.Core" />
<Reference Include="System.Windows" />
<Reference Include="System.Runtime.WindowsRuntime" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Folder Include="Collections\" />
<Folder Include="Cryptography\" />
<Folder Include="IO\" />
<Folder Include="Properties\" />
<Folder Include="Threading\" />
<Folder Include="XML\" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\RemObjects Software\Oxygene\RemObjects.Oxygene.Echoes.targets" />
<PropertyGroup>
<PreBuildEvent Condition="'$(OS)' != 'Unix'">rmdir /s /q $(ProjectDir)\Obj</PreBuildEvent>
</PropertyGroup>
</Project>
| Oxygene | 2 | nchevsky/remobjects-sugar | Sugar/Sugar.Echoes.WP8.BuildServer.oxygene | [
"BSD-3-Clause"
] |
/**
* This file is part of the Phalcon Framework.
*
* (c) Phalcon Team <[email protected]>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/
namespace Phalcon\Html\Attributes;
use Phalcon\Html\Attributes;
/**
* Phalcon\Html\Attributes\AttributesInterface
*
* Interface Phalcon\Html\Attributes\AttributesInterface
*/
interface AttributesInterface
{
/**
* Get Attributes
*/
public function getAttributes() -> <Attributes>;
/**
* Set Attributes
*/
public function setAttributes(<Attributes> attributes) -> <AttributesInterface>;
}
| Zephir | 4 | tidytrax/cphalcon | phalcon/Html/Attributes/AttributesInterface.zep | [
"BSD-3-Clause"
] |
sp S
sp W
sp A
sp B
sp C
| SourcePawn | 0 | maurizioabba/rose | projects/OpenMP_Translator/tests/npb2.3-omp-c/config/NAS.samples/suite.def.sp | [
"BSD-3-Clause"
] |
"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
const sign_1 = require("./sign");
const path = require("path");
(0, sign_1.main)([
process.env['EsrpCliDllPath'],
'windows',
process.env['ESRPPKI'],
process.env['ESRPAADUsername'],
process.env['ESRPAADPassword'],
path.dirname(process.argv[2]),
path.basename(process.argv[2])
]);
| JavaScript | 1 | sbj42/vscode | build/azure-pipelines/common/sign-win32.js | [
"MIT"
] |
insert into bar3 values (776391,146), (845404,147), (64451,148), (914580,149), (971775,150), (200267,151), (700776,152), (1017499,153), (1028205,154), (969075,155), (158739,156), (588962,157), (758396,158), (891459,159), (816741,160), (762463,161), (433295,162), (210772,163), (612322,164), (25473,165), (611842,166), (479123,167), (182476,168), (828985,169), (401483,170), (1035180,171), (211588,172), (370197,173), (536845,174), (934781,175), (346107,176), (60905,177), (393129,178), (506713,179), (402210,180), (925501,181), (1010666,182), (973232,183), (660431,184), (313592,185), (332847,186), (542524,187), (118007,188), (530727,189), (186647,190), (655276,191), (462492,192), (181333,193), (1011663,194), (412511,195), (962020,196), (102286,197), (117487,198), (302306,199), (440770,200), (96242,201), (362162,202), (1007622,203), (1015815,204), (404180,205), (841672,206), (195830,207), (853053,208), (679224,209), (199366,210), (846149,211), (645450,212), (595978,213), (559907,214), (649790,215), (938096,216), (82545,217), (932186,218), (521553,219), (657833,220), (384492,221), (474863,222), (315430,223), (913004,224), (265912,225), (68555,226), (494469,227), (62330,228), (292333,229), (266590,230), (582552,231), (553032,232), (538220,233), (223593,234), (505363,235), (994053,236), (719248,237), (171425,238), (42320,239), (92393,240), (401970,241), (180976,242), (53865,243), (228355,244), (685779,245);
insert into bar3 values (909669,246), (470089,247), (573523,248), (935844,249), (111697,250), (537395,251), (807046,252), (276663,253), (402033,254), (725007,255), (919883,256), (186650,257), (701209,258), (470754,259), (915639,260), (915195,261), (936698,262), (637249,263), (519977,264), (846324,265), (372001,266), (910872,267), (257688,268), (401179,269), (734008,270), (1042313,271), (706541,272), (149096,273), (526298,274), (952805,275), (617172,276), (509575,277), (573757,278), (985712,279), (896772,280), (579646,281), (806928,282), (2542,283), (479572,284), (339536,285), (1009594,286), (806831,287), (560277,288), (247198,289), (501355,290), (902746,291), (855253,292), (786634,293), (139444,294), (651661,295), (91797,296), (546320,297), (202054,298), (137625,299), (134787,300), (916658,301), (41053,302), (752428,303), (257493,304), (424944,305), (315561,306), (541363,307), (657453,308), (667731,309), (937038,310), (848736,311), (598138,312), (47263,313), (752488,314), (270104,315), (956746,316), (647910,317), (568969,318), (669442,319), (854371,320), (60193,321), (114573,322), (55013,323), (655328,324), (271008,325), (380485,326), (1022042,327), (301683,328), (169018,329), (159344,330), (760764,331), (189893,332), (683487,333), (975254,334), (566672,335), (112113,336), (747431,337), (659542,338), (756737,339), (838817,340), (486099,341), (55103,342), (58773,343), (364180,344), (818016,345);
insert into bar3 values (22253,346), (110306,347), (42407,348), (64226,349), (681415,350), (197599,351), (967808,352), (773367,353), (256786,354), (522336,355), (856220,356), (1031557,357), (422844,358), (617418,359), (1010445,360), (540675,361), (1042053,362), (589560,363), (80446,364), (449882,365), (372433,366), (657447,367), (933376,368), (617907,369), (808705,370), (390573,371), (300847,372), (1034031,373), (845667,374), (287077,375), (650342,376), (968385,377), (277151,378), (116061,379), (892673,380), (61770,381), (1030543,382), (185815,383), (288785,384), (278478,385), (943886,386), (927251,387), (638724,388), (545681,389), (467862,390), (792366,391), (1025051,392), (595491,393), (650662,394), (915538,395), (324683,396), (1036939,397), (1024229,398), (591699,399), (1039541,400), (34274,401), (1024008,402), (975465,403), (917804,404), (881463,405), (498754,406), (803065,407), (926462,408), (251902,409), (746601,410), (1048054,411), (703896,412), (671909,413), (983734,414), (347370,415), (440124,416), (701513,417), (1071,418), (607567,419), (358360,420), (786953,421), (157252,422), (184675,423), (298402,424), (287479,425), (70375,426), (810189,427), (67636,428), (711221,429), (395847,430), (149435,431), (547189,432), (875470,433), (521278,434), (619868,435), (94859,436), (416791,437), (212004,438), (261403,439), (334346,440), (867479,441), (929275,442), (802228,443), (416673,444), (233187,445);
insert into bar3 values (928850,446), (539940,447), (576077,448), (593244,449), (349574,450), (540244,451), (1027171,452), (206598,453), (899111,454), (228127,455), (387318,456), (940816,457), (118751,458), (190536,459), (800843,460), (827177,461), (670712,462), (120503,463), (499491,464), (144255,465), (284668,466), (18444,467), (305130,468), (397512,469), (747379,470), (778782,471), (79468,472), (471469,473), (911724,474), (747906,475), (950066,476), (456818,477), (386421,478), (112681,479), (813169,480), (446798,481), (296027,482), (158238,483), (966092,484), (85437,485), (764657,486), (730014,487), (372008,488), (366985,489), (280874,490), (233072,491), (872943,492), (359015,493), (330105,494), (774683,495), (553054,496), (233129,497), (390436,498), (648728,499), (336023,500), (434435,501), (871498,502), (532779,503), (447670,504), (149370,505), (8920,506), (249473,507), (492833,508), (190767,509), (901658,510), (55082,511), (740043,512), (620429,513), (293256,514), (54697,515), (671377,516), (301553,517), (631985,518), (951665,519), (826602,520), (753699,521), (590466,522), (1007342,523), (315695,524), (17095,525), (540513,526), (81252,527), (233459,528), (531660,529), (711055,530), (419321,531), (223548,532), (958016,533), (209616,534), (531034,535), (1042572,536), (464837,537), (938428,538), (293551,539), (567565,540), (30531,541), (674856,542), (214883,543), (499368,544), (81576,545);
insert into bar3 values (154245,546), (328459,547), (243575,548), (831836,549), (925352,550), (780571,551), (942052,552), (635189,553), (459015,554), (20430,555), (397177,556), (993922,557), (465466,558), (958535,559), (1033627,560), (23148,561), (581469,562), (961898,563), (180305,564), (836937,565), (400079,566), (9790,567), (646041,568), (199159,569), (719782,570), (151814,571), (60650,572), (832929,573), (247267,574), (563362,575), (665282,576), (923228,577), (890050,578), (712449,579), (721334,580), (607753,581), (358479,582), (339205,583), (530338,584), (632781,585), (431379,586), (42337,587), (614044,588), (886290,589), (683917,590), (999241,591), (761415,592), (739872,593), (664843,594), (1019376,595), (864854,596), (773941,597), (283426,598), (344111,599), (338779,600), (499147,601), (667754,602), (854964,603), (997124,604), (387922,605), (950103,606), (91460,607), (535515,608), (973272,609), (251563,610), (584720,611), (350508,612), (766564,613), (706673,614), (664037,615), (713491,616), (487065,617), (937408,618), (580026,619), (118730,620), (1032283,621), (686592,622), (360824,623), (562506,624), (181230,625), (300022,626), (1024155,627), (398562,628), (105286,629), (946120,630), (286702,631), (414651,632), (14397,633), (648901,634), (46349,635), (182239,636), (168766,637), (667137,638), (366355,639), (978476,640), (1005488,641), (689055,642), (99573,643), (386227,644), (826945,645);
insert into bar3 values (291566,646), (720241,647), (176344,648), (909613,649), (141834,650), (151981,651), (587265,652), (1000205,653), (903510,654), (582390,655), (239730,656), (154512,657), (458426,658), (878718,659), (447956,660), (205350,661), (734075,662), (157713,663), (849584,664), (516739,665), (151836,666), (412241,667), (94449,668), (29553,669), (108989,670), (764722,671), (300115,672), (851011,673), (24454,674), (503511,675), (351328,676), (144390,677), (964625,678), (922203,679), (159626,680), (850807,681), (913673,682), (224837,683), (280971,684), (558656,685), (272783,686), (613541,687), (330048,688), (820868,689), (905598,690), (424803,691), (275229,692), (371504,693), (470892,694), (316317,695), (78845,696), (862628,697), (692937,698), (301901,699), (957341,700), (494889,701), (68701,702), (409446,703), (729891,704), (879752,705), (1023963,706), (733471,707), (915191,708), (214741,709), (893921,710), (582245,711), (205993,712), (411389,713), (12471,714), (710988,715), (349764,716), (585413,717), (138990,718), (518224,719), (350882,720), (835909,721), (253351,722), (88049,723), (764374,724), (61560,725), (74341,726), (941482,727), (850856,728), (245071,729), (474889,730), (145269,731), (143839,732), (158790,733), (633482,734), (669665,735), (165801,736), (1045843,737), (51572,738), (56902,739), (694368,740), (842300,741), (327886,742), (619471,743), (504083,744), (504964,745);
insert into bar3 values (405232,746), (402256,747), (705088,748), (1004723,749), (196759,750), (820501,751), (871479,752), (850485,753), (553997,754), (1003517,755), (711591,756), (1009317,757), (846911,758), (376421,759), (606398,760), (894285,761), (10100,762), (142952,763), (254318,764), (3940,765), (826547,766), (630348,767), (642042,768), (344766,769), (983576,770), (46477,771), (106902,772), (802250,773), (87933,774), (668898,775), (497251,776), (244283,777), (510124,778), (530001,779), (996817,780), (331078,781), (436125,782), (589177,783), (76922,784), (510947,785), (249957,786), (983353,787), (329253,788), (670787,789), (197581,790), (102593,791), (739309,792), (345955,793), (206019,794), (424870,795), (793789,796), (1019531,797), (478367,798), (672278,799), (514113,800), (198625,801), (696591,802), (301106,803), (201333,804), (192556,805), (466685,806), (847252,807), (1046807,808), (797340,809), (759085,810), (632176,811), (821718,812), (871404,813), (229920,814), (810534,815), (244085,816), (987023,817), (32390,818), (869095,819), (434927,820), (168695,821), (617538,822), (439503,823), (222583,824), (261433,825), (226685,826), (960113,827), (542025,828), (531084,829), (57926,830), (800891,831), (365972,832), (764038,833), (139070,834), (563831,835), (842163,836), (358989,837), (759609,838), (66697,839), (963382,840), (676282,841), (931075,842), (1014901,843), (665881,844), (434184,845);
insert into bar3 values (490746,846), (507318,847), (313845,848), (711156,849), (999072,850), (376765,851), (363489,852), (639831,853), (969533,854), (304603,855), (682439,856), (630547,857), (49649,858), (606297,859), (764504,860), (767235,861), (93404,862), (14655,863), (356508,864), (1011138,865), (187834,866), (507207,867), (92445,868), (330572,869), (842957,870), (940484,871), (926242,872), (786877,873), (1003483,874), (176094,875), (851657,876), (283107,877), (315148,878), (317528,879), (698219,880), (423935,881), (1005021,882), (113227,883), (1012050,884), (648597,885), (526388,886), (809074,887), (733714,888), (137262,889), (240731,890), (1027713,891), (828005,892), (870750,893), (620757,894), (378303,895), (64036,896), (131806,897), (278880,898), (393901,899), (584135,900), (37755,901), (502434,902), (291501,903), (832974,904), (874120,905), (159678,906), (85723,907), (24928,908), (797459,909), (421580,910), (203142,911), (908470,912), (933960,913), (465545,914), (455490,915), (201488,916), (559879,917), (463302,918), (283668,919), (88448,920), (157148,921), (828905,922), (398186,923), (119363,924), (527688,925), (716045,926), (458678,927), (816922,928), (656323,929), (429205,930), (510183,931), (987926,932), (246546,933), (18917,934), (39723,935), (571804,936), (1030002,937), (987619,938), (16487,939), (980933,940), (295747,941), (546899,942), (673420,943), (639301,944), (528991,945);
insert into bar3 values (384868,946), (318834,947), (972463,948), (872686,949), (619714,950), (34006,951), (1005914,952), (165088,953), (251789,954), (946197,955), (468155,956), (919991,957), (851233,958), (429646,959), (807312,960), (855434,961), (827574,962), (415207,963), (71698,964), (737639,965), (325949,966), (947479,967), (522020,968), (371427,969), (119237,970), (558910,971), (857507,972), (14917,973), (167701,974), (389905,975), (296213,976), (404389,977), (490223,978), (265446,979), (63513,980), (812964,981), (998890,982), (343568,983), (727356,984), (14554,985), (177316,986), (598065,987), (954177,988), (821441,989), (541676,990), (78167,991), (217075,992), (39580,993), (782315,994), (460196,995), (655618,996), (966109,997), (950628,998), (816991,999), (135147,1000), (384533,1001), (993460,1002), (102761,1003), (124043,1004), (416310,1005), (439607,1006), (593842,1007), (424314,1008), (473254,1009), (346613,1010), (1012588,1011), (216483,1012), (981011,1013), (123119,1014), (443401,1015), (66014,1016), (740588,1017), (345972,1018), (856688,1019), (1044247,1020), (731622,1021), (163861,1022), (145199,1023), (184746,1024), (653384,1025), (835442,1026), (353908,1027), (927677,1028), (677075,1029), (51425,1030), (547707,1031), (95508,1032), (608013,1033), (433535,1034), (378365,1035), (634724,1036), (297559,1037), (165957,1038), (1027098,1039), (489860,1040), (748087,1041), (666468,1042), (886665,1043), (119331,1044), (723138,1045);
insert into bar3 values (233067,1046), (856822,1047), (117631,1048), (669263,1049), (652498,1050), (743998,1051), (1008313,1052), (1044745,1053), (958967,1054), (542307,1055), (630356,1056), (866693,1057), (790662,1058), (239052,1059), (204873,1060), (867418,1061), (973861,1062), (647395,1063), (668375,1064), (679122,1065), (297583,1066), (275911,1067), (925824,1068), (914890,1069), (826464,1070), (768814,1071), (125240,1072), (454228,1073), (42281,1074), (662876,1075), (594216,1076), (49321,1077), (82064,1078), (591068,1079), (1001189,1080), (861743,1081), (835791,1082), (537153,1083), (692253,1084), (128605,1085), (906850,1086), (573827,1087), (682676,1088), (31604,1089), (624050,1090), (751073,1091), (788036,1092), (156258,1093), (136784,1094), (924637,1095), (671986,1096), (329439,1097), (627691,1098), (442765,1099), (906688,1100), (161495,1101), (644455,1102), (469512,1103), (966580,1104), (943835,1105), (1008537,1106), (149848,1107), (130470,1108), (399414,1109), (804254,1110), (919227,1111), (160761,1112), (110759,1113), (1041774,1114), (816564,1115), (712880,1116), (950072,1117), (507316,1118), (755900,1119), (34537,1120), (687108,1121), (871595,1122), (76778,1123), (88470,1124), (558609,1125), (365590,1126), (715023,1127), (787821,1128), (1038510,1129), (421794,1130), (580602,1131), (673121,1132), (224823,1133), (894645,1134), (965531,1135), (290030,1136), (97523,1137), (578157,1138), (755859,1139), (673095,1140), (922674,1141), (17184,1142), (724554,1143), (780442,1144), (836466,1145);
| SQL | 1 | suryatmodulus/tidb | br/tests/lightning_tool_135/data/tool_135.bar3.sql | [
"Apache-2.0",
"BSD-3-Clause"
] |