content
stringlengths
4
1.04M
lang
stringclasses
358 values
score
int64
0
5
repo_name
stringlengths
5
114
repo_path
stringlengths
4
229
repo_licenses
listlengths
1
8
"Test Case" by Andrew Plotkin. Include Trivial Extension by Andrew Plotkin. Volume 1 - overview Chapter - setting the scene The Kitchen is a room. [Comment: this kitchen is modelled after the one in Zork, although it lacks the detail to establish this to the player.] Section - the kitchen table The spicerack is a container in the Kitchen. Table of Spices Name Flavor "cinnamon" 5 "nutmeg" 4 "szechuan pepper" 8 The description of the spicerack is "It's mostly empty." Chapter - a character A purple cow called Gelett is in the Kitchen. [This comment spans multiple lines.. ...and this line contains [nested square[] brackets]... ...which is legal in Inform 7.] Instead of examining Gelett: say "You'd rather see than be one." Instead of examining Gelett: say "You'd rather see than be one." Check smelling Gelett: say "This text contains several lines. A blank line is displayed as a paragraph break, but a simple line break is not."; stop the action. Section - cow catching Gelett has a number called the mooness. Instead of taking Gelett: increment the mooness of Gelett; if the mooness of Gelett is one: say "Gelett moos once."; else: say "Gelett moos [mooness of Gelett in words] times."; Volume 2 - the turn cycle Every turn: say "A turn passes[one of][or] placidly[or] idly[or] tediously[at random]."
Inform 7
5
JavascriptID/sourcerer-app
src/test/resources/samples/langs/Inform 7/story.ni
[ "MIT" ]
<!DOCTYPE html> <html> <!-- Test for jQuery.holdReady. Needs to be a standalone test since it deals with DOM ready. --> <head> <title> jQuery.holdReady Test </title> <style> div { margin-top: 10px; } #output { background-color: green } #expectedOutput { background-color: green } </style> <script src="../jquery.js"></script> <script src="./iframeTest.js"></script> <!-- Load the script loader that uses jQuery.readyWait --> <script type="text/javascript"> (function() { var released = false; // Hold on jQuery! jQuery.holdReady( true ); setTimeout( function() { released = true; jQuery.holdReady( false ); }, 300 ); jQuery(function() { jQuery( "#output" ).text( "Ready called, holdReady released: " + released ); startIframeTest( released ); }); })(); </script> </head> <body> <h1> jQuery.holdReady Test </h1> <p> This is a test page for jQuery.readyWait and jQuery.holdReady, see <a href="https://bugs.jquery.com/ticket/6781">#6781</a> and <a href="https://bugs.jquery.com/ticket/8803">#8803</a>. </p> <p> Test for jQuery.holdReady, which can be used by plugins and other scripts to indicate something important to the page is still loading and needs to block the DOM ready callbacks that are registered with jQuery. </p> <p> Script loaders are the most likely kind of script to use jQuery.holdReady, but it could be used by other things like a script that loads a CSS file and wants to pause the DOM ready callbacks. </p> <p> <strong>Expected Result</strong>: The text <span id="expectedOutput">It Worked!</span> appears below after about <strong>2 seconds.</strong> </p> <p> If there is an error in the console, or the text does not show up, then the test failed. </p> <div id="output"></div> </body> </html>
HTML
5
ggomez3/survey
data/readywait.html
[ "MIT" ]
p { text-indent: 0; } p, H1, H2, H3, H4, H5, H6, H7, H8, table { margin-top: 1em;} .pagebreak { page-break-before: always; } #toc H3 { text-indent: 1em; } #toc .document { text-indent: 2em; }
CSS
3
defc0n1/shoppe_promo
vendor/cache/gems/rails-4.2.6/guides/assets/stylesheets/kindle.css
[ "MIT" ]
<!-- #docplaster --> <!-- #docregion app-component-template --> <h1> {{title}} </h1> <button routerLink="/customers">Customers</button> <button routerLink="/orders">Orders</button> <button routerLink="">Home</button> <router-outlet></router-outlet> <!-- #enddocregion app-component-template -->
HTML
3
coreyscherbing/angular
aio/content/examples/lazy-loading-ngmodules/src/app/app.component.html
[ "MIT" ]
/var/list/turf/turfs = list() /turf/New() . = ..() global.turfs += src /turf/Del() global.turfs -= src . = ..()
DM
3
PJB3005/GoonLight-Heist
stubs/turf.dm
[ "MIT" ]
grammar t021hoist; options { language=JavaScript; } /* With this true, enum is seen as a keyword. False, it's an identifier */ @members { this.enableEnum = false; } stat returns [enumIs] : identifier {enumIs = "ID"} | enumAsKeyword {enumIs = "keyword"} ; identifier : ID | enumAsID ; enumAsKeyword : {this.enableEnum}? 'enum' ; enumAsID : {!this.enableEnum}? 'enum' ; ID : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')* ; INT : ('0'..'9')+ ; WS : ( ' ' | '\t' | '\r' | '\n' )+ {$channel=HIDDEN;} ;
G-code
4
DanielMabadeje/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials
java/java2py/antlr-3.1.3/runtime/JavaScript/tests/functional/t021hoist.g
[ "Apache-2.0" ]
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /// <reference lib="webworker" /> export declare global { interface ServiceWorkerGlobalScope { /** * Disallow accessing `CacheStorage APIs directly to ensure that all accesses go through a * `NamedCacheStorage` instance (exposed by the `Adapter`). */ caches: unknown; } }
TypeScript
3
John-Cassidy/angular
packages/service-worker/worker/src/service-worker.d.ts
[ "MIT" ]
% These tests create and distribute different entities. % Each entity is inserted in a weak dictionary. After a number of % applications, they are discarded locally and remotely. They are % then expected to show on the gc-stream of the weak dictionary. % Since the current implementation of the message passing layer % will transport any messages at the next thread switch, {Delay 10} or % suspension on an unbound variable is assumed to lead to transport of % the message. functor import System TestMisc Connection export Return define Sites=1 Show=System.show %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % General procedures %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Return a Start procedure invoked by the test-suite-engine % LocalTestProc and RemoteTestProc are the procedures to be % run in this particular test. fun {Start LocalTestProc RemoteTestProc} proc{$} Managers InP InS={NewPort $ InP} OutS OutP={NewPort OutS} in try Hosts in {TestMisc.getHostNames Hosts} {TestMisc.getRemoteManagers Sites Hosts Managers} {ForAll Managers proc {$ RemMan} {StartRemSite RemMan OutS InP RemoteTestProc} end} {LocalTestProc Managers InS OutP} catch X then {Show X} raise X end end {TestMisc.gcAll Managers} {TestMisc.listApply Managers close} end end % Start the specified procedure at a remote manager proc {StartRemSite Manager InS OutP RemoteTestProc} {Manager apply(url:'' functor import Connection define proc {Start InS OutP} % Must provide connection here to use % the right one. {RemoteTestProc Connection InS OutP} end thread {Start InS OutP} end end)} end % Use {Assert Test} or {Assert Test#Msg} to get an % exception whenever Test==false. proc{Assert V} case V of Test#Msg then if Test \= true then raise assertion(Msg) end end [] Test then if Test \= true then raise assertion(Test) end end else skip end end proc{DoGC Managers} {TestMisc.gcAll Managers} {Delay 10} {System.gcDo} {Delay 10} {System.gcDo} {Delay 10} {System.gcDo} end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Test procedures %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Variable distributed and bound by manager. proc {LocalVariableBind Managers InS OutP} WS WD={NewWeakDictionary WS} in {Assert {Not {IsDet WS}}#'GCstream of WD bound to early'} local V in {WeakDictionary.put WD gc V} {Send OutP {Connection.offer V}} {Delay 10} V=42 % small integers are never considered 'marked' by the GC {Delay 10} end {DoGC Managers} {Assert {IsDet WS}#'Nothing on stream'} end proc {RemoteVariableBind Connection InS OutP} % Wait for variable to arrive and to be bound {Wait {Connection.take InS.1}} end % Cell distributed and dropped proc {LocalCellDrop Managers InS OutP} WS WD={NewWeakDictionary WS} in {Assert {Not {IsDet WS}}#'GCstream of WD bound to early'} local C={NewCell 0} in {WeakDictionary.put WD gc C} {Send OutP {Connection.offer C}} {Delay 10} end {DoGC Managers} {Assert {IsDet WS}#'Nothing on stream'} end proc {RemoteCellDrop Connection InS OutP} % Wait for cell to arrive, then drop it {Wait {Connection.take InS.1}} end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % For the test-suite engine %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Keys=[remote credit] Return = dp([credit_variable_bind({Start LocalVariableBind RemoteVariableBind} keys:Keys) credit_cell_drop({Start LocalCellDrop RemoteCellDrop} keys:Keys) ]) end
Oz
5
Ahzed11/mozart2
platform-test/dp/credit.oz
[ "BSD-2-Clause" ]
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%> <%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%> <fmt:setBundle basename="messages" /> <%@ page session="true"%> <fmt:message key="message.password" var="noPass" /> <fmt:message key="message.username" var="noUser" /> <html> <head> <title> </title> <link href="<c:url value="/resources/bootstrap.css" />" rel="stylesheet"> <script data-main="js/main" src="<c:url value="/js/require.js" />"></script> <c:if test="${param.error != null}"> <div class="alert alert-error"> <spring:message code="message.badCredentials"></spring:message> </div> </c:if> <script type="text/javascript"> function validate() { if (document.f.j_username.value == "" && document.f.j_password.value == "") { alert("${noUser} & ${noPass}"); document.f.j_username.focus(); return false; } if (document.f.j_username.value == "") { alert("${noUser}"); document.f.j_username.focus(); return false; } if (document.f.j_password.value == "") { alert("${noPass}"); document.f.j_password.focus(); return false; } } </script> </head> <body> <h1><spring:message code="label.form.loginTitle"></spring:message></h1> <form name='f' action="login" method='POST' onsubmit="return validate();"> <table> <tr> <td><label><spring:message code="label.form.loginEmail"></spring:message></label></td> <td><input type='text' name='username' value=''></td> </tr> <tr> <td><label><spring:message code="label.form.loginPass"></spring:message></label></td> <td><input type='password' name='password' /></td> </tr> <tr> <td><input name="submit" type="submit" value=<spring:message code="label.form.submit"></spring:message> /></td> </tr> </table> </form> <br> </body> </html>
Java Server Pages
3
zeesh49/tutorials
spring-static-resources/src/main/webapp/WEB-INF/view/login.jsp
[ "MIT" ]
package {{apiPackage}}; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.web.SpringBootServletInitializer; import org.springframework.context.annotation.ImportResource; @ImportResource({"classpath:/ApplicationContext.xml"}) @EnableAutoConfiguration public class SpringBootApplication extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(SpringBootApplication.class); } public static void main(String[] args) { SpringApplication.run(SpringBootApplication.class, args); } }
HTML+Django
4
MalcolmScoffable/openapi-generator
modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/server/SpringBootApplication.mustache
[ "Apache-2.0" ]
*------------------------------------------------------------------------------- * Report model progress *------------------------------------------------------------------------------- $setargs phase $ifthen %phase% == 'init' set iterrep / infes, nonopt, itertime, tottime /; set timeiterrep(iterrep) / itertime, tottime /; parameter infoiter(iterrep); parameter allinfoiter(run,siter,iterrep); file gdxput; # Device used to save variables to a different gdxs * File used for realtime errors plotting file errdat / '%resdir%errors_%nameout%.txt' /; errdat.ap=0; errdat.lj=1; errdat.tj=1; put errdat; * Time put 'Start: ',system.date,' 'system.time /; * To be run put 'To run: '; loop(to_run, put to_run.tl:0,' '; ); put /; $if set nosolve put "NO SOLVE RUN" /; * Explanation sol put 'sol: [Y/N][clt nonopt][clt infes][tot infes]'; put /; * Horizontal separator put '===='; put '====='; loop(ierr, put '========='; ); loop(timeiterrep, put '=========='; ); put /; * Column headers put 'iter'; put ' sol'; loop(ierr, put ' ' ierr.tl:8; ); loop(timeiterrep, put ' ' timeiterrep.tl:9; ); put /; * Convergence tolerances put ' '; put ' '; loop(ierr, put ' <' errtol(ierr):5:3; ); put ' '; put /; putclose errdat; errdat.ap=1; $elseif %phase% == 'txtfooter' put errdat; * Horizontal separator put '===='; put '====='; loop(ierr, put '========='; ); loop(timeiterrep, put '=========='; ); put /; putclose errdat; $elseif %phase% == 'txtmaxiter' put errdat; * Horizontal separator put '----'; put '-----'; loop(ierr, put '---------'; ); loop(timeiterrep, put '----------'; ); put /; put '> reach max_iter!'; put /; putclose errdat; $elseif %phase% == 'txtconverged' put errdat; * Horizontal separator put '----'; put '-----'; loop(ierr, put '---------'; ); loop(timeiterrep, put '----------'; ); put /; put '> Convergence criteria met!'; put /; putclose errdat; $elseif %phase% == 'txtrun' put errdat; * Horizontal separator with run text put '>' run.tl:3 ; put ' ----'; loop(ierr, put '---------'; ); loop(timeiterrep, put '----------'; ); put /; putclose errdat; $elseif %phase% == 'txtnash' * Get information infoiter('infes') = sum(clt$((solrep(clt,'modelstat') eq %modelStat.infeasible%) or (solrep(clt,'modelstat') eq %modelStat.locallyInfeasible%) or (solrep(clt,'modelstat') eq %modelStat.intermediateInfeasible%)), 1); infoiter('nonopt') = sum(clt$((solrep(clt,'modelstat') eq %modelStat.feasibleSolution%)), 1); infoiter('itertime') = (timeelapsed-timer); infoiter('tottime') = timeelapsed; allinfoiter(run,siter,iterrep) = infoiter(iterrep); put errdat; errdat.ap=1; put ord(siter):<4:0 put ' '; put all_optimal(run,siter):1:0; if(nb_clt_noopt(run,siter) eq 0, put '0'; ); if(nb_clt_noopt(run,siter) ge 1 and nb_clt_noopt(run,siter) le 9, put nb_clt_noopt(run,siter):1:0; ); if(nb_clt_noopt(run,siter) gt 9, put 'X'; ); if(nb_clt_infes(run,siter) eq 0, put '0'; ); if(nb_clt_infes(run,siter) ge 1 and nb_clt_infes(run,siter) le 9, put nb_clt_infes(run,siter):1:0; ); if(nb_clt_infes(run,siter) gt 9, put 'X'; ); if(nb_tot_infes(run,siter) eq 0, put '0'; ); if(nb_tot_infes(run,siter) ge 1 and nb_tot_infes(run,siter) lt 9.8e+9, put log10(nb_tot_infes(run,siter)):1:0; ); if(nb_tot_infes(run,siter) ge 9.8e+9, put 'X'; ); loop(ierr, put allerr(run,siter,ierr):9:3; ); loop(iterrep$timeiterrep(iterrep), put ' '; # hours if(floor(allinfoiter(run,siter,iterrep)/3600)>0, put (floor(allinfoiter(run,siter,iterrep)/3600)):3:0, ':'; else put ' 0:'; ); # minutes if(floor(mod(allinfoiter(run,siter,iterrep),3600)/60)>0, if(floor(mod(allinfoiter(run,siter,iterrep),3600)/60)>9, put (floor(mod(allinfoiter(run,siter,iterrep),3600)/60)):2:0, ':'; else put '0' (floor(mod(allinfoiter(run,siter,iterrep),3600)/60)):1:0, ':'; ); else put '00:'; ); # seconds if(floor(mod(allinfoiter(run,siter,iterrep),60))>9, put (floor(mod(allinfoiter(run,siter,iterrep),60))):2:0; else put '0' (floor(mod(allinfoiter(run,siter,iterrep),60))):1:0; ); ); put /; putclose errdat; $elseif %phase% == 'gdxtemp' * write temp gdx execute_unload '%resdir%all_data_temp_%nameout%.gdx'; * write iter gdx $ifthen.x set outgdx_iter put gdxput; put_utility 'gdxout' / '%resdir%%outgdx%_' run.tl:0 '_' siter.tl:0 '.gdx'; execute_unload; putclose gdxput; $endif.x $endif
GAMS
3
witch-team/witchmodel
algo/report.gms
[ "Apache-2.0" ]
//This configuration file is for GNAT test. //This is to simulate the situation when an IPv4 private net try to connect to the IPv6 internet (e.g. 6bone). //18.26.4.125 => 18.26.4.60 , where 18.26.4.60 is actually some ipv4/ipv6 node on internet4/6 //src address is private address in the ipv4 local net. InfiniteSource( \<0000c043 71ef0090 27e0231f 86dd 60000000 0050113f 00000000 00000000 0000ffff 121a043c 3ffe0000 00000000 00000000 00000001 0514d641 55445020 7061636b 6574210a 117f0000 01000000 01000000 00000000 00800408 00800408 53530000 53530000 05000000 00100000 01000000 54530000 54e30408 54e30408 d8010000 13691369>, 1, 5) -> Strip(14) -> CheckIP6Header() -> GetIP6Address(24) -> rt6 :: LookupIP6Route( 3ffe:1ce1:2:0:200::1/128 ::0 0, 3ffe::/80 ::0 1, 0::ffff:0:0/96 ::0 2, ::0/0 ::0 3); rt6[0] -> Print(route60-ok, 200) -> Discard; rt6[2] -> Print(route62-ok, 200) -> Discard; rt6[3] -> Print(route63-ok, 200) -> Discard; InfiniteSource( \<0000c043 71ef0090 27e0231f 0800 45000064 00004000 3f110e9d 121a047d 121a043c 0514d641 55445020 7061636b 6574210a 3ae70000 01000000 01000000 00000000 00800408 00800408 53530000 53530000 05000000 00100000 01000000 54530000 54e30408 54e30408 d8010000 13691369>, 1, 5) -> Strip(14) -> CheckIPHeader() -> rt::StaticIPLookup(18.26.4.112/32 0, 18.26.4.255/32 0, 18.26.4.0/32 0, 18.26.4.0 255.255.255.0 1, 255.255.255.255/32 0.0.0.0 0, 0.0.0.0/32 0, 18.26.4.60/32 1, 0.0.0.0/0 18.26.4.60 2); pt::ProtocolTranslator(); //AddressTranslator: first part of the argument is static mapping //second part of the argument is dynamic mapping at::AddressTranslator(1, //1, 1 0 1 0 0 0, ::ffff:18.26.4.125 3ffe::1, 1 1 0 0 0 0, //0 0 1 1 0 0, 0 0 1 1 0 0, //1 1 0 0 0 0, 0, ::ffff:18.26.4.1 1300 1310); rt[0] -> Print(rt0, 200) -> [0]pt; //->Discard; rt[1] -> Print(rt1, 200) -> [1]pt; pt[1] -> Print(pt1, 200) -> [0]at; at[0] -> Print(after-at0, 200) -> Discard; at[1] -> Print(after-at1, 200) -> [0]pt; pt[0] -> Print(after-pt0, 200) -> Discard; rt[2] -> Print(rt2, 200) ->Discard; rt6[1] -> Print(route61-ok, 200) -> [1]at;
Click
4
MacWR/Click-changed-for-ParaGraph
conf/gnat02.click
[ "Apache-2.0" ]
/*--------------------------------------------------*/ /* SAS Programming for R Users - code for exercises */ /* Copyright 2016 SAS Institute Inc. */ /*--------------------------------------------------*/ /*SP4R07s02*/ /*Part A*/ proc iml; call randseed(27606); n = 20; beta0 = 3; beta1 = 2; beta2 = -1; xvals1 = randfun(n,"Uniform"); xvals1 = xvals1*20; xvals2 = randfun(n,"Uniform"); xvals2 = (xvals2*20) + 10; error = randfun(n,"Normal",0,5); y = beta0 + beta1*xvals1 + beta2*xvals2 + error; print y beta0 beta1 beta2 xvals1 xvals2 error; /*Part B*/ x = j(n,1,1)||xvals1||xvals2; betaHat = inv(x`*x)*(x`*y); print x, betaHat; *Alternative SAS Function; *betaHat = solve( (x`*x)*(x`*y) ); *print betaHat; /*Part C*/ pred = x*betaHat; sse = sum( (y-pred)##2 ); sigma2Hat = sse / (n-1); sigmaHat = sqrt(sigma2Hat); print sigma2Hat sigmaHat; quit;
SAS
4
snowdj/sas-prog-for-r-users
code/SP4R07s02.sas
[ "CC-BY-4.0" ]
token pod_formatting_code { $<code>=<[A..Z]> '<' { $*POD_IN_FORMATTINGCODE := 1 } $<content>=[ <!before '>'> <pod_string_character> ]+ '>' { $*POD_IN_FORMATTINGCODE := 0 } } token pod_string { <pod_string_character>+ } token something:sym«<» { <!> } token name { <!> } token comment:sym<#> { '#' {} \N* }
Perl6
4
JavascriptID/sourcerer-app
src/test/resources/samples/langs/Perl 6/grammar-test.p6
[ "MIT" ]
import torch # ModuleList with elements of type Module class FooModule(torch.nn.Module): pass class BarModule(torch.nn.Module): pass ml: torch.nn.ModuleList = torch.nn.ModuleList([FooModule(), BarModule()]) ml[0].children() == [] # noqa: B015 reveal_type(ml) # E: {ModuleList}
Python
4
Hacky-DH/pytorch
test/typing/reveal/module_list.py
[ "Intel" ]
# longlong.m4 serial 17 dnl Copyright (C) 1999-2007, 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert. # Define HAVE_LONG_LONG_INT if 'long long int' works. # This fixes a bug in Autoconf 2.61, and can be faster # than what's in Autoconf 2.62 through 2.68. # Note: If the type 'long long int' exists but is only 32 bits large # (as on some very old compilers), HAVE_LONG_LONG_INT will not be # defined. In this case you can treat 'long long int' like 'long int'. AC_DEFUN([AC_TYPE_LONG_LONG_INT], [ AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], [ac_cv_type_long_long_int=yes if test "x${ac_cv_prog_cc_c99-no}" = xno; then ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int if test $ac_cv_type_long_long_int = yes; then dnl Catch a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. dnl If cross compiling, assume the bug is not important, since dnl nobody cross compiles for this platform as far as we know. AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[@%:@include <limits.h> @%:@ifndef LLONG_MAX @%:@ define HALF \ (1LL << (sizeof (long long int) * CHAR_BIT - 2)) @%:@ define LLONG_MAX (HALF - 1 + HALF) @%:@endif]], [[long long int n = 1; int i; for (i = 0; ; i++) { long long int m = n << i; if (m >> i != n) return 1; if (LLONG_MAX / 2 < m) break; } return 0;]])], [], [ac_cv_type_long_long_int=no], [:]) fi fi]) if test $ac_cv_type_long_long_int = yes; then AC_DEFINE([HAVE_LONG_LONG_INT], [1], [Define to 1 if the system has the type 'long long int'.]) fi ]) # Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. # This fixes a bug in Autoconf 2.61, and can be faster # than what's in Autoconf 2.62 through 2.68. # Note: If the type 'unsigned long long int' exists but is only 32 bits # large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT # will not be defined. In this case you can treat 'unsigned long long int' # like 'unsigned long int'. AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], [ AC_CACHE_CHECK([for unsigned long long int], [ac_cv_type_unsigned_long_long_int], [ac_cv_type_unsigned_long_long_int=yes if test "x${ac_cv_prog_cc_c99-no}" = xno; then AC_LINK_IFELSE( [_AC_TYPE_LONG_LONG_SNIPPET], [], [ac_cv_type_unsigned_long_long_int=no]) fi]) if test $ac_cv_type_unsigned_long_long_int = yes; then AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1], [Define to 1 if the system has the type 'unsigned long long int'.]) fi ]) # Expands to a C program that can be used to test for simultaneous support # of 'long long' and 'unsigned long long'. We don't want to say that # 'long long' is available if 'unsigned long long' is not, or vice versa, # because too many programs rely on the symmetry between signed and unsigned # integer types (excluding 'bool'). AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET], [ AC_LANG_PROGRAM( [[/* For now, do not test the preprocessor; as of 2007 there are too many implementations with broken preprocessors. Perhaps this can be revisited in 2012. In the meantime, code should not expect #if to work with literals wider than 32 bits. */ /* Test literals. */ long long int ll = 9223372036854775807ll; long long int nll = -9223372036854775807LL; unsigned long long int ull = 18446744073709551615ULL; /* Test constant expressions. */ typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) ? 1 : -1)]; typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 ? 1 : -1)]; int i = 63;]], [[/* Test availability of runtime routines for shift and division. */ long long int llmax = 9223372036854775807ll; unsigned long long int ullmax = 18446744073709551615ull; return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) | (llmax / ll) | (llmax % ll) | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) | (ullmax / ull) | (ullmax % ull));]]) ])
M4
5
fossabot/chroot
share/gettext-tiny/m4/longlong.m4
[ "ISC" ]
{-# OPTIONS --prop --rewriting --confluence-check #-} open import Agda.Primitive open import Agda.Builtin.Equality open import Agda.Builtin.Nat renaming (Nat to ℕ; _+_ to _+ℕ_) infix 4 _≐_ data _≐_ {ℓ} {A : Set ℓ} (x : A) : A → Prop ℓ where refl : x ≐ x {-# BUILTIN REWRITE _≐_ #-} variable ℓ : Level A B C : Set ℓ x y z : A cong : (f : A → B) → x ≐ y → f x ≐ f y cong f refl = refl data ℤ : Set where zero : ℤ pred suc : ℤ → ℤ postulate pred-suc : (x : ℤ) → pred (suc x) ≐ x suc-pred : (x : ℤ) → suc (pred x) ≐ x {-# REWRITE pred-suc suc-pred #-} count-suc : ℤ → ℕ count-suc zero = 0 count-suc (pred x) = count-suc x count-suc (suc x) = 1 +ℕ count-suc x
Agda
5
cruhland/agda
test/Fail/ConstructorRewriteConfluenceFail.agda
[ "MIT" ]
package unit.issues; import unit.Test; import haxe.Template; class Issue2254 extends Test { function test() { var str = 'HI, IT IS ::if !isIt::NOT::end::'; var t = new haxe.Template(str); eq("HI, IT IS ", t.execute({ isIt:true })); eq("HI, IT IS NOT", t.execute({ isIt:false })); } }
Haxe
3
jonasmalacofilho/haxe
tests/unit/src/unit/issues/Issue2254.hx
[ "MIT" ]
SELECT t.table_schema, t.table_name, t.info :: json, coalesce(cc.computed_fields, '[]') as computed_fields FROM hdb_catalog.hdb_table_info_agg t LEFT OUTER JOIN ( SELECT c.table_schema, c.table_name, json_agg( json_build_object( 'name', c.computed_field_name, 'function_meta', json_build_object( 'function', json_build_object('name', c.function_name, 'schema', c.function_schema), 'oid', hf_agg.function_oid, 'type', hf_agg.function_type, 'description', hf_agg.description ) ) ) as computed_fields FROM hdb_catalog.hdb_function_agg hf_agg LEFT OUTER JOIN hdb_catalog.hdb_computed_field_function c ON ( hf_agg.function_name = c.function_name AND hf_agg.function_schema = c.function_schema ) GROUP BY c.table_schema, c.table_name ) cc ON ( cc.table_schema = t.table_schema AND cc.table_name = t.table_name ) WHERE t.table_schema NOT LIKE 'pg_%' AND t.table_schema <> 'information_schema' AND t.table_schema <> 'hdb_catalog' AND t.table_schema <> 'hdb_views'
SQL
3
gh-oss-contributor/graphql-engine-1
server/src-rsr/table_meta.sql
[ "Apache-2.0", "MIT" ]
require(httr) data = '{"admins":{"names":[], "roles":[]}, "readers":{"names":["joe"],"roles":[]}}' res <- httr::PUT(url = 'http://localhost:5984/test/_security', body = data, httr::authenticate('admin', '123'))
R
3
kado0413/curlconverter
fixtures/r/put_basic_auth_json_data.r
[ "MIT" ]
Oscillator osc2 { type square, frequency 800 } [ gain1 ] Oscillator osc1 { type square, frequency 540 } [ gain1 ] Gain gain1 { gain [ setValue 0.5, setValueAtTime 0.5 t + 0, exponentialRampToValueAtTime 0.01 t + 1.0 ] } [ filter ] BiquadFilter filter { type bandpass, frequency 800 } [ output ] End
Augeas
3
newlandsvalley/purescript-audiograph
audiograph-editor/dist/augsamples/cowbell.aug
[ "MIT" ]
import {Component, NgModule} from '@angular/core'; @Component({ selector: 'my-component', template: ` <div i18n="meaningA|descA@@idA">Content A</div> <div i18n-title="meaningB|descB@@idB" title="Title B">Content B</div> <div i18n-title="meaningC|" title="Title C">Content C</div> <div i18n-title="meaningD|descD" title="Title D">Content D</div> <div i18n-title="meaningE@@idE" title="Title E">Content E</div> <div i18n-title="@@idF" title="Title F">Content F</div> <div i18n-title="[BACKUP_$\{MESSAGE}_ID:idH]\`desc@@idG" title="Title G">Content G</div> <div i18n="Some text \\' [BACKUP_MESSAGE_ID: xxx]">Content H</div> ` }) export class MyComponent { } @NgModule({declarations: [MyComponent]}) export class MyModule { }
TypeScript
4
John-Cassidy/angular
packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/element_attributes/meaning_description.ts
[ "MIT" ]
module.exports (terms) = resolve = terms.term { constructor (term) = self.isResolve = true self.resolve = term.promisify () makeAsyncCallWithCallback (onFulfilled, onRejected) = args = [] if (onFulfilled @and onFulfilled != terms.onFulfilledFunction) args.push (onFulfilled) if (args.length > 0) terms.methodCall (self.resolve, ['then'], args) else self.resolve } createResolve (term, alreadyPromise: false) = asyncResult = terms.asyncResult () terms.subStatements [ terms.definition ( asyncResult resolve (term, alreadyPromise: alreadyPromise) async: true ) asyncResult ]
PogoScript
3
Sotrek/Alexa
Alexa_Cookbook/Workshop/StatePop/4_IOT/tests/node_modules/aws-sdk/node_modules/cucumber/node_modules/pogo/lib/resolve.pogo
[ "MIT" ]
BresultJ
PureBasic
0
cnheider/onnx
onnx/backend/test/data/node/test_argmax_no_keepdims_example/test_data_set_0/output_0.pb
[ "MIT" ]
-- Copyright 2021 Jeff Foley. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. local url = require("url") name = "Searx" type = "scrape" function start() set_rate_limit(4) math.randomseed(os.time()) end function vertical(ctx, domain) -- Qualified best Searx instances local instances = { "https://anon.sx", "https://searx.info", "https://searx.ru", "https://searx.run", "https://searx.sk", "https://xeek.com", } -- Randomly choose one instance for scraping local host = instances[math.random(1, 6)] .. "/search" for i=1,15 do local query = "site:" .. domain .. " -www" local params = { ['q']=query, ['pageno']=i, ['category_general']="1", ['time_range']="None", ['language']="en-US", } local ok = scrape(ctx, { ['url']=host, method="POST", data=url.build_query_string(params), headers={['Content-Type']="application/x-www-form-urlencoded"}, }) if not ok then break end end end
Ada
4
Elon143/Amass
resources/scripts/scrape/searx.ads
[ "Apache-2.0" ]
--TEST-- Bug #23894 (sprintf() decimal specifiers problem) 32bit version --SKIPIF-- <?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?> --FILE-- <?php $a = -12.3456; $test = sprintf("%04d", $a); var_dump($test, bin2hex($test)); $test = sprintf("% 13u", $a); var_dump($test, bin2hex($test)); ?> --EXPECT-- string(4) "-012" string(8) "2d303132" string(13) " 4294967284" string(26) "20202034323934393637323834"
PHP
3
NathanFreeman/php-src
ext/standard/tests/strings/bug23894_32bit.phpt
[ "PHP-3.01" ]
extensions [gis] breed [fish a-fish] fish-own [ age sex flockmates nearest-neighbor E-ingested E-survive E-growth E-repro ] patches-own [ lake ; values of lake raster (attersee.asc dataset): 0 = no lake; 1 = lake ] globals [ cohesion-flag ; helper variable to tag schools counter ; = integer of ticks (ticks have small rounding errors if governed by advance-dt) fish-stock sd-setup-count mature-not-in-flock plankton-eaten ;; spatial variables scale-factor ; conversion factor between metre NetLogo distance units attersee-dataset ; GIS shapefile of lake lake-patches ; all patches inside the lake coast-patches ; all patches adjacent to land ;; flocking parameters vision minimum-separation max-align-turn max-cohere-turn max-separate-turn ;; System dynamics model globals ;; constants carrying-capacity growth-rate plankton-growth-rate exponent-offspring exponent-mortality ;; stock values fish-stock-sd fish-growth-lst juvenile-fish-stock adult-fish-stock plankton-bio ;; size of each step, see SYSTEM-DYNAMICS-GO dt ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SETUP PROCEDURES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; system-dynamics-setup, and system-dynamics-go are automatically ;; generated by the System Dynamics Modeler. The code can be viewed in the ;; Code Tab of the System Dynamics Modeler. to setup ca reset-ticks reset-timer set cohesion-flag true ; time counter needed in ABM, because of rounding errors in "ticks" when incrementally advanced by SD set counter 0 ;; load GIS data ; loads Attersse.shp into the global variable “Attersee-dataset” set attersee-dataset gis:load-dataset "/netlogodata/Attersee.asc" ; defines the extent of the ‘World’ by the bounding box of a dataset gis:set-world-envelope (gis:envelope-of attersee-dataset) ; calculate scale conversion factor let envelope gis:envelope-of attersee-dataset let y-extent item 3 envelope - item 2 envelope ; scale-factor = 200 (with a world setting of 45 x 90 cells) -> 1 patch is 200m x 200m set scale-factor y-extent / (max-pycor + 1) ; copy values from Attersee-dataset into an lake patch variable (lake) gis:apply-raster attersee-dataset lake ; color lake patches blue and coast patches green ask patches [ifelse lake = 1 [set pcolor blue][set pcolor 68]] set lake-patches patches with [pcolor = blue] ask lake-patches [if count neighbors with [pcolor = 68] > 0 [set pcolor 97]] set coast-patches lake-patches with [pcolor = 97] ; set flocking parameters in metre and degree set vision 700 set minimum-separation 10 set max-align-turn 2 set max-cohere-turn 8.5 set max-separate-turn 3 ; create ABM fish create-fish initial-number-of-fish [ let a one-of lake-patches set shape "fish" set color orange set size 1 setxy [pxcor] of a [pycor] of a set age random-float 6 set sex random 2 ;female = 0, male = 1 ] ;set fish-stock count fish ask fish [ find-flockmates ] set sd-setup-count 0 ;; call NetLogo's SD Modeler system-dynamics-setup end ;; Initializes the system dynamics model. ;; Call this in your model's SETUP procedure. to system-dynamics-setup reset-ticks set dt 1 ;; initialize constant values set carrying-capacity 2300 set growth-rate 0 set plankton-growth-rate 0.01 set exponent-offspring 1 set exponent-mortality 0.033 ;; initialize stock values set fish-stock-sd 0 set plankton-bio 2150 end ;; set SD parameters after ABM-->SD switch to sd-setup-parametrization show timer show ticks ; the mature fish (1/3 of the population) that are female (1/2 of the population) produce 5 offspring per year (for daily timesteps: / 365) set growth-rate (1 / 3) * (1 / 2) * 5 / 365 ;; initialize stock values set fish-stock-sd 0 ;create fish growth list of zeros with length max possible age of fish set fish-growth-lst[] repeat 2190 * (1 / dt)[ set fish-growth-lst lput 0 fish-growth-lst ] ;parameterise fish growth list based on age of fish in patch foreach sort fish [ ;get position in fish growth list to add new fish let pos (length fish-growth-lst - (int ([age] of ? * 365 * (1 / dt)))) if pos = 0[ set pos 1 ] ;create new fish growth list by adding fish to school (+1) set fish-growth-lst replace-item (pos - 1) fish-growth-lst ((item (pos - 1) fish-growth-lst) + 1) ] ; update stocks in patch set juvenile-fish-stock sum sublist fish-growth-lst ((2190 - 1460) * (1 / dt)) (2190 * (1 / dt)) set adult-fish-stock sum sublist fish-growth-lst ((0) * (1 / dt)) ((2190 - 1461) * (1 / dt)) set fish-stock-sd juvenile-fish-stock + adult-fish-stock ; kill fish agents ask fish [die] end ;; reset simulation environment after SD-->ABM switch to abm-reset [fish-at-reset] set cohesion-flag true set-current-plot "Fish Stock" set-plot-pen-color black set-current-plot "performance" set-plot-pen-color black set fish-stock-sd 0 set sd-setup-count 0 create-fish fish-at-reset [ let a one-of lake-patches set shape "fish" set color orange set size 1 setxy [pxcor] of a [pycor] of a set age random-float 6 set sex random 2 ;female = 0, male = 1 set E-repro 0 ] ask fish [find-flockmates] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GO PROCEDURE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to go ;; performance tracking if counter = 0 [reset-timer] if counter mod (365 / dt) = 0 [show timer] ;; execute actions in ABM mode if ABM-mode? = TRUE [ ; if just switched back from SD if count fish = 0 and fish-stock-sd > 0 [abm-reset int fish-stock-sd] ; execute ABM actions only at full ticks (days) if counter mod (1 / dt) = 0 [ ;; execute ABM fish behaviour ask fish [ ; fish turn to flock with others flock ; move 20m move ( 20 ) ; calculate energy budget update-energy ;; reproduce, if eligible if sex = 0 [reproduce] ; grow older set age age + 1 / 365 ;one day (=1/365) ; die of age or if the fish has no more energy reserves (starvation) if age > 6 or E-repro < 0 [ die ] ] identify-schools ;fish eat 2.7g per day set plankton-eaten (count fish * 0.0000027) set fish-stock count fish ] ] ; stop, if no fish are left if fish-stock = 0 [stop] ;; execute SD actions if ABM-mode? = FALSE [ ;switch, if every mature fish belongs to a flock if sd-setup-count = 0 [ sd-setup-parametrization set sd-setup-count 1 set-current-plot "Fish Stock" set-plot-pen-color red set-current-plot "performance" set-plot-pen-color red set plankton-eaten 0 ask fish [die] ] set fish-stock fish-stock-sd ] system-dynamics-go update-plots display-biomass ; stop conditions if scenario = "100 years" [ if ticks >= (365 * 100) [ show timer show ticks stop ] ] if scenario = "fishing" [ if fish-stock > 500 [fishing 25] ] ; count helper to calculate ABM time steps set counter counter + 1 end ;; Step through the system dynamics model by performing next iteration of Euler's method. ;; Call this in your model's GO procedure. to system-dynamics-go ;; compute variable and flow values once per step ;let local-pop-growth pop-growth let local-biomass-growth biomass-growth let local-biomass-removed biomass-removed ;let local-mortality mortality if ABM-mode? = FALSE [ ;; compute variable and flow values once per step fish-growth fish-die-of-age fish-starve ;; update juvenile fish stock let new-juvenile-fish-stock ( sum sublist fish-growth-lst ((2190 - 1460) * (1 / dt)) (2190 * (1 / dt)) ) set juvenile-fish-stock new-juvenile-fish-stock ;if juvenile-fish-stock < 0 [show "juvenile stock is negative!"] ;update adult fish stock let new-adult-fish-stock ( sum sublist fish-growth-lst ((0) * (1 / dt)) ((2190 - 1461) * (1 / dt)) ) set adult-fish-stock new-adult-fish-stock ;if adult-fish-stock < 0 [show "adult stock is negative!"] ;;update fish stock let new-fish-stock ( juvenile-fish-stock + adult-fish-stock ) set fish-stock-sd new-fish-stock ] ;; update stock values ;; use temporary variables so order of computation doesn't affect result. ;let new-fish-stock-sd ( fish-stock-sd + local-pop-growth - local-mortality ) let new-plankton-bio ( plankton-bio + local-biomass-growth - local-biomass-removed ) ;set fish-stock-sd new-fish-stock-sd set plankton-bio new-plankton-bio tick-advance dt end ;;;;;;;;;;;;;;;;;;;;;;; FLOCKING Behaviour (from the NetLogo Library) ;;;;;;;;;;;;;;;;;;;;;;; to flock ;; a-fish procedure find-flockmates if any? flockmates [ find-nearest-neighbor ifelse distance nearest-neighbor < (minimum-separation / scale-factor) [ separate ] [ align cohere ] ] end to find-flockmates ;; a-fish procedure set flockmates other fish in-radius (vision / scale-factor) end to find-nearest-neighbor ;; a-fish procedure set nearest-neighbor min-one-of flockmates [distance myself] end ;;; SEPARATE to separate ;; a-fish procedure turn-away ([heading] of nearest-neighbor) max-separate-turn end ;;; ALIGN to align ;; a-fish procedure turn-towards average-flockmate-heading max-align-turn end to-report average-flockmate-heading ;; a-fish procedure ;; We can't just average the heading variables here. ;; For example, the average of 1 and 359 should be 0, ;; not 180. So we have to use trigonometry. let x-component sum [dx] of flockmates let y-component sum [dy] of flockmates ifelse x-component = 0 and y-component = 0 [ report heading ] [ report atan x-component y-component ] end ;;; COHERE to cohere ;; a-fish procedure turn-towards average-heading-towards-flockmates max-cohere-turn end to-report average-heading-towards-flockmates ;; a-fish procedure ;; "towards myself" gives us the heading from the other a-fish ;; to me, but we want the heading from me to the other a-fish, ;; so we add 180 let x-component mean [sin (towards myself + 180)] of flockmates let y-component mean [cos (towards myself + 180)] of flockmates ifelse x-component = 0 and y-component = 0 [ report heading ] [ report atan x-component y-component ] end ;;; HELPER PROCEDURES to turn-towards [new-heading max-turn] ;; a-fish procedure turn-at-most (subtract-headings new-heading heading) max-turn end to turn-away [new-heading max-turn] ;; a-fish procedure turn-at-most (subtract-headings heading new-heading) max-turn end ;; turn right by "turn" degrees (or left if "turn" is negative), ;; but never turn more than "max-turn" degrees to turn-at-most [turn max-turn] ;; a-fish procedure ifelse abs turn > max-turn [ ifelse turn > 0 [ rt max-turn ] [ lt max-turn ] ] [ rt turn ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; HELPER PROCEDURES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; update energy budget of fish agents ; plankton controls the energy budget of fish in the following order: maintenance, growth and reproduction (Sibly et al., 2013) to update-energy set E-ingested 2.7 * (plankton-bio / carrying-capacity) / (plankton-bio / carrying-capacity + 2) ;; after Sibly 2013 ; the normalisation constant is set to 0.005; body mass is estimated to be 100g * age set E-survive 0.005 * (age * 100)^ 0.75 ;; after Sibly 2013 ; under opimal conditions, after survival costs: 50% of the available energy goes into growth and 50% into reproduction set E-growth 0.5 * (0.9 - E-survive) ;; maximum E-ingest = 0.9 ; The reproduction energy includes maturation and reproduction; it is cumulative over the lifespan of a fish. if age >= 4 [set E-repro E-repro + E-ingested - E-survive - E-growth ] end ;; agent reproduction to reproduce ; probability of reproduction for an annual offspring of 5 (= 5 fish per 365 days) ; school membership, age >= 4, female gender and a optimum plunkton intake of >= 2.7g (0.0000027 tons) ; is prerequisite for reproduction if (random-float 1 < (5 / 365)) and (count flockmates > 5) and (age >= 4) and (sex = 0) and (E-repro > 15)[ set E-repro E-repro - 15 hatch-fish 1 [ let a one-of coast-patches set sex random 2 set age 0 setxy [pxcor] of a [pycor] of a set E-repro 0 ] ] end ;; fish move forward and turn at coast to move [dist] ; move [dist] metres per day ifelse [lake] of patch-ahead ((2 * dist) / scale-factor) != 1 [set heading heading + 180 ] [fd dist / scale-factor] end ;; build schools to identify-schools if (cohesion-flag) [ ask turtles [ set color one-of base-colors ] set cohesion-flag false ] ask turtles [ if any? flockmates [ set color [ color ] of min-one-of flockmates [distance myself] ] ] end ;; remove fish to fishing [remaining-fish] ifelse ABM-mode? = TRUE[ while [count fish > remaining-fish][ ask one-of fish [die] ]] [ set fish-stock-sd remaining-fish ] end ;; report 180° turn true, if fish approaches the coast to-report turn-180 ifelse [lake] of patch-ahead (20 / scale-factor) != 1 [report true] [report false] end ;; check for mode switch criteria to-report ABM-mode? set mature-not-in-flock count fish with [(age >= 4) and (count flockmates <= school-threshold)] ; switch criteria ; ABM -> SD: all mature fish are in a flock and populations size is larger than the user defined school-threshold (default = 50) ; SD -> ABM: population size is below the threshold ifelse mature-not-in-flock = 0 and fish-stock > school-threshold [report FALSE] [report TRUE] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; System Dynamics - Helper ;; fish inflow: exponential growth (growth depends on fish stock) to fish-growth ;; compute growth increment: annual offspring of female fish is 5 (= 5 fish per 365 days) let fish-growth-increment ((adult-fish-stock / 2) * (5 / 365) * dt * (plankton-bio / carrying-capacity)) ; append growth increment to list set fish-growth-lst lput fish-growth-increment fish-growth-lst end ;; fish outflow I (die because of age): linear decline - die after 6 years (2190 days) ; implemented as system delay to fish-die-of-age ; remove death increment from list set fish-growth-lst remove-item 0 fish-growth-lst end ;; fish outflow II (starvation): decline is coupled to plankton stock to fish-starve ;; starvation: each element in the fish-growth-lst is multiplied by the local starvation-rate ;let starvation-rate ( 1 - [plankton-bio] of patch-here / carrying-capacity) * 0.00825 let starvation-rate ( 1 - ((plankton-bio / carrying-capacity) ^ 0.033 )) * 0.24 ; 0.15 -> 640,000; 0.2 -> 576,000; 0.23 -> 522,000; 0.24 -> ; 0.25 -> 463,000 ; update fish growth list set fish-growth-lst map [? * (1 - starvation-rate * dt)] fish-growth-lst end ;; Report value of flow to-report biomass-growth report ( plankton-bio * plankton-growth-rate * ( 1 - plankton-bio / carrying-capacity ) ) * dt end ;; Report value of flow to-report biomass-removed report ( plankton-eaten + fish-stock-sd * 0.0000027 ) * dt end ;; Plot the current state of the system dynamics model's stocks ;; Call this procedure in your plot's update commands. to system-dynamics-do-plot if plot-pen-exists? "fish-stock-sd" [ set-current-plot-pen "fish-stock-sd" plotxy ticks fish-stock-sd ] if plot-pen-exists? "plankton-bio" [ set-current-plot-pen "plankton-bio" plotxy ticks plankton-bio ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;; DISPLAY ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; display plankton biomass stocks to display-biomass let min-biomass 1500 let max-biomass 2300 ask lake-patches [ set pcolor scale-color blue plankton-bio min-biomass max-biomass ] end ; Written by: Gudrun Wallentin and Christian Neuwirth ; Refer to the following publication to cite the model: ; Wallentin, G., and Neuwirth, C. (2016) "Dynamic hybrid modelling: switching between AB and SD designs of a predator-prey model". Ecological Modelling (under review) ; This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License ; https://creativecommons.org/licenses/by/3.0/ @#$#@#$#@ GRAPHICS-WINDOW 433 24 883 955 -1 -1 10.0 1 10 1 1 1 0 1 1 1 0 43 0 89 0 0 1 ticks 30.0 BUTTON 14 33 77 66 NIL setup NIL 1 T OBSERVER NIL NIL NIL NIL 1 BUTTON 14 73 77 106 NIL go T 1 T OBSERVER NIL NIL NIL NIL 1 BUTTON 13 119 76 152 step go NIL 1 T OBSERVER NIL NIL NIL NIL 1 PLOT 949 339 1320 491 Number of adult fish which do not belong to a flock NIL NIL 0.0 10.0 0.0 10.0 true false "" "" PENS "default" 1.0 0 -7500403 true "" "plotxy ticks (count fish with[(age >= 4) and (count flockmates <= school-threshold)])" SLIDER 9 177 181 210 initial-number-of-fish initial-number-of-fish 0 5000 25 50 1 NIL HORIZONTAL PLOT 5 274 376 465 Fish Stock years number of fish 0.0 1.0 0.0 10.0 true false "" "" PENS "default" 1.0 0 -16777216 true "" "if ticks > 0 [plotxy ticks / 365 (fish-stock-sd + count fish)]" PLOT 5 477 374 637 Plankton years NIL 0.0 1.0 1800.0 2300.0 true false "" "" PENS "default" 1.0 0 -16777216 true "" "if ticks > 0 [plotxy ticks / 365 plankton-bio ]" MONITOR 451 69 508 114 years floor (ticks / 365) 0 1 11 PLOT 5 643 374 793 performance years elapsed time 0.0 1.0 0.0 10.0 true false "" "" PENS "default" 1.0 0 -16777216 true "" "if counter > 0 [plotxy (ticks / 365) timer]" SLIDER 8 218 180 251 school-threshold school-threshold 0 100 50 1 1 NIL HORIZONTAL BUTTON 989 111 1093 144 makemovie movie-close\n;; make a 20-step movie of the current view\nsetup\nmovie-start \"out.mov\"\nrepeat 36500 [\n if ticks mod 100 = 0 [movie-grab-view]\n go\n]\nmovie-close NIL 1 T OBSERVER NIL NIL NIL NIL 1 CHOOSER 125 34 263 79 scenario scenario "100 years" "fishing" 1 @#$#@#$#@ ## PURPOSE The fish-plankton model represented the dynamics of a fish population in a lake in response to plankton abundance. The purpose of the model was to represent spatio-temporal population dynamics of plankton-feeding fish. The model specifically aimed to capture the dynamics of a small fish population that is governed by stochastic events of local interactions as well as the dynamics of large a population that is limited by the abundance of plankton biomass for feeding. For its specification the model partly borrowed from literature on Alpine whitefish (Coregonus laveretus) in the lake Attersee in Austria, complemented with fictitious parameter values. ## ENTITIES, STATE VARIABLES AND SCALES The entities in the model were fish and plankton. Depending on the design, fish were represented as agents, school-agents, spatial stocks or stocks. The plankton was represented either by a stock of a SD model or by spatial stocks in a cellular automaton. State variables were the number of fish and the amount of plankton biomass in tons. The temporal scale of the model had a resolution of one day and extended over a simulation period of one century. The lake was roughly rectangular with dimensions of about 20 km by 2 km amounting to 46 km2 surface area in total. In spatial variants of the model, the plankton was distributed over a cellular automaton grid with a cell size of 200m by 200m. Fish movement was represented in continuous vector space. ## PROCESS OVERVIEW AND SCHEDULING A single fish agent moved straight ahead until it sensed other fish, to which it adapted its movements according to the three rules of the boids model (Reynolds, 1987). From this behaviour fish schools emerged and grew over time. School membership was a prerequisite to successful reproduction in the ABM. Under optimal conditions, an annual offspring of five fish per mature female survived the first year. Female fish laid the eggs close to the shoreline out of which young fish developed independently from any fish school. The fish matured at the age of four and reached a maximum age of six years, but may have died of starvation earlier. A fish agent consumed 2.7 g plankton per day under maximum plankton availability. Lower plankton availability controlled the energy budget of fish in the order of maintenance, growth and reproduction (Sibly et al., 2013). Plankton biomass exhibited a logistic growth. The carrying capacity of plankton in the lake was assumed to be 2,300 tons. In spatial variants of the model, plankton diffused 10% of its biomass per month into neighbouring cells. The fish population was initialised with 25 individual fish agents, which is a situation close to extinction. Fish age and sex were attributed randomly from a uniform distribution. The individual locations in the lake were also assigned randomly. Plankton was set to 2150 tons, which is a value close to the carrying capacity of the lake. As the fish population grew to a viable population size that had organised itself into schools of fish, a trigger caused the agents to switch to a more aggregate representation: school-agents, spatial stocks or stocks. If the fish population fell below 50 fish, the model switched back to its initial configuration. ## HYBRID MODEL DESIGN AND PARADIGM SWITCHES please refer to the below reference for details. ## RELATED MODELS This is Design 3 of a series of six hybrid model designs. @#$#@#$#@ default true 0 Polygon -7500403 true true 150 5 40 250 150 205 260 250 airplane true 0 Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15 arrow true 0 Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150 box false 0 Polygon -7500403 true true 150 285 285 225 285 75 150 135 Polygon -7500403 true true 150 135 15 75 150 15 285 75 Polygon -7500403 true true 15 75 15 225 150 285 150 135 Line -16777216 false 150 285 150 135 Line -16777216 false 150 135 15 75 Line -16777216 false 150 135 285 75 bug true 0 Circle -7500403 true true 96 182 108 Circle -7500403 true true 110 127 80 Circle -7500403 true true 110 75 80 Line -7500403 true 150 100 80 30 Line -7500403 true 150 100 220 30 butterfly true 0 Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240 Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240 Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163 Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165 Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225 Circle -16777216 true false 135 90 30 Line -16777216 false 150 105 195 60 Line -16777216 false 150 105 105 60 car false 0 Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180 Circle -16777216 true false 180 180 90 Circle -16777216 true false 30 180 90 Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89 Circle -7500403 true true 47 195 58 Circle -7500403 true true 195 195 58 circle false 0 Circle -7500403 true true 0 0 300 circle 2 false 0 Circle -7500403 true true 0 0 300 Circle -16777216 true false 30 30 240 cow false 0 Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167 Polygon -7500403 true true 73 210 86 251 62 249 48 208 Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123 cylinder false 0 Circle -7500403 true true 0 0 300 dot false 0 Circle -7500403 true true 90 90 120 face happy false 0 Circle -7500403 true true 8 8 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240 face neutral false 0 Circle -7500403 true true 8 7 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Rectangle -16777216 true false 60 195 240 225 face sad false 0 Circle -7500403 true true 8 8 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183 fish false 0 Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166 Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165 Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60 Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166 Circle -16777216 true false 215 106 30 flag false 0 Rectangle -7500403 true true 60 15 75 300 Polygon -7500403 true true 90 150 270 90 90 30 Line -7500403 true 75 135 90 135 Line -7500403 true 75 45 90 45 flower false 0 Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135 Circle -7500403 true true 85 132 38 Circle -7500403 true true 130 147 38 Circle -7500403 true true 192 85 38 Circle -7500403 true true 85 40 38 Circle -7500403 true true 177 40 38 Circle -7500403 true true 177 132 38 Circle -7500403 true true 70 85 38 Circle -7500403 true true 130 25 38 Circle -7500403 true true 96 51 108 Circle -16777216 true false 113 68 74 Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218 Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240 house false 0 Rectangle -7500403 true true 45 120 255 285 Rectangle -16777216 true false 120 210 180 285 Polygon -7500403 true true 15 120 150 15 285 120 Line -16777216 false 30 120 270 120 leaf false 0 Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195 Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195 line true 0 Line -7500403 true 150 0 150 300 line half true 0 Line -7500403 true 150 0 150 150 pentagon false 0 Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120 person false 0 Circle -7500403 true true 110 5 80 Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90 Rectangle -7500403 true true 127 79 172 94 Polygon -7500403 true true 195 90 240 150 225 180 165 105 Polygon -7500403 true true 105 90 60 150 75 180 135 105 plant false 0 Rectangle -7500403 true true 135 90 165 300 Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285 Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285 Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210 Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135 Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135 Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60 Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90 sheep false 15 Circle -1 true true 203 65 88 Circle -1 true true 70 65 162 Circle -1 true true 150 105 120 Polygon -7500403 true false 218 120 240 165 255 165 278 120 Circle -7500403 true false 214 72 67 Rectangle -1 true true 164 223 179 298 Polygon -1 true true 45 285 30 285 30 240 15 195 45 210 Circle -1 true true 3 83 150 Rectangle -1 true true 65 221 80 296 Polygon -1 true true 195 285 210 285 210 240 240 210 195 210 Polygon -7500403 true false 276 85 285 105 302 99 294 83 Polygon -7500403 true false 219 85 210 105 193 99 201 83 square false 0 Rectangle -7500403 true true 30 30 270 270 square 2 false 0 Rectangle -7500403 true true 30 30 270 270 Rectangle -16777216 true false 60 60 240 240 star false 0 Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108 target false 0 Circle -7500403 true true 0 0 300 Circle -16777216 true false 30 30 240 Circle -7500403 true true 60 60 180 Circle -16777216 true false 90 90 120 Circle -7500403 true true 120 120 60 tree false 0 Circle -7500403 true true 118 3 94 Rectangle -6459832 true false 120 195 180 300 Circle -7500403 true true 65 21 108 Circle -7500403 true true 116 41 127 Circle -7500403 true true 45 90 120 Circle -7500403 true true 104 74 152 triangle false 0 Polygon -7500403 true true 150 30 15 255 285 255 triangle 2 false 0 Polygon -7500403 true true 150 30 15 255 285 255 Polygon -16777216 true false 151 99 225 223 75 224 truck false 0 Rectangle -7500403 true true 4 45 195 187 Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194 Rectangle -1 true false 195 60 195 105 Polygon -16777216 true false 238 112 252 141 219 141 218 112 Circle -16777216 true false 234 174 42 Rectangle -7500403 true true 181 185 214 194 Circle -16777216 true false 144 174 42 Circle -16777216 true false 24 174 42 Circle -7500403 false true 24 174 42 Circle -7500403 false true 144 174 42 Circle -7500403 false true 234 174 42 turtle true 0 Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210 Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105 Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105 Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87 Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210 Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99 wheel false 0 Circle -7500403 true true 3 3 294 Circle -16777216 true false 30 30 240 Line -7500403 true 150 285 150 15 Line -7500403 true 15 150 285 150 Circle -7500403 true true 120 120 60 Line -7500403 true 216 40 79 269 Line -7500403 true 40 84 269 221 Line -7500403 true 40 216 269 79 Line -7500403 true 84 40 221 269 wolf false 0 Polygon -16777216 true false 253 133 245 131 245 133 Polygon -7500403 true true 2 194 13 197 30 191 38 193 38 205 20 226 20 257 27 265 38 266 40 260 31 253 31 230 60 206 68 198 75 209 66 228 65 243 82 261 84 268 100 267 103 261 77 239 79 231 100 207 98 196 119 201 143 202 160 195 166 210 172 213 173 238 167 251 160 248 154 265 169 264 178 247 186 240 198 260 200 271 217 271 219 262 207 258 195 230 192 198 210 184 227 164 242 144 259 145 284 151 277 141 293 140 299 134 297 127 273 119 270 105 Polygon -7500403 true true -1 195 14 180 36 166 40 153 53 140 82 131 134 133 159 126 188 115 227 108 236 102 238 98 268 86 269 92 281 87 269 103 269 113 x false 0 Polygon -7500403 true true 270 75 225 30 30 225 75 270 Polygon -7500403 true true 30 75 75 30 270 225 225 270 @#$#@#$#@ NetLogo 5.3.1 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ <experiments> <experiment name="experiment" repetitions="100" runMetricsEveryStep="false"> <setup>setup</setup> <go>go</go> <metric>timer</metric> <enumeratedValueSet variable="initial-number-of-fish"> <value value="25"/> </enumeratedValueSet> <enumeratedValueSet variable="swarm-threshold"> <value value="50"/> </enumeratedValueSet> </experiment> </experiments> @#$#@#$#@ @#$#@#$#@ default 0.0 -0.2 0 0.0 1.0 0.0 1 1.0 0.0 0.2 0 0.0 1.0 link direction true 0 Line -7500403 true 150 150 90 180 Line -7500403 true 150 150 210 180 @#$#@#$#@ 0 @#$#@#$#@
NetLogo
5
ajnavarro/language-dataset
data/github.com/ZGIS/spatial-simulation/1b5d8d73c2dbdfafb4fab4ddd879184e5c50a3bf/PublishedModels/Wallentin & Neuwirth 2017/003_agent-stock - stock-stock.nlogo
[ "MIT" ]
# P10 - Min-Cost-Flow Problem # Read parameters from file param file := "instances/fluss1.txt"; param n := read file as "1n" skip 0 use 1 comment "#"; set N := { 1 .. n }; param u[N*N] := read file as "n+" skip 1 use n comment "#"; param c[N*N] := read file as "n+" skip n+1 use n comment "#"; param s[N] := read file as "n+" skip 2*n+1 use 1 comment "#"; # Variables var x[N*N] real >= 0; # Objective minimize objective: sum <i,j> in N*N : c[i,j] * x[i,j]; # Constraints subto capacity: forall <i,j> in N*N: x[i,j] <= u[i,j]; subto flowLess: forall <i> in N: sum <j> in N: x[i,j] - sum <k> in N: x[k,i] <= s[i]; subto flowGreater: forall <i> in N: sum <j> in N: x[i,j] - sum <k> in N: x[k,i] >= s[i];
Zimpl
5
ArielMant0/ko2017
sheet12/p10.zpl
[ "MIT" ]
[Desktop Entry] Name=Fuzzbunch Comment=NSA Exploit framework Exec=/usr/bin/fuzzbunch Terminal=false Type=Application Categories=Wine;
desktop
1
cyberqueen-meg/blackarch
packages/fuzzbunch/fuzzbunch.desktop
[ "BSD-3-Clause" ]
module FunctionsInIndices where open import Prelude open import Eq data Tree (a : Set) : ℕ -> Set where leaf : a -> Tree a 1 node : forall n₁ n₂ -> Tree a n₁ -> Tree a n₂ -> Tree a (n₁ + n₂) -- This does not work: -- leftmost : forall {a} n -> Tree a (suc n) -> a -- leftmost .0 (leaf x) = x -- leftmost .n₂ (node zero (suc n₂) l r) = leftmost l -- leftmost .(n₁ + n₂) (node (suc n₁) n₂ l r) = leftmost l module Workaround1 where private T : Set -> ℕ -> Set T a zero = ⊤ T a (suc n) = a leftmost' : forall {a n} -> Tree a n -> T a n leftmost' (leaf x) = x leftmost' (node zero zero l r) = tt leftmost' (node zero (suc n₂) l r) = leftmost' r leftmost' (node (suc n₁) n₂ l r) = leftmost' l leftmost : forall {a n} -> Tree a (suc n) -> a leftmost = leftmost' module Workaround2 where private leftmost' : forall {a n m} -> Tree a m -> m ≡ suc n -> a leftmost' (leaf x) _ = x leftmost' (node zero (suc n₂) l r) _ = leftmost' r refl leftmost' (node (suc n₁) n₂ l r) _ = leftmost' l refl leftmost : forall {a n} -> Tree a (suc n) -> a leftmost t = leftmost' t refl
Agda
4
cruhland/agda
examples/outdated-and-incorrect/FunctionsInIndices.agda
[ "MIT" ]
import "std/test" test.run("Single statement if expressions", fn(assert) { let counter = 0 if true { counter += 1 } if (true) { counter += 1 } if true: counter += 1 if (true): counter += 1 assert.isEq(counter, 4) }) test.run("Various if expressions", fn(assert) { assert.shouldThrow(fn() { if ["a"] == ["b"]: return println("Hello") }) assert.isTrue(fn() { if 42 == 42: return true return false }()) assert.isFalse(fn() { if "42" == 42: return true return false }) }) test.run("If statement with else", fn(assert) { const theTest = fn(a) { if a { return "Hello" } else { return "Good bye" } } assert.isEq(theTest(true), "Hello") assert.isEq(theTest(false), "Good bye") }) test.run("If statement with else and compound conditional", fn(assert) { const theTest = fn(a, b) { if a or b { return "Hello" } else { return "Good bye" } } assert.isEq(theTest(true, false), "Hello") assert.isEq(theTest(false, true), "Hello") assert.isEq(theTest(true, true), "Hello") assert.isEq(theTest(false, false), "Good bye") }) test.run("If statement with else assigned to variable", fn(assert) { const theTest = fn(a) { const msg = if a { "Hello" } else { "Good bye" } return msg } assert.isEq(theTest(true), "Hello") assert.isEq(theTest(false), "Good bye") }) test.run("If statement within an if true branch", fn(assert) { const theTest = fn(a, b) { if a { if b { return "Hello1" } else { return "Hello2" } } else { return "Good bye" } } assert.isEq(theTest(true, true), "Hello1") assert.isEq(theTest(true, false), "Hello2") assert.isEq(theTest(false, true), "Good bye") assert.isEq(theTest(false, false), "Good bye") }) test.run("If statement within an if false branch", fn(assert) { const theTest = fn(a, b) { if a { return "Hello" } else { if b { return "Good bye1" } else { return "Good bye2" } } } assert.isEq(theTest(true, true), "Hello") assert.isEq(theTest(true, false), "Hello") assert.isEq(theTest(false, true), "Good bye1") assert.isEq(theTest(false, false), "Good bye2") }) test.run("If statement with elif block", fn(assert) { const theTest = fn(a) { if a == 42 { return 82 } elif a == 43 { return 83 } elif a == 44 { return 84 } else { return 90 } } assert.isEq(theTest(42), 82) assert.isEq(theTest(43), 83) assert.isEq(theTest(44), 84) assert.isEq(theTest(45), 90) })
Inform 7
5
lfkeitel/nitrogen
tests/basic/conditionals.ni
[ "BSD-3-Clause" ]
/++ Auto-generated Linux syscall constants for X86 +/ module mir.linux.arch.x86.uapi._asm.unistd; version(LDC) pragma(LDC_no_moduleinfo); enum NR_restart_syscall = 0; enum NR_exit = 1; enum NR_fork = 2; enum NR_read = 3; enum NR_write = 4; enum NR_open = 5; enum NR_close = 6; enum NR_waitpid = 7; enum NR_creat = 8; enum NR_link = 9; enum NR_unlink = 10; enum NR_execve = 11; enum NR_chdir = 12; enum NR_time = 13; enum NR_mknod = 14; enum NR_chmod = 15; enum NR_lchown = 16; enum NR_break = 17; enum NR_oldstat = 18; enum NR_lseek = 19; enum NR_getpid = 20; enum NR_mount = 21; enum NR_umount = 22; enum NR_setuid = 23; enum NR_getuid = 24; enum NR_stime = 25; enum NR_ptrace = 26; enum NR_alarm = 27; enum NR_oldfstat = 28; enum NR_pause = 29; enum NR_utime = 30; enum NR_stty = 31; enum NR_gtty = 32; enum NR_access = 33; enum NR_nice = 34; enum NR_ftime = 35; enum NR_sync = 36; enum NR_kill = 37; enum NR_rename = 38; enum NR_mkdir = 39; enum NR_rmdir = 40; enum NR_dup = 41; enum NR_pipe = 42; enum NR_times = 43; enum NR_prof = 44; enum NR_brk = 45; enum NR_setgid = 46; enum NR_getgid = 47; enum NR_signal = 48; enum NR_geteuid = 49; enum NR_getegid = 50; enum NR_acct = 51; enum NR_umount2 = 52; enum NR_lock = 53; enum NR_ioctl = 54; enum NR_fcntl = 55; enum NR_mpx = 56; enum NR_setpgid = 57; enum NR_ulimit = 58; enum NR_oldolduname = 59; enum NR_umask = 60; enum NR_chroot = 61; enum NR_ustat = 62; enum NR_dup2 = 63; enum NR_getppid = 64; enum NR_getpgrp = 65; enum NR_setsid = 66; enum NR_sigaction = 67; enum NR_sgetmask = 68; enum NR_ssetmask = 69; enum NR_setreuid = 70; enum NR_setregid = 71; enum NR_sigsuspend = 72; enum NR_sigpending = 73; enum NR_sethostname = 74; enum NR_setrlimit = 75; enum NR_getrlimit = 76; enum NR_getrusage = 77; enum NR_gettimeofday = 78; enum NR_settimeofday = 79; enum NR_getgroups = 80; enum NR_setgroups = 81; enum NR_select = 82; enum NR_symlink = 83; enum NR_oldlstat = 84; enum NR_readlink = 85; enum NR_uselib = 86; enum NR_swapon = 87; enum NR_reboot = 88; enum NR_readdir = 89; enum NR_mmap = 90; enum NR_munmap = 91; enum NR_truncate = 92; enum NR_ftruncate = 93; enum NR_fchmod = 94; enum NR_fchown = 95; enum NR_getpriority = 96; enum NR_setpriority = 97; enum NR_profil = 98; enum NR_statfs = 99; enum NR_fstatfs = 100; enum NR_ioperm = 101; enum NR_socketcall = 102; enum NR_syslog = 103; enum NR_setitimer = 104; enum NR_getitimer = 105; enum NR_stat = 106; enum NR_lstat = 107; enum NR_fstat = 108; enum NR_olduname = 109; enum NR_iopl = 110; enum NR_vhangup = 111; enum NR_idle = 112; enum NR_vm86old = 113; enum NR_wait4 = 114; enum NR_swapoff = 115; enum NR_sysinfo = 116; enum NR_ipc = 117; enum NR_fsync = 118; enum NR_sigreturn = 119; enum NR_clone = 120; enum NR_setdomainname = 121; enum NR_uname = 122; enum NR_modify_ldt = 123; enum NR_adjtimex = 124; enum NR_mprotect = 125; enum NR_sigprocmask = 126; enum NR_create_module = 127; enum NR_init_module = 128; enum NR_delete_module = 129; enum NR_get_kernel_syms = 130; enum NR_quotactl = 131; enum NR_getpgid = 132; enum NR_fchdir = 133; enum NR_bdflush = 134; enum NR_sysfs = 135; enum NR_personality = 136; enum NR_afs_syscall = 137; enum NR_setfsuid = 138; enum NR_setfsgid = 139; enum NR__llseek = 140; enum NR_getdents = 141; enum NR__newselect = 142; enum NR_flock = 143; enum NR_msync = 144; enum NR_readv = 145; enum NR_writev = 146; enum NR_getsid = 147; enum NR_fdatasync = 148; enum NR__sysctl = 149; enum NR_mlock = 150; enum NR_munlock = 151; enum NR_mlockall = 152; enum NR_munlockall = 153; enum NR_sched_setparam = 154; enum NR_sched_getparam = 155; enum NR_sched_setscheduler = 156; enum NR_sched_getscheduler = 157; enum NR_sched_yield = 158; enum NR_sched_get_priority_max = 159; enum NR_sched_get_priority_min = 160; enum NR_sched_rr_get_interval = 161; enum NR_nanosleep = 162; enum NR_mremap = 163; enum NR_setresuid = 164; enum NR_getresuid = 165; enum NR_vm86 = 166; enum NR_query_module = 167; enum NR_poll = 168; enum NR_nfsservctl = 169; enum NR_setresgid = 170; enum NR_getresgid = 171; enum NR_prctl = 172; enum NR_rt_sigreturn = 173; enum NR_rt_sigaction = 174; enum NR_rt_sigprocmask = 175; enum NR_rt_sigpending = 176; enum NR_rt_sigtimedwait = 177; enum NR_rt_sigqueueinfo = 178; enum NR_rt_sigsuspend = 179; enum NR_pread64 = 180; enum NR_pwrite64 = 181; enum NR_chown = 182; enum NR_getcwd = 183; enum NR_capget = 184; enum NR_capset = 185; enum NR_sigaltstack = 186; enum NR_sendfile = 187; enum NR_getpmsg = 188; enum NR_putpmsg = 189; enum NR_vfork = 190; enum NR_ugetrlimit = 191; enum NR_mmap2 = 192; enum NR_truncate64 = 193; enum NR_ftruncate64 = 194; enum NR_stat64 = 195; enum NR_lstat64 = 196; enum NR_fstat64 = 197; enum NR_lchown32 = 198; enum NR_getuid32 = 199; enum NR_getgid32 = 200; enum NR_geteuid32 = 201; enum NR_getegid32 = 202; enum NR_setreuid32 = 203; enum NR_setregid32 = 204; enum NR_getgroups32 = 205; enum NR_setgroups32 = 206; enum NR_fchown32 = 207; enum NR_setresuid32 = 208; enum NR_getresuid32 = 209; enum NR_setresgid32 = 210; enum NR_getresgid32 = 211; enum NR_chown32 = 212; enum NR_setuid32 = 213; enum NR_setgid32 = 214; enum NR_setfsuid32 = 215; enum NR_setfsgid32 = 216; enum NR_pivot_root = 217; enum NR_mincore = 218; enum NR_madvise = 219; enum NR_getdents64 = 220; enum NR_fcntl64 = 221; enum NR_gettid = 224; enum NR_readahead = 225; enum NR_setxattr = 226; enum NR_lsetxattr = 227; enum NR_fsetxattr = 228; enum NR_getxattr = 229; enum NR_lgetxattr = 230; enum NR_fgetxattr = 231; enum NR_listxattr = 232; enum NR_llistxattr = 233; enum NR_flistxattr = 234; enum NR_removexattr = 235; enum NR_lremovexattr = 236; enum NR_fremovexattr = 237; enum NR_tkill = 238; enum NR_sendfile64 = 239; enum NR_futex = 240; enum NR_sched_setaffinity = 241; enum NR_sched_getaffinity = 242; enum NR_set_thread_area = 243; enum NR_get_thread_area = 244; enum NR_io_setup = 245; enum NR_io_destroy = 246; enum NR_io_getevents = 247; enum NR_io_submit = 248; enum NR_io_cancel = 249; enum NR_fadvise64 = 250; enum NR_exit_group = 252; enum NR_lookup_dcookie = 253; enum NR_epoll_create = 254; enum NR_epoll_ctl = 255; enum NR_epoll_wait = 256; enum NR_remap_file_pages = 257; enum NR_set_tid_address = 258; enum NR_timer_create = 259; enum NR_timer_settime = 260; enum NR_timer_gettime = 261; enum NR_timer_getoverrun = 262; enum NR_timer_delete = 263; enum NR_clock_settime = 264; enum NR_clock_gettime = 265; enum NR_clock_getres = 266; enum NR_clock_nanosleep = 267; enum NR_statfs64 = 268; enum NR_fstatfs64 = 269; enum NR_tgkill = 270; enum NR_utimes = 271; enum NR_fadvise64_64 = 272; enum NR_vserver = 273; enum NR_mbind = 274; enum NR_get_mempolicy = 275; enum NR_set_mempolicy = 276; enum NR_mq_open = 277; enum NR_mq_unlink = 278; enum NR_mq_timedsend = 279; enum NR_mq_timedreceive = 280; enum NR_mq_notify = 281; enum NR_mq_getsetattr = 282; enum NR_kexec_load = 283; enum NR_waitid = 284; enum NR_add_key = 286; enum NR_request_key = 287; enum NR_keyctl = 288; enum NR_ioprio_set = 289; enum NR_ioprio_get = 290; enum NR_inotify_init = 291; enum NR_inotify_add_watch = 292; enum NR_inotify_rm_watch = 293; enum NR_migrate_pages = 294; enum NR_openat = 295; enum NR_mkdirat = 296; enum NR_mknodat = 297; enum NR_fchownat = 298; enum NR_futimesat = 299; enum NR_fstatat64 = 300; enum NR_unlinkat = 301; enum NR_renameat = 302; enum NR_linkat = 303; enum NR_symlinkat = 304; enum NR_readlinkat = 305; enum NR_fchmodat = 306; enum NR_faccessat = 307; enum NR_pselect6 = 308; enum NR_ppoll = 309; enum NR_unshare = 310; enum NR_set_robust_list = 311; enum NR_get_robust_list = 312; enum NR_splice = 313; enum NR_sync_file_range = 314; enum NR_tee = 315; enum NR_vmsplice = 316; enum NR_move_pages = 317; enum NR_getcpu = 318; enum NR_epoll_pwait = 319; enum NR_utimensat = 320; enum NR_signalfd = 321; enum NR_timerfd_create = 322; enum NR_eventfd = 323; enum NR_fallocate = 324; enum NR_timerfd_settime = 325; enum NR_timerfd_gettime = 326; enum NR_signalfd4 = 327; enum NR_eventfd2 = 328; enum NR_epoll_create1 = 329; enum NR_dup3 = 330; enum NR_pipe2 = 331; enum NR_inotify_init1 = 332; enum NR_preadv = 333; enum NR_pwritev = 334; enum NR_rt_tgsigqueueinfo = 335; enum NR_perf_event_open = 336; enum NR_recvmmsg = 337; enum NR_fanotify_init = 338; enum NR_fanotify_mark = 339; enum NR_prlimit64 = 340; enum NR_name_to_handle_at = 341; enum NR_open_by_handle_at = 342; enum NR_clock_adjtime = 343; enum NR_syncfs = 344; enum NR_sendmmsg = 345; enum NR_setns = 346; enum NR_process_vm_readv = 347; enum NR_process_vm_writev = 348; enum NR_kcmp = 349; enum NR_finit_module = 350; enum NR_sched_setattr = 351; enum NR_sched_getattr = 352; enum NR_renameat2 = 353; enum NR_seccomp = 354; enum NR_getrandom = 355; enum NR_memfd_create = 356; enum NR_bpf = 357; enum NR_execveat = 358; enum NR_socket = 359; enum NR_socketpair = 360; enum NR_bind = 361; enum NR_connect = 362; enum NR_listen = 363; enum NR_accept4 = 364; enum NR_getsockopt = 365; enum NR_setsockopt = 366; enum NR_getsockname = 367; enum NR_getpeername = 368; enum NR_sendto = 369; enum NR_sendmsg = 370; enum NR_recvfrom = 371; enum NR_recvmsg = 372; enum NR_shutdown = 373; enum NR_userfaultfd = 374; enum NR_membarrier = 375; enum NR_mlock2 = 376; enum NR_copy_file_range = 377; enum NR_preadv2 = 378; enum NR_pwritev2 = 379; enum NR_pkey_mprotect = 380; enum NR_pkey_alloc = 381; enum NR_pkey_free = 382; enum NR_statx = 383; enum NR_arch_prctl = 384; enum NR_io_pgetevents = 385; enum NR_rseq = 386; enum NR_semget = 393; enum NR_semctl = 394; enum NR_shmget = 395; enum NR_shmctl = 396; enum NR_shmat = 397; enum NR_shmdt = 398; enum NR_msgget = 399; enum NR_msgsnd = 400; enum NR_msgrcv = 401; enum NR_msgctl = 402; enum NR_clock_gettime64 = 403; enum NR_clock_settime64 = 404; enum NR_clock_adjtime64 = 405; enum NR_clock_getres_time64 = 406; enum NR_clock_nanosleep_time64 = 407; enum NR_timer_gettime64 = 408; enum NR_timer_settime64 = 409; enum NR_timerfd_gettime64 = 410; enum NR_timerfd_settime64 = 411; enum NR_utimensat_time64 = 412; enum NR_pselect6_time64 = 413; enum NR_ppoll_time64 = 414; enum NR_io_pgetevents_time64 = 416; enum NR_recvmmsg_time64 = 417; enum NR_mq_timedsend_time64 = 418; enum NR_mq_timedreceive_time64 = 419; enum NR_semtimedop_time64 = 420; enum NR_rt_sigtimedwait_time64 = 421; enum NR_futex_time64 = 422; enum NR_sched_rr_get_interval_time64 = 423; enum NR_pidfd_send_signal = 424; enum NR_io_uring_setup = 425; enum NR_io_uring_enter = 426; enum NR_io_uring_register = 427; enum NR_open_tree = 428; enum NR_move_mount = 429; enum NR_fsopen = 430; enum NR_fsconfig = 431; enum NR_fsmount = 432; enum NR_fspick = 433; enum NR_pidfd_open = 434; enum NR_clone3 = 435; enum NR_close_range = 436; enum NR_openat2 = 437; enum NR_pidfd_getfd = 438; enum NR_faccessat2 = 439; enum NR_process_madvise = 440; enum NR_epoll_pwait2 = 441; enum NR_mount_setattr = 442; enum NR_quotactl_fd = 443; enum NR_landlock_create_ruleset = 444; enum NR_landlock_add_rule = 445; enum NR_landlock_restrict_self = 446; enum NR_memfd_secret = 447; enum NR_process_mrelease = 448;
D
1
libmir/mir-linux-kernel
source/mir/linux/arch/x86/uapi/_asm/unistd.di
[ "BSL-1.0" ]
#!/usr/bin/env sage import sys from CryptoAttacks.Block.whitebox_aes_sage import * from CryptoAttacks.Utils import * def test_encryption(): print "Test: normal/whitebox encryption" for test_case in xrange(10): key = bytes_to_matrix(random_bytes(16)) plaintext = bytes_to_matrix(random_bytes(16)) ciphertext_normal = encrypt(plaintext, key) boxes = generate_boxes(key) ciphertext_whitebox = encrypt_whitebox(plaintext, *boxes) assert ciphertext_normal == ciphertext_whitebox def test_recover_key_unprotected_wbaes(): print("Test: recover_key_unprotected_wbaes()") for test_case in xrange(10): key = bytes_to_matrix(random_bytes(16)) T = generate_tboxes(key) Ty = generate_tyboxes() TTy_composed = compose_T_Ty_boxes(T, Ty) key_recovered = recover_key_unprotected_wbaes(TTy_composed, Ty) assert key == key_recovered def test_recover_key_unprotected_wbaes_from_TTyboxFinal(): print("Test: recover_key_from_TTyboxFinal()") for test_case in xrange(10): key = bytes_to_matrix(random_bytes(16)) T = generate_tboxes(key) key_recovered = recover_key_unprotected_wbaes_from_TTyboxFinal(T[-1]) assert key == key_recovered def test_dfa(): print("Test: dfa()") for test_case in xrange(10): print "Test no", test_case key = bytes_to_matrix(random_bytes(16)) T = generate_tboxes(key) Ty = generate_tyboxes() TTy_composed = compose_T_Ty_boxes(T, Ty) key_recovered = dfa(TTy_composed, T[-1]) assert key == key_recovered if __name__ == "__main__": test_encryption() test_recover_key_unprotected_wbaes() test_recover_key_unprotected_wbaes_from_TTyboxFinal() test_dfa()
Sage
4
akbarszcz/CryptoAttacks
CryptoAttacks/tests/Block/test_whitebox_aes.sage
[ "MIT" ]
/** * PhasedT.x10 * * Rudra Distributed Learning Platform * * Copyright (c) IBM Corporation 2016 * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of Rudra nor the names of its contributors may be used * to endorse or promote products derived from this software without specific * prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ package rudra.util; import x10.util.concurrent.Lock; public class PhasedT[T]{T <: Arithmetic[T]} { static val logger = new Logger(Logger.NOTIFY); val lock = new Lock(); // reentrant lock var count:T; var phase:UInt=0un; val badT:T; public def this(init:T,bad:T) { this.count=init; this.badT=bad; } public def getPhase():UInt=phase; public def availableData(source:Long, myCount:T, myPhase:UInt):T { var result:T=badT; try { assert myPhase==phase||myPhase==phase+1un : "Phased[T].availableData myPhase=" + myPhase + " should be " + phase + " or " + (phase+1un); logger.notify(()=>"PhasedT: available Data source=" + source + " myCount=" + myCount + " myPhase=" + myPhase); lock.lock(); logger.notify(()=>"PhasedT: got lock"); if (myPhase==phase) { count +=myCount; result=count; } if (myPhase==phase+1un) { count = myCount; phase++; result=count; } } finally { logger.notify(()=>"PhasedT: releasing lock " + lock); lock.unlock(); } val r = result; logger.notify(()=>"PhasedT: ad =" + source + "," + myCount + "," + myPhase + " returns " + r); return result; } }
X10
5
milthorpe/rudra
x10/src/rudra/util/PhasedT.x10
[ "BSD-3-Clause" ]
// run-pass #![feature(trait_alias)] trait SimpleAlias = Default; trait GenericAlias<T> = Iterator<Item = T>; trait Partial<T> = IntoIterator<Item = T>; trait SpecificAlias = GenericAlias<i32>; trait PartialEqRef<'a, T: 'a> = PartialEq<&'a T>; trait StaticAlias = 'static; trait Things<T> {} trait Romeo {} #[allow(dead_code)] struct The<T>(T); #[allow(dead_code)] struct Fore<T>(T); impl<T, U> Things<T> for The<U> {} impl<T> Romeo for Fore<T> {} trait WithWhere<Art, Thou> = Romeo + Romeo where Fore<(Art, Thou)>: Romeo; trait BareWhere<Wild, Are> = where The<Wild>: Things<Are>; fn main() {}
Rust
4
Eric-Arellano/rust
src/test/ui/traits/trait-alias/trait-alias-syntax.rs
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
!include nsDialogs.nsh Var RadioButtonLabel1 !macro PAGE_INSTALL_MODE !insertmacro MUI_PAGE_INIT !insertmacro MUI_SET MULTIUSER_${MUI_PAGE_UNINSTALLER_PREFIX}INSTALLMODEPAGE "" Var MultiUser.InstallModePage Var MultiUser.InstallModePage.Text Var MultiUser.InstallModePage.KeepNonGeneralSettings Var MultiUser.InstallModePage.ClearAllUserData Var MultiUser.InstallModePage.ReturnValue !ifndef BUILD_UNINSTALLER !insertmacro FUNCTION_INSTALL_MODE_PAGE_FUNCTION MultiUser.InstallModePre_${MUI_UNIQUEID} MultiUser.InstallModeLeave_${MUI_UNIQUEID} "" PageEx custom PageCallbacks MultiUser.InstallModePre_${MUI_UNIQUEID} MultiUser.InstallModeLeave_${MUI_UNIQUEID} Caption " " PageExEnd !else !insertmacro FUNCTION_INSTALL_MODE_PAGE_FUNCTION MultiUser.InstallModePre_${MUI_UNIQUEID} MultiUser.InstallModeLeave_${MUI_UNIQUEID} un. UninstPage custom un.multiUser.InstallModePre_${MUI_UNIQUEID} un.MultiUser.InstallModeLeave_${MUI_UNIQUEID} !endif !macroend !macro FUNCTION_INSTALL_MODE_PAGE_FUNCTION PRE LEAVE UNINSTALLER_FUNCPREFIX Function "${UNINSTALLER_FUNCPREFIX}${PRE}" !ifdef BUILD_UNINSTALLER !insertmacro MUI_HEADER_TEXT "$(chooseUninstallationOptions)" "$(performCleanUninstall)" !else !insertmacro MUI_HEADER_TEXT "$(chooseInstallationOptions)" "$(performUpgradeOrCleanInstall)" !endif !insertmacro MUI_PAGE_FUNCTION_CUSTOM PRE # check if we are already installed and if we are show ${if} $showCleanUninstallInstallPage == "1" nsDialogs::Create 1018 Pop $MultiUser.InstallModePage !ifndef BUILD_UNINSTALLER ${NSD_CreateLabel} 0u 0u 300u 20u "$(cleanInstall)" StrCpy $8 "$(cleanInstallKeep)" StrCpy $9 "$(cleanInstallCleanup)" !else ${NSD_CreateLabel} 0u 0u 300u 20u "$(cleanUninstall)" StrCpy $8 "$(cleanUninstallKeep)" StrCpy $9 "$(cleanUninstallCleanup)" !endif Pop $MultiUser.InstallModePage.Text ${NSD_CreateRadioButton} 10u 30u 280u 20u "$8" Pop $MultiUser.InstallModePage.KeepNonGeneralSettings System::Call "advapi32::GetUserName(t.r0,*i${NSIS_MAX_STRLEN})i" ${NSD_CreateRadioButton} 10u 50u 280u 20u "$9"# "$9 ($0)" TODO figure out this macro that has $0 as system user name Pop $MultiUser.InstallModePage.ClearAllUserData nsDialogs::SetUserData $MultiUser.InstallModePage.KeepNonGeneralSettings 1 nsDialogs::SetUserData $MultiUser.InstallModePage.ClearAllUserData 0 ; bind to radiobutton change ${NSD_OnClick} $MultiUser.InstallModePage.ClearAllUserData ${UNINSTALLER_FUNCPREFIX}InstModeChange ${NSD_OnClick} $MultiUser.InstallModePage.KeepNonGeneralSettings ${UNINSTALLER_FUNCPREFIX}InstModeChange ${NSD_CreateLabel} 0u 110u 280u 50u "" Pop $RadioButtonLabel1 # If already installed set to keep value by default SendMessage $MultiUser.InstallModePage.KeepNonGeneralSettings ${BM_SETCHECK} ${BST_CHECKED} 0 ; set as default SendMessage $MultiUser.InstallModePage.KeepNonGeneralSettings ${BM_CLICK} 0 0 ; trigger click event !insertmacro MUI_PAGE_FUNCTION_CUSTOM SHOW nsDialogs::Show ${else} # install !insertmacro setInstallModePerUser ${endif} FunctionEnd Function "${UNINSTALLER_FUNCPREFIX}${LEAVE}" SendMessage $MultiUser.InstallModePage.KeepNonGeneralSettings ${BM_GETCHECK} 0 0 $MultiUser.InstallModePage.ReturnValue ${if} $MultiUser.InstallModePage.ReturnValue = ${BST_CHECKED} # delete data ;!ifndef BUILD_UNINSTALLER !insertmacro deleteUserData_KeepNonGeneralSettings ;!endif !insertmacro setInstallModePerUser ${else} !insertmacro deleteUserData_All !insertmacro setInstallModePerUser ${endif} !insertmacro MUI_PAGE_FUNCTION_CUSTOM LEAVE FunctionEnd # TODO maybe fix up the detail message for each case Function "${UNINSTALLER_FUNCPREFIX}InstModeChange" pop $1 nsDialogs::GetUserData $1 pop $1 StrCpy $7 "" ${if} "$1" == "0" ; KEEP DATA !ifndef BUILD_UNINSTALLER ; StrCpy $7 "KEEP DATA INSTALL" !else ; StrCpy $7 "KEEP DATA UNINSTALL" !endif ${else} ; REMOVE ALL DATA !ifndef BUILD_UNINSTALLER ; StrCpy $7 "REMOVE ALL INSTALL" !else ; StrCpy $7 "REMOVE ALL UNINSTALL" !endif ${endif} SendMessage $RadioButtonLabel1 ${WM_SETTEXT} 0 "STR:$7" FunctionEnd !macroend
NSIS
3
frank-spec/NiceHashMiner
installer/nsis_template/userDataCheckGUI.nsh
[ "MIT" ]
title: Test Title author: Test Author created: 2020-05-19 url: http://jpd236.github.io/kotwords copyright: (c) 2020 Kotwords notes: rows: - - clue: Row 1 answer: AAAAAAAAA - - clue: Row 2 Clue 1 (space) answer: AAAAA AAAAA - clue: Row 2 Clue 2 answer: AAAAAAAAAAA - - clue: Row 3 Clue 1 answer: AAAAAAAAAA - clue: Row 3 Clue 2 (hyphen) answer: AAA-AAAAAAAA - - clue: Row 4 Clue 1 (spaces and hyphen) answer: AAA AA AA-AAA - clue: Row 4 Clue 2 answer: AAAAAAAAAAA - - clue: Row 5 *Clue 1* (italics) answer: AAAAAAAAAA - clue: "Row 5" Clue 2 (quotes) answer: AAAAAAAAAAA - - clue: Row 6 Clue 1 answer: AAAAAAAAAA - clue: Row 6 Clue 2 :{}[],&*#?|-<>=!%@\ (special characters) answer: AAAAAAAAAAA - - clue: Row 7 Clue 1 answer: AAAAAAAAAA - clue: Row 7 Clue 2 answer: AAAAAAAAAAA - - clue: Row 8 Clue 1 answer: AAAAAAAAAA - clue: Row 8 Clue 2 answer: AAAAAAAAAAA - - clue: Row 9 Clue 1 answer: AAAAAAAAAA - clue: Row 9 Clue 2 answer: AAAAAAAAAAA - - clue: Row 10 Clue 1 answer: AAAAAAAAAA - clue: Row 10 Clue 2 answer: AAAAAAAAAAA - - clue: Row 11 Clue 1 answer: AAAAAAAAAA - clue: Row 11 Clue 2 answer: AAAAAAAAAAA - - clue: Row 12 answer: AAAAAAAAA light: - clue: Light 1 answer: AAAAAA - clue: Light 2 (space) answer: AAA AAA - clue: Light 3 (hyphen) answer: AAA-AAA - clue: Light 4 answer: AAAAAA - clue: Light 5 answer: AAAAAA - clue: Light 6 answer: AAAAAA - clue: Light 7 answer: AAAAAA - clue: Light 8 answer: AAAAAA - clue: Light 9 answer: AAAAAA - clue: Light 10 answer: AAAAAA - clue: Light 11 answer: AAAAAA - clue: Light 12 answer: AAAAAA - clue: Light 13 answer: AAAAAA - clue: Light 14 answer: AAAAAA medium: - clue: Medium 1 answer: AAAAAA - clue: Medium 2 answer: AAAAAA - clue: Medium 3 answer: AAAAAA - clue: Medium 4 answer: AAAAAA - clue: Medium 5 answer: AAAAAA - clue: Medium 6 answer: AAAAAA - clue: Medium 7 answer: AAAAAA - clue: Medium 8 answer: AAAAAA - clue: Medium 9 answer: AAAAAA - clue: Medium 10 answer: AAAAAA - clue: Medium 11 answer: AAAAAA - clue: Medium 12 answer: AAAAAA - clue: Medium 13 answer: AAAAAA - clue: Medium 14 answer: AAAAAA dark: - clue: Dark 1 answer: AAAAAA - clue: Dark 2 answer: AAAAAA - clue: Dark 3 answer: AAAAAA - clue: Dark 4 answer: AAAAAA - clue: Dark 5 answer: AAAAAA - clue: Dark 6 answer: AAAAAA - clue: Dark 7 answer: AAAAAA - clue: Dark 8 answer: AAAAAA - clue: Dark 9 answer: AAAAAA - clue: Dark 10 answer: AAAAAA
Rouge
1
jpd236/kotwords
src/commonTest/resources/rows-garden/test.rg
[ "Apache-2.0" ]
#lang scribble/base @(require "defs.rkt" "bib.rkt" "cur.rkt" scribble/manual scriblib/footnote scriblib/figure) @title[#:tag "sec:cur"]{Designing for Language Extension} If we were following the design of other proof assistants, we would now describe a practical surface language. The surface language would include features that are not necessary for expressivity but simplify development. We would then write an elaborator that transforms the surface language into the core language. In this paper, we instead essentially develop an expressive and extensible elaborator and expose it to the user. This elaborator is the language-extension system. As with our choice of core language, the choice of language-extension system is not vital to our design. We choose Racket's language-extension system as it is the subject of active research and development and already supports convenient and sophisticated extension, so we need only ensure the extensions are safe. We imagine that if a proof assistant like Coq were implemented using our design, it would feature a language-extension system written in OCaml. Whatever the choice, we want the language-extension system to enable the users to conveniently write safe and sophisticated extensions. We will refer to the "metalanguage" as the language in which users write extensions and the "object language" as the language in which users write proof and formal models. In fact, Cur supports an infinite hierarchy of metalanguages; we do not discuss this further in this paper, but refer the interested reader to the literature on multi-stage programming---@citeta{taha2004gentle}, for example. @subsubsub*section*{Safe Extension} For extensions to be @emph{safe} in the context of a proof assistant, all extensions must be valid---in the sense that they do not introduce inconsistency---according to the core language. The simplest and most convenient way to ensure safety is to check the output of all extensions after elaboration into the core language. The biggest drawback to this approach is that type errors may arise in expanded code, rather than in the code written by the user. To improve type errors, we enable extension authors to check subforms and report errors during expansion. While our design enables extension authors to overcome the problem, other approaches avoid the problem entirely by typing extensions. We discuss these alternatives in @secref{sec:related}. @subsubsub*section*{Convenient Extension} To ensure extensions are @emph{convenient} to write, we must allow extension authors to reuse language infrastructure and automatically integrate extensions into the object language. Extension authors should not need separate toolchains to write or integrate new extensions; the language-extension system should be an integral part of the proof assistant. Users should be free to write metalanguage and object language code in the same module. @;The user should not need to manually deal with parsing object language code. Users should only need to write the semantics of extension; the extensions should automatically integrate into the parser and receive parsed objects to compute over. All extensions should be automatically checked for safety. By comparison, Coq plugins require users to compile against the Coq implementation using a separate toolchain. Users abandon their project when they find they require a plugin.@note{There are many examples on the Coq-Club mailing list.} Writing extensions as external preprocessors, such as Ott@~citea{sewell:2007}, requires users to write a parser and compiler, and the resulting tool does not integrate into the object language. This adds a barrier to both developing and using such extensions. @subsubsub*section*{Sophisticated Extension} To support @emph{sophisticated} extension, we must allow extensions to perform computation in a general-purpose metalanguage. New extensions should integrate into the syntax of the object language as if they were native syntax. Users must be able to redefine and extend existing syntax, including base syntax like @racket[λ] and application. Language-extension should also support extensions to non-syntactic features of the language. A user may want to extend the reader to parse new literals, rather than just perform rewrites on the AST of the object language. A user may want to extend the interpretation of a module to perform advanced type inference before the existing type checker runs. Mixfix notation in Agda only supports defining new functions whose arguments appear in non-standard positions. It does not support defining a form whose subforms are not evaluated as object language expressions; we give an example of such a form in @secref{sec:olly}. Coq features notations and Idris@~citea{idris:jfp} features macros, but these are limited to simple syntactic rewrites. They do not support general-purpose computation nor redefining existing syntax. @section[#:tag "sec:cur:lang"]{Racket Languages and Language Extension} To describe how we implement Cur and language extension in Cur, we must first explain Racket's language-extension facilities. Racket is both a language and a system for defining languages@~citea{samth:2011}. We use Racket as both: we implement Cur as an object language in Racket as a system, and write language extensions in Cur using Racket as the metalanguage. We use Racket because Racket's existing language extension features support convenient and sophisticated extensions as defined earlier in the section. We describe how we enforce safety later in this section. Each Racket library provides a set of definitions that includes both syntactic forms such as @racket[lambda] or @racket[define] and values such as @racket[Nat] or @racket[plus]. Roughly speaking, definitions exist in one of two phases: compile-time and run-time. Compile-time definitions include both syntactic forms and value definitions. Run-time definitions include only value definitions. Compile-time definitions are written in a metalanguage, while run-time definitions are written in an object language. Defining new syntactic forms extends the object language. In Racket (the language), the metalanguage and object language are the same. In Cur, we create a new object language but leave Racket as metalanguage. We define syntactic forms using syntactic macros. Each macro binds an identifier to a @emph{transformer}, a metalanguage function on @emph{syntax objects}---a data type representing object language syntax. For example, if we assume the object language contains the form @racket[λ], we can define a new ASCII version @racket[lambda] as follows: @#reader scribble/comment-reader (racketblock ;; Start a metalanguage block (begin-for-syntax ;; A metalanguage function definition (define (transform-lambda syn) ;; Expect ":" to be a literal symbol (syntax-case syn (:) [(_ (x : t) e) #'(λ (x : t) e)]))) ;; Defines an object language "lambda" form (define-syntax lambda transform-lambda) ) The form @code{begin-for-syntax} starts a metalanguage block; it can contain arbitrary Racket definitions that will only be visible at compile-time. The transformer function @racket[transform-lambda] uses @code{syntax-case} to pattern match on the syntax object. It also takes a set of literals. This set, @racket[(:)], declares that @racket[:] should be treated as a literal and not as a pattern variable. Where @code{_} appears in a pattern, we do not bind a pattern variable. In @racket[transform-lambda], we ignore the first element of the syntax, as that will be the name of the macro. In the body of the clause, we use syntax quote @racket[#'code:blank] to create a template for a new syntax object. Pattern variables are bound inside the template. We simply preserve the pattern of the syntax object, and replace the macro identifier with the unicode name @racket[λ]. In a practical implementation, we would add additional conditions on the pattern variables, such as check that @code{x} is an identifier rather than an arbitrary expression. Finally, outside the meta-language block, we declare the new syntactic form using @racket[define-syntax], and it is added to the object language. The first stage of running a program is to run the macro expander. The expander recursively traverses the syntax and calls the associated transformer when it reaches a use of a macro identifier. This recursive expansion enables macros to generate calls to other macros, and to build abstractions for defining macros. In Racket, we can even use macros to extend and redefine language features that do not normally have an associated syntactic identifier, like the semantics of application. Language features that do not normally have an associated identifier have a secondary explicit name. For example, while we normally write application @racket[(f e)], this is just a special syntax for @racket[(#%app f e)]. We can redefine application by redefining @racket[#%app], exactly as we defined @racket[lambda]. Similarly, we can redefine the semantics of a module by redefining the @racket[#%module-begin] form. The ability to redefine language features enables the most sophisticated language extensions and allows us to define new object languages in Racket. We define a new language by defining a library that provides the base syntactic forms of the language and a definition for @racket[#%module-begin] to implements the semantics of a module. Each Racket module begins with a line of the form @racketmodfont{#lang name}, where @racketmodfont{name} is the name of a library. This causes Racket to use the library @racketmodfont{name} to interpret the module. We can also define extensions to the language reader which allow adding new literals or entirely new kinds of syntax for writing object and metalanguage programs. A reader mixin is an extension to the reader. Users can use reader mixins by adding them before the language name in the @racketmodfont{#lang name} line. For example, @code{#lang sweet-exp cur} adds the sweet-expression reader @code{sweet-exp} to Cur, allowing users to write Cur using sweet-expressions instead of Racket's usual s-expressions. Using reader mixins does not affect how macros are written, since macros are defined on syntax objects which the reader returns, and not on, say, token streams. @section{Implementing Cur} We define Cur as a Racket language invoked using @code{#lang cur}. Cur uses Racket as the metalanguage, but replaces the object language. The base syntactic forms of Cur are the Curnel forms given @secref{sec:curnel}. For example, we can write the identity function as: @codeblock{ #lang cur (λ (A : (Type 0)) (λ (a : A) a)) } To eliminate some of the syntactic noise of s-expressions, we can write the same code using sweet-expressions. Sweet-expressions are similar to s-expressions, but infer some structure from indentation, provide some support for infix notation, and support the @code{$} operator used in Haskell for controlling precedence. S-expressions are also valid sweet-expressions, so we can still express structure manually when necessary. The rest of the example in this paper will use sweet-expression syntax. @codeblock{ #lang sweet-exp cur λ (A : (Type 0)) $ λ (a : A) a } Cur also provides a @racket[define] form for creating run-time value definitions and a @racket[data] form for defining inductive types: @racketblock[ define id $ λ (A : (Type 0)) $ λ (a : A) a data Nat : 0 (Type 0) z : Nat s : (Π (x : Nat) Nat) ] The base forms plus @racket[define] and @racket[data] make up the default object language. The module semantics recursively expand all syntactic forms into base forms. The forms @racket[data] and @racket[define] generate no code, but affect the module's environment. The @racket[data] form extends the module's inductive type declaration @render-term[Δ]. The @racket[define] form extends the module's value definitions. As each syntactic form in the module is expanded, prior value definitions are inlined and added to the term environment @render-term[Γ], the expanded term is type-checked, and top-level expression are normalized and printed. We can write macros as we saw in the previous section to extend the syntax of Cur. The example of the ASCII @racket[lambda] is a valid Cur extension. As in Racket, we can also build and use metalanguage abstractions to simplify defining new language extensions. For instance, the previous example required a lot of code to simply add another name to an existing form. Instead, we could use the following metalanguage abstraction that generate transformers that just replace the macro identifier with another identifier: @codeblock{ define-syntax lambda make-rename-transformer(#'λ) ; id, now without unicode define id lambda (A : (Type 0)) $ lambda (a : A) a } @section{Reflection API} Some of the extensions we want to write check and infer types, and run Cur terms at compile-time. We can implement staged meta-programming by running Cur terms at compile-time. We can add type errors to extensions by type-checking during macro expansion. We therefore provide a @emph{reflection API}---a metalanguage API to the Curnel implementation---for language extensions to use. We explain the API functions that we use in the rest of this paper. Note that these API functions are added to the metalanguage, not the object language, and can only be used by extensions during expansion and before object language code is checked in the core language. @(declare-exporting cur/curnel/redex-lang) @defproc[(cur-expand [syn SyntaxObject] [id Identifier] ...) SyntaxObject]{ The @racket[cur-expand] function runs the macro expander on @racket[syn] until the expander encounters a base form or one of the identifiers in the @racket[id ...] list. The resulting term is not a fully expanded Curnel term; expansion halts when the top-level form begins with any of the identifiers in the @racket[id] list or any of the Curnel base forms. For instance, @racket[(cur-expand #'(λ (x : t) e))] does not expand @racket[t] or @racket[e] since @racket[λ] is a base form. This function lets users write extensions by only considering certain syntactic forms. Since users can arbitrarily extend the syntax of Cur, using @racket[cur-expand] before pattern matching in a new extensions ensures all unexpected extensions are already expanded. } @defproc[(cur-type-check? [term SyntaxObject] [type SyntaxObject]) Boolean]{ The @racket[cur-type-check?] function returns @racket[true] when @racket[term] expands to @render-term[e], @racket[type] expands to @render-term[t], and @render-term[(type-check Δ Γ e t)] holds, and returns @racket[false] otherwise. Note that this function is not meant to provide an error message; it is meant to be used by extensions that catch type errors in surface syntax and provide their own error messages. } @defproc[(cur-type-infer [term SyntaxObject]) (Maybe SyntaxObject)]{ The @racket[cur-type-infer] function returns a syntax representation of @render-term[t] when @racket[term] expands to the term @render-term[e] and @render-term[(type-infer Δ Γ e t)] holds, and @racket[false] otherwise. This function allows users to build type inference into extensions and reduce annotation burden. } @defproc[(cur-normalize [term SyntaxObject]) SyntaxObject]{ The @racket[cur-normalize] function is Cur's version of @racket[eval], but usable only by extensions at compile-time. It essentially calls the implementation of module semantics explained earlier: it expands all extensions, type checks the result, then normalizes the term in the Curnel. Specifically, the function returns a syntax representation of @render-term[e_1] when @racket[term] expands to a well-typed term @render-term[e_0] and @render-term[e_1] = @render-term[(reduce Δ e_0)]. This lets users explicitly reduce terms or simplify proofs when the type system or other extensions might not evaluate far enough. This is similar to a feature in Zombie@~citea{weirich2013combining}; Zombie users can write potentially non-terminating program to compute proofs, but to do so must explicitly force evaluation and thus act as a termination oracle. As Cur is terminating, the similarity is fleeting. This function also enables us to implement staged meta-programming and run-time reflection without extending the core language. }
Racket
5
bluephoenix47/cic-redex
cur-paper/cur.scrbl
[ "BSD-2-Clause" ]
AC_MSG_CHECKING(for clang fuzzer SAPI) PHP_ARG_ENABLE([fuzzer],, [AS_HELP_STRING([--enable-fuzzer], [Build PHP as clang fuzzing test module (for developers)])], [no], [no]) dnl For newer clang versions see https://llvm.org/docs/LibFuzzer.html#fuzzer-usage dnl for relevant flags. dnl Macro to define fuzzing target dnl PHP_FUZZER_TARGET(name, target-var) dnl AC_DEFUN([PHP_FUZZER_TARGET], [ PHP_FUZZER_BINARIES="$PHP_FUZZER_BINARIES $SAPI_FUZZER_PATH/php-fuzz-$1" PHP_SUBST($2) PHP_ADD_SOURCES_X([sapi/fuzzer],[fuzzer-$1.c],[],$2) $2="[$]$2 $FUZZER_COMMON_OBJS" ]) if test "$PHP_FUZZER" != "no"; then AC_MSG_RESULT([yes]) dnl Don't use PHP_REQUIRE_CXX() to avoid unnecessarily pulling in -lstdc++ AC_PROG_CXX AC_PROG_CXXCPP PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/fuzzer/Makefile.frag) SAPI_FUZZER_PATH=sapi/fuzzer PHP_SUBST(SAPI_FUZZER_PATH) if test -z "$LIB_FUZZING_ENGINE"; then FUZZING_LIB="-fsanitize=fuzzer" FUZZING_CC="$CC" AX_CHECK_COMPILE_FLAG([-fsanitize=fuzzer-no-link], [ CFLAGS="$CFLAGS -fsanitize=fuzzer-no-link" CXXFLAGS="$CXXFLAGS -fsanitize=fuzzer-no-link" ],[ AC_MSG_ERROR(Compiler doesn't support -fsanitize=fuzzer-no-link) ]) else FUZZING_LIB="$LIB_FUZZING_ENGINE" FUZZING_CC="$CXX -stdlib=libc++" fi PHP_SUBST(FUZZING_LIB) PHP_SUBST(FUZZING_CC) dnl PHP_SELECT_SAPI(fuzzer-parser, program, $FUZZER_SOURCES, , '$(SAPI_FUZZER_PATH)') PHP_ADD_BUILD_DIR([sapi/fuzzer]) PHP_FUZZER_BINARIES="" PHP_BINARIES="$PHP_BINARIES fuzzer" PHP_INSTALLED_SAPIS="$PHP_INSTALLED_SAPIS fuzzer" PHP_ADD_SOURCES_X([sapi/fuzzer], [fuzzer-sapi.c], [], FUZZER_COMMON_OBJS) PHP_FUZZER_TARGET([parser], PHP_FUZZER_PARSER_OBJS) PHP_FUZZER_TARGET([execute], PHP_FUZZER_EXECUTE_OBJS) PHP_FUZZER_TARGET([function-jit], PHP_FUZZER_FUNCTION_JIT_OBJS) PHP_FUZZER_TARGET([tracing-jit], PHP_FUZZER_TRACING_JIT_OBJS) PHP_FUZZER_TARGET([unserialize], PHP_FUZZER_UNSERIALIZE_OBJS) PHP_FUZZER_TARGET([unserializehash], PHP_FUZZER_UNSERIALIZEHASH_OBJS) PHP_FUZZER_TARGET([json], PHP_FUZZER_JSON_OBJS) if test -n "$enable_exif" && test "$enable_exif" != "no"; then PHP_FUZZER_TARGET([exif], PHP_FUZZER_EXIF_OBJS) fi if test -n "$enable_mbstring" && test "$enable_mbstring" != "no"; then PHP_FUZZER_TARGET([mbstring], PHP_FUZZER_MBSTRING_OBJS) fi PHP_SUBST(PHP_FUZZER_BINARIES) fi AC_MSG_RESULT($PHP_FUZZER)
M4
5
NathanFreeman/php-src
sapi/fuzzer/config.m4
[ "PHP-3.01" ]
<script>error</script>
HTML
1
frank-dspeed/nw.js
test/sanity/issue5148-iframe-err-crash/frame.html
[ "MIT" ]
<cffunction returntype="boolean" name="checkAuthKey"> <cfif fileExists(expandPath("../config/auth.cfm"))> <cfreturn true> <cfelse> <cfreturn false> </cfif> </cffunction> <cffunction returntype="boolean" name="createAuthKey" hint="Create a new authkey"> <cftry> <cffile action="write" file="#expandPath("../config/auth.cfm")#" output="#createUUID()#"> <cfcatch type="any"> <cfthrow message="Can't create Auth Key"> <cfabort> </cfcatch> </cftry> <cfreturn true> </cffunction> <cffunction returntype="boolean" name="testDSN"> <cfargument name="dsn" default="roombooking"> <!--- Test Q---> <cftry> <cfquery datasource="#arguments.dsn#" name="testQ"> SELECT * FROM settings; </cfquery> <cfcatch> <cfreturn false> </cfcatch> </cftry> <cfreturn true> </cffunction> <cffunction returntype="boolean" name="checkPrimaryAdmin"> <cfargument name="dsn" default="roombooking"> <cfquery datasource="#arguments.dsn#" name="userQ"> SELECT * FROM users WHERE role = <cfqueryparam cfsqltype="cf_sql_varchar" value="admin">; </cfquery> <cfif userQ.recordcount> <cfreturn true> <cfelse> <cfreturn false> </cfif> </cffunction> <cffunction name="createInitialAdminUser"> <cfargument name="dsn" default="roombooking"> <cfif !len(form.email) OR !len(form.firstname) OR !len(form.lastname)> <cfthrow message="Please fill in all fields"> </cfif> <cfif form.password NEQ form.password2> <cfthrow message="Passwords do not match"> </cfif> <cfscript> form.firstname=trim(form.firstname); form.lastname=trim(form.lastname); form.email=trim(form.email); form.t_salt=createUUID(); form.password=hashPassword(form.password, form.t_salt); form.salt=encrypt(form.t_salt, getAuthKey(), 'CFMX_COMPAT'); </cfscript> <cfquery datasource="#arguments.dsn#" name="adminU"> INSERT INTO users ( firstname,lastname,email,salt,password,role,createdAt ) VALUES ( <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.firstname#">, <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.lastname#">, <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.email#">, <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.salt#">, <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.password#">, <cfqueryparam cfsqltype="cf_sql_varchar" value="ADMIN">, <cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#"> ); </cfquery> </cffunction> <cffunction name="getAuthKey"> <cffile action="read" file="#expandpath("../config/auth.cfm")#" variable="authkey"> <cfreturn authkey> </cffunction> <cffunction name="createSalt" hint="Create Salt using authkey"> <cfscript> return encrypt(createUUID(), getAuthKey(), 'CFMX_COMPAT'); </cfscript> </cffunction> <cffunction name="hashPassword" hint="Hash Password using SHA512"> <cfargument name="string" required="true"> <cfargument name="salt" required="true"> <cfscript> return hash(arguments.string & arguments.salt, 'SHA-512'); </cfscript> </cffunction>
ColdFusion
4
fintecheando/RoomBooking
install/functions.cfm
[ "Apache-1.1" ]
count : Nat -> Stream Nat count n = n :: count (S n) badCount : Nat -> Stream Nat badCount n = n :: map S (badCount n) data SP : Type -> Type -> Type where Get : (a -> SP a b) -> SP a b Put : b -> Inf (SP a b) -> SP a b copy : SP a a copy = Get (\x => Put x copy) process : SP a b -> Stream a -> Stream b process (Get f) (x :: xs) = process (f x) xs process (Put b sp) xs = b :: process sp xs badProcess : SP a b -> Stream a -> Stream b badProcess (Get f) (x :: xs) = badProcess (f x) xs badProcess (Put b sp) xs = badProcess sp xs doubleInt : SP Nat Integer doubleInt = Get (\x => Put (the Integer (cast x)) (Put (the Integer (cast x) * 2) doubleInt)) countStream : Nat -> Stream Nat countStream x = x :: countStream (x + 1) main : IO () main = printLn (take 10 (process doubleInt (countStream 1)))
Idris
5
boxfire/rapid
tests/chez/chez001/Total.idr
[ "BSD-3-Clause" ]
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_PYTHON_LIB_CORE_SAFE_PYOBJECT_PTR_H_ #define TENSORFLOW_PYTHON_LIB_CORE_SAFE_PYOBJECT_PTR_H_ #include <Python.h> #include <memory> namespace tensorflow { namespace detail { struct PyDecrefDeleter { void operator()(PyObject* p) const { Py_DECREF(p); } }; } // namespace detail // Safe container for an owned PyObject. On destruction, the reference count of // the contained object will be decremented. using Safe_PyObjectPtr = std::unique_ptr<PyObject, detail::PyDecrefDeleter>; Safe_PyObjectPtr make_safe(PyObject* o); } // namespace tensorflow #endif // TENSORFLOW_PYTHON_LIB_CORE_SAFE_PYOBJECT_PTR_H_
C
4
EricRemmerswaal/tensorflow
tensorflow/python/lib/core/safe_pyobject_ptr.h
[ "Apache-2.0" ]
xinetd_conf=Inställningsfil för Xinetd,0 protocols_file=Nätverksprotokollsfil,0 pid_file=Sökväg till PID-fil för Xinetd,0 start_cmd=Kommando för att starta xinetd,0
SystemVerilog
2
GalaxyGFX/webmin
xinetd/config.info.sv
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
sleep 6 t app appmode photo_pes t app pes_settings 1 t app button shutter PR sleep 300 t app button shutter PR # sleep 6 t app appmode photo_pes t app pes_settings 5 t app button shutter PR sleep 1200 t app button shutter PR sleep 6 t app appmode photo_pes t app pes_settings 10 t app button shutter PR sleep 2400 t app button shutter PR sleep 6 t app appmode photo_pes t app pes_settings 30 t app button shutter PR sleep 9000 t app button shutter PR
AGS Script
1
waltersgrey/autoexechack
WarpLapse/autoexec.ash
[ "MIT" ]
\\ Copyright (c) 2019 Bruno Deferrari. \\ BSD 3-Clause License: http://opensource.org/licenses/BSD-3-Clause (define power N 1 -> N N Power -> (* N (power N (- Power 1)))) (set *benchmarks* []) (define add-benchmark Tag Description F RunsPower -> (do (set *benchmarks* [[Tag Description F RunsPower] | (value *benchmarks*)]) done)) (define run-benchmark Report [Tag Description F RunsPower] -> (let _ (Report begin [Tag Description RunsPower]) Runs (power 10 RunsPower) Start (get-time run) Result (F Runs) End (get-time run) _ (Report finish [Tag Description RunsPower Start End]) done)) (define stoutput-report setup _ -> skip cleanup _ -> skip begin [_ Description RunsPower] -> (output "Measuring 10^~S runs of: ~A~%" RunsPower Description) finish [_ _ _ Start End] -> (output " run time: ~S secs~%" (- End Start))) (define save-report setup _ -> (set *benchmark-results* []) cleanup _ -> skip begin _ -> skip finish Data -> (set *benchmark-results* [Data | (value *benchmark-results*)])) (define run-all-benchmarks Report -> (let Benchmarks (reverse (value *benchmarks*)) Setup (Report setup Benchmarks) Results (map (run-benchmark Report) Benchmarks) Cleanup (Report cleanup Benchmarks) done)) \\(set _scm.*factorize-patterns* false) (set *hush* true) \\(set shen-cl.*factorise-patterns* false) \\(load "benchmarks/data.shen") \\(load "benchmarks/control-flow.shen") \\(load "benchmarks/shen-compilation.shen") (load "benchmarks/pattern-matching.shen") \\(load "benchmarks/equality-check.shen") (set *hush* false) (if (bound? *argv*) (run-all-benchmarks (function stoutput-report)) skip)
Shen
4
vishalbelsare/shen-sources
benchmarks/benchmarks.shen
[ "BSD-3-Clause" ]
Nokia515.2/2.0 (10.34) Profile/MIDP-2.1 Configuration/CLDC-1.1 Nokia515.2/2.0 (05.08) Profile/MIDP-2.1 Configuration/CLDC-1.1 Nokia515/2.0 (05.09) Profile/MIDP-2.1 Configuration/CLDC-1.1 Nokia515.2/2.0 (05.10) Profile/MIDP-2.1 Configuration/CLDC-1.1 Nokia515/2.0 (10.34) Profile/MIDP-2.1 Configuration/CLDC-1.1 Nokia515/2.0 (07.01) Profile/MIDP-2.1 Configuration/CLDC-1.1 Mozilla/5.0 (Series40; Nokia515/07.01; Profile/MIDP-2.1 Configuration/CLDC-1.1) Gecko/20100401 S40OviBrowser/5.5.0.0.27 Mozilla/5.0 (Series40; Nokia515.2/05.08; Profile/MIDP-2.1 Configuration/CLDC-1.1) Gecko/20100401 S40OviBrowser/5.0.0.0.31
Text
1
5tr1x/SecLists
Fuzzing/User-Agents/operating-platform/nokia-515.txt
[ "MIT" ]
BITS 64 mov rbp, [rsp + 0x28] add rbp, 0x10 ; rsi = argv[0] (stage1_arr) mov rax, [rbp] ; esi = stage1_arr.length mov esi, [rax + 0x18] mov edi, 0 mov edx, 7 mov ecx, 0x1802 mov r8d, -1 mov r9, 0 push rbx push rcx push rbp push r10 push r12 push r13 push r14 push r15 mov eax, 20000C5h mov r10, rcx syscall pop r15 pop r14 pop r13 pop r12 pop r10 pop rbp pop rcx pop rbx push rax mov rdi, rax ; rsi = argv[0] (stage1_arr) mov rax, [rbp] ; ecx = stage1_arr.length mov ecx, [rax + 0x18] ; rsi = stage1_arr.vector mov rsi, [rax + 0x10] cld rep movsb ret
Assembly
3
OsmanDere/metasploit-framework
external/source/exploits/CVE-2020-9850/payload/stage0.asm
[ "BSD-2-Clause", "BSD-3-Clause" ]
# typed: false # frozen_string_literal: true require "requirements/arch_requirement" describe ArchRequirement do subject(:requirement) { described_class.new([Hardware::CPU.type]) } describe "#satisfied?" do it "supports architecture symbols" do expect(requirement).to be_satisfied end end end
Ruby
4
ylht/brew
Library/Homebrew/test/requirements/arch_requirement_spec.rb
[ "BSD-2-Clause" ]
#!/usr/bin/env bash set -euo pipefail main() { cd "$(dirname "$0")/../.." source ./ci/lib.sh # npm view won't exit with non-zero so we have to check the output. local hasVersion hasVersion=$(npm view "code-server@$VERSION" version) if [[ $hasVersion == "$VERSION" ]]; then echo "$VERSION is already published" return fi if [[ ${CI-} ]]; then echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc fi download_artifact npm-package ./release-npm-package # https://github.com/actions/upload-artifact/issues/38 tar -xzf release-npm-package/package.tar.gz # Ignore symlink when publishing npm package # See: https://github.com/cdr/code-server/pull/3935 echo "node_modules.asar" > release/.npmignore yarn publish --non-interactive release } main "$@"
Shell
4
mia-cx/code-server-npm
ci/steps/publish-npm.sh
[ "MIT" ]
server { listen 80 default_server; listen [::]:80 default_server; root /var/www/public; index index.php; client_max_body_size 20m; server_name server_domain_or_IP; if (!-e $request_filename) { rewrite ^/(.*)$ /index.php?/$1 last; break; } location / { try_files $uri $uri/ =404; } location ~ \.php$ { try_files $uri =404; include fastcgi_params; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass php:9000; } location ~ /\.ht { deny all; } }
ApacheConf
3
dhtmdgkr123/MyInfra
nginx/sites/default.vhost
[ "MIT" ]
111 0 -1 1 0 2 0 3 -1 4 3 5 3 6 -1 7 6 8 6 9 -1 10 9 11 9 12 -1 13 12 14 12 15 -1 16 15 17 15 18 -1 19 18 20 18 21 -1 22 21 23 21 24 -1 25 24 26 24 27 -1 28 27 29 27 30 -1 31 30 32 30 33 -1 34 33 35 33 36 -1 37 36 38 36 39 -1 40 39 41 39 42 -1 43 42 44 42 45 -1 46 45 47 45 48 -1 49 48 50 48 51 -1 52 51 53 51 54 -1 55 54 56 54 57 -1 58 57 59 57 60 -1 61 60 62 60 63 -1 64 63 65 63 66 -1 67 66 68 66 69 -1 70 69 71 69 72 -1 73 72 74 72 75 -1 76 75 77 75 78 -1 79 78 80 78 81 -1 82 81 83 81 84 -1 85 84 86 84 87 -1 88 87 89 87 90 -1 91 90 92 90 93 -1 94 93 95 93 96 -1 97 96 98 96 99 -1 100 99 101 99 102 -1 103 102 104 102 105 -1 106 105 107 105 108 -1 109 108 110 108
IDL
2
ricortiz/OpenTissue
demos/data/dlm/111/dep.dlm
[ "Zlib" ]
${model.nameUniqueResult}
Java Server Pages
0
woozhijun/cat
cat-home/src/main/webapp/jsp/system/appConfig/appNameCheck.jsp
[ "Apache-2.0" ]
<?Lassoscript // Last modified 4/2/08 by ECL, Landmann InterActive /* Tagdocs; {Tagname= LI_CleanSlug } {Description= Cleans the input to make it suitable for use as an URL slug. } {Author= Eric Landmann } {AuthorEmail= support@iterate.ws } {ModifiedBy= } {ModifiedByEmail= } {Date= 4/2/08 } {Usage= LI_CleanSlug: -NodeName=$URLSlug } {ExpectedResults= Input: ¿Por qué es esta código? Output: por que es esta codigo } {Dependencies= A number of tags from the Lasso Pro library: lp_string_extendedtoplain lp_string_CP1252toUTF8.lasso lp_logical_in.lasso lp_logical_between.lasso lp_string_zap.lasso } {DevelNotes= Strips question marks, periods, commas, quotes, dashes, exclam, percent, dollar. Converts UTF8 characters to plain ASCII. } {ChangeNotes= 4/2/08 First implementation } /Tagdocs; */ // Define the namespace Var:'svCTNamespace' = 'LI_'; If: !(Lasso_TagExists:'CleanSlug'); Define_Tag: 'CleanSlug', -Required='NodeName', -Priority='replace', -Description='Cleans the input to make it suitable for use as an URL slug', -namespace=$svCTNamespace; Local('Result') = null; // Process the Headline to produce the URLSlug #Result = (String_LowerCase:(lp_string_extendedtoplain: #NodeName)); // Strip question marks, periods, commas, quotes, dashes, exclam, percent, dollar #Result = (String_Replace: #Result, -Find='?', -Replace=' '); #Result = (String_Replace: #Result, -Find='.', -Replace=' '); #Result = (String_Replace: #Result, -Find=',', -Replace=' '); #Result = (String_Replace: #Result, -Find='"', -Replace=' '); #Result = (String_Replace: #Result, -Find='\'', -Replace=' '); #Result = (String_Replace: #Result, -Find='-', -Replace=' '); #Result = (String_Replace: #Result, -Find='!', -Replace=' '); #Result = (String_Replace: #Result, -Find='%', -Replace=' '); #Result = (String_Replace: #Result, -Find='$', -Replace=' '); // Compress multiple spaces down to one #Result = (String_ReplaceRegExp:#Result, -Find='\\s+', -Replace=' '); #Result->Trim; Return: (Encode_Smart:(#Result)); /Define_Tag; Log_Critical: 'Custom Tag Loaded - LI_CleanSlug'; /If; ?>
Lasso
4
subethaedit/SubEthaEd
Documentation/ModeDevelopment/Reference Files/LassoScript-HTML/itpage/LassoStartup/LI_CleanSlug.lasso
[ "MIT" ]
""" i as long = [1, 2, 3].IndexOf({ item as int | return (item > 2) }) """ i as long = [1, 2, 3].IndexOf({ item as int | return (item > 2) })
Boo
2
popcatalin81/boo
tests/testcases/parser/wsa/declarations-3.boo
[ "BSD-3-Clause" ]
--- APPLY_FIXES: none DISABLE: - ACTION - BASH - COPYPASTE - DOCKERFILE - GO - JAVASCRIPT - SPELL DISABLE_LINTERS: - YAML_YAMLLINT - MARKDOWN_MARKDOWN_TABLE_FORMATTER - MARKDOWN_MARKDOWN_LINK_CHECK FILTER_REGEX_EXCLUDE: .*testdata/* MARKDOWN_MARKDOWNLINT_CONFIG_FILE: .markdownlint.yml PARALLEL: false PRINT_ALPACA: false
YAML
1
RolandXu-Intel/act
.mega-linter.yml
[ "MIT" ]
var x := "Test"
Grace
0
Dmitri-2/GraceWebsite
js-simple/tests/t025_controlchar_fail_test.grace
[ "MIT", "BSD-3-Clause" ]
// Imports @import '../../styles/styles.sass' // Block .v-simple-checkbox align-self: center line-height: normal position: relative user-select: none .v-icon cursor: pointer // Modifiers .v-simple-checkbox--disabled cursor: default
Sass
3
VBeytok/vuetify
packages/vuetify/src/components/VCheckbox/VSimpleCheckbox.sass
[ "MIT" ]
"""Tests for the Airthings integration."""
Python
0
MrDelik/core
tests/components/airthings/__init__.py
[ "Apache-2.0" ]
// run-pass fn f() -> isize { mod m { pub fn g() -> isize { 720 } } m::g() } pub fn main() { assert_eq!(f(), 720); }
Rust
4
Eric-Arellano/rust
src/test/ui/modules/mod-inside-fn.rs
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
/home/spinalvm/hdl/riscv-compliance/work//C.AND.elf: file format elf32-littleriscv Disassembly of section .text.init: 80000000 <_start>: 80000000: 0001 nop 80000002: 0001 nop 80000004: 0001 nop 80000006: 0001 nop 80000008: 0001 nop 8000000a: 0001 nop 8000000c: 0001 nop 8000000e: 0001 nop 80000010: 0001 nop 80000012: 0001 nop 80000014: 0001 nop 80000016: 0001 nop 80000018: 0001 nop 8000001a: 0001 nop 8000001c: 0001 nop 8000001e: 0001 nop 80000020: 0001 nop 80000022: 0001 nop 80000024: 0001 nop 80000026: 0001 nop 80000028: 0001 nop 8000002a: 0001 nop 8000002c: 0001 nop 8000002e: 0001 nop 80000030: 0001 nop 80000032: 0001 nop 80000034: 0001 nop 80000036: 0001 nop 80000038: 0001 nop 8000003a: 0001 nop 8000003c: 0001 nop 8000003e: 0001 nop 80000040: 0001 nop 80000042: 0001 nop 80000044: 0001 nop 80000046: 0001 nop 80000048: 0001 nop 8000004a: 0001 nop 8000004c: 0001 nop 8000004e: 0001 nop 80000050: 0001 nop 80000052: 0001 nop 80000054: 0001 nop 80000056: 0001 nop 80000058: 0001 nop 8000005a: 0001 nop 8000005c: 0001 nop 8000005e: 0001 nop 80000060: 0001 nop 80000062: 0001 nop 80000064: 0001 nop 80000066: 0001 nop 80000068: 0001 nop 8000006a: 0001 nop 8000006c: 0001 nop 8000006e: 0001 nop 80000070: 0001 nop 80000072: 0001 nop 80000074: 0001 nop 80000076: 0001 nop 80000078: 0001 nop 8000007a: 0001 nop 8000007c: 0001 nop 8000007e: 0001 nop 80000080: 0001 nop 80000082: 0001 nop 80000084: 0001 nop 80000086: 0001 nop 80000088: 0001 nop 8000008a: 0001 nop 8000008c: 0001 nop 8000008e: 0001 nop 80000090: 0001 nop 80000092: 0001 nop 80000094: 0001 nop 80000096: 0001 nop 80000098: 0001 nop 8000009a: 0001 nop 8000009c: 0001 nop 8000009e: 0001 nop 800000a0: 0001 nop 800000a2: 0001 nop 800000a4: 0001 nop 800000a6: 0001 nop 800000a8: 0001 nop 800000aa: 0001 nop 800000ac: 0001 nop 800000ae: 0001 nop 800000b0: 0001 nop 800000b2: 0001 nop 800000b4: 0001 nop 800000b6: 0001 nop 800000b8: 0001 nop 800000ba: 0001 nop 800000bc: 0001 nop 800000be: 0001 nop 800000c0: 0001 nop 800000c2: 0001 nop 800000c4: 0001 nop 800000c6: 0001 nop 800000c8: 0001 nop 800000ca: 0001 nop 800000cc: 0001 nop 800000ce: 0001 nop 800000d0: 0001 nop 800000d2: 0001 nop 800000d4: 0001 nop 800000d6: 0001 nop 800000d8: 0001 nop 800000da: 0001 nop 800000dc: 0001 nop 800000de: 0001 nop 800000e0: 0001 nop 800000e2: 0001 nop 800000e4: 0001 nop 800000e6: 0001 nop 800000e8: 0001 nop 800000ea: 0001 nop 800000ec: 0001 nop 800000ee: 00001117 auipc sp,0x1 800000f2: f1210113 addi sp,sp,-238 # 80001000 <codasip_signature_start> 800000f6: 4581 li a1,0 800000f8: 4481 li s1,0 800000fa: 8ced and s1,s1,a1 800000fc: c026 sw s1,0(sp) 800000fe: 4681 li a3,0 80000100: 4605 li a2,1 80000102: 8e75 and a2,a2,a3 80000104: c232 sw a2,4(sp) 80000106: 4781 li a5,0 80000108: fff00713 li a4,-1 8000010c: 8f7d and a4,a4,a5 8000010e: c43a sw a4,8(sp) 80000110: 4481 li s1,0 80000112: 00008437 lui s0,0x8 80000116: fff40413 addi s0,s0,-1 # 7fff <_start-0x7fff8001> 8000011a: 8c65 and s0,s0,s1 8000011c: c622 sw s0,12(sp) 8000011e: 4601 li a2,0 80000120: 65a1 lui a1,0x8 80000122: 8df1 and a1,a1,a2 80000124: c82e sw a1,16(sp) 80000126: 00001117 auipc sp,0x1 8000012a: eee10113 addi sp,sp,-274 # 80001014 <test_2_res> 8000012e: 4705 li a4,1 80000130: 4681 li a3,0 80000132: 8ef9 and a3,a3,a4 80000134: c036 sw a3,0(sp) 80000136: 4405 li s0,1 80000138: 4785 li a5,1 8000013a: 8fe1 and a5,a5,s0 8000013c: c23e sw a5,4(sp) 8000013e: 4585 li a1,1 80000140: fff00493 li s1,-1 80000144: 8ced and s1,s1,a1 80000146: c426 sw s1,8(sp) 80000148: 4685 li a3,1 8000014a: 00008637 lui a2,0x8 8000014e: fff60613 addi a2,a2,-1 # 7fff <_start-0x7fff8001> 80000152: 8e75 and a2,a2,a3 80000154: c632 sw a2,12(sp) 80000156: 4785 li a5,1 80000158: 6721 lui a4,0x8 8000015a: 8f7d and a4,a4,a5 8000015c: c83a sw a4,16(sp) 8000015e: 00001117 auipc sp,0x1 80000162: eca10113 addi sp,sp,-310 # 80001028 <test_3_res> 80000166: fff00493 li s1,-1 8000016a: 4401 li s0,0 8000016c: 8c65 and s0,s0,s1 8000016e: c022 sw s0,0(sp) 80000170: fff00613 li a2,-1 80000174: 4585 li a1,1 80000176: 8df1 and a1,a1,a2 80000178: c22e sw a1,4(sp) 8000017a: fff00713 li a4,-1 8000017e: fff00693 li a3,-1 80000182: 8ef9 and a3,a3,a4 80000184: c436 sw a3,8(sp) 80000186: fff00413 li s0,-1 8000018a: 000087b7 lui a5,0x8 8000018e: fff78793 addi a5,a5,-1 # 7fff <_start-0x7fff8001> 80000192: 8fe1 and a5,a5,s0 80000194: c63e sw a5,12(sp) 80000196: fff00593 li a1,-1 8000019a: 64a1 lui s1,0x8 8000019c: 8ced and s1,s1,a1 8000019e: c826 sw s1,16(sp) 800001a0: 00001117 auipc sp,0x1 800001a4: e9c10113 addi sp,sp,-356 # 8000103c <test_4_res> 800001a8: 000086b7 lui a3,0x8 800001ac: fff68693 addi a3,a3,-1 # 7fff <_start-0x7fff8001> 800001b0: 4601 li a2,0 800001b2: 8e75 and a2,a2,a3 800001b4: c032 sw a2,0(sp) 800001b6: 000087b7 lui a5,0x8 800001ba: fff78793 addi a5,a5,-1 # 7fff <_start-0x7fff8001> 800001be: 4705 li a4,1 800001c0: 8f7d and a4,a4,a5 800001c2: c23a sw a4,4(sp) 800001c4: 000084b7 lui s1,0x8 800001c8: fff48493 addi s1,s1,-1 # 7fff <_start-0x7fff8001> 800001cc: fff00413 li s0,-1 800001d0: 8c65 and s0,s0,s1 800001d2: c422 sw s0,8(sp) 800001d4: 00008637 lui a2,0x8 800001d8: fff60613 addi a2,a2,-1 # 7fff <_start-0x7fff8001> 800001dc: 000085b7 lui a1,0x8 800001e0: fff58593 addi a1,a1,-1 # 7fff <_start-0x7fff8001> 800001e4: 8df1 and a1,a1,a2 800001e6: c62e sw a1,12(sp) 800001e8: 00008737 lui a4,0x8 800001ec: fff70713 addi a4,a4,-1 # 7fff <_start-0x7fff8001> 800001f0: 66a1 lui a3,0x8 800001f2: 8ef9 and a3,a3,a4 800001f4: c836 sw a3,16(sp) 800001f6: 00001117 auipc sp,0x1 800001fa: e5a10113 addi sp,sp,-422 # 80001050 <test_5_res> 800001fe: 6421 lui s0,0x8 80000200: 4781 li a5,0 80000202: 8fe1 and a5,a5,s0 80000204: c03e sw a5,0(sp) 80000206: 65a1 lui a1,0x8 80000208: 4485 li s1,1 8000020a: 8ced and s1,s1,a1 8000020c: c226 sw s1,4(sp) 8000020e: 66a1 lui a3,0x8 80000210: fff00613 li a2,-1 80000214: 8e75 and a2,a2,a3 80000216: c432 sw a2,8(sp) 80000218: 67a1 lui a5,0x8 8000021a: 00008737 lui a4,0x8 8000021e: fff70713 addi a4,a4,-1 # 7fff <_start-0x7fff8001> 80000222: 8f7d and a4,a4,a5 80000224: c63a sw a4,12(sp) 80000226: 64a1 lui s1,0x8 80000228: 6421 lui s0,0x8 8000022a: 8c65 and s0,s0,s1 8000022c: c822 sw s0,16(sp) 8000022e: 00001517 auipc a0,0x1 80000232: dd250513 addi a0,a0,-558 # 80001000 <codasip_signature_start> 80000236: 00001597 auipc a1,0x1 8000023a: e3a58593 addi a1,a1,-454 # 80001070 <_end> 8000023e: f0100637 lui a2,0xf0100 80000242: f2c60613 addi a2,a2,-212 # f00fff2c <_end+0x700feebc> 80000246 <complience_halt_loop>: 80000246: 00b50c63 beq a0,a1,8000025e <complience_halt_break> 8000024a: 4554 lw a3,12(a0) 8000024c: c214 sw a3,0(a2) 8000024e: 4514 lw a3,8(a0) 80000250: c214 sw a3,0(a2) 80000252: 4154 lw a3,4(a0) 80000254: c214 sw a3,0(a2) 80000256: 4114 lw a3,0(a0) 80000258: c214 sw a3,0(a2) 8000025a: 0541 addi a0,a0,16 8000025c: b7ed j 80000246 <complience_halt_loop> 8000025e <complience_halt_break>: 8000025e: f0100537 lui a0,0xf0100 80000262: f2050513 addi a0,a0,-224 # f00fff20 <_end+0x700feeb0> 80000266: 00052023 sw zero,0(a0) ... Disassembly of section .data: 80001000 <codasip_signature_start>: 80001000: ffff 0xffff 80001002: ffff 0xffff 80001004: ffff 0xffff 80001006: ffff 0xffff 80001008: ffff 0xffff 8000100a: ffff 0xffff 8000100c: ffff 0xffff 8000100e: ffff 0xffff 80001010: ffff 0xffff 80001012: ffff 0xffff 80001014 <test_2_res>: 80001014: ffff 0xffff 80001016: ffff 0xffff 80001018: ffff 0xffff 8000101a: ffff 0xffff 8000101c: ffff 0xffff 8000101e: ffff 0xffff 80001020: ffff 0xffff 80001022: ffff 0xffff 80001024: ffff 0xffff 80001026: ffff 0xffff 80001028 <test_3_res>: 80001028: ffff 0xffff 8000102a: ffff 0xffff 8000102c: ffff 0xffff 8000102e: ffff 0xffff 80001030: ffff 0xffff 80001032: ffff 0xffff 80001034: ffff 0xffff 80001036: ffff 0xffff 80001038: ffff 0xffff 8000103a: ffff 0xffff 8000103c <test_4_res>: 8000103c: ffff 0xffff 8000103e: ffff 0xffff 80001040: ffff 0xffff 80001042: ffff 0xffff 80001044: ffff 0xffff 80001046: ffff 0xffff 80001048: ffff 0xffff 8000104a: ffff 0xffff 8000104c: ffff 0xffff 8000104e: ffff 0xffff 80001050 <test_5_res>: 80001050: ffff 0xffff 80001052: ffff 0xffff 80001054: ffff 0xffff 80001056: ffff 0xffff 80001058: ffff 0xffff 8000105a: ffff 0xffff 8000105c: ffff 0xffff 8000105e: ffff 0xffff 80001060: ffff 0xffff 80001062: ffff 0xffff ...
ObjDump
2
cbrune/VexRiscv
src/test/resources/asm/C.AND.elf.objdump
[ "MIT" ]
(test (= (len (let _ Env/this)) 1)) (let (e (let (foo 1) (use _ do let) Env/this)) (test (= e/foo 1)) (e/do (let bar 2)) (test (= e/bar 2)) (let ee (let _ (use e foo)) (test (= ee/foo 1)))) (let (foo (let (bar 7) (fun resolve (key) 42) Env/this)) (test (= foo/bar 7)) (test (= foo/baz 42))) (let (foo (let (bar 42) Env/this) baz (let _ (use foo bar) Env/this)) (test (= baz/bar 42))) (let (super Env/this Counter (fun ((n 0)) (fun inc ((d 1)) (super/inc n d)) Env/this) c (Counter)) (for 3 (c/inc)) (test (= (c/inc -1) 2))) (let (key _ val _) (fun foo (x y)) (fun set-foo (f k..) (set key k val (f _))) (set (foo 'bar 'baz) 42) (test (= key '(bar baz))) (test (= val 42))) (let (proxy (fun (d) (fun resolve (key) (d/val key)) Env/this) p (proxy (let (foo 42) (use _ val) Env/this))) (test (= p/foo 42))) (let (bar 1 qux 4) (env foo (bar 2 baz 3) (use _ do)) (test (= (vec foo/bar foo/baz) '(2 3))) (foo/do (test (= (vec bar baz qux) '(2 3 4))))) (let _ (fun pub () 42) (env sec _ (use _ eval pub)) (test (= (sec/eval '(pub)) 42))) (let _ (let Widget (let _ (fun new (args..) (let left 0 top 0 width (or (pop-key args 'width) (fail "Missing width")) height (or (pop-key args 'height) (fail "Missing height"))) (fun move (dx dy) (vec (inc left dx) (inc top dy))) (fun resize (dx dy) (vec (inc width dx) (inc height dy))) Env/this) Env/this)) (let Button (let _ (fun new (args..) (let w (Widget/new args..) click-event ()) (use w move) (fun click () (for (click-event f) (f Env/this))) (fun on-click (f) (push click-event f)) (fun resize (dx dy) (w/resize (min (+ w/width dx) (- 200 w/width)) (min (+ w/height dy) (- 100 w/height)))) Env/this) Env/this)) (let b (Button/new 'width 100 'height 50)) (test (= (b/move 10 10) '(10 10))) (test (= (b/resize 400 200) '(200 100))) (let (called F) (b/on-click (fun (b) (set called T))) (test (not called)) (b/click) (test called)) )
Grammatical Framework
5
daota2/fffff
v1/test/env.gf
[ "MIT" ]
class GioProg { public static int main(string[] args) { var homedir = File.new_for_path(Environment.get_home_dir()); stdout.printf("Home directory as told by gio is " + homedir.get_path() + "\n"); return 0; } }
Vala
3
kira78/meson
test cases/vala/3 dep/gioprog.vala
[ "Apache-2.0" ]
.q-parallax position: relative width: 100% overflow: hidden border-radius: inherit .q-parallax__media > img, > video position: absolute left: 50% #{"/* rtl:ignore */"} bottom: 0 min-width: 100% min-height: 100% will-change: transform display: none
Sass
3
ygyg70/quasar
ui/src/components/parallax/QParallax.sass
[ "MIT" ]
#!/usr/bin/env Rscript library(reticulate) # call Python library use_python("/opt/python3.7/bin/python") np <- import("numpy") paddle <- import("paddle.fluid.core") set_config <- function() { config <- paddle$AnalysisConfig("") config$set_model("data/model/__model__", "data/model/__params__") config$switch_use_feed_fetch_ops(FALSE) config$switch_specify_input_names(TRUE) config$enable_profile() return(config) } zero_copy_run_mobilenet <- function() { data <- np$loadtxt("data/data.txt") data <- data[0:(length(data) - 4)] result <- np$loadtxt("data/result.txt") result <- result[0:(length(result) - 4)] config <- set_config() predictor <- paddle$create_paddle_predictor(config) input_names <- predictor$get_input_names() input_tensor <- predictor$get_input_tensor(input_names[1]) input_data <- np_array(data, dtype="float32")$reshape(as.integer(c(1, 3, 300, 300))) input_tensor$copy_from_cpu(input_data) predictor$zero_copy_run() output_names <- predictor$get_output_names() output_tensor <- predictor$get_output_tensor(output_names[1]) output_data <- output_tensor$copy_to_cpu() output_data <- np_array(output_data)$reshape(as.integer(-1)) #all.equal(output_data, result) } if (!interactive()) { zero_copy_run_mobilenet() }
R
5
zmxdream/Paddle
r/example/mobilenet.r
[ "Apache-2.0" ]
'reach 0.1'; export const main = Reach.App( {}, [Participant('A', {})], (A) => { const f = (a = 1, b) => a + b; assert(f(2, 3) == 5); });
RenderScript
3
chikeabuah/reach-lang
hs/t/n/Err_Default_Arg_Position.rsh
[ "Apache-2.0" ]
current continuation! () = cont () = continuation (nil, cont) continuation (nil, cont) n = 0 cont = current continuation! console.log (n) ++n if (n < 10) cont ()
PogoScript
3
featurist/pogoscript
examples/continuations.pogo
[ "BSD-2-Clause" ]
// These tests check for regex ambiguities var qrt = (\dur:1); var eth = (\dur:1/2); SkoarTestRunner(( // i'm not sure how to test this stuff. forte: [ "forte", [()] ], ));
SuperCollider
2
sofakid/Skoarcery
SuperCollider/Testing/regex.scd
[ "Artistic-2.0" ]
label ccc3012b: "……何してるんだか知らないが。" "ヘタにつつくのは利口じゃないしな。" "それより今の寒気を喚起せし存在が、気になる。" "家の中に……エイリアンでもいるのだろうか。" 太一 "「ふふふ……」" "俺は火炎放射器の一つさえも持っていない、ひ弱な現代ボウイだ。" "エイリアンに出くわしても、抗しうる武器などない。" "だが!" "構えを取る。" "武器はいらない。" "拳だけ、あればいい。" 太一 "「ついに実戦で用いる時が来たか」" "カラデ道は、長きに渡って耐え難きを耐えてきた。" "空手の亜種としてのそしり·中傷·訴訟。" "幾人もの戦友が、道を離れていった。" "だが人類が地球から根絶されようとしている今、ついに本懐の刻は訪れたのだ!" 太一 "「拳が、啼いてる」" "格闘ものっぽいセリフを独白しつつ、階下に向かう。" call gl(0,"bgcc0004c") call vsp(0,1) with wipeleft "いない。" "あの濃密な殺意。" "ただ者ではない。" "トイレ……にはいない。" "浴槽……にはいない。" 太一 "「……ふむ」" call gl(0,"bgcc0000d") call vsp(0,1) with wipeleft "一階の物置部屋……いない。" "睦美さんの寝室……いない。" "あ、ホコリが積もってる。" "……あとで掃除しておこう。" "ごめんなさい睦美さん。" "一礼して退出。" "あとは、どこだろう。" "一つ、探していない部屋があった。" 太一 "「まさか」" "二階に戻る。" "俺の部屋……の隣。" "おねえちゃん部屋。" "ノブに手をかける。" "入るのは久しぶりだった。" "曜子ちゃんが、家を出ていって以来になる。" "ゆっくりと扉を開く。" "室内に飛び込むと同時に、演舞!" 太一 "「ハッ、セヤッ、ティリャアッ!!」" "ホコリが舞う。" 太一 "「…………」" "誰もいない。" 太一 "「何をやってるんだ……」" "俺は照れた。" "部屋を出る。" "ホコリの中で暴れたせいか、喉が渇いた。" call gl(0,"bgcc0004c") call vsp(0,1) with wipeleft stop bgm extend "リビングに戻って汲み置きの水を飲も桜庭がトマトを食っていた。" "※新技術リアルタイムモノローグ使用中" 太一 "「チェリャアァァァァッ!!」" play se "SE003" with vpunch voice "vmCCC3012bsku000" 桜庭 "「ごふっ」" "桜庭は倒れてもトマトを離さなかった。" play bgm "bgm/bgm006.ogg" 太一 "「何をしている」" call gl(1,"TCSH0003c|tcsh") call gp(1,t=center)#x=190 call vsp(1,1) with dissolve voice "vmCCC3012bsku001" 桜庭 "「聞いてくれ」" 太一 "「なんだ?」" voice "vmCCC3012bsku002" 桜庭 "「カレーパンに飽きてきた」" 太一 "「……あのな」" voice "vmCCC3012bsku003" 桜庭 "「そこでおまえの家に来てみたら、トマトがあるじゃないか」" 太一 "「だからどうしてうちに来る」" call gl(1,"TCSH0000c|tcsh") call vsp(1,1) with dissolve voice "vmCCC3012bsku004" 桜庭 "「友貴に食料はいらないと言ってしまった」" 太一 "「な、なぜだ?」" call gl(1,"TCSH0002c|tcsh") call vsp(1,1) with dissolve voice "vmCCC3012bsku005" 桜庭 "「カレーパンがあったからだ」" "その場限りの人生だな。" call gl(1,"TCSH0000c|tcsh") call vsp(1,1) with dissolve voice "vmCCC3012bsku006" 桜庭 "「そういうわけで、今日から厄介になる」" 太一 "「ホワイ!?」" call gl(1,"TCSH0003c|tcsh") call vsp(1,1) with dissolve voice "vmCCC3012bsku007" 桜庭 "「以上の理由をもちまして、本日より桜庭浩は黒須太一の家に住まうことになった」" 太一 "「誰が言葉の意味がわからんと言ったか! スペペッ!」" call gl(1,"TCSH0000c|tcsh") call vsp(1,1) with dissolve voice "vmCCC3012bsku008" 桜庭 "「部屋を貸してくれ」" "こいつ……こいつ!" "狂っている。" "狂えるほどに正常に狂っている!" 太一 "「ほ、ほぉ……あの広い屋敷を出てここに住むと?」" call gl(1,"TCSH0002c|tcsh") call vsp(1,1) with dissolve voice "vmCCC3012bsku009" 桜庭 "「ああ。広いが食い物がない」" 太一 "「いいだろう」" "おぼっちゃまである桜庭に道理を説いても仕方がない。" 太一 "「部屋に案内してくれようではないか」" call gl(1,"TCSH0000c|tcsh") call vsp(1,1) with dissolve voice "vmCCC3012bsku010" 桜庭 "「頼む」" call gl(0,"bgcc0013b") call vsp(0,1) call vsp(1,0) with wipeleft "便所に案内した。" 太一 "「ここがおまえの部屋だ」" call gl(1,"TCSH0000c|tcsh") call vsp(1,1) with dissolve voice "vmCCC3012bsku011" 桜庭 "「狭いな」" 太一 "「八畳間だからな」" 太一 "「庶民の家なんてこんなもんだ」" 太一 "「おまえの部屋は広いだろう? やっぱり自宅がいいんじゃないのか?」" voice "vmCCC3012bsku012" 桜庭 "「広いといっても16畳らしいから、ここの倍程度だ」" 太一 "「16畳っ!?」" "なんつう部屋に住んでやがる!" call gl(1,"TCSH0002c|tcsh") call vsp(1,1) with dissolve voice "vmCCC3012bsku013" 桜庭 "「感覚的には倍以上なんだが……存外、オレの部屋も狭いらしい」" 太一 "「気づけよ」" "こいつは霊長類じゃないのかもしれん。" call gl(1,"TCSH0000c|tcsh") call vsp(1,1) with dissolve voice "vmCCC3012bsku014" 桜庭 "「12歳の誕生日に、ダディが一番日当たりのいい部屋をくれたのさ」" "ダディッ!" "こいつの家はぜったいオカシイ……と改めて確信する俺だった。" 太一 "「なあ……貴様、小遣いはいくらなんだ?」" "無意識に代名詞を切り替えて問う。" "ちなみに俺は甲斐性ある睦美さんのおかげで、月二万円をもらっている。" "食費別。" "なかなかの水準だ。" "誇らしげな気持ちになる。" "その気になれば、近年価格高騰中のヒットユニ○ン社製レアもの廃盤ブルマー667-N(型番)を毎月一枚ずつ買えちゃうんだぜ!" "そんなフェティッシュなライフを保証された学生は、決して多くない。" call gl(1,"TCSH0002c|tcsh") call vsp(1,1) with dissolve voice "vmCCC3012bsku015" 桜庭 "「そんなにもらってない」" "いかに桜庭と言えども。" call gl(1,"TCSH0000c|tcsh") call vsp(1,1) with dissolve voice "vmCCC3012bsku016" 桜庭 "「50万だ」" 太一 "「ボッシュート!」" "俺は回転しながらくずおれた。" 太一 "「リ、リアリー?」" voice "vmCCC3012bsku017" 桜庭 "「イエス」" 太一 "「どこの芸能人の息子だ貴様は!」" voice "vmCCC3012bsku018" 桜庭 "「なぜ怒る」" call gl(1,"TCSH0003c|tcsh") call vsp(1,1) with dissolve voice "vmCCC3012bsku019" 桜庭 "「第一、オレは芸能人じゃない」" call gl(1,"TCSH0002c|tcsh") call vsp(1,1) with dissolve voice "vmCCC3012bsku020" 桜庭 "「オレはオレだ」" 太一 "「そーいうセリフは、自分の存在意義に悩んだ末の壮大な自己肯定とともに吐け」" "50万だと。" "常軌を逸している。" "待てよ。" 太一 "「……なあ、家賃として前金で500万よこせと言ったらどうする」" "桜庭は首を振る。" call gl(1,"TCSH0000c|tcsh") call vsp(1,1) with dissolve voice "vmCCC3012bsku021" 桜庭 "「そんなに持ち合わせはない」" 太一 "「……じゃあ、今持ってる金をくれと言ったら?」" voice "vmCCC3012bsku022" 桜庭 "「小銭しかないぞ?」" 太一 "「ああ」" "財布を取り出す。" "受け取る。" "なるほど、確かに小銭だ。" "チャリチャリ音がする。" "ほっとした。" "嫉妬の炎が静まる。" 太一 "「はは、おぼっちゃまも貧乏な時があるようだな」" "桜庭は穏やかに笑った。" voice "vmCCC3012bsku023" 桜庭 "「まあな。金持ちと言っても、そんなもんさ」" voice "vmCCC3012bsku024" 桜庭 "「庶民の家の部屋が、こんなもんであるのと同じくな」" 太一 "「ははは」" voice "vmCCC3012bsku025" 桜庭 "「ハハッ」" "笑い合う。" "ガッ、と腕を交差させた。" "友情が深まった。" 太一 "「それに今さら金なんてもらっても、意味ないよな」" voice "vmCCC3012bsku026" 桜庭 "「確かに」" 太一 "「そういや、おまえには小銭を何度か貸したよな」" voice "vmCCC3012bsku027" 桜庭 "「じゃあそれで返済だ」" 太一 "「意味ねー」" voice "vmCCC3012bsku028" 桜庭 "「借りたものは返す」" 太一 "「律儀なやつめ。けどまあ記念に返されておくか」" "せせらぎの如く笑いあう。" "財布を開く。" "案の定、紙幣は入ってなかった。" "十万円金貨が十五枚入っていた。" 太一 "「ミスター円!!」" "卒倒。" voice "vmCCC3012bsku029" 桜庭 "「どうした?」" 太一 "「ひぃぃぃぃぃぃぃぃぃぃぃぃぃぃぃっっっ」" "芋虫のようにのたうちまわった。" "なにこのサイフっ!" "こんなスッゴイの初めて!!" "よく見たら十万円金貨だけではなかった。" "昭和天皇ご在位60年10万円金貨×8" "天皇ご即位記念10万円金貨×7" "皇太子殿下御成婚記念5万円金貨×2" "国際花と緑の博覧会5千円貨×4" "皇太子ご成婚5千円銀貨×3" "それだけしかない。" 太一 "「アホか!」" voice "vmCCC3012bsku030" 桜庭 "「なかなか買い物に使えなかった」" 太一 "「当たり前だ!」" "こいつ……こんなにあっさり大金を……。" "まさか桜庭の中では……十万円は大金ではない……ではない……ではない……?(エコー)" 太一 "「はっ?」" "人類滅亡前、まだ金が意味のある時代に一度でもせびっていたら。" 太一 "「おうおうおうおう!」" voice "vmCCC3012bsku031" 桜庭 "「なぜ泣く?」" 太一 "「おおおおおぉぉぉぉっ!」" "神はいじわるであらせられる!" "後悔しまくりの俺だった。" 太一 "「もういい……寝てくれ……」" voice "vmCCC3012bsku032" 桜庭 "「ああ、世話になる」" "桜庭は便所にこもった。" call vsp(1,0) 太一 "「……はあ」" "疲れた。" "まあヤツのことだ。" "一晩で忘れてまたどこかに行くに違いない。" "放浪癖があるからな。" call gl(0,"bgcc0004c") call vsp(0,1) with wipeleft "トマトは食い荒らされていた。" "一つ残っていたのを食べる。夜食にはちょうどいい。" stop bgm "背後に気配。" 太一 "「……桜庭か? もう出て行く気になったか?」" voice "vfCCC3012byou000" 曜子 "「太一……」" 太一 "「曜子ちゃん?」" call gl(1,"TCHY0000c|tchy000x") call gp(1,t=center)#x=180 call vsp(1,1) with Dissolve(500.0/1000.0) "リビングに立っていた。" 太一 "「どしたの、こんな時間に」" "こっちの家には入らないよう言ってあったのに。" play bgm "bgm/bgm020.ogg" voice "vfCCC3012byou001" 曜子 "「太一」" "雰囲気が違う。" 太一 "「どうした、の?」" "曜子ちゃんは……まるで……あの時の彼女みたいだ……。" call gl(5,"evcc0063") call vsp(5,1) with dissolve hide pic5 with dissolve voice "vfCCC3012byou002" 曜子 "「……太一……」" "近寄ってくる。" 太一 "「ちょ……と……?」" "下がる。" voice "vfCCC3012byou003" 曜子 "「太一っ」" "抱きついてきた。" 太一 "「……っ」" voice "vfCCC3012byou004" 曜子 "「太一……」" "わけがわからない。" 太一 "「どう、したのさ」" "だが彼女はすぐに身を離す。" voice "vfCCC3012byou005" 曜子 "「……口元に、トマトのかけら」" 太一 "「え?」" hide pic1 with dissolve "彼女の頭部が、俺に合わさってきた。" "唇の端を、舌がかすめた。" "そしてそのまま、唇に……。" 太一 "「ちょっと」" "到達する前に、両肩を抱いて引きはがす。" voice "vfCCC3012byou006" 曜子 "「……太一っ……太一ぃ……」" "珍しい。" "こんな不安定になって。" "下腹部が熱で波打つ。" "いつもは強い彼女の、弱い部分に反応して。" 太一 "「ダメだ!」" call gl(1,"TCHY0001c|tchy000x") call gp(1,t=center)#x=180 call vsp(1,1) with Dissolve(500.0/1000.0) voice "vfCCC3012byou007" 曜子 "「でも」" 太一 "「……この家では、しないって決めたろ」" 太一 "「睦美さんとの約束だったはずだ」" 太一 "「俺は約束は守る」" 太一 "「キミにも、守ってもらう」" call gl(1,"TCHY0000c|tchy000x") call vsp(1,1) with dissolve voice "vfCCC3012byou008" 曜子 "「睦美はもういない」" 太一 "「約束はまだある!」" "声をあらげて叫ぶ。" 太一 "「俺の心の中に、まだあるんだ」" 曜子 "「…………」" 太一 "「この約束が消えたかどうかは、俺が決める」" 太一 "「キミとは他人である、俺が自分の意志と責任で決める」" voice "vfCCC3012byou010" 曜子 "「また……そんなことを言う……」" voice "vfCCC3012byou011" 曜子 "「いじわるな太一」" 太一 "「出ていってくれるかな」" 太一 "「キミはこの家に入ってきたらいけない」" 太一 "「……俺なんかに慰められたらいけないよ」" 曜子 "「……」" "無言で。" "曜子ちゃんは出ていく。" "一度立ち止まり、俺の顔を見る。" "表情の乏しいマスクはすべらかで、落胆も失意も張りつかない。" "それでも俺には、彼女がひどく疲れているように見えて、不思議だった。" 太一 "「おやすみ」" voice "vfCCC3012byou013" 曜子 "「……おやすみ、太一」" voice "vfCCC3012byou014" 曜子 "「愛してる」" hide pic1 with dissolve "消える。" "俺は追いつめられたままの姿勢で、冷蔵庫に背を当てたまま、ずるずると床にうずくまった。" 太一 "「なんだってんだ」" stop bgm return #
Ren'Py
2
fossabot/cross-channel_chinese-localization_project
AllPlatforms/scripts/ccc/ccc3012b.rpy
[ "Apache-2.0" ]
main = asText (qsort [3,9,1,8,5,4,7]) qsort lst = case lst of x:xs -> qsort (filter ((>=)x) xs) ++ [x] ++ qsort (filter ((<)x) xs) [] -> [] {--------------------- QuickSort works as follows: - Choose a pivot element which be placed in the "middle" of the sorted list. In our case we are choosing the first element as the pivot. - Gather all of the elements less than the pivot (the first filter). We know that these must come before our pivot element in the sorted list. Note: ((>=)x) === (\y -> (>=) x y) === (\y -> x >= y) - Gather all of the elements greater than the pivot (the second filter). We know that these must come after our pivot element in the sorted list. - Run `qsort` on the lesser elements, producing a sorted list that contains only elements less than the pivot. Put these before the pivot. - Run `qsort` on the greater elements, producing a sorted list. Put these after the pivot. Note that choosing a bad pivot can have bad effects. Take a sorted list with N elements. The pivot will always be the lowest member, meaning that it does not divide the list very evenly. The list of lessers has 0 elements and the list of greaters has N-1 elemens. This means qsort will be called N times, each call looking through the entire list. This means, in the worst case, QuickSort will make N^2 comparisons. ----------------------}
Elm
5
JavascriptID/sourcerer-app
src/test/resources/samples/langs/Elm/QuickSort.elm
[ "MIT" ]
- dashboard: ga4_campaign_impact title: "[GA4] Campaign Impact" layout: newspaper preferred_viewer: dashboards-next elements: - title: Users saw the campaign page name: Users saw the campaign page model: ga4 explore: sessions type: single_value fields: [sessions.total_users, user_segment.segment_users, user_segment.retention_rate] filters: events.event_param_page: '' limit: 500 custom_color_enabled: true show_single_value_title: true show_comparison: false comparison_type: value comparison_reverse_colors: false show_comparison_label: true enable_conditional_formatting: true conditional_formatting_include_totals: false conditional_formatting_include_nulls: false conditional_formatting: [{type: not null, value: !!null '', background_color: "#1A73E8", font_color: !!null '', color_application: {collection_id: 7c56cc21-66e4-41c9-81ce-a60e1c3967b2, palette_id: 56d0c358-10a0-4fd6-aa0b-b117bef527ab}, bold: false, italic: false, strikethrough: false, fields: !!null ''}] x_axis_gridlines: false y_axis_gridlines: true show_view_names: false show_y_axis_labels: true show_y_axis_ticks: true y_axis_tick_density: default y_axis_tick_density_custom: 5 show_x_axis_label: true show_x_axis_ticks: true y_axis_scale_mode: linear x_axis_reversed: false y_axis_reversed: false plot_size_by_field: false trellis: '' stacking: '' limit_displayed_rows: false legend_position: center point_style: none show_value_labels: false label_density: 25 x_axis_scale: auto y_axis_combined: true ordering: none show_null_labels: false show_totals_labels: false show_silhouette: false totals_color: "#808080" defaults_version: 1 series_types: {} hidden_fields: [user_segment.segment_users, user_segment.retention_rate] listen: Audience Selector: sessions.audience_selector Campaign Date: sessions.session_date User Return Date: user_segment.user_segment_timeframe Page: sessions.landing_page row: 5 col: 0 width: 12 height: 4 - title: Users Returned name: Users Returned model: ga4 explore: sessions type: single_value fields: [sessions.total_users, user_segment.segment_users, user_segment.retention_rate] filters: events.event_param_page: '' limit: 500 custom_color_enabled: true show_single_value_title: true show_comparison: true comparison_type: value comparison_reverse_colors: false show_comparison_label: true enable_conditional_formatting: true conditional_formatting_include_totals: false conditional_formatting_include_nulls: false conditional_formatting: [{type: not null, value: !!null '', background_color: "#1A73E8", font_color: !!null '', color_application: {collection_id: 7c56cc21-66e4-41c9-81ce-a60e1c3967b2, palette_id: 56d0c358-10a0-4fd6-aa0b-b117bef527ab}, bold: false, italic: false, strikethrough: false, fields: !!null ''}] x_axis_gridlines: false y_axis_gridlines: true show_view_names: false show_y_axis_labels: true show_y_axis_ticks: true y_axis_tick_density: default y_axis_tick_density_custom: 5 show_x_axis_label: true show_x_axis_ticks: true y_axis_scale_mode: linear x_axis_reversed: false y_axis_reversed: false plot_size_by_field: false trellis: '' stacking: '' limit_displayed_rows: false legend_position: center point_style: none show_value_labels: false label_density: 25 x_axis_scale: auto y_axis_combined: true ordering: none show_null_labels: false show_totals_labels: false show_silhouette: false totals_color: "#808080" defaults_version: 1 series_types: {} hidden_fields: [sessions.total_users] listen: Audience Selector: sessions.audience_selector Campaign Date: sessions.session_date User Return Date: user_segment.user_segment_timeframe Page: sessions.landing_page row: 5 col: 12 width: 12 height: 4 - title: Retained User Transaction Conversion Rate name: Retained User Transaction Conversion Rate model: ga4 explore: sessions type: single_value fields: [events.transaction_conversion_rate, user_segment.segment_transaction_conversion_rate] filters: events.event_param_page: '' limit: 500 dynamic_fields: [{_kind_hint: measure, table_calculation: change, _type_hint: number, category: table_calculation, expression: "${user_segment.segment_transaction_conversion_rate}-${events.transaction_conversion_rate}", label: Change, value_format: !!null '', value_format_name: percent_1}] custom_color_enabled: true show_single_value_title: true show_comparison: true comparison_type: change comparison_reverse_colors: false show_comparison_label: true enable_conditional_formatting: true conditional_formatting_include_totals: false conditional_formatting_include_nulls: false comparison_label: conversion rate driven by campaign conditional_formatting: [{type: not null, value: !!null '', background_color: "#EA4335", font_color: !!null '', color_application: {collection_id: 7c56cc21-66e4-41c9-81ce-a60e1c3967b2, palette_id: 56d0c358-10a0-4fd6-aa0b-b117bef527ab}, bold: false, italic: false, strikethrough: false, fields: !!null ''}] x_axis_gridlines: false y_axis_gridlines: true show_view_names: false show_y_axis_labels: true show_y_axis_ticks: true y_axis_tick_density: default y_axis_tick_density_custom: 5 show_x_axis_label: true show_x_axis_ticks: true y_axis_scale_mode: linear x_axis_reversed: false y_axis_reversed: false plot_size_by_field: false trellis: '' stacking: '' limit_displayed_rows: false legend_position: center point_style: none show_value_labels: false label_density: 25 x_axis_scale: auto y_axis_combined: true ordering: none show_null_labels: false show_totals_labels: false show_silhouette: false totals_color: "#808080" defaults_version: 1 series_types: {} hidden_fields: [events.transaction_conversion_rate] listen: Audience Selector: sessions.audience_selector Campaign Date: sessions.session_date User Return Date: user_segment.user_segment_timeframe Page: sessions.landing_page row: 9 col: 12 width: 12 height: 4 - title: Transaction Conversion Rate name: Transaction Conversion Rate model: ga4 explore: sessions type: single_value fields: [events.transaction_conversion_rate, user_segment.segment_transaction_conversion_rate] filters: events.event_param_page: '' limit: 500 dynamic_fields: [{_kind_hint: measure, table_calculation: change, _type_hint: number, category: table_calculation, expression: "${user_segment.segment_transaction_conversion_rate}-${events.transaction_conversion_rate}", label: Change, value_format: !!null '', value_format_name: percent_1}] custom_color_enabled: true show_single_value_title: true show_comparison: false comparison_type: change comparison_reverse_colors: false show_comparison_label: true enable_conditional_formatting: true conditional_formatting_include_totals: false conditional_formatting_include_nulls: false comparison_label: conversion rate driven by campaign conditional_formatting: [{type: not null, value: !!null '', background_color: "#EA4335", font_color: !!null '', color_application: {collection_id: 7c56cc21-66e4-41c9-81ce-a60e1c3967b2, palette_id: 56d0c358-10a0-4fd6-aa0b-b117bef527ab}, bold: false, italic: false, strikethrough: false, fields: !!null ''}] x_axis_gridlines: false y_axis_gridlines: true show_view_names: false show_y_axis_labels: true show_y_axis_ticks: true y_axis_tick_density: default y_axis_tick_density_custom: 5 show_x_axis_label: true show_x_axis_ticks: true y_axis_scale_mode: linear x_axis_reversed: false y_axis_reversed: false plot_size_by_field: false trellis: '' stacking: '' limit_displayed_rows: false legend_position: center point_style: none show_value_labels: false label_density: 25 x_axis_scale: auto y_axis_combined: true ordering: none show_null_labels: false show_totals_labels: false show_silhouette: false totals_color: "#808080" defaults_version: 1 series_types: {} hidden_fields: [user_segment.segment_transaction_conversion_rate, change] listen: Audience Selector: sessions.audience_selector Campaign Date: sessions.session_date User Return Date: user_segment.user_segment_timeframe Page: sessions.landing_page row: 9 col: 0 width: 12 height: 4 - title: Revenue per User name: Revenue per User model: ga4 explore: sessions type: single_value fields: [events.transaction_revenue_per_user] filters: events.event_param_page: '' limit: 500 column_limit: 50 dynamic_fields: [{_kind_hint: measure, table_calculation: change, _type_hint: number, category: table_calculation, expression: "${user_segment.segment_transaction_revenue_per_user}/${events.transaction_revenue_per_user}-1", label: Change, value_format: !!null '', value_format_name: percent_0, is_disabled: true}] custom_color_enabled: true show_single_value_title: true show_comparison: false comparison_type: value comparison_reverse_colors: false show_comparison_label: true enable_conditional_formatting: true conditional_formatting_include_totals: false conditional_formatting_include_nulls: false custom_color: "#ffffff" conditional_formatting: [{type: not null, value: !!null '', background_color: "#F9AB00", font_color: "#ffffff", color_application: {collection_id: 7c56cc21-66e4-41c9-81ce-a60e1c3967b2, palette_id: 56d0c358-10a0-4fd6-aa0b-b117bef527ab}, bold: false, italic: false, strikethrough: false, fields: !!null ''}] x_axis_gridlines: false y_axis_gridlines: true show_view_names: false show_y_axis_labels: true show_y_axis_ticks: true y_axis_tick_density: default y_axis_tick_density_custom: 5 show_x_axis_label: true show_x_axis_ticks: true y_axis_scale_mode: linear x_axis_reversed: false y_axis_reversed: false plot_size_by_field: false trellis: '' stacking: '' limit_displayed_rows: false legend_position: center point_style: none show_value_labels: false label_density: 25 x_axis_scale: auto y_axis_combined: true ordering: none show_null_labels: false show_totals_labels: false show_silhouette: false totals_color: "#808080" defaults_version: 1 series_types: {} hidden_fields: [] y_axes: [] listen: Audience Selector: sessions.audience_selector Campaign Date: sessions.session_date User Return Date: user_segment.user_segment_timeframe Page: sessions.landing_page row: 13 col: 0 width: 12 height: 4 - title: Revenue per Retained User name: Revenue per Retained User model: ga4 explore: sessions type: single_value fields: [user_segment.segment_transaction_revenue_per_user, events.transaction_revenue_per_user] filters: events.event_param_page: '' limit: 500 column_limit: 50 dynamic_fields: [{category: table_calculation, expression: "${user_segment.segment_transaction_revenue_per_user}/${events.transaction_revenue_per_user}-1", label: Change, value_format: !!null '', value_format_name: percent_0, _kind_hint: measure, table_calculation: change, _type_hint: number}] custom_color_enabled: true show_single_value_title: true show_comparison: true comparison_type: change comparison_reverse_colors: false show_comparison_label: true enable_conditional_formatting: true conditional_formatting_include_totals: false conditional_formatting_include_nulls: false custom_color: '' comparison_label: revenue per user driven by campaign conditional_formatting: [{type: not null, value: !!null '', background_color: "#F9AB00", font_color: "#ffffff", color_application: {collection_id: 7c56cc21-66e4-41c9-81ce-a60e1c3967b2, palette_id: 56d0c358-10a0-4fd6-aa0b-b117bef527ab}, bold: false, italic: false, strikethrough: false, fields: !!null ''}] x_axis_gridlines: false y_axis_gridlines: true show_view_names: false show_y_axis_labels: true show_y_axis_ticks: true y_axis_tick_density: default y_axis_tick_density_custom: 5 show_x_axis_label: true show_x_axis_ticks: true y_axis_scale_mode: linear x_axis_reversed: false y_axis_reversed: false plot_size_by_field: false trellis: '' stacking: '' limit_displayed_rows: false legend_position: center point_style: none show_value_labels: false label_density: 25 x_axis_scale: auto y_axis_combined: true ordering: none show_null_labels: false show_totals_labels: false show_silhouette: false totals_color: "#808080" defaults_version: 1 series_types: {} hidden_fields: [events.transactions_per_user, events.transaction_revenue_per_user] listen: Audience Selector: sessions.audience_selector Campaign Date: sessions.session_date User Return Date: user_segment.user_segment_timeframe Page: sessions.landing_page row: 13 col: 12 width: 12 height: 4 - title: Impact by Audience name: Impact by Audience model: ga4 explore: sessions type: looker_grid fields: [sessions.audience_trait, sessions.total_users, user_segment.segment_users, events.transaction_revenue_per_user, user_segment.segment_transaction_revenue_per_user, events.transaction_conversion_rate, user_segment.segment_transaction_conversion_rate] filters: events.event_param_page: '' sorts: [conversion_rate_change desc] limit: 500 column_limit: 50 dynamic_fields: [{_kind_hint: measure, table_calculation: retention_rate, _type_hint: number, category: table_calculation, expression: "${user_segment.segment_users}/${sessions.total_users}", label: Retention Rate, value_format: !!null '', value_format_name: percent_1}, {_kind_hint: measure, table_calculation: conversion_rate_change, _type_hint: number, category: table_calculation, expression: "${user_segment.segment_transaction_conversion_rate}-${events.transaction_conversion_rate}", label: Conversion Rate Change, value_format: !!null '', value_format_name: percent_1}, {category: table_calculation, expression: "(${user_segment.segment_transaction_revenue_per_user}/${events.transaction_revenue_per_user})\ \ -1", label: Rev per User Change, value_format: !!null '', value_format_name: percent_1, _kind_hint: measure, table_calculation: rev_per_user_change, _type_hint: number}] show_view_names: false show_row_numbers: true transpose: false truncate_text: true hide_totals: false hide_row_totals: false size_to_fit: true table_theme: white limit_displayed_rows: false enable_conditional_formatting: false header_text_alignment: left header_font_size: '12' rows_font_size: '14' conditional_formatting_include_totals: false conditional_formatting_include_nulls: false show_sql_query_menu_options: false column_order: ["$$$_row_numbers_$$$", sessions.audience_trait, retention_rate, events.transaction_revenue_per_user, user_segment.segment_transaction_revenue_per_user, rev_per_user_change, events.transaction_conversion_rate, user_segment.segment_transaction_conversion_rate, conversion_rate_change] show_totals: true show_row_totals: true series_labels: events.transactions_per_user: Transactions / User user_segment.segment_transaction_revenue_per_user: Revenue / Retained User user_segment.segment_transaction_conversion_rate: Retained User Conversion Rate events.transaction_conversion_rate: Conversion Rate rev_per_user_change: Δ conversion_rate_change: Δ events.transaction_revenue_per_user: Revenue / User series_cell_visualizations: events.transactions_per_user: is_active: false retention_rate: is_active: true conversion_rate_change: is_active: true rev_per_user_change: is_active: true header_background_color: "#7CB342" x_axis_gridlines: false y_axis_gridlines: true show_y_axis_labels: true show_y_axis_ticks: true y_axis_tick_density: default y_axis_tick_density_custom: 5 show_x_axis_label: true show_x_axis_ticks: true y_axis_scale_mode: linear x_axis_reversed: false y_axis_reversed: false plot_size_by_field: false trellis: '' stacking: '' legend_position: center point_style: none show_value_labels: false label_density: 25 x_axis_scale: auto y_axis_combined: true ordering: none show_null_labels: false show_totals_labels: false show_silhouette: false totals_color: "#808080" defaults_version: 1 series_types: {} hidden_fields: [sessions.total_users, user_segment.segment_users] listen: Audience Selector: sessions.audience_selector Campaign Date: sessions.session_date User Return Date: user_segment.user_segment_timeframe Page: sessions.landing_page row: 17 col: 0 width: 24 height: 8 - name: '' type: text title_text: '' subtitle_text: '' body_text: "<div style=\"text-align: center;\">\n\t<div>\n\t\t<h1 style=\"font-size:\ \ 28px;\">GA4 Campaign Impact</h1><h2 style=\"font-size: 16px;\"><b>Recommended\ \ Action</b><br>\n Select a <b>period</b> and <b>landing page</b> for a campaign\ \ you ran, and measure its <b>retention</b> and <b>upsell</b> impact. Observe\ \ which <b>audiences</b> are benefitting the most from this campaign to <b>better\ \ target in the future</b>.\n</h2></div>\n</div>" row: 0 col: 0 width: 24 height: 5 filters: - name: Campaign Date title: Campaign Date type: field_filter default_value: 30 day allow_multiple_values: true required: false ui_config: type: advanced display: inline options: [] model: ga4 explore: sessions listens_to_filters: [] field: sessions.session_date - name: User Return Date title: User Return Date type: field_filter default_value: 7 day allow_multiple_values: true required: false ui_config: type: advanced display: popover options: [] model: ga4 explore: sessions listens_to_filters: [] field: user_segment.user_segment_timeframe - name: Page title: Page type: field_filter default_value: "/" allow_multiple_values: true required: false ui_config: type: tag_list display: popover options: [] model: ga4 explore: sessions listens_to_filters: [] field: sessions.landing_page - name: Audience Selector title: Audience Selector type: field_filter default_value: Channel allow_multiple_values: true required: false ui_config: type: dropdown_menu display: inline options: [] model: ga4 explore: sessions listens_to_filters: [] field: sessions.audience_selector
LookML
3
bcmu/ga_four
dashboards/campaign_impact.dashboard.lookml
[ "MIT" ]
label ccd0015b: 太一 "「降伏します」" stop bgm voice "vfCCD0001kri022" 霧 "「動かないで下さい。撃ちますよ……って、え?」" 太一 "「降参です」" "壁に手をついて足を開けと言われる前に壁に手をついて足を開いた。" "降伏の姿勢だ。" voice "vfCCD0001mki030" 美希 "「よわぁ……」" play bgm "bgm/bgm010.ogg" voice "vfCCD0001kri023" 霧 "「……どうしよう、美希?」" voice "vfCCD0001mki031" 美希 "「えっと……どうしようって言われても……可哀相だよ」" voice "vfCCD0001kri024" 霧 "「全然可哀相じゃないよ、こんな人」" voice "vfCCD0001mki032" 美希 "「だって、霧ちん武器もって一方的すぎるよ。人に向けたらよくない……」" voice "vfCCD0001kri025" 霧 "「……だって」" voice "vfCCD0001mki033" 美希 "「やめよ、ね?」" voice "vfCCD0001kri026" 霧 "「……わかった」" "不承不承ではあったが。" 太一 "「手おろしていい?」" voice "vfCCD0001kri027" 霧 "「……どうぞ」" 太一 "「ふー、助かった、美希」" voice "vfCCD0001mki034" 美希 "「あ、いえ」" "ええ子だ。" menu: "さて、どっちかをうまくアレしないとな。" "霧": $B=1 "美希": $B=2 return #
Ren'Py
3
fossabot/cross-channel_chinese-localization_project
AllPlatforms/scripts/ccd/ccd0015b.rpy
[ "Apache-2.0" ]
#!/usr/bin/env sh for i in {1..499}; do cp 0.test.js $i.test.js done
Shell
4
laohubuzaijia/jest
benchmarks/test-file-overhead/prepare.sh
[ "MIT" ]
it("should answer typeof System correctly", () => { if(__SYSTEM__) { expect((typeof System)).toBe("object"); } else { expect((typeof System)).toBe("undefined"); } }); it("should answer typeof System.import correctly", () => { if(__SYSTEM__) { expect((typeof System.import)).toBe("function"); } else { expect(() => { typeof System.import; }).toThrowError(); } }); it("should be able to use System.import()", done => { try { System.import("./module").then(mod => { if(__SYSTEM__) { expect(mod).toEqual(nsObj({ default: "ok" })); done(); } else { done(new Error("System.import should not be parsed")); } }); } catch(e) { if(__SYSTEM__) { done(e); } else { done(); } } });
JavaScript
3
1shenxi/webpack
test/configCases/parsing/system.import/index.js
[ "MIT" ]
xof 0303txt 0032 Material __Color_A01_ { 0.0000;0.0000;0.0000;0.0000;; 5.0000; 0.0000;0.0000;0.0000;; 0.0000;0.0000;0.0000;; } Mesh mesh_0{ 3; 0.0000;0.0000;0.0000;, 0.0000;0.0000;0.0000;, 0.0000;0.0000;0.0000;; 1; 3;0,1,2;; MeshMaterialList { 1; 1; 0; { __Color_A01_ } } MeshTextureCoords { 3; 0.0000,0.0000; 0.0000,0.0000; 0.0000,0.0000; } MeshNormals { 1; -0.0000;1.0000;-0.0000;; 1; 3;0,0,0;; } }
Logos
2
rentheaxolotl/RayMMD-ren-version
ray.x
[ "MIT" ]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % This file is part of Logtalk <https://logtalk.org/> % Copyright (c) 2010, Paulo Moura % SPDX-License-Identifier: BSD-3-Clause % % Redistribution and use in source and binary forms, with or without % modification, are permitted provided that the following conditions are met: % % * Redistributions of source code must retain the above copyright notice, this % list of conditions and the following disclaimer. % % * Redistributions in binary form must reproduce the above copyright notice, % this list of conditions and the following disclaimer in the documentation % and/or other materials provided with the distribution. % % * Neither the name of the copyright holder nor the names of its % contributors may be used to endorse or promote products derived from % this software without specific prior written permission. % % THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" % AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE % IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE % DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE % FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL % DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR % SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER % CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, % OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE % OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% :- object(debug_expansion(_Mode), implements(expanding)). :- info([ version is 1:0:0, author is 'Paulo Moura', date is 2010-04-15, comment is 'Expands debug/1 calls. The parameter Mode can be either the atom "debug" or "production".', parnames is ['Mode'] ]). goal_expansion(debug(Goal), ExpandedGoal) :- parameter(1, Mode), ( Mode == debug -> ExpandedGoal = Goal ; ExpandedGoal = true ). :- end_object.
Logtalk
4
PaulBrownMagic/logtalk3
contributions/verdi_neruda/debug_expansion.lgt
[ "Apache-2.0" ]
"""The test for the Template sensor platform.""" from datetime import timedelta from unittest.mock import patch import pytest from homeassistant import config from homeassistant.components.template import DOMAIN from homeassistant.helpers.reload import SERVICE_RELOAD from homeassistant.setup import async_setup_component from homeassistant.util import dt as dt_util from tests.common import async_fire_time_changed, get_fixture_path @pytest.mark.parametrize("count,domain", [(1, "sensor")]) @pytest.mark.parametrize( "config", [ { "sensor": { "platform": DOMAIN, "sensors": { "state": { "value_template": "{{ states.sensor.test_sensor.state }}" }, }, }, "template": [ { "trigger": {"platform": "event", "event_type": "event_1"}, "sensor": { "name": "top level", "state": "{{ trigger.event.data.source }}", }, }, { "sensor": { "name": "top level state", "state": "{{ states.sensor.top_level.state }} + 2", }, "binary_sensor": { "name": "top level state", "state": "{{ states.sensor.top_level.state == 'init' }}", }, }, ], }, ], ) async def test_reloadable(hass, start_ha): """Test that we can reload.""" hass.states.async_set("sensor.test_sensor", "mytest") await hass.async_block_till_done() assert hass.states.get("sensor.top_level_state").state == "unknown + 2" assert hass.states.get("binary_sensor.top_level_state").state == "off" hass.bus.async_fire("event_1", {"source": "init"}) await hass.async_block_till_done() assert len(hass.states.async_all()) == 5 assert hass.states.get("sensor.state").state == "mytest" assert hass.states.get("sensor.top_level").state == "init" await hass.async_block_till_done() assert hass.states.get("sensor.top_level_state").state == "init + 2" assert hass.states.get("binary_sensor.top_level_state").state == "on" await async_yaml_patch_helper(hass, "sensor_configuration.yaml") assert len(hass.states.async_all()) == 4 hass.bus.async_fire("event_2", {"source": "reload"}) await hass.async_block_till_done() assert hass.states.get("sensor.state") is None assert hass.states.get("sensor.top_level") is None assert hass.states.get("sensor.watching_tv_in_master_bedroom").state == "off" assert float(hass.states.get("sensor.combined_sensor_energy_usage").state) == 0 assert hass.states.get("sensor.top_level_2").state == "reload" @pytest.mark.parametrize("count,domain", [(1, "sensor")]) @pytest.mark.parametrize( "config", [ { "sensor": { "platform": DOMAIN, "sensors": { "state": { "value_template": "{{ states.sensor.test_sensor.state }}" }, }, }, "template": { "trigger": {"platform": "event", "event_type": "event_1"}, "sensor": { "name": "top level", "state": "{{ trigger.event.data.source }}", }, }, }, ], ) async def test_reloadable_can_remove(hass, start_ha): """Test that we can reload and remove all template sensors.""" hass.states.async_set("sensor.test_sensor", "mytest") await hass.async_block_till_done() hass.bus.async_fire("event_1", {"source": "init"}) await hass.async_block_till_done() assert len(hass.states.async_all()) == 3 assert hass.states.get("sensor.state").state == "mytest" assert hass.states.get("sensor.top_level").state == "init" await async_yaml_patch_helper(hass, "empty_configuration.yaml") assert len(hass.states.async_all()) == 1 @pytest.mark.parametrize("count,domain", [(1, "sensor")]) @pytest.mark.parametrize( "config", [ { "sensor": { "platform": DOMAIN, "sensors": { "state": { "value_template": "{{ states.sensor.test_sensor.state }}" }, }, } }, ], ) async def test_reloadable_stops_on_invalid_config(hass, start_ha): """Test we stop the reload if configuration.yaml is completely broken.""" hass.states.async_set("sensor.test_sensor", "mytest") await hass.async_block_till_done() assert hass.states.get("sensor.state").state == "mytest" assert len(hass.states.async_all()) == 2 await async_yaml_patch_helper(hass, "configuration.yaml.corrupt") assert hass.states.get("sensor.state").state == "mytest" assert len(hass.states.async_all()) == 2 @pytest.mark.parametrize("count,domain", [(1, "sensor")]) @pytest.mark.parametrize( "config", [ { "sensor": { "platform": DOMAIN, "sensors": { "state": { "value_template": "{{ states.sensor.test_sensor.state }}" }, }, } }, ], ) async def test_reloadable_handles_partial_valid_config(hass, start_ha): """Test we can still setup valid sensors when configuration.yaml has a broken entry.""" hass.states.async_set("sensor.test_sensor", "mytest") await hass.async_block_till_done() assert hass.states.get("sensor.state").state == "mytest" assert len(hass.states.async_all("sensor")) == 2 await async_yaml_patch_helper(hass, "broken_configuration.yaml") assert len(hass.states.async_all("sensor")) == 3 assert hass.states.get("sensor.state") is None assert hass.states.get("sensor.watching_tv_in_master_bedroom").state == "off" assert float(hass.states.get("sensor.combined_sensor_energy_usage").state) == 0 @pytest.mark.parametrize("count,domain", [(1, "sensor")]) @pytest.mark.parametrize( "config", [ { "sensor": { "platform": DOMAIN, "sensors": { "state": { "value_template": "{{ states.sensor.test_sensor.state }}" }, }, } }, ], ) async def test_reloadable_multiple_platforms(hass, start_ha): """Test that we can reload.""" hass.states.async_set("sensor.test_sensor", "mytest") await async_setup_component( hass, "binary_sensor", { "binary_sensor": { "platform": DOMAIN, "sensors": { "state": { "value_template": "{{ states.sensor.test_sensor.state }}" }, }, } }, ) await hass.async_block_till_done() assert hass.states.get("sensor.state").state == "mytest" assert hass.states.get("binary_sensor.state").state == "off" assert len(hass.states.async_all()) == 3 await async_yaml_patch_helper(hass, "sensor_configuration.yaml") assert len(hass.states.async_all()) == 4 assert hass.states.get("sensor.state") is None assert hass.states.get("sensor.watching_tv_in_master_bedroom").state == "off" assert float(hass.states.get("sensor.combined_sensor_energy_usage").state) == 0 assert hass.states.get("sensor.top_level_2") is not None @pytest.mark.parametrize("count,domain", [(1, "sensor")]) @pytest.mark.parametrize( "config", [ { "sensor": { "platform": DOMAIN, "sensors": { "state": {"value_template": "{{ 1 }}"}, }, } }, ], ) async def test_reload_sensors_that_reference_other_template_sensors(hass, start_ha): """Test that we can reload sensor that reference other template sensors.""" await async_yaml_patch_helper(hass, "ref_configuration.yaml") assert len(hass.states.async_all()) == 3 await hass.async_block_till_done() next_time = dt_util.utcnow() + timedelta(seconds=1.2) with patch( "homeassistant.helpers.ratelimit.dt_util.utcnow", return_value=next_time ): async_fire_time_changed(hass, next_time) await hass.async_block_till_done() assert hass.states.get("sensor.test1").state == "3" assert hass.states.get("sensor.test2").state == "1" assert hass.states.get("sensor.test3").state == "2" async def async_yaml_patch_helper(hass, filename): """Help update configuration.yaml.""" yaml_path = get_fixture_path(filename, "template") with patch.object(config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( DOMAIN, SERVICE_RELOAD, {}, blocking=True, ) await hass.async_block_till_done()
Python
4
MrDelik/core
tests/components/template/test_init.py
[ "Apache-2.0" ]
CLASS zcl_abapgit_ui_injector DEFINITION PUBLIC CREATE PRIVATE . PUBLIC SECTION. CLASS-METHODS set_popups IMPORTING !ii_popups TYPE REF TO zif_abapgit_popups . CLASS-METHODS set_frontend_services IMPORTING !ii_fe_serv TYPE REF TO zif_abapgit_frontend_services . CLASS-METHODS set_gui_services IMPORTING !ii_gui_services TYPE REF TO zif_abapgit_gui_services . CLASS-METHODS get_dummy_gui_services RETURNING VALUE(ri_gui_services) TYPE REF TO zif_abapgit_gui_services . CLASS-METHODS set_html_viewer IMPORTING !ii_html_viewer TYPE REF TO zif_abapgit_html_viewer . CLASS-METHODS set_gui_jumper IMPORTING !ii_gui_jumper TYPE REF TO zif_abapgit_gui_jumper . PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcl_abapgit_ui_injector IMPLEMENTATION. METHOD get_dummy_gui_services. ri_gui_services = lcl_gui_services_dummy=>create( ). ENDMETHOD. METHOD set_frontend_services. zcl_abapgit_ui_factory=>gi_fe_services = ii_fe_serv. ENDMETHOD. METHOD set_gui_jumper. zcl_abapgit_ui_factory=>gi_gui_jumper = ii_gui_jumper. ENDMETHOD. METHOD set_gui_services. zcl_abapgit_ui_factory=>gi_gui_services = ii_gui_services. ENDMETHOD. METHOD set_html_viewer. zcl_abapgit_ui_factory=>gi_html_viewer = ii_html_viewer. ENDMETHOD. METHOD set_popups. zcl_abapgit_ui_factory=>gi_popups = ii_popups. ENDMETHOD. ENDCLASS.
ABAP
4
gepparta/abapGit
src/ui/zcl_abapgit_ui_injector.clas.abap
[ "MIT" ]
from testfixtures import LogCapture from twisted.internet import defer from scrapy.exceptions import StopDownload from tests.test_engine import ( AttrsItemsSpider, DataClassItemsSpider, DictItemsSpider, TestSpider, CrawlerRun, EngineTest, ) class HeadersReceivedCrawlerRun(CrawlerRun): def headers_received(self, headers, body_length, request, spider): super().headers_received(headers, body_length, request, spider) raise StopDownload(fail=False) class HeadersReceivedEngineTest(EngineTest): @defer.inlineCallbacks def test_crawler(self): for spider in (TestSpider, DictItemsSpider, AttrsItemsSpider, DataClassItemsSpider): if spider is None: continue self.run = HeadersReceivedCrawlerRun(spider) with LogCapture() as log: yield self.run.run() log.check_present(("scrapy.core.downloader.handlers.http11", "DEBUG", f"Download stopped for <GET http://localhost:{self.run.portno}/redirected> from" " signal handler HeadersReceivedCrawlerRun.headers_received")) log.check_present(("scrapy.core.downloader.handlers.http11", "DEBUG", f"Download stopped for <GET http://localhost:{self.run.portno}/> from signal" " handler HeadersReceivedCrawlerRun.headers_received")) log.check_present(("scrapy.core.downloader.handlers.http11", "DEBUG", f"Download stopped for <GET http://localhost:{self.run.portno}/numbers> from" " signal handler HeadersReceivedCrawlerRun.headers_received")) self._assert_visited_urls() self._assert_downloaded_responses(count=6) self._assert_signals_caught() self._assert_bytes_received() self._assert_headers_received() def _assert_bytes_received(self): self.assertEqual(0, len(self.run.bytes)) def _assert_visited_urls(self): must_be_visited = ["/", "/redirect", "/redirected"] urls_visited = {rp[0].url for rp in self.run.respplug} urls_expected = {self.run.geturl(p) for p in must_be_visited} assert urls_expected <= urls_visited, f"URLs not visited: {list(urls_expected - urls_visited)}"
Python
4
FingerCrunch/scrapy
tests/test_engine_stop_download_headers.py
[ "BSD-3-Clause" ]
// // Nocilla.h // Nocilla // // Created by Robert Böhnke on 26/03/15. // Copyright (c) 2015 Luis Solano Bonet. All rights reserved. // #import <Foundation/Foundation.h> //! Project version number for Nocilla. FOUNDATION_EXPORT double NocillaVersionNumber; //! Project version string for Nocilla. FOUNDATION_EXPORT const unsigned char NocillaVersionString[]; #import "LSHTTPBody.h" #import "LSMatcheable.h" #import "LSNocilla.h" #import "LSStubRequestDSL.h" #import "LSStubResponseDSL.h" #import "NSData+Matcheable.h" #import "NSData+Nocilla.h" #import "NSRegularExpression+Matcheable.h" #import "NSString+Matcheable.h" #import "NSString+Nocilla.h"
C
2
dongshuju/Kingfisher
Tests/Dependency/Nocilla/Nocilla/Nocilla.h
[ "MIT" ]
include: - validate-saltcheck.directory - validate-saltcheck.directory.level1 saltcheck-test-pass: test.succeed_without_changes: - name: testing-saltcheck
SaltStack
1
Noah-Huppert/salt
tests/integration/files/file/base/validate-saltcheck/init.sls
[ "Apache-2.0" ]
$$ MODE TUSCRIPT - epoch number=1 dayofweeknr=DATE (date,day,month,year,number) epoch=JOIN(year,"-",month,day) PRINT "epoch: ", epoch," (daynumber ",number,")" - today's daynumber dayofweeknr=DATE (today,day,month,year,number) date=JOIN (year,"-",month,day) PRINT "today's date: ", date," (daynumber ", number,")"
Turing
3
LaudateCorpus1/RosettaCodeData
Task/Show-the-epoch/TUSCRIPT/show-the-epoch.tu
[ "Info-ZIP" ]
package com.baeldung.websession.configuration; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.annotation.Configuration; import org.springframework.web.reactive.config.EnableWebFlux; import org.springframework.web.reactive.config.ResourceHandlerRegistry; import org.springframework.web.reactive.config.WebFluxConfigurer; @Configuration @EnableWebFlux public class WebFluxConfig implements ApplicationContextAware, WebFluxConfigurer { private ApplicationContext context; @Override public void setApplicationContext(ApplicationContext context) { this.context = context; } }
Java
4
DBatOWL/tutorials
spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxConfig.java
[ "MIT" ]
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.zuul.sample.filters.inbound import com.netflix.zuul.filters.http.HttpInboundFilter import com.netflix.zuul.message.http.HttpRequestMessage import com.netflix.zuul.sample.SampleService import org.slf4j.Logger import org.slf4j.LoggerFactory import rx.Observable import javax.inject.Inject /** * Sample Service Filter to demonstrate Guice injection of services and * making external requests to slow endpoints. * * Author: Arthur Gonigberg * Date: January 04, 2018 */ class SampleServiceFilter extends HttpInboundFilter { private static final Logger log = LoggerFactory.getLogger(SampleServiceFilter.class) private final SampleService sampleService @Inject SampleServiceFilter(SampleService sampleService) { this.sampleService = sampleService } @Override int filterOrder() { return 500 } @Override boolean shouldFilter(HttpRequestMessage msg) { return sampleService.isHealthy() } @Override Observable<HttpRequestMessage> applyAsync(HttpRequestMessage request) { return sampleService.makeSlowRequest().map({ response -> log.info("Fetched sample service result: {}", response) return request }) } }
Groovy
5
TomMD/zuul
zuul-sample/src/main/groovy/com/netflix/zuul/sample/filters/inbound/SampleServiceFilter.groovy
[ "Apache-2.0" ]
rm -f this-doesnt-exist ! redo this-doesnt-exist >/dev/null 2>&1 || exit 32 # expected to fail ! redo-ifchange this-doesnt-exist >/dev/null 2>&1 || exit 33 # expected to fail redo-ifcreate this-doesnt-exist >/dev/null 2>&1 || exit 34 # expected to pass rm -f fail ! redo-ifchange fail >/dev/null 2>&1 || exit 44 # expected to fail touch fail ../flush-cache # since we created this file by hand, fail.do won't run, so it won't fail. redo-ifchange fail >/dev/null 2>&1 || exit 55 # expected to pass # Make sure we don't leave this lying around for future runs, or redo # might mark it as "manually modified" (since we did!) rm -f fail rm -f maybe-fail : >want-fail ! redo-ifchange maybe-fail >/dev/null 2>&1 || exit 66 rm -f want-fail ../flush-cache redo-ifchange maybe-fail || exit 67 # failed last time, must retry : >want-fail ../flush-cache redo-ifchange maybe-fail || exit 68 # passed last time, no dep, no redo rm -f want-fail
Stata
3
BlameJohnny/redo
t/201-fail/all.do
[ "Apache-2.0" ]
<script> import { mapActions, mapMutations } from 'vuex' export default { created () { this.initPage() }, methods: { ...mapMutations('weather', { setLocation: 'SET_LOCATION' }), ...mapActions('weather', ['getWeather']), async initPage() { const location = await this.getLocation() this.setLocation({ location }) this.getWeather() }, async getLocation() { return await new Promise((resolve, reject) => { wx.getLocation({ success(location) { resolve(location) }, fail(err) { console.log(err) reject(err) } }) }) } } } </script> <style> .container { font-size: 26rpx; text-align: center; } .wrapper { font-size: 26rpx; text-align: left; } * { transition: width 2s; -moz-transition: width 2s; -webkit-transition: width 2s; -o-transition: width 2s; } /* font color */ * { color: #353535; } .gray { color: #808080; } .wxParse { text-indent: 2em; } .wxParse image { text-indent: 0; } .wxParse ._view { padding: 0 10rpx; text-indent: 0; } .wxParse .p { text-indent: 1em; } </style>
Vue
4
ye1088/uni-app
examples/uniapp-one/App.vue
[ "Apache-2.0" ]
"""Tests for the DLNA MediaServer integration."""
Python
0
MrDelik/core
tests/components/dlna_dms/__init__.py
[ "Apache-2.0" ]
#include-once #include <AutoItConstants.au3> #include <Color.au3> #include <ColorConstants.au3> #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <ProcessConstants.au3> #include <StringConstants.au3> #include <WindowsConstants.au3> #include "IsMgcNumPresent.au3" #AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 ; #INDEX# ======================================================================================================================= ; Title ............: Process UDF. ; AutoIt Version ...: 3.3.14.1 ; Description ......: UDF for AutoIt which contains useful functions which can be used to interact with processes in windows! ; Author(s) ........: Damon Harris (TheDcoder). ; This UDF Uses ....: PslatyDS's Code - https://www.autoitscript.com/forum/topic/98602-run-not-runwait-with-dos-exit-code/?do=findComment&comment=720326 ; Is Magic Number Present? - https://git.io/vPFjk ; Links ............: GitHub - https://github.com/TheDcoder/Process-UDF-for-AutoIt/ ; AutoIt Forum - https://www.autoitscript.com/forum/topic/174697-process-udf-get-both-the-output-the-exit-code ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ; _Process_RunCommand ; _Process_WaitUntil ; _Process_GetPID ; _Process_GetPath ; _Process_GetHandle ; _Process_CloseHandle ; _Process_GetExitCode ; _Process_DebugRunCommand ; =============================================================================================================================== ; #INTERNAL_USE_ONLY# =========================================================================================================== ; __Process_WM_SIZE ; =============================================================================================================================== ; #CONSTANTS# =================================================================================================================== Global Const $PROCESS_RUN = 2, $PROCESS_RUNWAIT = 4, $PROCESS_EXIST = 8, $PROCESS_NOTEXIST = 16, $PROCESS_DEBUG = 32 Global Const $PROCESS_COMMAND = @ComSpec & " /c " ; Use this in RunCommand function to run commands ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Process_RunCommand ; Description ...: Runs a command or a executable ; Syntax ........: _Process_RunCommand($iMode, $sExecutable [, $sWorkingDir = "" [, $iRunOptFlag = $STDERR_MERGED]]) ; Parameters ....: $iMode - Mode in which this function should operate, See Remarks. ; $sExecutable - The command to run/execute (along with any arguments). ; $sWorkingDir - [optional] The working directroy for the command. Default is "". ; $iRunOptFlag - [optional] The Opt flag for the Run function. Default is $STDERR_MERGED. ; Return values .: Success: Mode $PROCESS_RUN : Will return the process handle & @extended will contain the PID of the command ; Mode $PROCESS_RUNWAIT : Will return the output & @extended will contain the exit code for the function ; Failure: Will return False & @error will contain: ; 1 - If the $iMode flag is invalid ; 2 - If the command is invalid ; Author ........: TheDcoder ; Remarks .......: 1. The ONLY valid modes are: $PROCESS_RUN & $PROCESS_RUNWAIT ; $PROCESS_RUN : Will act similarly to Run function, See Return values ; $PROCESS_RUNWAIT : Will act similarly to RunWait function, See Return values ; If you use $PROCESS_RUN then use _Process_GetExitCode to get the exit code & use StdoutRead to get the output of the command ; 2. Use $PROCESS_COMMAND to run commands like this: $PROCESS_COMMAND & "ping 127.0.0.1" ; 3. Add $PROCESS_DEBUG to $iMode to automagically debug the command, $PROCESS_RUN is equivalent to $PROCESS_RUNWAIT in this case ; Related .......: Run, RunWait ; Example .......: Yes, see example.au3 ; ===============================================================================================================================; Functions Func _Process_RunCommand($iMode, $sExecutable, $sWorkingDir = "", $iRunOptFlag = $STDERR_MERGED) Local $iExitCode = 0 ; Declare the exit code variable before hand Local $sOutput = "" ; Declare the output variable before hand Local $bDebug = IsMgcNumPresent($PROCESS_DEBUG, $iMode) ; Check if $PROCESS_DEBUG is present. Select ; Select... Case IsMgcNumPresent($PROCESS_RUN, $iMode) ; If the mode is $PROCESS_RUN $iMode = $PROCESS_RUN Case IsMgcNumPresent($PROCESS_RUNWAIT, $iMode) ; If the mode is $PROCESS_RUNWAIT $iMode = $PROCESS_RUNWAIT Case Else Return SetError(1, 0, False) ; If the mode is invalid... EndSelect Local $iPID = Run($sExecutable, $sWorkingDir, @SW_HIDE, $iRunOptFlag) ; Run!!! :P If @error Then Return SetError(2, 0, False) ; If the command is invalid... Local $hProcessHandle = _Process_GetHandle($iPID) ; Get the handle of the process If $iMode = $PROCESS_RUN Then If Not $bDebug Then Return SetExtended($iPID, $hProcessHandle) ; If the function is in Run mode then return the PID & Process Handle $sOutput = _Process_DebugRunCommand($hProcessHandle, $iPID) ; Debug the process $iExitCode = _Process_GetExitCode($hProcessHandle) ; Note the exit code Return SetExtended($iExitCode, $sOutput) ; Return the output & exit code EndIf If Not $bDebug Then While ProcessExists($iPID) $sOutput &= StdoutRead($iPID) ; Capture the output Sleep(10) ; Don't kill the CPU WEnd $sOutput &= StdoutRead($iPID) ; Capture any remaining output $iExitCode = _Process_GetExitCode($hProcessHandle) ; Note the exit code Return SetExtended($iExitCode, $sOutput) ; Return the exit code & the output :D EndIf $sOutput = _Process_DebugRunCommand($hProcessHandle, $iPID) ; Debug the process $iExitCode = _Process_GetExitCode($hProcessHandle) ; Note the exit code Return SetExtended($iExitCode, $sOutput) ; Return the output & exit code EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Process_WaitUntil ; Description ...: Waits until a process starts or quits. Also returns the exit code... ; Syntax ........: _Process_WaitUntil($iMode, $vProcess [, $iUpdateInterval = 10]) ; Parameters ....: $iMode - Mode in which this function should operate, See Remarks. ; $vProcess - The PID or Name of the process, Same as ProcessExist's "process" parameter. ; $iUpdateInterval - [optional] The time (in milliseconds) to wait before performing another check. Default is 10. ; Return values .: Success: True and sets @extended to the exit code if the mode is $PROCESS_NOTEXIST ; Failure: False ; Special: 0(See Remarks) ; Author ........: TheDcoder ; Remarks .......: 1. There are only 2 valid modes: ; $PROCESS_EXIST : Waits until a process starts. ; $PROCESS_NOTEXIST : Waits until a process quits. ; 2. 0 is returned when unable to retrive the PID of the process when in $PROCESS_NOTEXIST as the mode, ; There is an good chance that the process has already quit before the function starts checking. ; Example .......: No ; =============================================================================================================================== Func _Process_WaitUntil($iMode, $vProcess, $iUpdateInterval = 10) If $iMode = $PROCESS_NOTEXIST And Not IsInt($vProcess) Then ; If it is in $PROCESS_NOTEXIST mode & not an PID $vProcess = _Process_GetPID($vProcess) ; Get the PID If @error Then Return 0 ; Return Immediatly EndIf Switch $iMode ; Switch to the required mode to opreate in. Case $PROCESS_EXIST While Not ProcessExists($vProcess) ; Wait for the process to start Sleep($iUpdateInterval) ; Some mercy on the CPU WEnd Return True ; Return True Case $PROCESS_NOTEXIST Local $hProcessHandle = _Process_GetHandle($vProcess) ; Get the process handle :) While ProcessExists($vProcess) ; Wait for the process to quit Sleep($iUpdateInterval) ; Some mercy on the CPU WEnd Return SetExtended(_Process_GetExitCode($hProcessHandle), True) ; Return True & set @extended to the exit code Case Else Return False EndSwitch EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Process_GetPID ; Description ...: Gets the PID of the process using the name of the process ; Syntax ........: _Process_GetPID($sProcess) ; Parameters ....: $sProcess - The name of the process. ; Return values .: Success: The PID of the process ; Failure: False & sets @error to non-zero ; Author ........: TheDcoder ; Remarks .......: If multiple processes exist then the most recent process's PID is returned. ; Example .......: No ; =============================================================================================================================== Func _Process_GetPID($sProcess) Local $aProcess = ProcessList($sProcess) ; List processes with that name If @error Or $aProcess[0][0] = 0 Then Return SetError(@error, False) ; Return False & set @error to non-zero if an error Return $aProcess[1][1] ; Return the PID EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Process_GetPath ; Description ...: Get the path of a process along with its arguments (if any) ; Syntax ........: _Process_GetPath($vProcess) ; Parameters ....: $vProcess - The PID or name of the process. ; Return values .: Success: The path of process with its arguments ; Failure: False & sets @error to 1 ; Author ........: TheDcoder ; Remarks .......: The return value is in this format: X:\Process.exe -Argument1 -ArgumentN... ; Example .......: No ; =============================================================================================================================== Func _Process_GetPath($vProcess) Local Const $eiCharsToTrim = 12 If Not IsInt($vProcess) Then $vProcess = _Process_GetPID($vProcess) ; Convert process name to PID Local $sCommandline = "wmic" ; Declare the commandline string $sCommandline &= ' process' $sCommandline &= ' where "' & "processid='" & $vProcess & "'" & '"' $sCommandline &= ' get commandline /format:list' Local $sOutput = _Process_RunCommand($PROCESS_RUNWAIT, $sCommandline) ; Run the command... ; Thanks to rojo for this command at stackowerflow: http://stackoverflow.com/a/32609300/3815591 $sOutput = StringStripWS($sOutput, $STR_STRIPLEADING + $STR_STRIPTRAILING) ; Remove whitespaces attached to the string If $sOutput = "No Instance(s) Available." Then Return SetError(1, 0, False) ; If process was not found... Local $sCommand = StringTrimLeft($sOutput, $eiCharsToTrim) ; Trim the Commandline= Return $sCommand ; Return EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Process_GetHandle ; Description ...: Gets the handle of a process, will be used later to retrive the exit code ; Syntax ........: _Process_GetHandle($vProcess) ; Parameters ....: $vProcess - The PID or name of the process. ; Return values .: Success: Process handle ; Failure: 0 & Sets @error to non-zero ; Author ........: PsaltyDS ; Modified ......: TheDcoder: Comments, "If...Else...EndIf" to "If...Then", Return value for failure & Name of the function ; Example .......: No ; =============================================================================================================================== Func _Process_GetHandle($vProcess) If Not IsInt($vProcess) Then $vProcess = _Process_GetPID($vProcess) ; Get the PID of the process if its not a PID ;) Local $avRET = DllCall("kernel32.dll", "ptr", "OpenProcess", "int", $PROCESS_QUERY_INFORMATION, "int", 0, "int", $vProcess) ; Get the process handle If @error Then Return SetError(1, 0, 0) ; If the process does not exists... Return $avRET[0] ; Return handle EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Process_CloseHandle ; Description ...: Closes the Process Handle of a process ; Syntax ........: _Process_CloseHandle($hProcessHandle) ; Parameters ....: $hProcessHandle - A Process Handle. ; Return values .: Success: True ; Failure: False & sets @error to non-zero ; Author ........: PsaltyDS ; Modified ......: TheDcoder: Comments, "If...Else...EndIf" to "If...Then", Return values & Name of the function ; Example .......: No ; =============================================================================================================================== Func _Process_CloseHandle($hProcessHandle) DllCall("kernel32.dll", "int", "CloseHandle", "ptr", $hProcessHandle) ; Close the handle If @error Then Return SetError(@error, 0, False) ; If invalid handle... Return True ; Return True if success EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Process_GetExitCode ; Description ...: Gets the exit code of a process ; Syntax ........: _Process_GetExitCode($hProcessHandle[, $bCloseHandle = True]) ; Parameters ....: $hProcessHandle - A Process Handle. ; $bCloseHandle - [optional] Do you want to close the $hProcessHandle?. Default is True. ; Return values .: Success: Exit Code ; Failure: Returns 0 & sets @error to non-zero ; Author ........: PsaltyDS ; Modified ......: TheDcoder: Comments & Name of the function ; Example .......: No ; =============================================================================================================================== Func _Process_GetExitCode($hProcessHandle, $bCloseHandle = True) Local $t_ExitCode = DllStructCreate("int") ; Its the container for the exit code DllCall("kernel32.dll", "int", "GetExitCodeProcess", "ptr", $hProcessHandle, "ptr", DllStructGetPtr($t_ExitCode)) ; Store the exit code in the container If @error Then Return SetError(1, 0, 0) ; If it is a invalid $hProcessHandle then return error If $bCloseHandle Then _Process_CloseHandle($hProcessHandle) ; Close the $hProcessHandle Return DllStructGetData($t_ExitCode, 1) ; Return exit code from the container EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Process_DebugRunCommand ; Description ...: Debugs a command in CMD style, see the example. ; Syntax ........: _Process_DebugRunCommand($hProcessHandle, $iPID[, $sGuiTitle = "Command Prompt Simulator"]) ; Parameters ....: $hProcessHandle - The Process Handle. ; $iPID - The PID of the Process. ; $sGuiTitle - [optional] The title of the Debug window. Default is "Command Prompt Simulator". ; Return values .: Success: Will return the output & @extended will contain the exit code for the function ; Failure: N/A ; Author ........: TheDcoder ; Modified ......: N/A ; Remarks .......: Make sure that the Process Handle & the PID are of the same process, otherwise you get the wrong exit code :P ; Example .......: Yes, see example.au3 ; =============================================================================================================================== Func _Process_DebugRunCommand($hProcessHandle, $iPID, $sGuiTitle = "Command Prompt Simulator") Local $aGrayCmdColor[3] = [197, 197, 197] ; CMD Text Color's combination in RGB Local Const $iGrayCmdColor = _ColorSetRGB($aGrayCmdColor) ; Get the RGB code of CMD Text Color Local $hGUI = GUICreate($sGuiTitle, 639, 299, -1, -1, $WS_OVERLAPPEDWINDOW) ; Create the GUI Local $idEdit = GUICtrlCreateEdit("", 0, 0, 639, 299, BitOR($WS_HSCROLL, $WS_VSCROLL, $ES_MULTILINE, $ES_READONLY, $ES_AUTOVSCROLL), 0) ; Create the Edit control :) Global $g__hEdit = GUICtrlGetHandle($idEdit) ; Get the edit control's handle GUICtrlSetBkColor($idEdit, $COLOR_BLACK) ; Set the background color GUICtrlSetColor($idEdit, $iGrayCmdColor) ; Set the text color GUICtrlSetFont($idEdit, 8, 0, 0, "Fixedsys") GUIRegisterMsg($WM_SIZE, "__Process_WM_SIZE") ; Register the resizing function GUISetState(@SW_SHOW, $hGUI) ; Reveal the GUI _GUICtrlEdit_AppendText($g__hEdit, "The Process: " & _Process_GetPath($iPID) & @CRLF) ; Append the process information Local $sOutput = "", $sPartialOutput = "" ; Declare the output variable While ProcessExists($iPID) ; Loop until the process finishes $sPartialOutput = StdoutRead($iPID) ; Record the output $sOutput &= $sPartialOutput _GUICtrlEdit_AppendText($g__hEdit, $sPartialOutput) ; Append the output Sleep(250) ; Don't kill the CPU WEnd $sPartialOutput = StdoutRead($iPID) ; Record the output $sOutput &= $sPartialOutput _GUICtrlEdit_AppendText($g__hEdit, $sPartialOutput) ; Append any remaining chunks of output Local $iExitCode = _Process_GetExitCode($hProcessHandle) _GUICtrlEdit_AppendText($g__hEdit, @CRLF & @CRLF & "Debug Complete! The Exit Code was: " & $iExitCode) ; Display the exit code ; Same steps as in the above loop Local $nMsg = 0 While 1 ; Wait for user to close the window $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGUI) ; Delete the GUI Return SetExtended($iExitCode, $sOutput) ; Return True EndFunc Func __Process_WM_SIZE($hWnd, $iMsg, $wParam, $lParam) Local $iWidth = _WinAPI_LoWord($lParam) Local $iHeight = _WinAPI_HiWord($lParam) _WinAPI_MoveWindow($g__hEdit, 2, 2, $iWidth - 4, $iHeight - 4) Return 0 #forceref $hWnd, $iMsg, $wParam EndFunc ; Thanks Mat :)
AutoIt
5
IHA114/ProxAllium
ProcessEx.au3
[ "MIT" ]
from django.urls import path, re_path from .views import empty_view urlpatterns = [ path('', empty_view, name='inner-nothing'), re_path(r'extra/(?P<extra>\w+)/$', empty_view, name='inner-extra'), re_path(r'(?P<one>[0-9]+)|(?P<two>[0-9]+)/$', empty_view, name='inner-disjunction'), ]
Python
4
ni-ning/django
tests/urlpatterns_reverse/included_urls.py
[ "CNRI-Python-GPL-Compatible", "BSD-3-Clause" ]
package com.baeldung.finalkeyword; public class Dog { public final void sound() { } }
Java
3
zeesh49/tutorials
core-java/src/main/java/com/baeldung/finalkeyword/Dog.java
[ "MIT" ]
local helpers = require('test.functional.helpers')(after_each) local eq = helpers.eq local clear = helpers.clear local exc_exec = helpers.exc_exec describe(':syntax', function() before_each(clear) describe('keyword', function() it('does not crash when group name contains unprintable characters', function() eq('Vim(syntax):E669: Unprintable character in group name', exc_exec('syntax keyword \024 foo bar')) end) end) end)
Lua
4
uga-rosa/neovim
test/functional/ex_cmds/syntax_spec.lua
[ "Vim" ]
#!/usr/bin/env python from __future__ import print_function import numpy as np import cv2 as cv import os import sys import unittest from tests_common import NewOpenCVTests try: if sys.version_info[:2] < (3, 0): raise unittest.SkipTest('Python 2.x is not supported') class MatTest(NewOpenCVTests): def test_mat_construct(self): data = np.random.random([10, 10, 3]) #print(np.ndarray.__dictoffset__) # 0 #print(cv.Mat.__dictoffset__) # 88 (> 0) #print(cv.Mat) # <class cv2.Mat> #print(cv.Mat.__base__) # <class 'numpy.ndarray'> mat_data0 = cv.Mat(data) assert isinstance(mat_data0, cv.Mat) assert isinstance(mat_data0, np.ndarray) self.assertEqual(mat_data0.wrap_channels, False) res0 = cv.utils.dumpInputArray(mat_data0) self.assertEqual(res0, "InputArray: empty()=false kind=0x00010000 flags=0x01010000 total(-1)=300 dims(-1)=3 size(-1)=[10 10 3] type(-1)=CV_64FC1") mat_data1 = cv.Mat(data, wrap_channels=True) assert isinstance(mat_data1, cv.Mat) assert isinstance(mat_data1, np.ndarray) self.assertEqual(mat_data1.wrap_channels, True) res1 = cv.utils.dumpInputArray(mat_data1) self.assertEqual(res1, "InputArray: empty()=false kind=0x00010000 flags=0x01010000 total(-1)=100 dims(-1)=2 size(-1)=10x10 type(-1)=CV_64FC3") mat_data2 = cv.Mat(mat_data1) assert isinstance(mat_data2, cv.Mat) assert isinstance(mat_data2, np.ndarray) self.assertEqual(mat_data2.wrap_channels, True) # fail if __array_finalize__ doesn't work res2 = cv.utils.dumpInputArray(mat_data2) self.assertEqual(res2, "InputArray: empty()=false kind=0x00010000 flags=0x01010000 total(-1)=100 dims(-1)=2 size(-1)=10x10 type(-1)=CV_64FC3") def test_mat_construct_4d(self): data = np.random.random([5, 10, 10, 3]) mat_data0 = cv.Mat(data) assert isinstance(mat_data0, cv.Mat) assert isinstance(mat_data0, np.ndarray) self.assertEqual(mat_data0.wrap_channels, False) res0 = cv.utils.dumpInputArray(mat_data0) self.assertEqual(res0, "InputArray: empty()=false kind=0x00010000 flags=0x01010000 total(-1)=1500 dims(-1)=4 size(-1)=[5 10 10 3] type(-1)=CV_64FC1") mat_data1 = cv.Mat(data, wrap_channels=True) assert isinstance(mat_data1, cv.Mat) assert isinstance(mat_data1, np.ndarray) self.assertEqual(mat_data1.wrap_channels, True) res1 = cv.utils.dumpInputArray(mat_data1) self.assertEqual(res1, "InputArray: empty()=false kind=0x00010000 flags=0x01010000 total(-1)=500 dims(-1)=3 size(-1)=[5 10 10] type(-1)=CV_64FC3") mat_data2 = cv.Mat(mat_data1) assert isinstance(mat_data2, cv.Mat) assert isinstance(mat_data2, np.ndarray) self.assertEqual(mat_data2.wrap_channels, True) # __array_finalize__ doesn't work res2 = cv.utils.dumpInputArray(mat_data2) self.assertEqual(res2, "InputArray: empty()=false kind=0x00010000 flags=0x01010000 total(-1)=500 dims(-1)=3 size(-1)=[5 10 10] type(-1)=CV_64FC3") def test_mat_wrap_channels_fail(self): data = np.random.random([2, 3, 4, 520]) mat_data0 = cv.Mat(data) assert isinstance(mat_data0, cv.Mat) assert isinstance(mat_data0, np.ndarray) self.assertEqual(mat_data0.wrap_channels, False) res0 = cv.utils.dumpInputArray(mat_data0) self.assertEqual(res0, "InputArray: empty()=false kind=0x00010000 flags=0x01010000 total(-1)=12480 dims(-1)=4 size(-1)=[2 3 4 520] type(-1)=CV_64FC1") with self.assertRaises(cv.error): mat_data1 = cv.Mat(data, wrap_channels=True) # argument unable to wrap channels, too high (520 > CV_CN_MAX=512) res1 = cv.utils.dumpInputArray(mat_data1) print(mat_data1.__dict__) print(res1) def test_ufuncs(self): data = np.arange(10) mat_data = cv.Mat(data) mat_data2 = 2 * mat_data self.assertEqual(type(mat_data2), cv.Mat) np.testing.assert_equal(2 * data, 2 * mat_data) def test_comparison(self): # Undefined behavior, do NOT use that. # Behavior may be changed in the future data = np.ones((10, 10, 3)) mat_wrapped = cv.Mat(data, wrap_channels=True) mat_simple = cv.Mat(data) np.testing.assert_equal(mat_wrapped, mat_simple) # ???: wrap_channels is not checked for now np.testing.assert_equal(data, mat_simple) np.testing.assert_equal(data, mat_wrapped) #self.assertEqual(mat_wrapped, mat_simple) # ??? #self.assertTrue(mat_wrapped == mat_simple) # ??? #self.assertTrue((mat_wrapped == mat_simple).all()) except unittest.SkipTest as e: message = str(e) class TestSkip(unittest.TestCase): def setUp(self): self.skipTest('Skip tests: ' + message) def test_skip(): pass pass if __name__ == '__main__': NewOpenCVTests.bootstrap()
Python
5
xipingyan/opencv
modules/python/test/test_mat.py
[ "Apache-2.0" ]
namespace math_test { long add_one(long val); double pow(double base, double exponent); };
WebIDL
3
tlively/wasm-bindgen
crates/webidl-tests/webidls/enabled/namespace.webidl
[ "Apache-2.0", "MIT" ]
# Group Messages Group of all messages-related resources. {{partial "messages/actions.apib"}}
API Blueprint
1
caioDelgado/snowboard
packages/snowboard-reader/test/fixtures/api/messages.apib
[ "MIT" ]
module examples/case_studies/firewire /* * A model of leader election in the Firewire protocol. * * Adapted from: * [DG+01] M.C.A. Devillers, W.O.D. GriAEoen, J.M.T Romijn, and F.W. Vaandrager. * Verification of a leader election protocol -- formal methods applied to IEEE * 1394. Technical Report CSI-R9728, Computing Science Institute, University of * Nijmegen, December 1997. Also, Formal Methods in System Design, 2001. * * This model describes a leader election protocol used in Firewire, an IEEE * standard for connecting consumer electronic devices. The model is a * straightforward translation into Alloy of a model [DG+01] developed in Lynch's * IO Automata which has been analyzed using PVS, a theorem prover, but which, as * far as we know, has not been subjected to fully automatic analysis. We are able * to express the key correctness property -- that exactly one leader is elected * -- more directly, as a trace property rather than a refinement property, and * can check it without the need for the 15 invariants used in the more * traditional proof. And the analysis does not hardwire * a particular topology, so would be tricky to do with a standard model checker. * * The network is assumed to consist of a collection of nodes connected by * links. Each link between a pair of nodes is matched by a link in the other * direction. Viewing a link and its dual as a single, undirected edge, the * network as a whole is assumed to form a tree. The purpose of the algorithm is * to construct such a tree; in the model, this is achieved by labelling some * subset of the links as parent links (each pointing from a node to its parent), * and by marking a single node as the root. * * The algorithm, described in detail elsewhere [DG+01], works briefly as * follows. When a node detects that all of its incoming links (or all but one) * has been marked as a parent link, it sends a message on each outgoing link, * either an acknowledgment (indicating its willingness to act as parent), or a * request (indicating its desire to be a child), according to whether the dual of * the outgoing link has been marked or not. Leaf nodes (with only one incoming * link) may thus initiate the algorithm by sending requests to their adjacent * nodes. Performing this action changes a node's status from {\em waiting} to * {\em active}. A node that is still waiting, and which receives a message on a * link, may label that link a parent link. Once active, a node that receives an * acknowledgment on a link may also label the link, but if it receives a request, * instead changes its node status to {\em contending}. The resolving of * contentions is modelled simplistically by a single action that arbitrarily * labels one of the two links a pair of contending nodes. Finally, a node all of * whose incoming links are parent links designates itself a root. * * The specification is given below. Each signature introduces a basic type * and some relations whose first column has that type: * * \begin{itemize} * * \item {\em Msg} represents the type of messages. {\em Req} is the request * message and {\em Ack} is the acknowledgment message; these are actually * declared as singleton (keyword {\em static}) subsets of {\em Msg}, the set of * all messages, that form a partition (keyword {\em part}). * * \item {\em Node} represents the nodes of the network. The relations {\em to} * and {\em from} associate each node with a set of incoming and outgoing links * respectively. * * \item {\em Link} represents the links. The relations {\em target} and {\em * source} map a link to its end nodes; {\em reverse} maps a link to its dual. The * facts in the signatures {\em Node} and {\em Link} ensure that all these * relations are consistent with one another: that the incoming links of a node * are those whose target is that node, etc. * * \item {\em Op} introduces a set of names for the operations of the * protocol. This is merely for convenience; it allows us to ask for an execution * in which named operations occur, or example. * * \item {\em State} represents the global states. Each state has a partition of * the nodes into one of four statuses: {\em waiting} to participate, {\em active} * (having sent messages on outgoing links), {\em contending} (having sent a * request on a link and received a request on its dual), and {\em elected} * (having designated itself as a root). A set of links are labelled as parent * links. There is a message queue associated with each link. Finally, the state * is associated with the operation that produced it. * * \item {\em Queue} represents the message queues. Each queue has a slot that * optionally contains a message; the relation {\em slot} is a partial function * from queues to messages. In our first attempt at a model, we represented a * queue as a sequence (a partial function from a prefix of the integers to * messages), but having checked that no queue ever contained more than one * message, we simplified the model. The {\em overflow} field is included just in * case this was a mistake; a write to a queue that already contains a message * puts an arbitrary value there, which is easily detected. * * \end{itemize} * * The {\em facts} record the assumptions about the topology. The one named {\em * Topology} says that there is some partial function on nodes and some root such * that (1) every node is reachable from the root ({\tt *r} being the reflexive * transitive closure of the relation {\tt r}); (2) there are no cycles (expressed * by saying that the transitive closure has no intersection with the identity * relation on nodes); and (3) the relation obtained by following the {\em source} * relation backwards (from a node to the link for which it is a source), and then * the {\em target} relation forwards (from the link to its target) is this * relation, plus its transpose (so that each tree edge becomes two * links). Although the quantifier appears to be higher-order, it will be * skolemized away by the analyzer. * * The {\em functions} of the model are parameterized formulas. The function {\em * Trans} relates a pre-state {\tt s} to a post-state {\tt s1}. It has a case for * each operation. Look at the clause for the operation {\em WriteReqOrAck}, for * example. If this operation is deemed to have occurred, each of the constraints * in the curly braces must hold. The first says that the labelling of links as * parent links is unchanged. The second constraint (the quantified formula) * constrains with respect to the node at which the operation occurs. The * subformulas, from first to last, say that the node belongs to the waiting set * before and the active set afterwards; that there is at most one ({\em sole}) * link that is incoming but not a parent link in the pre-state; that there are no * changes to node status except at this node; that a message is queued onto each * outgoing link; and that queues on all other links are unchanged. * * An 'invoked' function is simply short for the formula in its body with the * formal arguments replaced by the actual expressions. {\em WriteQueue}, for * example, says that if the queue's slot is not filled in the pre-state, then the * new queue in the post-state (given the local name {\tt q}) contains the message * {\tt m} in its slot, and has no message in its overflow. Otherwise, some * message is placed arbitrarily in the overflow, and the slot is * unconstrained. In {\em WriteReqOrAck}, the arguments {\tt s} and {\tt s1} are * bound to the {\tt s} and {\tt s1} of {\em Trans}; {\tt x} is bound to one of * the outgoing links from the set {\tt n.from}; and {\tt msg} is bound either to * the acknowledgment or request message. * * The function {\em Execution} constrains the set of states. It makes use of a * library module that defines a polymorphic ordering relation. The expression * {\tt Ord[State]} gives an ordering on all states. The two formulas of the * function say that {\tt Initialization} holds in the first state, and that any * pair of adjacent states is related by {\tt Trans}. The function {\em NoRepeats} * adds the constraints that there are no equivalent states in the trace, and that * no stuttering occurs. * * The three assertions are theorems for which the analyzer will search for * counterexamples. They assert respectively that: in every state of the trace, * there is at most one node that has been elected; that there is some state in * which a node has been elected; and that no queue overflows. * * The rest of the model is a collection of commands executed to find instances of * the functions or counterexamples to the theorems. We started by presenting a * variety of functions as a sanity check; here, only one is given, that asks for * an execution involving 2 nodes, 4 links, 4 queues and a trace of 6 states. The * standard semantics of these {\em scope} declarations in Alloy is that the * numbers represent an upper bound, so an instance may involve fewer than 4 * queues, for example. The ordering module (not shown here), however, for * technical reasons, constrains the ordered set to match its scope, so a trace * with fewer than 6 states will not be acceptable. * * We then established some bounds on the diameter of the state machine for * various topology bounds. For 2 nodes and 2 links, for example, there are no * non-repeating traces of length 4; checking traces of length 3 is thus * sufficient in this case. The number of queues was limited to 5, to accommodate * the empty queue, a queue containing an {\tt Ack} or {\tt Req}, and each of * these with overflow. For 3 nodes and 6 links, a trace length of 8 suffices. * * We then checked that for these various topology bounds, the queues never * overflow. Finally, we checked the correctness properties, taken advantage of * the earlier results that justify the short traces and queues. We are thus able * to verify the properties for all topologies involving the given number of nodes * and links, without any assumptions about trace length, queue size or the * particular topological structure. * * author: Daniel Jackson * visualization: Robert Seater */ open util/ordering[State] as ord abstract sig Msg {} one sig Req, Ack extends Msg {} sig Node {to, from: set Link} { to = {x: Link | x.target = this} from = {x: Link | x.source = this} } sig Link {target, source: Node, reverse: Link} { reverse.@source = target reverse.@target = source } /** * at most one link between a pair of nodes in a given direction */ fact {no x,y: Link | x!=y && x.source = y.source && x.target = y.target} /** * topology is tree-like: acyclic when viewed as an undirected graph */ fact Topology { some tree: Node lone -> Node, root: Node { Node in root.*tree no ^tree & iden & Node->Node tree + ~tree = ~source.target } } sig Op {} one sig Init, AssignParent, ReadReqOrAck, Elect, WriteReqOrAck, ResolveContention, Stutter extends Op {} sig State { disj waiting, active, contending, elected: set Node, parentLinks: set Link, queue: Link -> one Queue, op: Op -- the operation that produced the state } { waiting + active + contending + elected = Node } pred SameState [s, s1: State] { s.waiting = s1.waiting s.active = s1.active s.contending = s1.contending s.elected = s1.elected s.parentLinks = s1.parentLinks all x: Link | SameQueue [s.queue[x], s1.queue[x]] } pred Trans [s, s1: State] { s1.op != Init s1.op = Stutter => SameState [s, s1] s1.op = AssignParent => { some x: Link { x.target in s.waiting & s1.waiting NoChangeExceptAt [s, s1, x.target] ! IsEmptyQueue [s, x] s1.parentLinks = s.parentLinks + x ReadQueue [s, s1, x] }} s1.op = ReadReqOrAck => { s1.parentLinks = s.parentLinks some x: Link { x.target in s.(active + contending) & (PeekQueue [s, x, Ack] => s1.contending else s1.active) NoChangeExceptAt [s, s1, x.target] ! IsEmptyQueue [s, x] ReadQueue [s1, s, x] }} s1.op = Elect => { s1.parentLinks = s.parentLinks some n: Node { n in s.active & s1.elected NoChangeExceptAt [s, s1, n] n.to in s.parentLinks QueuesUnchanged [s, s1, Link] }} s1.op = WriteReqOrAck => { -- note how this requires access to child ptr s1.parentLinks = s.parentLinks some n: Node { n in s.waiting & s1.active lone n.to - s.parentLinks NoChangeExceptAt [s, s1, n] all x: n.from | let msg = (x.reverse in s.parentLinks => Ack else Req) | WriteQueue [s, s1, x, msg] QueuesUnchanged [s, s1, Link - n.from] }} s1.op = ResolveContention => { some x: Link { let contenders = x.(source + target) { contenders in s.contending & s1.active NoChangeExceptAt [s, s1, contenders] } s1.parentLinks = s.parentLinks + x } QueuesUnchanged [s, s1, Link] } } pred NoChangeExceptAt [s, s1: State, nodes: set Node] { let ns = Node - nodes { ns & s.waiting = ns & s1.waiting ns & s.active = ns & s1.active ns & s.contending = ns & s1.contending ns & s.elected = ns & s1.elected }} sig Queue {slot: lone Msg, overflow: lone Msg} pred SameQueue [q, q1: Queue] { q.slot = q1.slot && q.overflow = q1.overflow } pred ReadQueue [s, s1: State, x: Link] { -- let q = s1.queue[x] | no q.(slot + overflow) no s1.queue[x].(slot + overflow) all x1: Link - x | s1.queue[x1] = s.queue[x1] } pred PeekQueue [s: State, x: Link, m: Msg] { m = s.queue[x].slot } pred WriteQueue [s, s1: State, x: Link, m: Msg] { let q = s1.queue[x] | no s.queue[x].slot => ( q.slot = m && no q.overflow) else some q.overflow } pred QueuesUnchanged [s, s1: State, xs: set Link] { all x: xs | s1.queue[x] = s.queue[x] } pred IsEmptyQueue [s: State, x: Link] { no s.queue[x].(slot + overflow) -- let q = s.queue[x] | no q.(slot + overflow) } pred Initialization [s: State] { s.op = Init Node in s.waiting no s.parentLinks all x: Link | IsEmptyQueue [s, x] } pred Execution { Initialization [ord/first] all s: State - ord/last | let s1 = ord/next[s] | Trans [s, s1] } pred ElectionHappens { Execution some s: State | some s.elected some s: State | no s.elected } pred NoRepeats { Execution no s, s1: State | s!=s1 && SameState [s, s1] no s: State | s.op = Stutter } pred NoShortCuts { all s: State | -- remove this to speed up analysis - Ord[State].last - OrdPrev (Ord[State].last) | ! Trans [s, ord/next[ord/next[s]]] } assert AtMostOneElected { Execution => (all s: State | lone s.elected) } assert OneEventuallyElected { Execution => (some s: State | some s.elected) } assert NoOverflow { Execution => (all s: State, x: Link | no s.queue[x].overflow) } run Execution for 7 Op, 2 Msg, 2 Node, 4 Link, 4 Queue, 6 State expect 1 run ElectionHappens for 7 Op, 2 Msg, exactly 3 Node, 6 Link, 3 Queue, 7 State expect 1 -- solution for 3 State but not for 4 State run NoRepeats for 7 Op, 2 Msg, 2 Node, 2 Link, 2 Queue, 4 State expect 0 -- solution for 8 but not 9 State run NoRepeats for 7 Op, 2 Msg, 3 Node, 6 Link, 6 Queue, 8 State expect 0 -- only 5 queues needed: just count -- no solution: establishes at most 3 queues needed check NoOverflow for 7 Op, 2 Msg, 3 Node, 6 Link, 5 Queue, 9 State expect 0 check AtMostOneElected for 7 Op, 2 Msg, 3 Node, 6 Link, 3 Queue, 9 State expect 0 check OneEventuallyElected for 7 Op, 2 Msg, 3 Node, 6 Link, 3 Queue, 9 State expect 1 // DEFINED VARIABLES // Defined variables are uncalled, no-argument functions. // They are helpful for getting good visualization. fun queued: State -> Link -> Msg { {s: State, L: Link, m: Msg | m in L.(s.queue).slot} }
Alloy
5
haslab/Electrum
electrum/src/main/resources/models/examples/case_studies/firewire.als
[ "MIT" ]
// check-pass fn _test() -> impl Default { } fn main() {}
Rust
0
Eric-Arellano/rust
src/test/ui/issues/issue-36379.rs
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
<template> <v-row class="text-center" justify="center"> <v-col cols="12" md="3" > <div class="pa-4 secondary text-no-wrap rounded-pill" > .rounded-pill </div> </v-col> <v-col cols="12" md="3" > <div class="pa-7 secondary rounded-circle d-inline-block" ></div> <div>.rounded-circle</div> </v-col> </v-row> </template>
Vue
4
mark-gene/vuetify
packages/docs/src/examples/border-radius/misc-pill-and-circle.vue
[ "MIT" ]
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { registerSharedProcessRemoteService } from 'vs/platform/ipc/electron-sandbox/services'; import { IV8InspectProfilingService } from 'vs/platform/profiling/common/profiling'; registerSharedProcessRemoteService(IV8InspectProfilingService, 'v8InspectProfiling', { supportsDelayedInstantiation: true });
TypeScript
3
sbj42/vscode
src/vs/platform/profiling/electron-sandbox/profilingService.ts
[ "MIT" ]
// Copyright (c) 2016 GitHub, Inc. // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. #include "shell/browser/mac/dict_util.h" #include <string> #include "base/json/json_writer.h" #include "base/strings/sys_string_conversions.h" #include "base/values.h" namespace electron { NSArray* ListValueToNSArray(const base::ListValue& value) { std::string json; if (!base::JSONWriter::Write(value, &json)) return nil; NSData* jsonData = [NSData dataWithBytes:json.c_str() length:json.length()]; id obj = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil]; if (![obj isKindOfClass:[NSArray class]]) return nil; return obj; } base::ListValue NSArrayToListValue(NSArray* arr) { base::ListValue result; if (!arr) return result; for (id value in arr) { if ([value isKindOfClass:[NSString class]]) { result.Append(base::SysNSStringToUTF8(value)); } else if ([value isKindOfClass:[NSNumber class]]) { const char* objc_type = [value objCType]; if (strcmp(objc_type, @encode(BOOL)) == 0 || strcmp(objc_type, @encode(char)) == 0) result.Append([value boolValue]); else if (strcmp(objc_type, @encode(double)) == 0 || strcmp(objc_type, @encode(float)) == 0) result.Append([value doubleValue]); else result.Append([value intValue]); } else if ([value isKindOfClass:[NSArray class]]) { result.Append(NSArrayToListValue(value)); } else if ([value isKindOfClass:[NSDictionary class]]) { result.Append(NSDictionaryToDictionaryValue(value)); } else { result.Append(base::SysNSStringToUTF8([value description])); } } return result; } NSDictionary* DictionaryValueToNSDictionary( const base::DictionaryValue& value) { std::string json; if (!base::JSONWriter::Write(value, &json)) return nil; NSData* jsonData = [NSData dataWithBytes:json.c_str() length:json.length()]; id obj = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil]; if (![obj isKindOfClass:[NSDictionary class]]) return nil; return obj; } base::DictionaryValue NSDictionaryToDictionaryValue(NSDictionary* dict) { base::DictionaryValue result; if (!dict) return result; for (id key in dict) { std::string str_key = base::SysNSStringToUTF8( [key isKindOfClass:[NSString class]] ? key : [key description]); id value = [dict objectForKey:key]; if ([value isKindOfClass:[NSString class]]) { result.SetKey(str_key, base::Value(base::SysNSStringToUTF8(value))); } else if ([value isKindOfClass:[NSNumber class]]) { const char* objc_type = [value objCType]; if (strcmp(objc_type, @encode(BOOL)) == 0 || strcmp(objc_type, @encode(char)) == 0) result.SetKey(str_key, base::Value([value boolValue])); else if (strcmp(objc_type, @encode(double)) == 0 || strcmp(objc_type, @encode(float)) == 0) result.SetKey(str_key, base::Value([value doubleValue])); else result.SetKey(str_key, base::Value([value intValue])); } else if ([value isKindOfClass:[NSArray class]]) { result.SetKey(str_key, NSArrayToListValue(value)); } else if ([value isKindOfClass:[NSDictionary class]]) { result.SetKey(str_key, NSDictionaryToDictionaryValue(value)); } else { result.SetKey(str_key, base::Value(base::SysNSStringToUTF8([value description]))); } } return result; } } // namespace electron
Objective-C++
5
TarunavBA/electron
shell/browser/mac/dict_util.mm
[ "MIT" ]
{:name "User" :version "0.0.1" :author "TODO" :source "TODO" :desc "TODO" :behaviors "user.behaviors"}
edn
1
sam-aldis/LightTable
deploy/core/User/plugin.edn
[ "MIT" ]