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
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org; import java.lang.ref.*; import java.util.*; import java.awt.KeyEventDispatcher; import java.awt.KeyboardFocusManager; import java.awt.event.KeyEvent; import java.awt.event.InputEvent; aspect ListenerCount { // // pointcuts and advice // pointcut addAnyListener(Object t, Object l) : target(t) && args(l) && execution(* *..add*Listener(*Listener+)); pointcut addNamedPropertyChangeListener(Object t, Object l) : target(t) && execution(* *..addPropertyChangeListener(String, *Listener+)) && args(*, l); pointcut removeAnyListener(Object t, Object l) : target(t) && args(l) && execution(* *..remove*Listener(*Listener+)); before(Object t, Object l): addAnyListener(t, l) || addNamedPropertyChangeListener(t, l) { listenerAdded(t, thisJoinPointStaticPart.getSignature().getName().substring("add".length()), l); } before(Object t, Object l): removeAnyListener(t, l) { listenerRemoved(t, thisJoinPointStaticPart.getSignature().getName().substring("remove".length()), l); } before() : execution(* org.netbeans.core.NbTopManager.exit()) { dumpListenerCounts(); } // // implementation details // ListenerCount() { KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new MagicKeyHandler()); } private class MagicKeyHandler implements KeyEventDispatcher { public boolean dispatchKeyEvent(KeyEvent e) { if (e.getID() == KeyEvent.KEY_PRESSED && e.getModifiers() == (InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK) && e.getKeyCode() == KeyEvent.VK_L) { ListenerCount.this.dumpListenerCounts(); } return false; } } private static final boolean DONT_REPORT_FAILED_REMOVE = Boolean.getBoolean("ListenerCount.dont_report_failed_remove"); private ThreadLocal lastFailedRemovedListener = new ThreadLocal(); private ThreadLocal lastFailedRemoveStackTrace = new ThreadLocal(); private Map sourceListeners = new HashMap(); // SourceListener -> Map(listener->count) private Map sourceListenerPeaks = new HashMap(); private synchronized void listenerAdded(Object source, String listenerType, Object listener) { //System.err.println("added: source = " + source + " listenerType = " + listenerType); checkLastFailedRemove(listener); SourceListener sl = new SourceListener(source, listenerType); Map listeners = (Map) sourceListeners.get(sl); int c = 1; if (listeners == null) { listeners = new IdentityHashMap(); sourceListeners.put(sl, listeners); } else { Integer count = (Integer) listeners.get(listener); if (count != null) { c = count.intValue() + 1; System.err.println("listenerCount> WARNING: registering the same listener for the " + (c == 2 ? "2nd" : (c == 3 ? "3rd" : ("" + c + "th"))) + " time, not good"); System.err.println("listenerCount> source = " + source); System.err.println("listenerCount> listener = " + listener); Thread.dumpStack(); } } listeners.put(listener, new Integer(c)); Integer peak = (Integer) sourceListenerPeaks.get(sl); if (peak != null) { int count = listeners.size(); if (peak.intValue() < count) sourceListenerPeaks.put(sl, new Integer(count)); } else { sourceListenerPeaks.put(sl, new Integer(1)); } } private synchronized void listenerRemoved(Object source, String listenerType, Object listener) { //System.err.println("rm'ed: source = " + source + " listenerType = " + listenerType); checkLastFailedRemove(null); SourceListener sl = new SourceListener(source, listenerType); Map listeners = (Map) sourceListeners.get(sl); if (listeners == null || null != listeners.remove(listener)) { lastFailedRemovedListener.set(listener); lastFailedRemoveStackTrace.set(new Throwable()); } } private void checkLastFailedRemove(Object addedListener) { Object listener = lastFailedRemovedListener.get(); if (! DONT_REPORT_FAILED_REMOVE && listener != null && listener != addedListener) { System.err.println("listenerCount> WARNING: attempt to remove unregistered listener, may or may not be okay"); ((Throwable)lastFailedRemoveStackTrace.get()).printStackTrace(System.err); } lastFailedRemovedListener.set(null); lastFailedRemoveStackTrace.set(null); } private void dumpListenerCounts() { System.gc(); System.gc(); System.gc(); HashMap sourceListenerPeaks; synchronized (this) { sourceListenerPeaks = new HashMap(this.sourceListenerPeaks); } Map sclcounts = new HashMap(); // SourceClassListener -> List of Integers Iterator iter = sourceListenerPeaks.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); SourceListener sl = (SourceListener) entry.getKey(); Integer count = (Integer) entry.getValue(); SourceClassListener scl = new SourceClassListener(sl.getSourceClass(), sl.getListenerType()); List counts = (List) sclcounts.get(scl); if (counts == null) { counts = new ArrayList(); sclcounts.put(scl, counts); } counts.add(count); } System.out.println("listenerCount> --%<----%<----%<----%<----%<----%<----%<----%<----%<----%<----%<----%<----%<----%<--"); iter = sclcounts.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); SourceClassListener scl = (SourceClassListener) entry.getKey(); List counts = (List) entry.getValue(); Collections.sort(counts); int num = -1; int occur = 0; Iterator iter2 = counts.iterator(); while (iter2.hasNext()) { int c = ((Integer)iter2.next()).intValue(); if (num < 0) { num = c; } else { if (c != num) { System.out.println("listenerCount: " + num + "\t" + occur + "\t" + scl.getSourceClass().getName() + "\t" + scl.getListenerType()); num = c; occur = 1; continue; } } occur++; } if (num > 0 && occur > 0) System.out.println("listenerCount: " + num + "\t" + occur + "\t" + scl.getSourceClass().getName() + "\t" + scl.getListenerType()); } System.out.println("listenerCount> --%<----%<----%<----%<----%<----%<----%<----%<----%<----%<----%<----%<----%<----%<--"); } private static class SourceClassListener { private Class sourceClass; private String listenerType; SourceClassListener(Class sourceClass, String listenerType) { this.sourceClass = sourceClass; this.listenerType = listenerType.intern(); } Class getSourceClass() { return sourceClass; } String getListenerType() { return listenerType; } public boolean equals(Object o) { if (!(o instanceof SourceClassListener)) return false; SourceClassListener scl = (SourceClassListener) o; return sourceClass == scl.sourceClass && listenerType == scl.listenerType; } public int hashCode() { return 37 * sourceClass.hashCode() + listenerType.hashCode(); } } private static class SourceListener { private WeakReference sourceRef; private int sourceHashCode; private Class sourceClass; private String listenerType; SourceListener(Object source, String listenerType) { this.sourceRef = new WeakReference(source); this.sourceHashCode = source.hashCode(); this.sourceClass = source.getClass(); this.listenerType = listenerType.intern(); } Object getSource() { return sourceRef.get(); } Class getSourceClass() { return sourceClass; } String getListenerType() { return listenerType; } public boolean equals(Object o) { if (o instanceof SourceListener) { SourceListener sl = (SourceListener) o; return sourceRef.get() == sl.sourceRef.get() && listenerType == sl.listenerType; } else { return false; } } public int hashCode() { return 37 * listenerType.hashCode() + sourceHashCode; } } }
AspectJ
5
timfel/netbeans
java/performance/aspectj/ListenerCount.aj
[ "Apache-2.0" ]
package promql_test import "testing" import "internal/promql" option now = () => 2030-01-01T00:00:00Z outData = " #datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,double #group,false,true,true,true,false,false #default,_result,0,1970-01-01T00:00:00Z,1970-01-01T00:00:00Z,, ,result,table,_start,_stop,_time,_value " t_emptyTable = (table=<-) => table test _emptyTable = () => ({input: promql.emptyTable(), want: testing.loadMem(csv: outData), fn: t_emptyTable})
FLUX
3
metrico/flux
stdlib/testing/promql/emptyTable_test.flux
[ "MIT" ]
.dropdown-menu { // setting a margin is not compatible with popper. margin: 0 !important; > li > a { padding: 3px 10px; } }
Less
3
KarlParkinson/mitmproxy
web/src/css/dropdown.less
[ "MIT" ]
#![feature(half_open_range_patterns)] #![feature(exclusive_range_pattern)] #![allow(illegal_floating_point_literal_pattern)] macro_rules! m { ($s:expr, $($t:tt)+) => { match $s { $($t)+ => {} } } } fn main() { m!(0, ..u8::MIN); //~^ ERROR lower range bound must be less than upper //~| ERROR lower range bound must be less than upper m!(0, ..u16::MIN); //~^ ERROR lower range bound must be less than upper //~| ERROR lower range bound must be less than upper m!(0, ..u32::MIN); //~^ ERROR lower range bound must be less than upper //~| ERROR lower range bound must be less than upper m!(0, ..u64::MIN); //~^ ERROR lower range bound must be less than upper //~| ERROR lower range bound must be less than upper m!(0, ..u128::MIN); //~^ ERROR lower range bound must be less than upper //~| ERROR lower range bound must be less than upper m!(0, ..i8::MIN); //~^ ERROR lower range bound must be less than upper //~| ERROR lower range bound must be less than upper m!(0, ..i16::MIN); //~^ ERROR lower range bound must be less than upper //~| ERROR lower range bound must be less than upper m!(0, ..i32::MIN); //~^ ERROR lower range bound must be less than upper //~| ERROR lower range bound must be less than upper m!(0, ..i64::MIN); //~^ ERROR lower range bound must be less than upper //~| ERROR lower range bound must be less than upper m!(0, ..i128::MIN); //~^ ERROR lower range bound must be less than upper //~| ERROR lower range bound must be less than upper m!(0f32, ..f32::NEG_INFINITY); //~^ ERROR lower range bound must be less than upper //~| ERROR lower range bound must be less than upper m!(0f64, ..f64::NEG_INFINITY); //~^ ERROR lower range bound must be less than upper //~| ERROR lower range bound must be less than upper m!('a', ..'\u{0}'); //~^ ERROR lower range bound must be less than upper //~| ERROR lower range bound must be less than upper }
Rust
3
Eric-Arellano/rust
src/test/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.rs
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
FORMAT: 1A # Machines API # Group Machines # Machine [/machines/{name}] + Parameters + name (required,`willy`) ## Get Machine [GET] - Response 200 (application/json; charset=utf-8) { "type": "bulldozer", "name": "willy" }
API Blueprint
4
tomoyamachi/dredd
packages/dredd/test/fixtures/single-get-uri-template.apib
[ "MIT" ]
#tag IOSView Begin iosView ShakingView BackButtonTitle = "Back" Compatibility = "" LargeTitleMode = 2 Left = 0 NavigationBarVisible= True TabIcon = "" TabTitle = "" Title = "Shake the phone to start!" Top = 0 Begin Extensions.SwipeView SwipeView1 AccessibilityHint= "" AccessibilityLabel= "" AutoLayout = SwipeView1, 4, BottomLayoutGuide, 4, False, +1.00, 1, 1, 0, , True AutoLayout = SwipeView1, 3, TopLayoutGuide, 4, False, +1.00, 1, 1, 0, , True AutoLayout = SwipeView1, 2, <Parent>, 2, False, +1.00, 1, 1, 0, , True AutoLayout = SwipeView1, 1, <Parent>, 1, False, +1.00, 1, 1, 0, , True Height = 503.0 Left = 0 LockedInPosition= False Scope = 1 Top = 65 Visible = True Width = 320.0 End Begin Timer Timer1 LockedInPosition= False PanelIndex = -1 Parent = "" Period = 10 RunMode = 2 Scope = 0 End End #tag EndIOSView #tag WindowCode #tag Event Sub Open() declare sub becomeFirstResponder lib UIKitLib selector "becomeFirstResponder" (obj_id as ptr) becomeFirstResponder(SwipeView1.Handle) End Sub #tag EndEvent #tag Method, Flags = &h21 Private Sub EndShake() shaking = False End Sub #tag EndMethod #tag Property, Flags = &h21 Private shaking As Boolean #tag EndProperty #tag EndWindowCode #tag Events SwipeView1 #tag Event Sub ShakeBegan() shaking = True End Sub #tag EndEvent #tag Event Sub ShakeEnded() Timer.CallLater(100, AddressOf endShake) End Sub #tag EndEvent #tag Event Function UsesGestures() As Boolean Return False End Function #tag EndEvent #tag Event Sub Paint(g as iOSGraphics) if not shaking then g.FillColor = Color.Green else g.FillColor = color.Red end if g.FillRect 0,0,g.Width,g.Height End Sub #tag EndEvent #tag EndEvents #tag Events Timer1 #tag Event Sub Run() SwipeView1.Invalidate End Sub #tag EndEvent #tag EndEvents #tag ViewBehavior #tag ViewProperty Name="TabIcon" Visible=false Group="Behavior" InitialValue="" Type="iOSImage" EditorType="" #tag EndViewProperty #tag ViewProperty Name="LargeTitleMode" Visible=true Group="Behavior" InitialValue="2" Type="LargeTitleDisplayModes" EditorType="Enum" #tag EnumValues "0 - Automatic" "1 - Always" "2 - Never" #tag EndEnumValues #tag EndViewProperty #tag ViewProperty Name="BackButtonTitle" Visible=false Group="Behavior" InitialValue="" Type="Text" EditorType="MultiLineEditor" #tag EndViewProperty #tag ViewProperty Name="Index" Visible=true Group="ID" InitialValue="-2147483648" Type="Integer" EditorType="" #tag EndViewProperty #tag ViewProperty Name="Left" Visible=true Group="Position" InitialValue="0" Type="Integer" EditorType="" #tag EndViewProperty #tag ViewProperty Name="Name" Visible=true Group="ID" InitialValue="" Type="String" EditorType="" #tag EndViewProperty #tag ViewProperty Name="NavigationBarVisible" Visible=false Group="Behavior" InitialValue="" Type="Boolean" EditorType="" #tag EndViewProperty #tag ViewProperty Name="Super" Visible=true Group="ID" InitialValue="" Type="String" EditorType="" #tag EndViewProperty #tag ViewProperty Name="TabTitle" Visible=false Group="Behavior" InitialValue="" Type="Text" EditorType="" #tag EndViewProperty #tag ViewProperty Name="Title" Visible=false Group="Behavior" InitialValue="" Type="Text" EditorType="MultiLineEditor" #tag EndViewProperty #tag ViewProperty Name="Top" Visible=true Group="Position" InitialValue="0" Type="Integer" EditorType="" #tag EndViewProperty #tag EndViewBehavior
Xojo
3
kingj5/iOSKit
ExampleViews/ShakingView.xojo_code
[ "MIT" ]
Project-wide requirejs configuration for Leisure requirejs.config #baseUrl: (new URL(requirejs.leisureCompiled ? 'build' : 'src', document.location)).pathname.replace(/\/.*:/, ''), #baseUrl: requirejs.leisureCompiled ? 'build' : 'src', # disable coffeescript if this is true # this will load *.js files instead of *.coffee or *.litcoffee disableCoffeeScript: requirejs.leisureCompiled paths: # the left side is the module ID, # the right side is the path to # the jQuery file, relative to baseUrl. # Also, the path should NOT include # the '.js' file extension. This example # is using jQuery 1.9.0 located at # js/lib/jquery-1.9.0.js, relative to # the HTML page. jquery: 'lib/jquery-2.1.4' jqueryui: 'lib/jquery-ui.min-1.11.4' #jqueryui: 'lib/jquery-ui-1.11.4' acorn: 'lib/acorn-3.2.0' acorn_loose: 'lib/acorn_loose-3.2.0' acorn_walk: 'lib/acorn_walk-3.2.0' immutable: 'lib/immutable-3.8.1.min' handlebars: 'lib/handlebars-v4.0.5' sockjs: 'lib/sockjs-1.0.0.min' lispyscript: 'lib/lispyscript/browser-bundle' lodash: 'lib/lodash.full-4.14.1' bluebird: 'lib/bluebird-3.5.0' fingertree: 'lib/fingertree' "browser-source-map-support": 'lib/browser-source-map-support-0.4.14' #define 'TEST', [], "HELLO" #require ['./editor'], (editor)-> # console.log "REDEFINING JQUERY:", editor # define 'jquery', [], editor.$$$
Literate CoffeeScript
4
zot/Leisure
src/config.litcoffee
[ "Zlib" ]
-include ../tools.mk # The following command will: # 1. dump the symbols of a library using `nm` # 2. extract only those lines that we are interested in via `grep` # 3. from those lines, extract just the symbol name via `sed`, which: # * always starts with "_ZN" and ends with "E" (`legacy` mangling) # * always starts with "_R" (`v0` mangling) # 4. sort those symbol names for deterministic comparison # 5. write the result into a file dump-symbols = nm "$(TMPDIR)/lib$(1).rlib" \ | grep -E "$(2)" \ | sed -E "s/.*(_ZN.*E|_R[a-zA-Z0-9_]*).*/\1/" \ | sort \ > "$(TMPDIR)/$(1)$(3).nm" # This test # - compiles each of the two crates 2 times and makes sure each time we get # exactly the same symbol names # - makes sure that both crates agree on the same symbol names for monomorphic # functions all: $(RUSTC) stable-symbol-names1.rs $(call dump-symbols,stable_symbol_names1,generic_|mono_,_v1) rm $(TMPDIR)/libstable_symbol_names1.rlib $(RUSTC) stable-symbol-names1.rs $(call dump-symbols,stable_symbol_names1,generic_|mono_,_v2) cmp "$(TMPDIR)/stable_symbol_names1_v1.nm" "$(TMPDIR)/stable_symbol_names1_v2.nm" $(RUSTC) stable-symbol-names2.rs $(call dump-symbols,stable_symbol_names2,generic_|mono_,_v1) rm $(TMPDIR)/libstable_symbol_names2.rlib $(RUSTC) stable-symbol-names2.rs $(call dump-symbols,stable_symbol_names2,generic_|mono_,_v2) cmp "$(TMPDIR)/stable_symbol_names2_v1.nm" "$(TMPDIR)/stable_symbol_names2_v2.nm" $(call dump-symbols,stable_symbol_names1,mono_,_cross) $(call dump-symbols,stable_symbol_names2,mono_,_cross) cmp "$(TMPDIR)/stable_symbol_names1_cross.nm" "$(TMPDIR)/stable_symbol_names2_cross.nm"
Makefile
4
Eric-Arellano/rust
src/test/run-make-fulldeps/stable-symbol-names/Makefile
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
{% assign mine_open = '<button onclick="wmctrl -s ' %} {% assign visible_open = '<button onclick="wmctrl -s ' %} {% assign busy_open = '<button onclick="wmctrl -s ' %} {% assign close = '</button>' %} {% assign middle = '">' %} {% assign unoccupied = '<button onclick="wmctrl -s ' %} {{'<box>'}} {% for tag in workspace.tags %} {% if tag.mine %} {{mine_open}}{{tag.index}}{{middle}} {{ tag.name }} {{close}} {% elsif tag.visible %} {{visible_open}}{{tag.index}}{{middle}} {{ tag.name }} {{close}} {% elsif tag.busy %} {{busy_open}}{{tag.index}}{{middle}} {{ tag.name }} {{close}} {% else tag.visible %} {{unoccupied}}{{tag.index}}{{middle}} {{ tag.name }} {{close}} {% endif %} {% endfor %} {{"</box>"}}
Liquid
3
Vizdun/leftwm
themes/basic_eww/legacy_eww_xml_config/template.liquid
[ "MIT" ]
dnl Copyright (C) 1993-2002 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl From Bruno Haible, Marcus Daniels. AC_PREREQ(2.13) AC_DEFUN([CL_PROG_LN], [AC_REQUIRE([CL_PROG_CP])dnl AC_CACHE_CHECK(how to make hard links, cl_cv_prog_LN, [ rm -f conftestdata conftestfile echo data > conftestfile if ln conftestfile conftestdata 2>/dev/null; then cl_cv_prog_LN=ln else cl_cv_prog_LN="$cl_cv_prog_cp" fi rm -f conftestdata conftestfile ]) LN="$cl_cv_prog_LN" AC_SUBST(LN)dnl ]) AC_DEFUN([CL_PROG_LN_S], [AC_REQUIRE([CL_PROG_LN])dnl dnl Make a symlink if possible; otherwise try a hard link. On filesystems dnl which support neither symlink nor hard link, use a plain copy. AC_MSG_CHECKING(whether ln -s works) AC_CACHE_VAL(cl_cv_prog_LN_S, [ rm -f conftestdata if ln -s X conftestdata 2>/dev/null; then cl_cv_prog_LN_S="ln -s" else cl_cv_prog_LN_S="$cl_cv_prog_LN" fi rm -f conftestdata ])dnl if test "$cl_cv_prog_LN_S" = "ln -s"; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi LN_S="$cl_cv_prog_LN_S" AC_SUBST(LN_S)dnl ]) AC_DEFUN([CL_PROG_HLN], [AC_REQUIRE([CL_PROG_LN_S])dnl dnl SVR4 "ln" makes hard links to symbolic links, instead of resolving the dnl symbolic link. To avoid this, use the "hln" program. AC_CACHE_CHECK(how to make hard links to symlinks, cl_cv_prog_hln, [ cl_cv_prog_hln="ln" if test "$cl_cv_prog_LN_S" = "ln -s"; then echo "blabla" > conftest.x ln -s conftest.x conftest.y ln conftest.y conftest.z 2>&AC_FD_CC rm -f conftest.x if cat conftest.z > /dev/null 2>&1 ; then # ln is usable. cl_cv_prog_hln="ln" else # conftest.z is a symbolic link to the non-existent conftest.x cl_cv_prog_hln="hln" fi else # If there are no symbolic links, the problem cannot occur. cl_cv_prog_hln="ln" fi rm -f conftest* ]) HLN="$cl_cv_prog_hln" AC_SUBST(HLN)dnl ])
M4
4
ucsf-ckm/geddify
magick-installer/libiconv-1.13.1/m4/ln.m4
[ "BSD-3-Clause" ]
fn main() { while true { //~ WARN denote infinite loops with true //~ ERROR mismatched types //~| expected `()`, found `bool` } }
Rust
3
Eric-Arellano/rust
src/test/ui/block-result/block-must-not-have-result-while.rs
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
(ns todomvc.components.footer) (defn component [] [:footer.info [:p "Double-click to edit a todo"] [:p "Credits: " [:a {:href "https://twitter.com/gadfly361"} "Matthew Jaoudi"] ", " [:a {:href "https://twitter.com/yogthos"} "Dmitri Sotnikov"] ", and " [:a {:href "https://twitter.com/holmsand"} "Dan Holmsand"]] [:p "Part of " [:a {:href "http://todomvc.com"} "TodoMVC"]]])
Clojure
4
dtelaroli/todomvc
examples/reagent/src/cljs/todomvc/components/footer.cljs
[ "MIT" ]
syntax = "proto3"; package tensorflow.profiler; import "tensorflow/core/profiler/protobuf/diagnostics.proto"; message StepBreakdownEvents { int32 id = 1; string name = 2; } // A database of PodStats records. message PodStatsDatabase { // All PodStats records, one for each row in the PodStats tool. repeated PodStatsRecord pod_stats_record = 1; // Error and warning messages for diagnosing profiling issues. Diagnostics diagnostics = 3; // A map from event type number to event name string for step breakdown. repeated StepBreakdownEvents step_breakdown_events = 4; reserved 2; } // Next ID: 20 // There is one PodStatsRecord for each step traced on each compute node. message PodStatsRecord { // The host name where the trace was collected. string host_name = 1; // The TPU global chip id where the trace was collected. int32 chip_id = 2; // The TPU node id where the trace was collected. int32 node_id = 3; // The step number. uint32 step_num = 4; // The step duration in micro-seconds. double total_duration_us = 5; // Breakdown the durations for each event type in micro-seconds. map<int32, double> step_breakdown_us = 19; // Indicates the bottleneck out of the above mentioned metrics. string bottleneck = 14; reserved 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18; }
Protocol Buffer
3
EricRemmerswaal/tensorflow
tensorflow/core/profiler/protobuf/pod_stats.proto
[ "Apache-2.0" ]
// // Double3.mm // // Created by Giles Payne on 2020/05/22. // #import "Double3.h" #import "Mat.h" @implementation Double3 { cv::Vec3d native; } -(double)v0 { return native[0]; } -(void)setV0:(double)v { native[0] = v; } -(double)v1 { return native[1]; } -(void)setV1:(double)v { native[1] = v; } -(double)v2 { return native[2]; } -(void)setV2:(double)v { native[2] = v; } -(instancetype)init { return [self initWithV0:0 v1:0 v2:0]; } -(instancetype)initWithV0:(double)v0 v1:(double)v1 v2:(double)v2 { self = [super init]; if (self) { self.v0 = v0; self.v1 = v1; self.v2 = v2; } return self; } -(instancetype)initWithVals:(NSArray<NSNumber*>*)vals { self = [super init]; if (self) { [self set:vals]; } return self; } +(instancetype)fromNative:(cv::Vec3d&)vec3d { return [[Double3 alloc] initWithV0:vec3d[0] v1:vec3d[1] v2:vec3d[2]]; } -(void)set:(NSArray<NSNumber*>*)vals { self.v0 = (vals != nil && vals.count > 0) ? vals[0].doubleValue : 0; self.v1 = (vals != nil && vals.count > 1) ? vals[1].doubleValue : 0; self.v2 = (vals != nil && vals.count > 2) ? vals[2].doubleValue : 0; } -(NSArray<NSNumber*>*)get { return @[[NSNumber numberWithFloat:native[0]], [NSNumber numberWithFloat:native[1]], [NSNumber numberWithFloat:native[2]]]; } - (BOOL)isEqual:(id)other { if (other == self) { return YES; } else if (![other isKindOfClass:[Double3 class]]) { return NO; } else { Double3* d3 = (Double3*)other; return self.v0 == d3.v0 && self.v1 == d3.v1 && self.v2 == d3.v2; } } @end
Objective-C++
4
artun3e/opencv
modules/core/misc/objc/common/Double3.mm
[ "BSD-3-Clause" ]
lexer grammar GrammarFilter; options { language=ObjC; filter=true; } @ivars { id delegate; } @methodsdecl { - (void) setDelegate:(id)theDelegate; } @methods { - (void) setDelegate:(id)theDelegate { delegate = theDelegate; // not retained, will always be the object creating this lexer! } } // figure out the grammar type in this file GRAMMAR : ( grammarType=GRAMMAR_TYPE {[delegate setGrammarType:$grammarType.text]; } WS | /* empty, must be parser or combined grammar */ {[delegate setGrammarType:@"parser"]; [delegate setIsCombinedGrammar:NO]; } ) 'grammar' WS grammarName=ID { [delegate setGrammarName:$grammarName.text]; } WS? ';' ; fragment GRAMMAR_TYPE : ('lexer'|'parser'|'tree') ; // find out if this grammar depends on other grammars OPTIONS : 'options' WS? '{' ( (WS? '//') => SL_COMMENT | (WS? '/*') => COMMENT | (WS? 'tokenVocab') => WS? 'tokenVocab' WS? '=' WS? tokenVocab=ID WS? ';' { [delegate setDependsOnVocab:$tokenVocab.text]; } | WS? ID WS? '=' WS? ID WS?';' )* WS? '}' ; // look for lexer rules when in parser grammar -> this LEXER_RULE : ('A'..'Z') ID? WS? ':' (options {greedy=false;} : .)* ';' { [delegate setIsCombinedGrammar:YES]; } ; // ignore stuff in comments COMMENT : '/*' (options {greedy=false;} : . )* '*/' ; SL_COMMENT : '//' (options {greedy=false;} : . )* '\n' ; // throw away all actions, as they might confuse LEXER_RULE ACTION : '{' (options {greedy=false;} : .)* '}' ; // similarly throw away strings STRING : '\'' (options {greedy=false;} : .)* '\'' ; fragment ID : ('a'..'z'|'A'..'Z'|'_'|'0'..'9')+ ; WS : (' '|'\t'|'\n')+ ;
G-code
5
DanielMabadeje/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials
java/java2py/antlr-3.1.3/runtime/ObjC/Xcode plugin/GrammarFilter.g
[ "Apache-2.0" ]
// run-pass #![allow(dead_code)] #[repr(align(256))] struct A { v: u8, } impl A { fn f(&self) -> *const A { self } } fn f2(v: u8) -> Box<dyn FnOnce() -> *const A> { let a = A { v }; Box::new(move || a.f()) } fn main() { let addr = f2(0)(); assert_eq!(addr as usize % 256, 0, "addr: {:?}", addr); }
Rust
4
Eric-Arellano/rust
src/test/ui/fn/dyn-fn-alignment.rs
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
component{ void function setCallerVars(data, row, getRow, columnNames){ var currentRow=0; var rowData = getRow(data, row, columnNames); caller["currentRow"] = currentRow; } }
ColdFusion CFC
2
tonym128/CFLint
src/test/resources/com/cflint/tests/VarScoper/fpositive/tag.cfc
[ "BSD-3-Clause" ]
NAME ParaView::GUIKit LIBRARY_NAME vtkPVGUIKit
Kit
0
xj361685640/ParaView
Kits/GUI/vtk.kit
[ "Apache-2.0", "BSD-3-Clause" ]
- dashboard: ga4_page_funnel title: "[GA4] Page Funnel" layout: newspaper preferred_viewer: dashboards-next elements: - title: Page Funnel name: Page Funnel model: ga4 explore: sessions type: looker_column fields: [sessions.audience_trait, sessions.count_of_page_1, sessions.count_of_page_2, sessions.count_of_page_3, sessions.count_of_page_4, sessions.count_of_page_5, sessions.count_of_page_6] limit: 12 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: row 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" series_types: {} show_dropoff: true defaults_version: 1 hidden_fields: [] y_axes: [] listen: Session Date: sessions.session_date Host Name: events.event_param_host Audience Selector: sessions.audience_selector Page 3: sessions.page_3_filter Page 2: sessions.page_2_filter Page 1: sessions.page_1_filter Page 4: sessions.page_4_filter Page 5: sessions.page_5_filter Page 6: sessions.page_6_filter row: 4 col: 0 width: 24 height: 14 - 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 Page Pathing Page Funnel</h1><h2 style=\"font-size: 16px;\">How\ \ are customers moving through our site?<br><b>Recommended Action</b>\U0001f447\ Update the filters above to create your own custom path pathing funnel. Then\ \ link from any page in the funnel to see what actions occur on that page.</h2></div>\n\ </div>" row: 0 col: 0 width: 24 height: 4 - name: " (2)" type: text title_text: '' subtitle_text: '' body_text: "<div style=\"text-align: center;\">\n\t<div><h1 style=\"font-size:\ \ 20px;\"><b>Page Path Funnel</b><br></h1><h2 style=\"font-size: 16px;\">How\ \ are people moving through the website as a % of Total<br><b>\nRecommended\ \ Action</b>\U0001f447 Use the page filters at the top to define the different\ \ steps in the funnel.\n</h2></div>\n</div>" row: 18 col: 0 width: 24 height: 4 - title: Page Path Funnel % of Total name: Page Path Funnel % of Total model: ga4 explore: sessions type: looker_column fields: [sessions.count_of_page_1, sessions.count_of_page_2, sessions.count_of_page_3, sessions.count_of_page_4, sessions.count_of_page_5, sessions.count_of_page_6] limit: 12 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" series_types: {} show_dropoff: true defaults_version: 1 hidden_fields: [] y_axes: [] listen: Session Date: sessions.session_date Host Name: events.event_param_host Audience Selector: sessions.audience_selector Page 3: sessions.page_3_filter Page 2: sessions.page_2_filter Page 1: sessions.page_1_filter Page 4: sessions.page_4_filter Page 5: sessions.page_5_filter Page 6: sessions.page_6_filter row: 22 col: 0 width: 24 height: 8 - title: Top Page Paths name: Top Page Paths model: ga4 explore: sessions type: looker_grid fields: [sessions.total_sessions, events.event_param_page, events.current_page_plus_1, events.current_page_plus_2, events.current_page_plus_3, events.current_page_plus_4, events.current_page_plus_5, events.current_page_plus_6] sorts: [sessions.total_sessions desc] limit: 12 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: 12 conditional_formatting_include_totals: false conditional_formatting_include_nulls: false 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" series_types: {} show_dropoff: true defaults_version: 1 hidden_fields: [] y_axes: [] listen: Session Date: sessions.session_date Host Name: events.event_param_host Audience Selector: sessions.audience_selector row: 34 col: 0 width: 24 height: 7 - name: " (3)" type: text title_text: '' subtitle_text: '' body_text: "<div style=\"text-align: center;\">\n\t<div><h1 style=\"font-size:\ \ 20px;\"><b>Natural Page Path</b><br></h1><h2 style=\"font-size: 16px;\">How\ \ are users naturally flowing through the site?<br><b>\nRecommended Action</b>\U0001f447\ \ Drill in to see the breakdown by source medium.\n</h2></div>\n</div>" row: 30 col: 0 width: 24 height: 4 filters: - name: Session Date title: Session Date type: field_filter default_value: 7 day allow_multiple_values: true required: false ui_config: type: relative_timeframes display: inline options: [] model: ga4 explore: sessions listens_to_filters: [] field: sessions.session_date - name: Host Name title: Host Name 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: events.event_param_host - name: Page 1 title: Page 1 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.page_1_filter - name: Page 2 title: Page 2 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.page_2_filter - name: Page 3 title: Page 3 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.page_3_filter - name: Page 4 title: Page 4 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.page_4_filter - name: Page 5 title: Page 5 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.page_5_filter - name: Page 6 title: Page 6 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.page_6_filter - name: Audience Selector title: Audience Selector type: field_filter default_value: Device 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/page_funnel.dashboard.lookml
[ "MIT" ]
/*! * Copyright (c) 2015-2021 by Contributors * \file sparse_page_raw_format.cc * Raw binary format of sparse page. */ #include <xgboost/data.h> #include <dmlc/registry.h> #include "xgboost/logging.h" #include "./sparse_page_writer.h" namespace xgboost { namespace data { DMLC_REGISTRY_FILE_TAG(sparse_page_raw_format); template<typename T> class SparsePageRawFormat : public SparsePageFormat<T> { public: bool Read(T* page, dmlc::SeekStream* fi) override { auto& offset_vec = page->offset.HostVector(); if (!fi->Read(&offset_vec)) { return false; } auto& data_vec = page->data.HostVector(); CHECK_NE(page->offset.Size(), 0U) << "Invalid SparsePage file"; data_vec.resize(offset_vec.back()); if (page->data.Size() != 0) { size_t n_bytes = fi->Read(dmlc::BeginPtr(data_vec), (page->data).Size() * sizeof(Entry)); CHECK_EQ(n_bytes, (page->data).Size() * sizeof(Entry)) << "Invalid SparsePage file"; } fi->Read(&page->base_rowid, sizeof(page->base_rowid)); return true; } size_t Write(const T& page, dmlc::Stream* fo) override { const auto& offset_vec = page.offset.HostVector(); const auto& data_vec = page.data.HostVector(); CHECK(page.offset.Size() != 0 && offset_vec[0] == 0); CHECK_EQ(offset_vec.back(), page.data.Size()); fo->Write(offset_vec); auto bytes = page.MemCostBytes(); bytes += sizeof(uint64_t); if (page.data.Size() != 0) { fo->Write(dmlc::BeginPtr(data_vec), page.data.Size() * sizeof(Entry)); } fo->Write(&page.base_rowid, sizeof(page.base_rowid)); bytes += sizeof(page.base_rowid); return bytes; } private: /*! \brief external memory column offset */ std::vector<size_t> disk_offset_; }; XGBOOST_REGISTER_SPARSE_PAGE_FORMAT(raw) .describe("Raw binary data format.") .set_body([]() { return new SparsePageRawFormat<SparsePage>(); }); XGBOOST_REGISTER_CSC_PAGE_FORMAT(raw) .describe("Raw binary data format.") .set_body([]() { return new SparsePageRawFormat<CSCPage>(); }); XGBOOST_REGISTER_SORTED_CSC_PAGE_FORMAT(raw) .describe("Raw binary data format.") .set_body([]() { return new SparsePageRawFormat<SortedCSCPage>(); }); } // namespace data } // namespace xgboost
C++
5
bclehmann/xgboost
src/data/sparse_page_raw_format.cc
[ "Apache-2.0" ]
#multiple-commits-selected { padding: 0; display: block; ul { margin-top: 0px; } .panel { height: 100%; text-align: left; } }
SCSS
2
testtas9812/desktop
app/styles/ui/history/_multiple_commits_selected.scss
[ "MIT" ]
// Copyright 2021 The Google Research Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "scann/utils/intrinsics/flags.h" #include "tensorflow/core/platform/cpu_info.h" ABSL_FLAG(bool, ignore_avx512, false, "Ignore the presence of AVX512 instructions when assigning " "function pointers at ScaNN startup. Useful for testing and " "debugging. NOTE: AVX512 support is currently experimental and " "therefore disabled by default."); ABSL_FLAG(bool, ignore_avx2, false, "Ignore the presence of AVX2/FMA instructions when assigning " "function pointers at ScaNN startup. Useful for testing and " "debugging."); ABSL_FLAG(bool, ignore_avx, false, "Ignore the presence of AVX and higher instructions when assigning " "function pointers at ScaNN startup. Useful for testing and " "debugging."); ABSL_RETIRED_FLAG(bool, ignore_sse4, false, "Ignore SSE4"); namespace research_scann { namespace flags_internal { bool should_use_sse4 = tensorflow::port::TestCPUFeature(tensorflow::port::SSE4_2); bool should_use_avx1 = tensorflow::port::TestCPUFeature(tensorflow::port::AVX); bool should_use_avx2 = tensorflow::port::TestCPUFeature(tensorflow::port::AVX2); bool should_use_avx512 = tensorflow::port::TestCPUFeature(tensorflow::port::AVX512F) && tensorflow::port::TestCPUFeature(tensorflow::port::AVX512DQ) && tensorflow::port::TestCPUFeature(tensorflow::port::AVX512BW); } // namespace flags_internal ScopedPlatformOverride::ScopedPlatformOverride(PlatformGeneration generation) { original_avx1_ = flags_internal::should_use_avx1; original_avx2_ = flags_internal::should_use_avx2; original_avx512_ = flags_internal::should_use_avx512; original_sse4_ = flags_internal::should_use_sse4; flags_internal::should_use_sse4 = false; flags_internal::should_use_avx1 = false; flags_internal::should_use_avx2 = false; flags_internal::should_use_avx512 = false; switch (generation) { case kSkylakeAvx512: flags_internal::should_use_avx512 = true; ABSL_FALLTHROUGH_INTENDED; case kHaswellAvx2: flags_internal::should_use_avx2 = true; ABSL_FALLTHROUGH_INTENDED; case kSandyBridgeAvx1: flags_internal::should_use_avx1 = true; ABSL_FALLTHROUGH_INTENDED; case kBaselineSse4: flags_internal::should_use_sse4 = true; break; case kFallbackForNonX86: break; default: LOG(FATAL) << "Unexpected Case: " << generation; } } ScopedPlatformOverride::~ScopedPlatformOverride() { flags_internal::should_use_avx1 = original_avx1_; flags_internal::should_use_avx2 = original_avx2_; flags_internal::should_use_avx512 = original_avx512_; flags_internal::should_use_sse4 = original_sse4_; } bool ScopedPlatformOverride::IsSupported() { if (flags_internal::should_use_avx512 && !(tensorflow::port::TestCPUFeature(tensorflow::port::AVX512F) && tensorflow::port::TestCPUFeature(tensorflow::port::AVX512DQ))) { LOG(WARNING) << "The CPU lacks AVX512 support! (skipping some tests)"; return false; } if (flags_internal::should_use_avx2 && !tensorflow::port::TestCPUFeature(tensorflow::port::AVX2)) { LOG(WARNING) << "The CPU lacks AVX2 support! (skipping some tests)"; return false; } if (flags_internal::should_use_avx1 && !tensorflow::port::TestCPUFeature(tensorflow::port::AVX)) { LOG(WARNING) << "The CPU lacks AVX1 support! (skipping some tests)"; return false; } if (flags_internal::should_use_sse4 && !tensorflow::port::TestCPUFeature(tensorflow::port::SSE4_2)) { LOG(WARNING) << "This CPU lacks SSE4.2 support! (skipping some tests)"; } return true; } ScopedPlatformOverride TestHookOverridePlatform(PlatformGeneration generation) { return ScopedPlatformOverride(generation); } } // namespace research_scann
C++
4
DionysisChristopoulos/google-research
scann/scann/utils/intrinsics/flags.cc
[ "Apache-2.0" ]
<!--- My Account ---> <cfoutput> #errorMessagesFor("user")# <div class="row"> <div class="col-md-9"> #startFormTag(route="updateaccount")# #includePartial("formparts/main")# #submitTag(value="Update My Details")# #endFormTag()# </div> <div class="col-md-3"> #panel(title="Change Password")# <cfif application.rbs.setting.isDemoMode> <em>Disabled in Demo Mode</em> <cfelse> #startFormTag(route="updatepassword")# #passwordFieldTag(name="password", label="Password", required=true)# #passwordFieldTag(name="passwordConfirmation", label="Confirm Password", required=true)# #submitTag(value="Update Password")# #endFormTag()# </cfif> #panelend()# </div> </div> </cfoutput>
ColdFusion
3
fintecheando/RoomBooking
views/users/myaccount.cfm
[ "Apache-1.1" ]
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon")); var _jsxRuntime = require("react/jsx-runtime"); var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", { d: "M19.56 11.36 13 8.44V7c0-.55-.45-1-1-1s-1-.45-1-1 .45-1 1-1 1 .45 1 1h2c0-1.84-1.66-3.3-3.56-2.95-1.18.22-2.15 1.17-2.38 2.35-.3 1.56.6 2.94 1.94 3.42v.63l-6.56 2.92c-.88.38-1.44 1.25-1.44 2.2v.01C3 14.92 4.08 16 5.42 16H7v6h10v-6h1.58c1.34 0 2.42-1.08 2.42-2.42v-.01c0-.95-.56-1.82-1.44-2.21zM15 20H9v-5h6v5zm3.58-6H17v-1H7v1H5.42c-.46 0-.58-.65-.17-.81l6.75-3 6.75 3c.42.19.28.81-.17.81z" }), 'DryCleaningOutlined'); exports.default = _default;
JavaScript
4
good-gym/material-ui
packages/material-ui-icons/lib/DryCleaningOutlined.js
[ "MIT" ]
import chalk from 'next/dist/compiled/chalk' import os from 'os' import path from 'path' import { FatalError } from '../fatal-error' import isError from '../is-error' export async function getTypeScriptConfiguration( ts: typeof import('typescript'), tsConfigPath: string, metaOnly?: boolean ): Promise<import('typescript').ParsedCommandLine> { try { const formatDiagnosticsHost: import('typescript').FormatDiagnosticsHost = { getCanonicalFileName: (fileName: string) => fileName, getCurrentDirectory: ts.sys.getCurrentDirectory, getNewLine: () => os.EOL, } const { config, error } = ts.readConfigFile(tsConfigPath, ts.sys.readFile) if (error) { throw new FatalError(ts.formatDiagnostic(error, formatDiagnosticsHost)) } let configToParse: any = config const result = ts.parseJsonConfigFileContent( configToParse, // When only interested in meta info, // avoid enumerating all files (for performance reasons) metaOnly ? { ...ts.sys, readDirectory(_path, extensions, _excludes, _includes, _depth) { return [extensions ? `file${extensions[0]}` : `file.ts`] }, } : ts.sys, path.dirname(tsConfigPath) ) if (result.errors) { result.errors = result.errors.filter( ({ code }) => // No inputs were found in config file code !== 18003 ) } if (result.errors?.length) { throw new FatalError( ts.formatDiagnostic(result.errors[0], formatDiagnosticsHost) ) } return result } catch (err) { if (isError(err) && err.name === 'SyntaxError') { const reason = '\n' + (err.message ?? '') throw new FatalError( chalk.red.bold( 'Could not parse', chalk.cyan('tsconfig.json') + '.' + ' Please make sure it contains syntactically correct JSON.' ) + reason ) } throw err } }
TypeScript
5
blomqma/next.js
packages/next/lib/typescript/getTypeScriptConfiguration.ts
[ "MIT" ]
target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64" target triple = "armv7em-none-eabi" declare void @foo() define void @bar() section ".text.bar" { ret void }
LLVM
2
ybkimm/tinygo
transform/testdata/globals-function-sections.out.ll
[ "Apache-2.0" ]
#!/usr/bin/env bash function incompatible_function() { : } compatible_function() { if ! [ "$1" == "yes" ] then return 3;:; fi ( exec 3>&1 echo "finished! $@? $*." >&3 \ | cat | bat - | cat exit 4 ) || exit $? } if command -v bat &> /dev/null; then var=1 printf "%s...\n" "$(echo some text)" while true; do echo $var if { [[ "$var" -eq 1 && ( true || false ) ]] || false 2>&1 1> /dev/null; } &> /dev/null; then var="$(cat <<< "two")" continue 1 fi case "$var" in "two") var="three" ;; three) var="four" ;; fo*r) var=five ;; "fi"ve) var="$( cat << END six > $var END )" ;; $'six\n' | *six*) echo "?" seven=seven while read -r line do var="$line" done << "HEREDOC" 1 2 $seven HEREDOC ;; *'sev'*) export var=eight unset var ;; '') { incompatible_function && false; } || compatible_function "yes" break ;; esac continue done fi
Shell
3
JesseVermeulen123/bat
tests/syntax-tests/source/Bash/simple.sh
[ "Apache-2.0", "MIT" ]
let $auction := doc("auction.xml") return for $b in $auction/site/regions//item let $k := $b/name/text() order by zero-or-one($b/location) ascending return <item name="{$k}">{$b/location/text()}</item>
XQuery
4
santoshkumarkannur/sirix
bundles/sirix-xquery/src/test/resources/xmark/queries/fndoc/q19.xq
[ "BSD-3-Clause" ]
(ns fdb.storage) (defprotocol Storage (get-entity [storage e-id] ) (write-entity [storage entity]) (drop-entity [storage entity])) (defrecord InMemory [] Storage (get-entity [storage e-id] (e-id storage)) (write-entity [storage entity] (assoc storage (:id entity) entity)) (drop-entity [storage entity] (dissoc storage (:id entity))))
Clojure
4
choosewhatulike/500lines
functionalDB/code/fdb/storage.clj
[ "CC-BY-3.0" ]
fn main() { assert_eq!(10u64, 10usize); //~ ERROR mismatched types }
Rust
3
Eric-Arellano/rust
src/test/ui/suggestions/dont-suggest-try_into-in-macros.rs
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
class ProxyStatus { constructor(status) { this.name = status.name this.type = status.type this.status = status.status this.err = status.err this.local_addr = status.local_addr this.plugin = status.plugin this.remote_addr = status.remote_addr } } export {ProxyStatus}
JavaScript
3
Icarus0xff/frp
web/frpc/src/utils/status.js
[ "Apache-2.0" ]
package com.baeldung.overrideproperties.resolver; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @Component public class PropertySourceResolver { private final String firstProperty; private final String secondProperty; public PropertySourceResolver(@Value("${example.firstProperty}") String firstProperty, @Value("${example.secondProperty}") String secondProperty) { this.firstProperty = firstProperty; this.secondProperty = secondProperty; } public String getFirstProperty() { return firstProperty; } public String getSecondProperty() { return secondProperty; } }
Java
4
DBatOWL/tutorials
testing-modules/spring-testing/src/main/java/com/baeldung/overrideproperties/resolver/PropertySourceResolver.java
[ "MIT" ]
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # DSC MOF Compilation # DSC Configuration() script that: # Defines base configuration users, groups, settings # Uses PS function to set package configuration (ensure=Present) for an array of packages # Probes for the existence of a package (Apache or MySQL) and conditionally configures the workload. I.e., if Apache is installed, configure Apache settings # Demo execution: # Show the .ps1 # Run the .ps1 to generate a MOF # Apply the MOF locally with Start-DSCConfiguration # Show the newly configured state
PowerShell
4
dahlia/PowerShell
demos/dsc.ps1
[ "MIT" ]
0 reg32_t "dword" 1 code_t "proc*" 2 num32_t "int" 3 uint32_t "size_t" 4 ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(struct(0:num32_t,4:ptr(reg8_t),8:ptr(reg8_t),12:ptr(reg8_t),16:ptr(reg8_t),20:ptr(reg8_t),24:ptr(reg8_t),28:ptr(reg8_t),32:ptr(reg8_t),36:ptr(reg8_t),40:ptr(reg8_t),44:ptr(reg8_t),48:ptr(TOP),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),8:num32_t)),52:ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(TOP),8:num32_t)),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))) "FILE*" 5 ptr(num8_t) "char*" 6 ptr(TOP) "void*" 7 ptr(reg8_t) "byte[]" 8 num8_t "char" 9 ptr(array(reg8_t,16)) "unknown_128*" 10 ptr(array(reg8_t,56)) "unknown_448*" 11 ptr(array(reg8_t,119)) "unknown_952*" 12 ptr(array(reg8_t,42)) "unknown_336*" 13 ptr(reg32_t) "dword*" 14 union(ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(struct(0:num32_t,4:ptr(reg8_t),8:ptr(reg8_t),12:ptr(reg8_t),16:ptr(reg8_t),20:ptr(reg8_t),24:ptr(reg8_t),28:ptr(reg8_t),32:ptr(reg8_t),36:ptr(reg8_t),40:ptr(reg8_t),44:ptr(reg8_t),48:ptr(TOP),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(reg8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(reg8_t,40))),8:num32_t)),52:ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(TOP),8:num32_t)),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(TOP),8:num32_t)),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40)))) "Union_0" 15 ptr(num32_t) "int*" 16 ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(TOP),8:num32_t)),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))) "_IO_FILE*" 5 ptr(num8_t) "char[]" 17 ptr(struct(0:num32_t,4:ptr(ptr(num8_t)),4294967292:reg32_t)) "Struct_2*" 18 ptr(struct(0:ptr(num8_t),4:num32_t,8:ptr(num32_t),12:num32_t)) "option*" 19 ptr(ptr(num8_t)) "char**" 20 ptr(struct(0:reg32_t,40:ptr(num8_t),44:ptr(num8_t))) "Struct_1*" 3 uint32_t "unsigned int" 21 ptr(uint32_t) "size_t*" 22 ptr(struct(0:reg32_t,4:ptr(TOP))) "Struct_0*" 23 ptr(struct(0:num32_t,4:reg32_t,40:ptr(num8_t),44:ptr(num8_t))) "Struct_7*" 24 reg64_t "qword" 25 int32_t "signed int" 26 ptr(struct(0:array(reg8_t,18),18:num8_t)) "StructFrag_1*" 27 ptr(struct(0:array(reg8_t,3),3:num8_t)) "StructFrag_11*" 21 ptr(uint32_t) "unsigned int*" 28 ptr(ptr(uint16_t)) "unsigned short**" 29 ptr(struct(0:reg64_t,8:num8_t)) "StructFrag_9*" 30 ptr(ptr(TOP)) "void**" 13 ptr(reg32_t) "dword[]" 31 ptr(struct(0:num32_t,4:uint32_t,40:ptr(num8_t),44:ptr(num8_t))) "Struct_10*" 32 ptr(struct(0:num32_t,40:ptr(num8_t),44:ptr(num8_t))) "Struct_9*" 33 ptr(reg16_t) "word[]" 34 ptr(struct(0:array(reg8_t,51594),51594:reg32_t)) "StructFrag_4*" 35 ptr(struct(0:array(reg8_t,536870908),4294967292:reg32_t)) "StructFrag_5*" 36 ptr(struct(0:array(reg8_t,28284),28284:reg32_t)) "StructFrag_7*" 37 ptr(struct(0:array(reg8_t,456),456:reg32_t)) "StructFrag_8*" 38 ptr(struct(0:uint32_t,4:ptr(TOP))) "Struct_8*" 39 ptr(uint16_t) "unsigned short*" 40 ptr(struct(0:reg64_t,8:uint32_t)) "StructFrag_10*" 41 array(reg8_t,4096) "unknown_32768" 42 array(reg8_t,135168) "unknown_1081344" 43 array(reg8_t,30) "unknown_240" 44 array(reg8_t,5) "unknown_40" 45 array(reg8_t,29) "unknown_232" 46 array(reg8_t,16) "unknown_128" 47 array(reg8_t,119) "unknown_952" 48 array(reg8_t,63) "unknown_504" 49 array(reg8_t,26) "unknown_208" 50 array(reg8_t,18) "unknown_144" 51 array(reg8_t,24) "unknown_192" 52 array(reg8_t,38) "unknown_304" 53 array(reg8_t,10) "unknown_80" 54 array(reg8_t,78) "unknown_624" 55 array(reg8_t,19) "unknown_152" 56 array(reg8_t,9) "unknown_72" 57 array(reg8_t,28) "unknown_224" 58 array(reg8_t,7) "unknown_56" 59 array(reg8_t,25) "unknown_200" 60 array(reg8_t,41) "unknown_328" 61 array(reg8_t,14) "unknown_112" 62 array(reg8_t,15) "unknown_120" 63 array(reg8_t,51) "unknown_408" 64 array(reg8_t,13) "unknown_104" 65 array(reg8_t,32) "unknown_256" 66 array(reg8_t,27) "unknown_216" 67 array(reg8_t,52) "unknown_416" 68 array(reg8_t,57) "unknown_456" 69 array(reg8_t,204) "unknown_1632" 70 array(reg8_t,53) "unknown_424" 71 array(reg8_t,42) "unknown_336" 72 array(reg8_t,66) "unknown_528" 73 array(reg8_t,11) "unknown_88" 74 array(reg8_t,20) "unknown_160" 75 reg16_t "word" 76 array(reg8_t,109) "unknown_872" 77 array(reg8_t,31) "unknown_248" 78 array(reg8_t,33) "unknown_264" 79 array(reg8_t,45) "unknown_360" 80 array(reg8_t,39) "unknown_312" 81 array(reg8_t,80) "unknown_640" 82 array(reg8_t,96) "unknown_768" 83 array(reg8_t,112) "unknown_896" 84 array(reg8_t,62) "unknown_496" 85 array(reg8_t,74) "unknown_592" 86 array(reg8_t,3) "unknown_24" 87 array(reg8_t,17) "unknown_136" 88 array(reg8_t,47) "unknown_376" 89 array(reg8_t,22) "unknown_176" 90 array(reg8_t,21) "unknown_168" 91 array(reg8_t,44) "unknown_352" 92 array(reg8_t,34) "unknown_272" 93 array(reg8_t,90) "unknown_720" 94 array(reg8_t,6) "unknown_48" 95 array(reg8_t,23) "unknown_184" 96 array(reg8_t,37) "unknown_296" 97 array(reg8_t,87) "unknown_696" 98 array(reg8_t,162) "unknown_1296" 99 array(reg8_t,48) "unknown_384" 100 array(reg8_t,176) "unknown_1408" 101 array(reg8_t,160) "unknown_1280" 102 array(reg8_t,61) "unknown_488" 103 array(reg8_t,83) "unknown_664" 104 array(reg8_t,12) "unknown_96" 105 array(reg8_t,60) "unknown_480" 106 array(reg8_t,65) "unknown_520" 107 array(reg8_t,36) "unknown_288" 108 array(reg8_t,56) "unknown_448" 109 array(reg8_t,64) "unknown_512" 110 array(reg8_t,43) "unknown_344" 111 array(reg8_t,108) "unknown_864" 112 array(reg8_t,147) "unknown_1176" 113 array(reg8_t,71) "unknown_568" 114 array(reg8_t,72) "unknown_576" 115 array(num8_t,39) "char[39]" 116 array(num8_t,362) "char[362]" 117 array(num8_t,299) "char[299]" 118 array(num8_t,45) "char[45]" 119 array(num8_t,54) "char[54]" 120 array(num8_t,69) "char[69]" 121 array(num8_t,65) "char[65]" 122 array(num8_t,87) "char[87]" 123 array(num8_t,23) "char[23]" 124 array(num8_t,30) "char[30]" 125 array(num8_t,10) "char[10]" 126 array(num8_t,4) "char[4]" 127 array(num8_t,5) "char[5]" 128 array(num8_t,16) "char[16]" 129 array(num8_t,17) "char[17]" 130 struct(0:ptr(num8_t),4:num32_t,8:ptr(num32_t),12:num32_t) "option" 131 array(reg8_t,208) "unknown_1664" 132 array(num8_t,12) "char[12]" 133 array(num8_t,7) "char[7]" 134 array(num8_t,56) "char[56]" 135 array(num8_t,8) "char[8]" 136 array(num8_t,3) "char[3]" 137 array(num8_t,2) "char[2]" 138 array(reg32_t,9) "dword[9]" 139 array(reg32_t,127) "dword[127]" 140 array(reg32_t,34) "dword[34]" 141 array(num8_t,28) "char[28]" 142 array(num8_t,21) "char[21]" 143 array(num8_t,22) "char[22]" 144 array(num8_t,20) "char[20]" 145 array(num8_t,203) "char[203]" 146 array(num8_t,32) "char[32]" 147 array(num8_t,36) "char[36]" 148 array(num8_t,40) "char[40]" 149 array(num8_t,44) "char[44]" 150 array(num8_t,48) "char[48]" 151 array(num8_t,52) "char[52]" 152 array(num8_t,60) "char[60]" 153 array(num8_t,64) "char[64]" 154 array(ptr(TOP),10) "void*[10]" 155 array(num8_t,47) "char[47]" 156 array(num8_t,6) "char[6]" 157 array(num8_t,78) "char[78]" 158 array(reg8_t,588) "unknown_4704" 159 array(reg8_t,4800) "unknown_38400" 160 array(reg8_t,4488) "unknown_35904" 1 code_t "(void -?-> dword)*" 161 array(reg8_t,232) "unknown_1856" 162 ptr(struct(0:reg16_t,2:num8_t)) "StructFrag_0*" 163 array(reg8_t,256) "unknown_2048"
BlitzBasic
0
matt-noonan/retypd-data
data/uname.decls
[ "MIT" ]
variable "region" { description = "Azure region" type = string } variable "validator_name" { description = "Name of the validator node owner" type = string } variable "zone_name" { description = "Zone name of Azure DNS domain to create records in" default = "" } variable "zone_resource_group" { description = "Azure resource group name of the DNS zone" default = "" } variable "record_name" { description = "DNS record name to use (<workspace> is replaced with the TF workspace name)" default = "<workspace>.diem" } variable "helm_chart" { description = "Path to diem-validator Helm chart file" default = "../helm" } variable "helm_values" { description = "Map of values to pass to Helm" type = any default = {} } variable "helm_values_file" { description = "Path to file containing values for Helm chart" default = "" } variable "helm_force_update" { description = "Force Terraform to update the Helm deployment" default = false } variable "k8s_api_sources" { description = "List of CIDR subnets which can access the Kubernetes API endpoint" default = ["0.0.0.0/0"] } variable "ssh_sources_ipv4" { description = "List of CIDR subnets which can SSH to the bastion host" default = ["0.0.0.0/0"] } variable "bastion_enable" { default = false description = "Enable the bastion host for access to Vault" } variable "vault_num" { default = 1 description = "Number of Vault servers" } variable "node_pool_sizes" { type = map(number) default = {} description = "Override the number of nodes in the specified pool" } variable "backup_replication_type" { default = "ZRS" description = "Replication type of backup storage account" } variable "backup_public_access" { default = false description = "Allow public access to download backups" } variable "k8s_viewer_groups" { description = "List of AD Group IDs to configure as Kubernetes viewers" type = list(string) default = [] } variable "k8s_debugger_groups" { description = "List of AD Group IDs to configure as Kubernetes debuggers" type = list(string) default = [] } variable "key_vault_owner_id" { default = null description = "Object ID of the key vault owner (defaults to current Azure client)" } variable "use_kube_state_metrics" { default = false description = "Use kube-state-metrics to monitor k8s cluster" }
HCL
4
PragmaTwice/diem
terraform/validator/azure/variables.tf
[ "Apache-2.0" ]
"""Tests for the Tailscale integration."""
Python
0
MrDelik/core
tests/components/tailscale/__init__.py
[ "Apache-2.0" ]
var fprintf; var fputs; include "stdlib.sl"; include "sys.sl"; include "xprintf.sl"; include "xscanf.sl"; var fgetc = func(fd) { var ch; var n = read(fd, &ch, 1); if (n == 0) return EOF; if (n < 0) return n; return ch; }; var fputc = func(fd, ch) { return write(fd,&ch,1); }; var getchar = func() { var ch = fgetc(0); if (ch < 0) return EOF; # collapse all types of error to "EOF" return ch; }; var putchar = func(ch) return fputc(1, ch); # read at most size-1 characters into s, and terminate with a 0 # return s if any chars were read # return 0 if EOF was reached with no chars var fgets = func(fd, s, size) { var ch = 0; var len = 0; while (ch >= 0 && ch != '\n' && len < size) { ch = fgetc(fd); if (ch >= 0) s[len++] = ch; }; if (ch < 0 && len == 0) return 0; s[len] = 0; return s; }; # take a pointer to a nul-terminated string, and print it fputs = func(fd, s) { var ss = s; var len = 0; while (*ss++) len++; write(fd,s,len); }; var gets = func(s,size) return fgets(0,s,size); var puts = func(s) return fputs(1,s); var fprintf_fd; fprintf = func(fd, fmt, args) { fprintf_fd = fd; return xprintf(fmt, args, func(ch) { fputc(fprintf_fd, ch) }); }; var printf = func(fmt, args) return xprintf(fmt, args, putchar); var fscanf_fd; var fscanf = func(fd, fmt, args) { fscanf_fd = fd; return xscanf(fmt, args, func() { return fgetc(fscanf_fd) }); }; var scanf = func(fmt, args) return xscanf(fmt, args, getchar); # return a pointer to a static buffer containing the string "/tmp/tmpfileXX", # with X's changed to digits, naming a file that did not previously exist; # also, create the (empty) file # in the event that creating the file fails (e.g. the system is out of fds), exit(256) # TODO: [nice] use application-specific names instead of always "tmpfile" var tmpnam_buf = "/tmp/tmpfileXX"; var tmpnam_x = tmpnam_buf+12; # address of first "X" var tmpnam = func() { var ok = 0; # search for an unused name var y = 0; var x; var n; var statbuf = [0,0,0,0]; while (y < 10 && !ok) { *tmpnam_x = y+'0'; x = 0; while (x < 10 && !ok) { tmpnam_x[1] = x+'0'; n = stat(tmpnam_buf, statbuf); if (n == NOTFOUND) ok=1; x++; }; y++; }; # create the file mkdir("/tmp"); # just in case var fd = open(tmpnam_buf, O_WRITE|O_CREAT); if (fd < 0) { fputs(2, "tmpnam: %s: %s\n", [tmpnam_buf, strerror(fd)]); exit(256); }; close(fd); return tmpnam_buf; }; var assert = func(true, fmt, args) { if (!true) { fprintf(2, fmt, args); exit(1); }; };
Slash
5
jes/scamp-cpu
sys/lib/stdio.sl
[ "Unlicense" ]
{- Alertmanager API API of the Prometheus Alertmanager (https://github.com/prometheus/alertmanager) OpenAPI spec version: 0.0.1 NOTE: This file is auto generated by the openapi-generator. https://github.com/openapitools/openapi-generator.git Do not edit this file manually. -} module Data.Alert exposing (Alert(..), decoder, encoder) import Dict exposing (Dict) import Json.Decode as Decode exposing (Decoder) import Json.Decode.Pipeline exposing (optional, required) import Json.Encode as Encode type alias Alert = { labels : Dict String String , generatorURL : Maybe String } decoder : Decoder Alert decoder = Decode.succeed Alert |> required "labels" (Decode.dict Decode.string) |> optional "generatorURL" (Decode.nullable Decode.string) Nothing encoder : Alert -> Encode.Value encoder model = Encode.object [ ( "labels", Encode.dict identity Encode.string model.labels ) , ( "generatorURL", Maybe.withDefault Encode.null (Maybe.map Encode.string model.generatorURL) ) ]
Elm
5
jtlisi/alertmanager
ui/app/src/Data/Alert.elm
[ "ECL-2.0", "Apache-2.0" ]
(: Query for searching the database for keywords :) import module namespace index = "http://guide.com/index"; import module namespace catalog = "http://guide.com/catalog"; import module namespace req = "http://www.28msec.com/modules/http-request"; variable $phrase := (req:param-values("q"), "London")[1]; variable $limit := integer((req:param-values("limit"), 5)[1]); [ for $result at $idx in index:index-search($phrase) where $idx le $limit let $data := catalog:get-data-by-id($result.s, $result.p) return {| { score : $result.r } , $data |} ]
JSONiq
3
JavascriptID/sourcerer-app
src/test/resources/samples/langs/JSONiq/query.jq
[ "MIT" ]
package io.lattekit.template import io.lattekit.parser.LatteClass import io.lattekit.parser.LatteFile import io.lattekit.parser.NativeCode import io.lattekit.parser.XmlTag import io.lattekit.parser.LayoutNode import io.lattekit.parser.Prop import io.lattekit.parser.PropSetter /** * Created by maan on 4/2/16. */ class KotlinTemplate { def renderClass(LatteClass cls, LatteFile file) ''' package «file.packageName»; «IF !file.imports.contains("io.lattekit.Latte")» import io.lattekit.Latte; «ENDIF» «FOR importCls : file.imports» import «importCls» «ENDFOR» class «cls.classNameImpl» : «cls.className»() { «FOR layoutFn: cls.layoutFunctions» override fun «layoutFn.functionName»«layoutFn.functionParams» { «FOR child : layoutFn.children» «renderLayoutNode(child)» «ENDFOR» } «ENDFOR» } ''' def renderLayoutNode(LayoutNode node) { if (node instanceof NativeCode) { return (node as NativeCode).code } else { var xmlNode = node as XmlTag; if (xmlNode.isNativeView) { return renderNativeNode(xmlNode); } else { return renderVirtualNode(xmlNode); } } } def renderPropOptions(XmlTag node) '''mutableMapOf(«FOR prop : node.props SEPARATOR ','» "«prop.propName»" to «IF prop.propModifier == "@"»Latte.PropOption.WAIT_LAYOUT«ELSE»Latte.PropOption.NO_OPTIONS«ENDIF»«ENDFOR»)''' def renderVirtualNode(XmlTag node) ''' __current.addChild(Latte.create(this, Latte.lookupClass("«node.tagName»"), «renderPropsMap(node)», «renderPropOptions(node)», { __it : LatteView -> «FOR child : node.children» __current = __it; «renderLayoutNode(child)» «ENDFOR» })) ''' def renderNativeNode(XmlTag node) ''' __current.addChild(Latte.createNative(this,«node.viewClass.name»::class.java, «renderPropsMap(node)», «renderPropOptions(node)», { __viewWrapper, __lprops -> var __view = __viewWrapper.androidView as «node.viewClass.name» var __acceptedProps = mutableListOf<String>(); __lprops.forEach { var __propKey = it.key; var __propValue = it.value; var __valueAccepted = false; «FOR prop : node.props» «renderPropSetters(prop)» «ENDFOR» if (__valueAccepted) { __acceptedProps.add(__propKey); } } __acceptedProps }, { __it : LatteView -> «FOR child : node.children» __current = __it; «renderLayoutNode(child)» «ENDFOR» })) ''' def renderPropSetters(Prop prop) ''' «IF !prop.propSetters.empty» if (__propKey == "«prop.propName»") { «FOR propSetter : prop.propSetters» «IF prop.isListenerProp» if (__propValue is «propSetter.kotlinTypeName») { __view.«propSetter.setterMethod.name»(__propValue); } else { var __listener = Latte.createLambdaProxyInstance(«propSetter.kotlinTypeName»::class.java, __propValue as Object) as «propSetter.kotlinTypeName» __view.«propSetter.setterMethod.name»(__listener); } «ELSE» if (!__valueAccepted && __propValue is «propSetter.kotlinTypeName»«IF !propSetter.primitiveType»?«ENDIF» ) { «IF propSetter.hasGetter» var __currentValue = if (__view.«propSetter.getterMethod.name»() != null) __view.«propSetter.getterMethod.name»()«IF propSetter.getterMethod.returnType.simpleName == "CharSequence"».toString()«ENDIF» else null; «ENDIF» «IF propSetter.hasGetter»if (__currentValue != __propValue) {«ENDIF» __view.«propSetter.setterMethod.name»(__propValue as «propSetter.kotlinTypeName»«IF !propSetter.primitiveType»?«ENDIF»); __valueAccepted = true; «IF propSetter.hasGetter»}«ENDIF» } «IF propSetter.isPrimitiveType && !prop.hasStringSetter» else if (!__valueAccepted && __propValue != null && __propValue is String) { try { var castValue = __propValue.to«propSetter.kotlinTypeName»(); «IF propSetter.hasGetter» var __currentValue = if (__view.«propSetter.getterMethod.name»() != null) __view.«propSetter.getterMethod.name»()«IF propSetter.getterMethod.returnType.simpleName == "CharSequence"».toString()«ENDIF» else null; if (__currentValue != castValue) { __view.«propSetter.setterMethod.name»(castValue); } «ELSE» __view.«propSetter.setterMethod.name»(castValue); «ENDIF» __valueAccepted = true; } catch (e : Exception) {} } «ENDIF» «ENDIF» «ENDFOR» } «ENDIF» ''' def renderPropSetterInvocation(PropSetter propSetter, Prop prop) ''' ''' def getPropValue(Prop prop) { if (prop.valueType == Prop.ValueType.RESOURCE_REF) { return '''«prop.resourcePackage».R.«prop.resourceType».«prop.resourceName»''' } else if (prop.valueType == Prop.ValueType.LITERAL){ return prop.value } else { return "("+prop.value+")" } } def renderPropsMap(XmlTag node) '''mutableMapOf(«FOR prop : node.props SEPARATOR ","»"«prop.propName»" to «getPropValue(prop)»«ENDFOR»)''' def getKotlinTypeName(PropSetter propSetter) { if (propSetter.paramType.name == "java.lang.CharSequence") { return "CharSequence" } else if (propSetter.paramType.isPrimitive) { return propSetter.paramType.name.substring(0,1).toUpperCase() + propSetter.paramType.name.substring(1) } else { return propSetter.paramType.name.replaceAll("\\$",".") } } }
Xtend
4
maannajjar/lattek
gradle-plugin/src/main/java/io/lattekit/template/KotlinTemplate.xtend
[ "Unlicense", "MIT" ]
#include <algorithm> #include "caffe2/core/context_gpu.h" #include "caffe2/operators/boolean_unmask_ops.h" namespace caffe2 { namespace { __global__ void ComputeIndicesKernel( const int numMasks, const int maskSize, int* indices, bool* const masks[]) { CUDA_1D_KERNEL_LOOP(i, maskSize) { for (int j = 0; j < numMasks; ++j) { if (masks[j][i]) { indices[i] = j; return; } } CUDA_KERNEL_ASSERT(false); } } __global__ void FillValuesKernel( const int numMasks, const int maskSize, const size_t itemSize, const int* indices, char* const values[], int* valueSizes, char* dest) { CUDA_1D_KERNEL_LOOP(j, numMasks) { int k = 0; for (int i = 0; i < maskSize; ++i) { if (indices[i] == j) { for (int h = 0; h < itemSize; ++h) { dest[i * itemSize + h] = values[j][k * itemSize + h]; } ++k; } } CUDA_KERNEL_ASSERT(valueSizes[j] == k); } } } // namespace template <> class BooleanUnmaskOp<CUDAContext> final : public Operator<CUDAContext> { public: BooleanUnmaskOp(const OperatorDef& def, Workspace* ws) : Operator<CUDAContext>(def, ws) {} bool RunOnDevice() override { int maskSize = Input(0).numel(); int numMasks = InputSize() / 2; const auto& meta = Input(1).meta(); auto* out = Output(0); out->Resize(maskSize); auto* dest = (char*)out->raw_mutable_data(meta); ReinitializeTensor(&hostMasks_, {numMasks}, at::dtype<bool*>().device(CPU)); auto* hostMasksData = hostMasks_.mutable_data<bool*>(); ReinitializeTensor( &hostValues_, {numMasks}, at::dtype<char*>().device(CPU)); auto* hostValuesData = hostValues_.mutable_data<char*>(); ReinitializeTensor( &hostValueSizes_, {numMasks}, at::dtype<int>().device(CPU)); auto* hostValueSizesData = hostValueSizes_.mutable_data<int>(); for (int i = 0; i < numMasks; ++i) { auto& mask = Input(i * 2); CAFFE_ENFORCE_EQ(mask.dim(), 1); CAFFE_ENFORCE_EQ(mask.numel(), maskSize); hostMasksData[i] = const_cast<bool*>(mask.data<bool>()); const auto& value = Input(i * 2 + 1); CAFFE_ENFORCE_EQ(value.dim(), 1); hostValuesData[i] = (char*)value.raw_data(); hostValueSizesData[i] = value.numel(); } masks_.CopyFrom(hostMasks_); values_.CopyFrom(hostValues_); valueSizes_.CopyFrom(hostValueSizes_); ReinitializeTensor(&indices_, {maskSize}, at::dtype<int>().device(CUDA)); auto* indicesData = indices_.mutable_data<int>(); ComputeIndicesKernel<<< std::min(maskSize, CAFFE_MAXIMUM_NUM_BLOCKS), CAFFE_CUDA_NUM_THREADS, 0, context_.cuda_stream()>>>( numMasks, maskSize, indicesData, masks_.data<bool*>()); C10_CUDA_KERNEL_LAUNCH_CHECK(); auto* valueSizesData = valueSizes_.mutable_data<int>(); FillValuesKernel<<< std::min(numMasks, CAFFE_MAXIMUM_NUM_BLOCKS), CAFFE_CUDA_NUM_THREADS, 0, context_.cuda_stream()>>>( numMasks, maskSize, meta.itemsize(), indicesData, values_.data<char*>(), valueSizesData, dest); C10_CUDA_KERNEL_LAUNCH_CHECK(); return true; } private: Tensor indices_; Tensor masks_{CUDA}; Tensor values_{CUDA}; Tensor valueSizes_{CUDA}; Tensor hostMasks_; Tensor hostValues_; Tensor hostValueSizes_; }; REGISTER_CUDA_OPERATOR(BooleanUnmask, BooleanUnmaskOp<CUDAContext>); } // caffe2
Cuda
3
Hacky-DH/pytorch
caffe2/operators/boolean_unmask_ops.cu
[ "Intel" ]
REBOL [ Title: "Red run time error test script" Author: "Peter W A Wood" File: %run-time-error-test.r Rights: "Copyright (C) 2011-2015 Peter W A Wood. All rights reserved." License: "BSD-3 - https://github.com/red/red/blob/origin/BSD-3-License.txt" ] ~~~start-file~~~ "Red run time errors" --test-- "rte-1" --compile-and-run-this/error {Red[] i: 1 j: 0 k: i / j} --assert-red-printed? "*** Math error: attempt to divide by zero" --test-- "rte-2" --compile-and-run-this/error {Red[] absolute -2147483648} --assert-red-printed? "*** Math error: math or number overflow" --test-- "rte-3" --compile-and-run-this/error {Red[] #"^^(01)" + #"^^(10FFFF)"} --assert-red-printed? "*** Math Error: math or number overflow" --test-- "rte-4" --compile-and-run-this/error {Red[] do [#"^^(01)" + #"^^(10FFFF)"]} --assert-red-printed? "*** Math Error: math or number overflow" --test-- "rte-5" --compile-and-run-this/error {Red[] #"^^(00)" - #"^^(01)"} --assert-red-printed? "*** Math Error: math or number overflow" --test-- "rte-6" --compile-and-run-this/error {Red[] do [#"^^(00)" - #"^^(01)"]} --assert-red-printed? "*** Math Error: math or number overflow" --test-- "rte-7" --compile-and-run-this/error {Red[] #"^^(010FFF)" * #"^^(11)"} --assert-red-printed? "*** Math Error: math or number overflow" --test-- "rte-8" --compile-and-run-this/error {Red[] do [#"^^(010FFF)" * #"^^(11)" ]} --assert-red-printed? "*** Math Error: math or number overflow" --test-- "stack-trace-1" --compile-and-run-this/error {Red[] do { system/state/stack-trace: 1 a: object [af: does [b/bf]] b: object [bf: does [cf]] c: object [set 'system/words/cf does [df] cf: none] d: object [set 'df does [ff]] ff: does [ gf: does [do make error! "error"] gf ] a/af } } --assert-red-printed? "*** Stack: af bf cf df ff gf" ~~~end-file~~~
R
4
GalenIvanov/red
tests/source/compiler/run-time-error-test.r
[ "BSL-1.0", "BSD-3-Clause" ]
library ieee; use IEEE.STD_LOGIC_1164.all; use ieee.numeric_std.all; library STD; use STD.textio.all; entity tb is end tb; architecture beh of tb is component simple port ( CLK, RESET : in std_ulogic; DATA_OUT : out std_ulogic_vector(7 downto 0); DONE_OUT : out std_ulogic ); end component; signal data : std_ulogic_vector(7 downto 0) := "00100000"; signal clk : std_ulogic; signal RESET : std_ulogic := '0'; signal done : std_ulogic := '0'; signal cyclecount : integer := 0; constant cycle_time_c : time := 200 ms; constant maxcycles : integer := 100; begin simple1 : simple port map ( CLK => clk, RESET => RESET, DATA_OUT => data, DONE_OUT => done ); clk_process : process begin clk <= '0'; wait for cycle_time_c/2; clk <= '1'; wait for cycle_time_c/2; end process; count_process : process(CLK) begin if (CLK'event and CLK ='1') then if (RESET = '1') then cyclecount <= 0; else cyclecount <= cyclecount + 1; end if; end if; end process; test : process begin RESET <= '1'; wait until (clk'event and clk='1'); wait until (clk'event and clk='1'); RESET <= '0'; wait until (clk'event and clk='1'); for cyclecnt in 1 to maxcycles loop exit when done = '1'; wait until (clk'event and clk='1'); report integer'image(to_integer(unsigned(data))); end loop; wait until (clk'event and clk='1'); report "All tests passed." severity NOTE; wait; end process; end beh;
VHDL
5
arjix/nixpkgs
pkgs/development/compilers/ghdl/simple-tb.vhd
[ "MIT" ]
-- name: create-table-org-secrets CREATE TABLE IF NOT EXISTS orgsecrets ( secret_id INTEGER PRIMARY KEY AUTOINCREMENT ,secret_namespace TEXT COLLATE NOCASE ,secret_name TEXT COLLATE NOCASE ,secret_type TEXT ,secret_data BLOB ,secret_pull_request BOOLEAN ,secret_pull_request_push BOOLEAN ,UNIQUE(secret_namespace, secret_name) );
SQL
3
sthagen/drone-drone
store/shared/migrate/sqlite/files/012_create_table_org_secrets.sql
[ "Apache-2.0" ]
// run-rustfix #![allow(dead_code, unused_variables)] pub mod foo { #[derive(Default)] pub struct Foo { invisible: bool, } #[derive(Default)] pub struct Bar { pub visible: bool, invisible: bool, } } fn main() { let foo::Foo {} = foo::Foo::default(); //~^ ERROR pattern requires `..` due to inaccessible fields let foo::Bar { visible } = foo::Bar::default(); //~^ ERROR pattern requires `..` due to inaccessible fields }
Rust
3
Eric-Arellano/rust
src/test/ui/issues/issue-76077-1.rs
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
--TEST-- JIT ASSIGN: Typed reference error with return value --INI-- opcache.enable=1 opcache.enable_cli=1 opcache.file_update_protection=0 opcache.jit_buffer_size=1M opcache.protect_memory=1 --FILE-- <?php class Test { public string $x; } function test() { $test = new Test; $test->x = ""; $r =& $test->x; +($r = $y); } try { test(); } catch (TypeError $e) { echo $e->getMessage(), "\n"; } --EXPECTF-- Warning: Undefined variable $y in %s on line %d Cannot assign null to reference held by property Test::$x of type string
PHP
3
NathanFreeman/php-src
ext/opcache/tests/jit/assign_040.phpt
[ "PHP-3.01" ]
// Copyright (c) 2018 GitHub, Inc. // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. #ifndef SHELL_RENDERER_PRINTING_PRINT_RENDER_FRAME_HELPER_DELEGATE_H_ #define SHELL_RENDERER_PRINTING_PRINT_RENDER_FRAME_HELPER_DELEGATE_H_ #include "base/macros.h" #include "components/printing/renderer/print_render_frame_helper.h" namespace electron { class PrintRenderFrameHelperDelegate : public printing::PrintRenderFrameHelper::Delegate { public: PrintRenderFrameHelperDelegate(); ~PrintRenderFrameHelperDelegate() override; private: // printing::PrintRenderFrameHelper::Delegate: blink::WebElement GetPdfElement(blink::WebLocalFrame* frame) override; bool IsPrintPreviewEnabled() override; bool OverridePrint(blink::WebLocalFrame* frame) override; DISALLOW_COPY_AND_ASSIGN(PrintRenderFrameHelperDelegate); }; } // namespace electron #endif // SHELL_RENDERER_PRINTING_PRINT_RENDER_FRAME_HELPER_DELEGATE_H_
C
4
lingxiao-Zhu/electron
shell/renderer/printing/print_render_frame_helper_delegate.h
[ "MIT" ]
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package one type T1 int type T2 []T1 type T3 T2 func F1(T2) { } func (p *T1) M1() T3 { return nil } func (p T3) M2() { }
Go
3
Havoc-OS/androidprebuilts_go_linux-x86
test/fixedbugs/bug404.dir/one.go
[ "BSD-3-Clause" ]
// Copyright 2020 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "include/cppgc/object-size-trait.h" #include "include/cppgc/allocation.h" #include "include/cppgc/garbage-collected.h" #include "src/heap/cppgc/heap.h" #include "test/unittests/heap/cppgc/tests.h" #include "testing/gtest/include/gtest/gtest.h" namespace cppgc { namespace internal { namespace { class ObjectSizeTraitTest : public testing::TestWithHeap {}; class GCed : public GarbageCollected<GCed> { public: void Trace(Visitor*) const {} }; class NotGCed {}; class Mixin : public GarbageCollectedMixin {}; class UnmanagedMixinWithDouble { protected: virtual void ForceVTable() {} }; class GCedWithMixin : public GarbageCollected<GCedWithMixin>, public UnmanagedMixinWithDouble, public Mixin {}; } // namespace TEST_F(ObjectSizeTraitTest, GarbageCollected) { auto* obj = cppgc::MakeGarbageCollected<GCed>(GetAllocationHandle()); EXPECT_GE(subtle::ObjectSizeTrait<GCed>::GetSize(*obj), sizeof(GCed)); } TEST_F(ObjectSizeTraitTest, GarbageCollectedMixin) { auto* obj = cppgc::MakeGarbageCollected<GCedWithMixin>(GetAllocationHandle()); Mixin& mixin = static_cast<Mixin&>(*obj); EXPECT_NE(static_cast<void*>(&mixin), obj); EXPECT_GE(subtle::ObjectSizeTrait<Mixin>::GetSize(mixin), sizeof(GCedWithMixin)); } } // namespace internal } // namespace cppgc
C++
3
LancerWang001/v8
test/unittests/heap/cppgc/object-size-trait-unittest.cc
[ "BSD-3-Clause" ]
/* * Copyright (C) 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jetbrains.android.lang.rs; import com.intellij.lexer.FlexLexer; import com.intellij.psi.TokenType; import com.intellij.psi.tree.IElementType; /** A lexer for Renderscript files, generated from renderscript.flex using JFlex. */ %% %class _RenderscriptLexer %implements FlexLexer %unicode %function advance %type IElementType %{ StringBuilder stringBuilder = new StringBuilder(30); %} /* main character classes */ LineTerminator = \r|\n|\r\n InputCharacter = [^\r\n] WhiteSpace = {LineTerminator} | [ \t\f] /* comments */ Comment = {TraditionalComment} | {EndOfLineComment} TraditionalComment = "/*" [^*] ~"*/" | "/*" "*"+ "/" EndOfLineComment = "//" {InputCharacter}* {LineTerminator}? /* identifiers */ Identifier = [:jletter:][:jletterdigit:]* /* integer literals */ DecIntegerLiteral = 0 | [1-9][0-9]* DecLongLiteral = {DecIntegerLiteral} [lL] HexIntegerLiteral = 0 [xX] 0* {HexDigit} {1,8} HexLongLiteral = 0 [xX] 0* {HexDigit} {1,16} [lL] HexDigit = [0-9a-fA-F] OctIntegerLiteral = 0+ [1-3]? {OctDigit} {1,15} OctLongLiteral = 0+ 1? {OctDigit} {1,21} [lL] OctDigit = [0-7] /* floating point literals */ FloatLiteral = ({FLit1}|{FLit2}|{FLit3}) {Exponent}? [fF] DoubleLiteral = ({FLit1}|{FLit2}|{FLit3}) {Exponent}? FLit1 = [0-9]+ \. [0-9]* FLit2 = \. [0-9]+ FLit3 = [0-9]+ Exponent = [eE] [+-]? [0-9]+ CharacterLiteral="'"([^\\\'\r\n]|{EscapeSequence})*("'"|\\)? StringLiteral=\"([^\\\"\r\n]|{EscapeSequence})*(\"|\\)? EscapeSequence=\\[^\r\n] VectorDigit = [2-4] RSPrimeType = "char"|"double"|"float"|"half"|"int"|"long"|"short"|"uchar"|"ulong"|"uint"|"ushort" RSVectorType = {RSPrimeType}{VectorDigit} %% <YYINITIAL> { "auto" | "case" | "char" | "const" | "break" | "bool" | "continue" | "default" | "do" | "double" | "else" | "enum" | "extern" | "float" | "for" | "goto" | "half" | "if" | "inline" | "int" | "int8_t" | "int16_t" | "int32_t" | "int64_t" | "long" | "register" | "restrict" | "return" | "short" | "signed" | "sizeof" | "static" | "struct" | "switch" | "typedef" | "uchar" | "ulong" | "uint" | "uint8_t" | "uint16_t" | "uint32_t" | "uint64_t" | "union" | "unsigned" | "ushort" | "void" | "volatile" | "while" | "#pragma" | "_Bool" | "_Complex" | "_Imaginary" { return RenderscriptTokenType.KEYWORD; } "TRUE" | "FALSE" | "null" { return RenderscriptTokenType.KEYWORD; } {RSVectorType} | "rs_matrix2x2" | "rs_matrix3x3" | "rs_matrix4x4" | "rs_quaternion" | "rs_allocation" | "rs_allocation_cubemap_face"| "rs_allocation_usage_type" | "rs_data_kind" | "rs_data_type" | "rs_element" | "rs_sampler" | "rs_sampler_value" | "rs_script" | "rs_type" | "rs_time_t" | "rs_tm" | "rs_for_each_strategy_t" | "rs_kernel_context" | "rs_script_call_t" | "RS_KERNEL" | "__attribute__" { return RenderscriptTokenType.KEYWORD; } /* RenderScript defined APIs */ "abs" | "acos" | "acosh" | "acospi" | "asin" | "asinh" | "asinpi" | "atan" | "atan2" | "atan2pi" | "atanh" | "atanpi" | "cbrt" | "ceil" | "clamp" | "clz" | "copysign" | "cos" | "cosh" | "cospi" | "degrees" | "erf" | "erfc" | "exp" | "exp10" | "exp2" | "expm1" | "fabs" | "fdim" | "floor" | "fma" | "fmax" | "fmin" | "fmod" | "fract" | "frexp" | "half_recip" | "half_rsqrt" | "half_sqrt" | "hypot" | "ilogb" | "ldexp" | "lgamma" | "log" | "log10" | "log1p" | "log2" | "logb" | "mad" | "max" | "min" | "mix" | "modf" | "nan" | "native_acos" | "native_acosh" | "native_acospi" | "native_asin" | "native_asinh" | "native_asinpi" | "native_atan" | "native_atan2" | "native_atan2pi" | "native_atanh" | "native_atanpi" | "native_cbrt" | "native_cos" | "native_cosh" | "native_cospi" | "native_divide" | "native_exp" | "native_exp10" | "native_exp2" | "native_expm1" | "native_hypot" | "native_log" | "native_log10" | "native_log1p" | "native_log2" | "native_powr" | "native_recip" | "native_rootn" | "native_rsqrt" | "native_sin" | "native_sincos" | "native_sinh" | "native_sinpi" | "native_sqrt" | "native_tan" | "native_tanh" | "native_tanpi" | "nextafter" | "pow" | "pown" | "powr" | "radians" | "remainder" | "remquo" | "rint" | "rootn" | "round" | "rsRand" | "rsqrt" | "sign" | "sin" | "sincos" | "sinh" | "sinpi" | "sqrt" | "step" | "tan" | "tanh" | "tanpi" | "tgamma" | "trunc" | "cross" | "distance" | "dot" | "fast_distance" | "fast_length" | "fast_normalize" | "length" | "native_distance" | "native_length" | "native_normalize" | "normalize" | "convert_"{RSVectorType} | "rsExtractFrustumPlanes" | "rsIsSphereInFrustum" | "rsMatrixGet" | "rsMatrixInverse" | "rsMatrixInverseTranspose" | "rsMatrixLoad" | "rsMatrixLoadFrustum" | "rsMatrixLoadIdentity" | "rsMatrixLoadMultiply" | "rsMatrixLoadOrtho" | "rsMatrixLoadPerspective" | "rsMatrixLoadRotate" | "rsMatrixLoadScale" | "rsMatrixLoadTranslate" | "rsMatrixMultiply" | "rsMatrixRotate" | "rsMatrixScale" | "rsMatrixSet" | "rsMatrixTranslate" | "rsMatrixTranspose" | "rsQuaternionAdd" | "rsQuaternionConjugate" | "rsQuaternionDot" | "rsQuaternionGetMatrixUnit" | "rsQuaternionLoadRotate" | "rsQuaternionLoadRotateUnit" | "rsQuaternionMultiply" | "rsQuaternionNormalize" | "rsQuaternionSet" | "rsQuaternionSlerp" | "rsAtomicAdd" | "rsAtomicAnd" | "rsAtomicCas" | "rsAtomicDec" | "rsAtomicInc" | "rsAtomicMax" | "rsAtomicMin" | "rsAtomicOr" | "rsAtomicSub" | "rsAtomicXor" | "rsGetDt" | "rsLocaltime" | "rsTime" | "rsUptimeMillis" | "rsUptimeNanos" | "rsAllocationCopy1DRange" | "rsAllocationCopy2DRange" | "rsAllocationVLoadX" | "rsAllocationVLoadX_"{RSVectorType} | "rsAllocationVStoreX" | "rsAllocationVStoreX_"{RSVectorType}| "rsGetElementAt" | "rsGetElementAt_"{RSPrimeType} | "rsGetElementAt_"{RSVectorType} | "rsGetElementAtYuv_uchar_U" | "rsGetElementAtYuv_uchar_V" | "rsGetElementAtYuv_uchar_Y" | "rsSample" | "rsSetElementAt" | "rsSetElementAt_"{RSPrimeType} | "rsSetElementAt_"{RSVectorType} | "rsAllocationGetDimFaces" | "rsAllocationGetDimLOD" | "rsAllocationGetDimX" | "rsAllocationGetDimY" | "rsAllocationGetDimZ" | "rsAllocationGetElement" | "rsClearObject" | "rsElementGetBytesSize" | "rsElementGetDataKind" | "rsElementGetDataType" | "rsElementGetSubElement" | "rsElementGetSubElementArraySize" | "rsElementGetSubElementCount" | "rsElementGetSubElementName" | "rsElementGetSubElementNameLength" | "rsElementGetSubElementOffsetBytes" | "rsElementGetVectorSize" | "rsIsObject" | "rsSamplerGetAnisotropy" | "rsSamplerGetMagnification" | "rsSamplerGetMinification" | "rsSamplerGetWrapS" | "rsSamplerGetWrapT" | "rsForEach" | "rsGetArray0" | "rsGetArray1" | "rsGetArray2" | "rsGetArray3" | "rsGetDimArray0" | "rsGetDimArray1" | "rsGetDimArray2" | "rsGetDimArray3" | "rsGetDimHasFaces" | "rsGetDimLod" | "rsGetDimX" | "rsGetDimY" | "rsGetDimZ" | "rsGetFace" | "rsGetLod" | "rsAllocationIoReceive" | "rsAllocationIoSend" | "rsSendToClient" | "rsSendToClientBlocking" | "rsDebug" | "rsPackColorTo8888" | "rsUnpackColor8888" | "rsYuvToRGBA" { return RenderscriptTokenType.KEYWORD; } "(" | ")" | "{" | "}" | "[" | "]" { return RenderscriptTokenType.BRACE; } ";" | "," | "." { return RenderscriptTokenType.SEPARATOR; } "=" | "!" | "<" | ">" | "~" | "?" | ":" | "==" | "<=" | ">=" | "!=" | "&&" | "||" | "++" | "--" | "+" | "-" | "*" | "/" | "&" | "|" | "^" | "%" | "<<" | ">>" | "+=" | "-=" | "*=" | "/=" | "&=" | "|=" | "^=" | "%=" | "<<=" | ">>=" { return RenderscriptTokenType.OPERATOR; } {DecIntegerLiteral} | {DecLongLiteral} | {HexIntegerLiteral} | {HexLongLiteral} | {OctIntegerLiteral} | {OctLongLiteral} | {FloatLiteral} | {DoubleLiteral} | {DoubleLiteral}[dD] { return RenderscriptTokenType.NUMBER; } {Comment} { return RenderscriptTokenType.COMMENT; } {WhiteSpace} { return TokenType.WHITE_SPACE; } {Identifier} { return RenderscriptTokenType.IDENTIFIER; } {CharacterLiteral} { return RenderscriptTokenType.CHARACTER; } {StringLiteral} { return RenderscriptTokenType.STRING; } } [^] { return TokenType.BAD_CHARACTER; } <<EOF>> { return null; }
JFlex
4
phpc0de/idea-android
android-lang/src/com/android/tools/idea/lang/rs/renderscript.flex
[ "Apache-2.0" ]
// Copyright 2021 gRPC authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. syntax = "proto3"; package promise_fuzzer; message Seq { Promise first = 1; repeated PromiseFactory promise_factories = 2; } message Join { repeated Promise promises = 1; } message Race { repeated Promise promises = 1; } message Last {} message PromiseFactory { oneof promise_factory_type { // Return a specific promise Promise promise = 1; // Return the result of the last thing Last last = 2; } } message Never {} message ScheduleWaker { bool owning = 1; int32 waker = 2; } message Promise { oneof promise_type { // Seq combinator Seq seq = 1; // Join combinator Join join = 2; // Race combinator Race race = 3; // Never complete Never never = 4; // Sleep n times, then wakeup int32 sleep_first_n = 5; // Cancel and be pending Cancel cancel_from_inside = 6; // Wait for waker n, then continue ScheduleWaker wait_once_on_waker = 7; } } message Cancel {} message Wakeup {} message Action { oneof action_type { // Activity::ForceWakeup Wakeup force_wakeup = 1; // Cancel the activity Cancel cancel = 2; // Flush any pending scheduled wakeups Wakeup flush_wakeup = 3; // Awake waker n if it exists int32 awake_waker = 4; // Drop waker n if it exists int32 drop_waker = 5; } } message Msg { Promise promise = 1; repeated Action actions = 2; }
Protocol Buffer
4
echo80313/grpc
test/core/promise/promise_fuzzer.proto
[ "Apache-2.0" ]
CREATE SCHEMA IF NOT EXISTS storage AUTHORIZATION supabase_admin; grant usage on schema storage to postgres, anon, authenticated, service_role; alter default privileges in schema storage grant all on tables to postgres, anon, authenticated, service_role; alter default privileges in schema storage grant all on functions to postgres, anon, authenticated, service_role; alter default privileges in schema storage grant all on sequences to postgres, anon, authenticated, service_role; CREATE TABLE "storage"."buckets" ( "id" text not NULL, "name" text NOT NULL, "owner" uuid, "created_at" timestamptz DEFAULT now(), "updated_at" timestamptz DEFAULT now(), CONSTRAINT "buckets_owner_fkey" FOREIGN KEY ("owner") REFERENCES "auth"."users"("id"), PRIMARY KEY ("id") ); CREATE UNIQUE INDEX "bname" ON "storage"."buckets" USING BTREE ("name"); CREATE TABLE "storage"."objects" ( "id" uuid NOT NULL DEFAULT extensions.uuid_generate_v4(), "bucket_id" text, "name" text, "owner" uuid, "created_at" timestamptz DEFAULT now(), "updated_at" timestamptz DEFAULT now(), "last_accessed_at" timestamptz DEFAULT now(), "metadata" jsonb, CONSTRAINT "objects_bucketId_fkey" FOREIGN KEY ("bucket_id") REFERENCES "storage"."buckets"("id"), CONSTRAINT "objects_owner_fkey" FOREIGN KEY ("owner") REFERENCES "auth"."users"("id"), PRIMARY KEY ("id") ); CREATE UNIQUE INDEX "bucketid_objname" ON "storage"."objects" USING BTREE ("bucket_id","name"); CREATE INDEX name_prefix_search ON storage.objects(name text_pattern_ops); ALTER TABLE storage.objects ENABLE ROW LEVEL SECURITY; CREATE FUNCTION storage.foldername(name text) RETURNS text[] LANGUAGE plpgsql AS $function$ DECLARE _parts text[]; BEGIN select string_to_array(name, '/') into _parts; return _parts[1:array_length(_parts,1)-1]; END $function$; CREATE FUNCTION storage.filename(name text) RETURNS text LANGUAGE plpgsql AS $function$ DECLARE _parts text[]; BEGIN select string_to_array(name, '/') into _parts; return _parts[array_length(_parts,1)]; END $function$; CREATE FUNCTION storage.extension(name text) RETURNS text LANGUAGE plpgsql AS $function$ DECLARE _parts text[]; _filename text; BEGIN select string_to_array(name, '/') into _parts; select _parts[array_length(_parts,1)] into _filename; -- @todo return the last part instead of 2 return split_part(_filename, '.', 2); END $function$; CREATE FUNCTION storage.search(prefix text, bucketname text, limits int DEFAULT 100, levels int DEFAULT 1, offsets int DEFAULT 0) RETURNS TABLE ( name text, id uuid, updated_at TIMESTAMPTZ, created_at TIMESTAMPTZ, last_accessed_at TIMESTAMPTZ, metadata jsonb ) LANGUAGE plpgsql AS $function$ DECLARE _bucketId text; BEGIN -- will be replaced by migrations when server starts -- saving space for cloud-init END $function$; -- create migrations table -- https://github.com/ThomWright/postgres-migrations/blob/master/src/migrations/0_create-migrations-table.sql -- we add this table here and not let it be auto-created so that the permissions are properly applied to it CREATE TABLE IF NOT EXISTS storage.migrations ( id integer PRIMARY KEY, name varchar(100) UNIQUE NOT NULL, hash varchar(40) NOT NULL, -- sha1 hex encoded hash of the file name and contents, to ensure it hasn't been altered since applying the migration executed_at timestamp DEFAULT current_timestamp ); CREATE USER supabase_storage_admin NOINHERIT CREATEROLE LOGIN NOREPLICATION; GRANT ALL PRIVILEGES ON SCHEMA storage TO supabase_storage_admin; GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA storage TO supabase_storage_admin; GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA storage TO supabase_storage_admin; ALTER USER supabase_storage_admin SET search_path = "storage"; ALTER table "storage".objects owner to supabase_storage_admin; ALTER table "storage".buckets owner to supabase_storage_admin; ALTER table "storage".migrations OWNER TO supabase_storage_admin; ALTER function "storage".foldername(text) owner to supabase_storage_admin; ALTER function "storage".filename(text) owner to supabase_storage_admin; ALTER function "storage".extension(text) owner to supabase_storage_admin; ALTER function "storage".search(text,text,int,int,int) owner to supabase_storage_admin;
SQL
5
ProPiloty/supabase
docker/volumes/db/init/02-storage-schema.sql
[ "Apache-2.0" ]
// FIR_IDENTICAL //FILE:a.kt package a // no error is reported import b.a fun foo() = a //FILE:b.kt package b object a {}
Kotlin
4
Mu-L/kotlin
compiler/testData/diagnostics/tests/imports/ImportObjectHidesCurrentPackage.kt
[ "ECL-2.0", "Apache-2.0" ]
var $iconst1 <[4] [4] i32> = [ [1007, 707, -273, 75], [0113, 0x4b, 75u, 75l], [75ul, 75lu, 31425926, 60223], [60223, 1619, 30, 314159]] var $fconst1 <[4] [4] f64> = [ [1007.0, 707.0, -273.0, 75.0], [113.1, 4.0, 75.0, 75.1], [75.0, 75.1, 3.1425926, 6.02e23], [6.02e+23, 1.6e-19, 3.0, 3.14159]] func &printf (var %p1 <* i8>)void func &main ( ) i32 { call &printf (addrof a32 $fconst1) return (constval i32 0) } # EXEC: %irbuild Main.mpl # EXEC: %irbuild Main.irb.mpl # EXEC: %cmp Main.irb.mpl Main.irb.irb.mpl
Maple
1
harmonyos-mirror/OpenArkCompiler-test
test/testsuite/irbuild_test/I0006-mapleall-irbuild-edge-arrayinit/Main.mpl
[ "MulanPSL-1.0" ]
#!/bin/tcsh set CP_PATH=cmstacuser@cmstac11:/data3/CAF set TAR_BALL=~cctrack/scratch0/DQM/${CMSSW_VERSION}/output/${1}.tar.gz scp /afs/cern.ch/cms/CAF/CMSCOMM/COMM_TRACKER/DQM/SiStrip/jobs/merged/DQM_V0001_SiStrip_${1}-*.root ${CP_PATH}/Clusters/ tar -czvf ${TAR_BALL} ../*/${1} scp ${TAR_BALL} ${CP_PATH}/archive/ rm -r ${TAR_BALL} ../*/${1}
Tcsh
2
ckamtsikis/cmssw
DQM/SiStripMonitorClient/scripts/archiveCAFProcessing.csh
[ "Apache-2.0" ]
{{ page.content|json_encode()|raw }}
Twig
1
AuroraOS/grav
plugins/error/templates/error.json.twig
[ "MIT" ]
<div class="container"> <app-ecommerce></app-ecommerce> </div>
HTML
0
DBatOWL/tutorials
spring-boot-modules/spring-boot-angular/src/main/js/ecommerce/src/app/app.component.html
[ "MIT" ]
<?xml version="1.0" encoding="UTF-8"?> <!-- ******************************************************************* --> <!-- --> <!-- Copyright IBM Corp. 2010, 2014 --> <!-- --> <!-- 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. --> <!-- --> <!-- ******************************************************************* --> <!-- DO NOT EDIT. THIS FILE IS GENERATED. --> <faces-config> <faces-config-extension> <namespace-uri>http://www.ibm.com/xsp/coreex</namespace-uri> <default-prefix>xe</default-prefix> <designer-extension> <control-subpackage-name>data</control-subpackage-name> </designer-extension> </faces-config-extension> <component> <description>%component.com.ibm.xsp.extlib.data.FormLayout.descr%</description> <display-name>%component.com.ibm.xsp.extlib.data.FormLayout.name%</display-name> <component-type>com.ibm.xsp.extlib.data.FormLayout</component-type> <component-class>com.ibm.xsp.extlib.component.data.FormLayout</component-class> <group-type-ref>com.ibm.xsp.group.core.prop.style</group-type-ref> <group-type-ref>com.ibm.xsp.group.core.prop.styleClass</group-type-ref> <property> <description>%property.disableErrorSummary.descr%</description> <display-name>%property.disableErrorSummary.name%</display-name> <property-name>disableErrorSummary</property-name> <property-class>boolean</property-class> <property-extension> <designer-extension> <category>basics</category> </designer-extension> </property-extension> </property> <property> <description>%property.errorSummaryText.descr%</description> <display-name>%property.errorSummaryText.name%</display-name> <property-name>errorSummaryText</property-name> <property-class>java.lang.String</property-class> <property-extension> <localizable>true</localizable> <designer-extension> <category>basics</category> </designer-extension> </property-extension> </property> <property> <description>%property.disableRowError.descr%</description> <display-name>%property.disableRowError.name%</display-name> <property-name>disableRowError</property-name> <property-class>boolean</property-class> <property-extension> <designer-extension> <category>basics</category> </designer-extension> </property-extension> </property> <property> <description>%property.formTitle.descr%</description> <display-name>%property.formTitle.name%</display-name> <property-name>formTitle</property-name> <property-class>java.lang.String</property-class> <property-extension> <localizable>true</localizable> <designer-extension> <category>basics</category> <tags> not-accessibility-title </tags> </designer-extension> </property-extension> </property> <property> <description>%property.formDescription.descr%</description> <display-name>%property.formDescription.name%</display-name> <property-name>formDescription</property-name> <property-class>java.lang.String</property-class> <property-extension> <localizable>true</localizable> <designer-extension> <category>basics</category> <tags> todo </tags> </designer-extension> </property-extension> </property> <property> <description>%property.fieldHelp.descr%</description> <display-name>%property.fieldHelp.name%</display-name> <property-name>fieldHelp</property-name> <property-class>boolean</property-class> <property-extension> <designer-extension> <category>basics</category> <tags> todo </tags> </designer-extension> </property-extension> </property> <property> <description>%property.labelPosition.component.com.ibm.xsp.extlib.data.FormLayout.descr%</description> <display-name>%property.labelPosition.component.com.ibm.xsp.extlib.data.FormLayout.name%</display-name> <property-name>labelPosition</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>format</category> <editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor> <editor-parameter> above left none </editor-parameter> <tags> not-localizable todo </tags> </designer-extension> </property-extension> </property> <property> <description>%property.disableRequiredMarks.descr%</description> <display-name>%property.disableRequiredMarks.name%</display-name> <property-name>disableRequiredMarks</property-name> <property-class>boolean</property-class> <property-extension> <designer-extension> <category>format</category> </designer-extension> </property-extension> </property> <property> <description>%property.legend.descr%</description> <display-name>%property.legend.name%</display-name> <property-name>legend</property-name> <property-class>java.lang.String</property-class> <property-extension> <localizable>true</localizable> <designer-extension> <category>accessibility</category> <tags> localizable-text </tags> </designer-extension> </property-extension> </property> <component-extension> <component-family>com.ibm.xsp.extlib.data.FormLayout</component-family> <designer-extension/> </component-extension> </component> <component> <description>%component.formTable.descr%</description> <display-name>%component.formTable.name%</display-name> <component-type>com.ibm.xsp.extlib.data.FormTable</component-type> <component-class>com.ibm.xsp.extlib.component.data.UIFormTable</component-class> <group-type-ref>com.ibm.xsp.extlib.group.aria_label</group-type-ref> <property> <description>%property.labelWidth.component.formTable.descr%</description> <display-name>%property.labelWidth.component.formTable.name%</display-name> <property-name>labelWidth</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>basics</category> <editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor> <editor-parameter> 50% 30px 10em 2cm auto inherit </editor-parameter> <tags> not-localizable todo </tags> </designer-extension> </property-extension> </property> <component-extension> <base-component-type>com.ibm.xsp.extlib.data.FormLayout</base-component-type> <component-family>com.ibm.xsp.extlib.data.FormLayout</component-family> <renderer-type>com.ibm.xsp.extlib.data.OneUIFormTable</renderer-type> <tag-name>formTable</tag-name> <designer-extension> <in-palette>true</in-palette> <category>Extension Library</category> <tags> todo </tags> </designer-extension> </component-extension> </component> <component> <description>%component.formRow.descr%</description> <display-name>%component.formRow.name%</display-name> <component-type>com.ibm.xsp.extlib.data.FormLayoutRow</component-type> <component-class>com.ibm.xsp.extlib.component.data.UIFormLayoutRow</component-class> <group-type-ref>com.ibm.xsp.group.core.prop.style</group-type-ref> <group-type-ref>com.ibm.xsp.group.core.prop.styleClass</group-type-ref> <property> <description>%property.label.descr%</description> <display-name>%property.label.name%</display-name> <property-name>label</property-name> <property-class>java.lang.String</property-class> <property-extension> <localizable>true</localizable> <designer-extension> <category>basics</category> </designer-extension> </property-extension> </property> <property> <description>%property.labelWidth.component.formRow.descr%</description> <display-name>%property.labelWidth.component.formRow.name%</display-name> <property-name>labelWidth</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>basics</category> <editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor> <editor-parameter> 50% 30px 10em 2cm auto inherit </editor-parameter> <tags> not-localizable </tags> </designer-extension> </property-extension> </property> <property> <description>%property.for.descr%</description> <display-name>%property.for.name%</display-name> <property-name>for</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>basics</category> <editor>com.ibm.designer.domino.xsp.idpicker</editor> </designer-extension> </property-extension> </property> <property> <description>%property.helpId.descr%</description> <display-name>%property.helpId.name%</display-name> <property-name>helpId</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>basics</category> <tags> todo </tags> <editor>com.ibm.designer.domino.xsp.idpicker</editor> </designer-extension> </property-extension> </property> <property> <description>%property.labelPosition.component.formRow.descr%</description> <display-name>%property.labelPosition.component.formRow.name%</display-name> <property-name>labelPosition</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>format</category> <editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor> <editor-parameter> above left none inherit </editor-parameter> <tags> not-localizable todo </tags> </designer-extension> </property-extension> </property> <component-extension> <component-family>com.ibm.xsp.extlib.FormLayout</component-family> <renderer-type>com.ibm.xsp.extlib.data.FormLayoutRow</renderer-type> <tag-name>formRow</tag-name> <designer-extension> <in-palette>true</in-palette> <category>Extension Library</category> <tags> todo no-faces-config-renderer </tags> </designer-extension> </component-extension> </component> <component> <description>%component.formColumn.descr%</description> <display-name>%component.formColumn.name%</display-name> <component-type>com.ibm.xsp.extlib.data.FormLayoutColumn</component-type> <component-class>com.ibm.xsp.extlib.component.data.UIFormLayoutColumn</component-class> <group-type-ref>com.ibm.xsp.group.core.prop.style</group-type-ref> <group-type-ref>com.ibm.xsp.group.core.prop.styleClass</group-type-ref> <property> <description>%property.colSpan.descr%</description> <display-name>%property.colSpan.name%</display-name> <property-name>colSpan</property-name> <property-class>int</property-class> <property-extension> <designer-extension> <category>basics</category> <tags> todo </tags> </designer-extension> </property-extension> </property> <component-extension> <component-family>com.ibm.xsp.extlib.FormLayout</component-family> <renderer-type>com.ibm.xsp.extlib.data.FormLayoutColumn</renderer-type> <tag-name>formColumn</tag-name> <designer-extension> <in-palette>true</in-palette> <category>Extension Library</category> <tags> no-faces-config-renderer </tags> </designer-extension> </component-extension> </component> </faces-config>
XPages
3
jesse-gallagher/XPagesExtensionLibrary
extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.controls/src/com/ibm/xsp/extlib/config/extlib-data-formlayout.xsp-config
[ "Apache-2.0" ]
module openconfig-fw-link-monitoring { yang-version "1"; // namespace namespace "http://openconfig.net/yang/openconfig-fw-link-monitoring"; // Assign this module a prefix to be used when imported. prefix "oc-fw-linkmon"; // Imports import openconfig-extensions { prefix oc-ext; } import openconfig-interfaces { prefix oc-if; } // Meta organization "OpenConfig working group"; contact "OpenConfig working group www.openconfig.net"; description "This model defines interface groups and corresponding monitoring policies for firewall HA groups. It also provides modeling for a global health monitoring policy for the HA group."; oc-ext:openconfig-version "0.2.1"; revision "2021-06-16" { description "Remove trailing whitespace"; reference "0.2.1"; } revision "2021-03-21" { description "Removed redundandt uses statement from root node."; reference "0.2.0"; } revision "2020-06-23" { description "Initial version"; reference "0.1.0"; } grouping interface-group-config { description "Parameters to bundle monitored interfaces together"; leaf id { type union { type uint8; type string; } description "Assign a unique id to an interface group"; } leaf-list monitored-interfaces { type oc-if:base-interface-ref; description "Interface being monitored"; } leaf group-policy { type enumeration { enum ANY { description "Group status is DOWN if the status of ANY interface within the group is down."; } enum ALL { description "Group status is DOWN if the status of ALL interfaces within the group are down."; } } description "Determines how the State of monitored-interfaces is used to determine the State of the group they are a member of"; } } grouping interface-group-state { description "State data associated with the interface groups"; leaf group-status { type enumeration { enum UP { description "Group status is UP"; } enum DOWN { description "Group status is DOWN"; } } description "The status of this interface group"; } } grouping global-health-config { description "Configuration parameters used to drive the decision criteria to determine the global health of the interface monitoring state machine. The global health is a derivative of the status of the individual interface groups"; leaf global-health-policy { type enumeration { enum ANY { description "Global health is DOWN if ANY of the monitored interface groups are DOWN"; } enum ALL { description "Global health is DOWN if ALL of the monitored interface groups are DOWN"; } } description "Global health values associated with the interface monitoring state machine"; } } grouping global-health-state { description "State parameters associated with the global health of the interface monitoring state machine"; leaf global-health-status { type enumeration { enum UP { description "Global interface monitoring status is UP"; } enum DOWN { description "Global interface monitoring status is DOWN"; } } description "Global interface monitoring status"; } } grouping interface-group-top { description "Top level grouping for monitored interface-groups"; container interface-groups { description "Top level container for monitored interface groups"; list interface-group { key "id"; description "List of interface groups being monitored"; leaf id { type leafref { path "../config/id"; } description "Reference to the interface-group key used to bundle interfaces in a logical group"; } container config { description "Configuration parameters for the interface-groups"; uses interface-group-config; } container state { config false; description "State container for monitored interface-groups."; uses interface-group-config; uses interface-group-state; } } } } }
YANG
5
xw-g/public
release/models/firewall/openconfig-fw-link-monitoring.yang
[ "Apache-2.0" ]
option now = () => 2020-02-22T18:00:00Z @tableflux.h2o_temperature{ location, state, bottom_degrees, surface_degrees, time > -3h } |> aggregate( { min(bottom_degrees), max(bottom_degrees), min(surface_degrees), max(surface_degrees) }, by: ["state"] )
FLUX
3
RohanSreerama5/flux
colm/tableflux/query16.flux
[ "MIT" ]
/* Copyright (c) 2012 Advanced Micro Devices, Inc. This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ //Originally written by Takahiro Harada #pragma OPENCL EXTENSION cl_amd_printf : enable #pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics : enable typedef unsigned int u32; #define GET_GROUP_IDX get_group_id(0) #define GET_LOCAL_IDX get_local_id(0) #define GET_GLOBAL_IDX get_global_id(0) #define GET_GROUP_SIZE get_local_size(0) #define GROUP_LDS_BARRIER barrier(CLK_LOCAL_MEM_FENCE) #define GROUP_MEM_FENCE mem_fence(CLK_LOCAL_MEM_FENCE) #define AtomInc(x) atom_inc(&(x)) #define AtomInc1(x, out) out = atom_inc(&(x)) #define make_uint4 (uint4) #define make_uint2 (uint2) #define make_int2 (int2) typedef struct { int m_n; int m_padding[3]; } ConstBuffer; __kernel __attribute__((reqd_work_group_size(64,1,1))) void Copy1F4Kernel(__global float4* dst, __global float4* src, ConstBuffer cb) { int gIdx = GET_GLOBAL_IDX; if( gIdx < cb.m_n ) { float4 a0 = src[gIdx]; dst[ gIdx ] = a0; } } __kernel __attribute__((reqd_work_group_size(64,1,1))) void Copy2F4Kernel(__global float4* dst, __global float4* src, ConstBuffer cb) { int gIdx = GET_GLOBAL_IDX; if( 2*gIdx <= cb.m_n ) { float4 a0 = src[gIdx*2+0]; float4 a1 = src[gIdx*2+1]; dst[ gIdx*2+0 ] = a0; dst[ gIdx*2+1 ] = a1; } } __kernel __attribute__((reqd_work_group_size(64,1,1))) void Copy4F4Kernel(__global float4* dst, __global float4* src, ConstBuffer cb) { int gIdx = GET_GLOBAL_IDX; if( 4*gIdx <= cb.m_n ) { int idx0 = gIdx*4+0; int idx1 = gIdx*4+1; int idx2 = gIdx*4+2; int idx3 = gIdx*4+3; float4 a0 = src[idx0]; float4 a1 = src[idx1]; float4 a2 = src[idx2]; float4 a3 = src[idx3]; dst[ idx0 ] = a0; dst[ idx1 ] = a1; dst[ idx2 ] = a2; dst[ idx3 ] = a3; } } __kernel __attribute__((reqd_work_group_size(64,1,1))) void CopyF1Kernel(__global float* dstF1, __global float* srcF1, ConstBuffer cb) { int gIdx = GET_GLOBAL_IDX; if( gIdx < cb.m_n ) { float a0 = srcF1[gIdx]; dstF1[ gIdx ] = a0; } } __kernel __attribute__((reqd_work_group_size(64,1,1))) void CopyF2Kernel(__global float2* dstF2, __global float2* srcF2, ConstBuffer cb) { int gIdx = GET_GLOBAL_IDX; if( gIdx < cb.m_n ) { float2 a0 = srcF2[gIdx]; dstF2[ gIdx ] = a0; } }
OpenCL
5
N0hbdy/godot
thirdparty/bullet/Bullet3OpenCL/ParallelPrimitives/kernels/CopyKernels.cl
[ "CC-BY-3.0", "Apache-2.0", "MIT" ]
(ns wisp.backend.escodegen.generator (:require [wisp.reader :refer [read-from-string read*] :rename {read-from-string read-string}] [wisp.ast :refer [meta with-meta symbol? symbol keyword? keyword namespace unquote? unquote-splicing? quote? syntax-quote? name gensym pr-str]] [wisp.sequence :refer [empty? count list? list first second third rest cons conj butlast reverse reduce vec last map filter take concat partition repeat interleave]] [wisp.runtime :refer [odd? dictionary? dictionary merge keys vals contains-vector? map-dictionary string? number? vector? boolean? subs re-find true? false? nil? re-pattern? inc dec str char int = ==]] [wisp.string :refer [split join upper-case replace]] [wisp.expander :refer [install-macro!]] [wisp.analyzer :refer [empty-env analyze analyze*]] [wisp.backend.escodegen.writer :refer [write compile write*]] [escodegen :refer [generate] :rename {generate generate*}] [base64-encode :as btoa] [fs :refer [read-file-sync write-file-sync]] [path :refer [basename dirname join] :rename {join join-path}])) (defn generate [options & nodes] (let [ast (apply write* nodes) output (generate* ast {:file (:output-uri options) :sourceContent (:source options) :sourceMap (:source-uri options) :sourceMapRoot (:source-root options) :sourceMapWithCode true})] ;; Workaround the fact that escodegen does not yet includes source (.setSourceContent (:map output) (:source-uri options) (:source options)) {:code (if (:no-map options) (:code output) (str (:code output) "\n//# sourceMappingURL=" "data:application/json;base64," (btoa (str (:map output))) "\n")) :source-map (:map output) :js-ast ast})) (defn expand-defmacro "Like defn, but the resulting function name is declared as a macro and will be used as a macro by the compiler when it is called." [&form id & body] (let [fn (with-meta `(defn ~id ~@body) (meta &form)) form `(do ~fn ~id) ast (analyze form) code (compile ast) macro (eval code)] (install-macro! id macro) nil)) (install-macro! 'defmacro (with-meta expand-defmacro {:implicit [:&form]}))
wisp
5
NhanHo/wisp
src/backend/escodegen/generator.wisp
[ "BSD-3-Clause" ]
-- -- Licensed to the Apache Software Foundation (ASF) under one or more -- contributor license agreements. See the NOTICE file distributed with -- this work for additional information regarding copyright ownership. -- The ASF licenses this file to You under the Apache License, Version 2.0 -- (the "License"); you may not use this file except in compliance with -- the License. You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- CREATE TEMPORARY VIEW t AS SELECT 1; SELECT COUNT(*) OVER (PARTITION BY 1 ORDER BY cast(1 as tinyint)) FROM t; SELECT COUNT(*) OVER (PARTITION BY 1 ORDER BY cast(1 as smallint)) FROM t; SELECT COUNT(*) OVER (PARTITION BY 1 ORDER BY cast(1 as int)) FROM t; SELECT COUNT(*) OVER (PARTITION BY 1 ORDER BY cast(1 as bigint)) FROM t; SELECT COUNT(*) OVER (PARTITION BY 1 ORDER BY cast(1 as float)) FROM t; SELECT COUNT(*) OVER (PARTITION BY 1 ORDER BY cast(1 as double)) FROM t; SELECT COUNT(*) OVER (PARTITION BY 1 ORDER BY cast(1 as decimal(10, 0))) FROM t; SELECT COUNT(*) OVER (PARTITION BY 1 ORDER BY cast(1 as string)) FROM t; SELECT COUNT(*) OVER (PARTITION BY 1 ORDER BY cast('1' as binary)) FROM t; SELECT COUNT(*) OVER (PARTITION BY 1 ORDER BY cast(1 as boolean)) FROM t; SELECT COUNT(*) OVER (PARTITION BY 1 ORDER BY cast('2017-12-11 09:30:00.0' as timestamp)) FROM t; SELECT COUNT(*) OVER (PARTITION BY 1 ORDER BY cast('2017-12-11 09:30:00' as date)) FROM t; SELECT COUNT(*) OVER (PARTITION BY 1 ORDER BY cast(1 as tinyint) DESC RANGE BETWEEN CURRENT ROW AND 1 FOLLOWING) FROM t; SELECT COUNT(*) OVER (PARTITION BY 1 ORDER BY cast(1 as smallint) DESC RANGE BETWEEN CURRENT ROW AND 1 FOLLOWING) FROM t; SELECT COUNT(*) OVER (PARTITION BY 1 ORDER BY cast(1 as int) DESC RANGE BETWEEN CURRENT ROW AND 1 FOLLOWING) FROM t; SELECT COUNT(*) OVER (PARTITION BY 1 ORDER BY cast(1 as bigint) DESC RANGE BETWEEN CURRENT ROW AND 1 FOLLOWING) FROM t; SELECT COUNT(*) OVER (PARTITION BY 1 ORDER BY cast(1 as float) DESC RANGE BETWEEN CURRENT ROW AND 1 FOLLOWING) FROM t; SELECT COUNT(*) OVER (PARTITION BY 1 ORDER BY cast(1 as double) DESC RANGE BETWEEN CURRENT ROW AND 1 FOLLOWING) FROM t; SELECT COUNT(*) OVER (PARTITION BY 1 ORDER BY cast(1 as decimal(10, 0)) DESC RANGE BETWEEN CURRENT ROW AND 1 FOLLOWING) FROM t; SELECT COUNT(*) OVER (PARTITION BY 1 ORDER BY cast(1 as string) DESC RANGE BETWEEN CURRENT ROW AND 1 FOLLOWING) FROM t; SELECT COUNT(*) OVER (PARTITION BY 1 ORDER BY cast('1' as binary) DESC RANGE BETWEEN CURRENT ROW AND 1 FOLLOWING) FROM t; SELECT COUNT(*) OVER (PARTITION BY 1 ORDER BY cast(1 as boolean) DESC RANGE BETWEEN CURRENT ROW AND 1 FOLLOWING) FROM t; SELECT COUNT(*) OVER (PARTITION BY 1 ORDER BY cast('2017-12-11 09:30:00.0' as timestamp) DESC RANGE BETWEEN CURRENT ROW AND 1 FOLLOWING) FROM t; SELECT COUNT(*) OVER (PARTITION BY 1 ORDER BY cast('2017-12-11 09:30:00' as date) DESC RANGE BETWEEN CURRENT ROW AND 1 FOLLOWING) FROM t;
SQL
3
OlegPt/spark
sql/core/src/test/resources/sql-tests/inputs/typeCoercion/native/windowFrameCoercion.sql
[ "Apache-2.0" ]
package unit.issues; class Issue7492 extends unit.Test { function test() { var a = [1]; a[1] = 1; var v = haxe.ds.Vector.fromArrayCopy(a); eq(2, v.length); } }
Haxe
4
Alan-love/haxe
tests/unit/src/unit/issues/Issue7492.hx
[ "MIT" ]
cpp_include "<unordered_map>"
Thrift
0
JonnoFTW/thriftpy2
tests/parser-cases/cpp_include.thrift
[ "MIT" ]
h2. The Repository API After reading this guide, you will * Understand the concept * Repository item data structure * Know how to configure the Repository Manager * Know how to implementing the Repository API endprologue. h3. Concept A repository is a service or data source, which provides repository items and is registered with the Repository Manager (@RepositoryManager@). The Repository Manger manages all available repositories and routes queries to all registered repositories. Any plugin may make requests to the Repository Manager for repository items, and specify one or more kinds of items it wishes to have returned, such as @website@ or @localanchor@ (where @localanchor@ could be a headline provided by a document repository implementation). Usually a CMS back-end would provide data such as links to sites, images, videos, files that should be available during the editing process. The repository data are repository items that contain JSON data with at least the following attributes: @id@, @name@, @url@, @type@. All other attributes are optional and depend on the item's @type@. A repository may provide repository items of a freely definable @type@. We suggest @type@ to be a <a href="http://www.iana.org/assignments/media-types/index.html">mimetype</a>, e.g.: @image/png@, @text/html@, @video/H264@, @application/pdf@ …. However, this is _not required_. h4. Origins Aloha Editor's Repository API is based on the "CMIS specification":http://docs.oasis-open.org/cmis/CMIS/v1.0/cd04/cmis-spec-v1.0.html#_Toc234072402. Notable differences are: * @ObjecTypes@ is based on "CMIS' Document Object-Type definition":http://docs.oasis-open.org/cmis/CMIS/v1.0/cd04/cmis-spec-v1.0.html#_Toc239416977 * @query()@ ** @queryString@: In the CMIS spec comes with its own query language; we limit ourselves to a full text search. ** @renditionFilter@: Instead of @termlist@ an array of @type@ is expected. If the empty array or @null@ is passed, all renditions are returned. See the "CMIS specification about @renditionFilter@":http://docs.oasis-open.org/cmis/CMIS/v1.0/cd04/cmis-spec-v1.0.html#_Ref237323310. h3. Repository item data structure The API and data layout is "inspired by CMIS":http://docs.oasis-open.org/cmis/CMIS/v1.0/cd04/cmis-spec-v1.0.html#_Toc239416972. h4. Repository Item types The object concept from CMIS is inconsistent and too complicated for Aloha Editor's needs. So we opted for a much simpler model, which is easier to use for developers (but still allows one to implement CMIS if desirable). h5. @type@, @baseType@ and @mimeType@ Each repository item must have at least the @type@ attribute defined, but may optionally also have a @mimeType@ attribute defined. See below for more details. Besides @type@ being required, @baseType@ is also required. @baseType@ must be either @document@ or @folder@. That indeed means that you can "subclass" @document@ and @folder@ to fullfill your domain-specific or site-specific needs. Note that you can not set @baseType@ to anything else than @document@ or @folder@ -- from an OOP point of view, this implies that you can only do single level inheritance, not multiple levels of inheritance. @folder@ is used only for browsing your repository, and it probably makes less sense to define your own, more specific type for @type = folder@ repository items. An example could be that each user in your system has his own folder with content, so you could then define a @ownFolder@, so this one could be styled differently in the repository browser. However, for @type = document@ repository items, it makes a _lot_ of sense: @documents@ are the actual content your users are looking for; it's the whole reason the Repository API exists. Many different types of content likely exist: videos, audio, text, rich text, vector graphics, photographs, and so on. You could define @type@ to be equal to the @mimetype@. But you could also come up with your own types to discern between repository items that have the same @mimeType@, such as @internalImage@ for images that are part of your site/CMS, @flickrImage@ for external images hosted by Flickr, and @externalImage@ for other externally hosted images. h5. Document * @id@ REQUIRED * @repositoryId@ REQUIRED * @name@ REQUIRED * @baseType@ REQUIRED @(document|folder)@ * @type@ REQUIRED -- This is the type you can freely define. * @parentId@ OPTIONAL * @renditions@ OPTIONAL * @localName@ OPTIONAL * @createdBy@ OPTIONAL * @creationDate@ OPTIONAL * @lastModifiedBy@ OPTIONAL * @lastModificationDate@ OPTIONAL * @length@ OPTIONAL * @mimeType@ OPTIONAL * @fileName@ OPTIONAL * @url@ OPTIONAL h5. Folder * @id@ REQUIRED * @repositoryId@ REQUIRED * @name@ REQUIRED * @baseType@ REQUIRED @(document|folder)@ * @type@ REQUIRED * @parentId@ REQUIRED * @localName@ OPTIONAL * @createdBy@ OPTIONAL * @creationDate@ OPTIONAL * @lastModifiedBy@ OPTIONAL * @lastModificationDate@ OPTIONAL h4. Repository Item Renditions For some @type = document@ repository items, it makes sense to have multiple representations. For example, for rich text documents, you could have @.rtf@, @.docx@, @.odf@ and @pdf@ renditions (or _representations_ or _renderings_ or _derivatives_ or _variations_ or … inaccurately, but often used: _versions_). Another example: a vector graphics file in both @svg@ and @pdf@ format. The most archetypical example is probably the case of images: you typically have the "original" image, of which many derivatives are generated: a medium version, a small version and a thumbnail. These call all be renditions! A more complete example: a page document in a repository may be rendered in 3 different languages. Each of these 3 variations of that page can be served by the repository as a rendition of any of the other 2 translations that correspond with it. Each of these pages may be a stand-alone document in the repository as well. In fact, different renditions for a single document type will likely be different files which the repository will serve back in response to a request for a specific rendition of a given object. No matter what your renditions (and there is no limit on their number) turn out to be, you can assign it your own naming scheme, so that you can make it fit your needs. The name of a rendition is called its @kind@. h5. Rendition * @documentId@ ID REQUIRED identifies the rendition document (The @baseType@ _must_ be @document@) * @url@ URL REQUIRED identifies the rendition stream. * @mimeType@ String REQUIRED The MIME type of the rendition stream. * @filename@ String REQUIRED The filename of the rendition stream * @length@ Integer OPTIONAL The length of the rendition stream in bytes. * @name@ String OPTIONAL Human readable information about the rendition. * @kind@ String REQUIRED A categorization associated with the rendition. This is freely definable. An example could be: ** @square@ - an image square 75x75 ** @thumbnail@ - a thumbnail version of the object ** @small@ - 240 on longest side ** @medium@- 500 on longest side ** @large@ - 1024 on longest side (only exists for very large original images) ** @docx@ - Microsoft docx Version of the content ** @lang_de@ - same content in German language ** @lang_fr@ - same content in French language ** @pdf@ - pdf version of the content * @height@ Integer OPTIONAL Typically used for image @type@ renditions (expressed as pixels). SHOULD be present if @kind@ equals @thumbnail@. * @width@ Integer OPTIONAL Typically used for image @type@ renditions (expressed as pixels). SHOULD be present if @kind@ equals @thumbnail@. h5. Example: Flickr Image Repository Item * id - gailenejane/5008283282 * name - Quiet moment * baseType - document * type - image * url http://www.flickr.com/photos/gailenejane/5008283282/ The JSON response could look like: <shell> { id: 'gailenejane/5008283282’, repositoryId: 'flickr', name: 'Quiet moment’, type: ‘image/jpeg’, url: 'http://www.flickr.com/photos/gailenejane/5008283282/‘, renditions: [{ url: 'http://farm5.static.flickr.com/4128/5008283282_f3162bc6b7_s.jpg’, mimeType: ‘image/jpeg’, filename: '4128/5008283282_f3162bc6b7_s.jpg’, kind: ’thumbnail’, height: 75, width: 75 }] } </shell> h3. Repository API h4. query The implementation should perform a full text search on all attributes and properties of the repository items. @query()@ receives two parameters: @p@, which contains all the parameters the query should take into account (if it supports them), and @callback@, which should be called whenever the results of the query are available. h5. Parameters Parameters are passed as properties of @p@. Required parameters: * @queryString@ [String] Optional parameters: * @filter@ [array] OPTIONAL Attributes that will be returned. * @orderBy@ [array] OPTIONAL e.g. @[{lastModificationDate: 'DESC', name: 'ASC'}]@ * @maxItems@ [Integer] OPTIONAL * @inFolderId@ [RepositoryItem] OPTIONAL This is a predicate function that tests whether or not a candidate object is a child-object of the folder object identified by the given @inFolderId@. * @inTreeId@ [RepositoryItem] OPTIONAL This is a predicate function that tests whether or not a candidate object is a descendant-object of the folder object identified by the given @inTreeId@. * @skipCount@ [Integer] OPTIONAL This is tricky in a merged multi repository scenario. * @renditionFilter@ [array] OPTIONAL An array of zero or more @type@ s and @kind@ s; if empty, then _all_ renditions are returned. h5. Return values Required return values: * @objects@ [Object][] Array of Aloha objects as result of a full text search. * @hasMoreItems@ Boolean Optional return values: * @numItems@ [Integer] OPTIONAL h4. getChildren h5. Input attributes * folderId [RepositoryItem] OPTIONAL If null the root folderId should be used * maxItems [Integer] OPTIONAL * skipCount [Integer] OPTIONAL This is tricky in a merged multi repository scenario * filter [array] OPTIONAL Attributes that will be returned * renditionFilter [array] OPTIONAL ** Instead of termlist an array of '''kind''' or '''mimetype''' is expected. If '''null''' or '''array.length == 0''' all renditions are returned. See http://docs.oasis-open.org/cmis/CMIS/v1.0/cd04/cmis-spec-v1.0.html#_Ref237323310 h5. Output attributes * [array] Objects Aloha objects as result of a full text search * Boolean hasMoreItems * Integer numItems OPTIONAL h4. getObjectById h4. markObject h4. makeClean h4. example <shell> /** * Create the Aloha Repositories object. */ define( [ 'aloha', 'jquery' ], function ( Aloha, jQuery ) { 'use strict'; new ( Aloha.AbstractRepository.extend( { _constructor: function () { this._super( 'myRepository' ); }, /** * initialize the repository */ init: function () { }, /** * Searches a repository for repository items matching queryString if none found returns null. * The returned repository items must be an array of Aloha.Repository.Object * * @param {object} params object with properties * @param {function} callback this method must be called with all resulting repository items */ query: function ( p, callback ) { callback.call( this, [ { id: 1, name: 'My item', url: 'http://mydomain.com/myItem.html', type: 'text/html' } ]); }, /** * Returns all children of a given motherId. * * @param {object} params object with properties * @property {array} objectTypeFilter OPTIONAL Object types that will be returned. * @property {array} filter OPTIONAL Attributes that will be returned. * @property {string} inFolderId OPTIONAL his is a predicate function that tests whether or not a candidate object is a child-object of the folder object identified by the given inFolderId (objectId). * @property {array} orderBy OPTIONAL ex. [{lastModificationDate:’DESC’}, {name:’ASC’}] * @property {Integer} maxItems OPTIONAL number items to return as result * @property {Integer} skipCount OPTIONAL This is tricky in a merged multi repository scenario * @property {array} renditionFilter OPTIONAL Instead of termlist an array of kind or mimetype is expected. If null or array.length == 0 all renditions are returned. See http://docs.oasis-open.org/cmis/CMIS/v1.0/cd04/cmis-spec-v1.0.html#_Ref237323310 for renditionFilter * @param {function} callback this method must be called with all resulting repository items */ getChildren: function ( p, callback ) { callback.call( this, [ { id: 1, name: 'My item', url: 'http://mydomain.com/myItem.html', type: 'text/html' } ]); }, /** * Get the repositoryItem with given id * Callback: {Aloha.Repository.Object} item with given id * @param itemId {String} id of the repository item to fetch * @param callback {function} callback function */ getObjectById: function ( itemId, callback ) { callback.call( this, [ { id: 1, name: 'My item', url: 'http://mydomain.com/myItem.html', type: 'text/html' } ]); }, /** * Mark or modify an object as needed by that repository for handling, processing or identification. * Objects can be any DOM object as A, SPAN, ABBR, etc.. * (see http://dev.w3.org/html5/spec/elements.html#embedding-custom-non-visible-data) * @param obj jQuery object to make clean * @return void */ markObject: function (obj, repositoryItem) { obj.attr('data-myRepository-temporary-data').text( repositoryItem.name ); }, /** * Make the given jQuery object (representing an object marked as object of this type) * clean. All attributes needed for handling should be removed. * @param {jQuery} obj jQuery object to make clean * @return void */ makeClean: function ( obj ) { obj.removeAttr('data-myRepository-temporary-data'); }; }))(); }); </shell> h3. Reccomandation of repository item attributes The API and data layout is inspired by <a href="http://docs.oasis-open.org/cmis/CMIS/v1.0/cd04/cmis-spec-v1.0.html#_Toc239416972">CMIS</a>. h4. ObjectTypes The object concept from CMIS is inconsistent and to complicated for Aloha Editors needs. So we changed to a much simpler model, which allows to implement CMIS, but is easier to use for developers. <a href="http://docs.oasis-open.org/cmis/CMIS/v1.0/cd04/cmis-spec-v1.0.html#_Toc239416977">CMIS objects</a> There are 2 BaseTypes: document and folder. All other objectTypes may extend either document or folder. Extended Objects may not be extended any more. h4. Document * id MUST * repositoryId MUST * name MUST * baseType MUST (document|folder) * type MUST * parentId OPTIONAL * renditions OPTIONAL * localName OPTIONAL * createdBy OPTIONAL * creationDate OPTIONAL * lastModifiedBy OPTIONAL * lastModificationDate OPTIONAL * length OPTIONAL * mimeType OPTIONAL * fileName OPTIONAL * url OPTIONAL h4. Folder * id MUST * repositoryId MUST * name MUST * baseType MUST (document|folder) * type MUST * parentId MUST * localName OPTIONAL * createdBy OPTIONAL * creationDate OPTIONAL * lastModifiedBy OPTIONAL * lastModificationDate OPTIONAL * children OPTIONAL (array of child folders objects) h4. Rendition * documentId ID identfies the rendition document (baseObjectType == document) * url URL identifies the rendition stream. * mimeType String The MIME type of the rendition stream. * filename String The filename of the rendition stream * length Integer (optional)The length of the rendition stream in bytes. * name String (optional) Human readable information about the rendition. * kind String A categorization String associated with the rendition. ** square - an image square 75x75 ** thumbnail - a thumbnail version of the object ** small - 240 on longest side ** medium- 500 on longest side ** large - 1024 on longest side (only exists for very large original images) ** docx - Microsoft docx Version of the content ** lang_de - same content in german language ** lang_fr - same content in frensh language ** pdf - pdf version of the content * height Integer (optional) Typically used for ‘image’ renditions (expressed as pixels). SHOULD be present if kind = cmis:thumbnail. * width Integer (optional) Typically used for ‘image’ renditions (expressed as pixels). SHOULD be present if kind = cmis:thumbnail. h5. What are renditions, and why are they so useful? A repository may implement renditions for any object that has "document" as its baseObjectType. A rendition is simply an alternative representation (rendering) of a given object. Any document may have any number of renditions. For example: A page document in a repositroy may be rendered in 3 different languages. Each of these 3 variations of that page can be served by the repository as a rendition of any of the other 2 translations that correspond with it. Each of these pages may be a stand-alone document in the repository as well. In fact, different renditions for a single document type will likely be different files which the repository will server back in response to a request for a specific rendition of a given object. h3. Configuring the Repository Manager You may define a timeout (in milliseconds) when the Repository Manager should stop waiting for any repository implementation's response. <shell> var Aloha = { settings : { repositories: { timeout: 10000 // default 5000 (5 sec) } } }; </shell> If you want to figure out the optimal value for your timeout, you should test the server-side script for your repository to find its typical response times under heavy load. After determining the maximum time it takes to load a result you might want to add a buffer (e.g. 2–5 seconds) to allow for adapting to even higher server load.
Textile
5
luciany/Aloha-Editor
doc/guides/source/repository.textile
[ "CC-BY-3.0" ]
class Abe extends BaseMapObject { static kAnimationResources = [ "AbeWalkToStand", "AbeWalkToStandMidGrid", "AbeWalkingToRunning", "AbeWalkingToRunningMidGrid", "AbeWalkingToSneaking", "AbeWalkingToSneakingMidGrid", "AbeStandToRun", "AbeRunningToSkidTurn", "AbeRunningTurnAround", "AbeRunningTurnAroundToWalk", "AbeRunningToRoll", "AbeRuningToJump", "AbeRunningJumpInAir", "AbeLandToRunning", "AbeLandToWalking", "AbeFallingToLand", "RunToSkidStop", "AbeRunningSkidStop", "AbeRunningToWalk", "AbeRunningToWalkingMidGrid", "AbeStandToSneak", "AbeSneakToStand", "AbeSneakToStandMidGrid", "AbeSneakingToWalking", "AbeSneakingToWalkingMidGrid", "AbeStandPushWall", "AbeHitGroundToStand", "AbeStandToWalk", "AbeStandToCrouch", "AbeCrouchToStand", "AbeStandTurnAround", "AbeStandTurnAroundToRunning", "AbeCrouchTurnAround", "AbeCrouchToRoll", "AbeStandSpeak1", "AbeStandSpeak2", "AbeStandSpeak3", "AbeStandingSpeak4", "AbeStandSpeak5", "AbeCrouchSpeak1", "AbeCrouchSpeak2", "AbeStandIdle", "AbeCrouchIdle", "AbeStandToHop", "AbeHopping", "AbeHoppingToStand", "AbeHoistDangling", "AbeHoistPullSelfUp", "AbeStandToJump", "AbeJumpUpFalling", "AbeHitGroundToStand", "AbeWalking", "AbeRunning", "AbeSneaking", "AbeStandToFallingFromTrapDoor", "AbeHoistDropDown", "AbeRolling" ]; function InputNotSameAsDirection() { return (Actions.Left(mInput.IsHeld) && base.FacingRight()) || (Actions.Right(mInput.IsHeld) && base.FacingLeft()); } function InputSameAsDirection() { return (Actions.Left(mInput.IsHeld) && base.FacingLeft()) || (Actions.Right(mInput.IsHeld) && base.FacingRight()); } function SetAnimationFrame(frame) { log_info("Force animation frame to " + frame); base.SetAnimationFrame(frame); } function FlipXDirection() { base.FlipXDirection(); } function FrameIs(frame) { return base.FrameNumber() == frame && base.FrameCounter() == 0; } function SetXSpeed(speed) { mXSpeed = speed; } function SetYSpeed(speed) { mYSpeed = speed; } function SetXVelocity(velocity) { mXVelocity = velocity; } function SetYVelocity(velocity) { mYVelocity = velocity; } function SnapXToGrid() { // TODO: This breaks sometimes, stand idle, press inverse direction and take 1 step to repro issue base.SnapXToGrid(); } function ToStandCommon(anim) { SetXSpeed(2.777771); SetXVelocity(0); PlayAnimation(anim, { onFrame = function(obj) { if (obj.FrameIs(2)) { obj.PlaySoundEffect("MOVEMENT_MUD_STEP"); } } }); //SnapXToGrid(); return GoTo(Stand); } function ToStand() { return ToStandCommon("AbeWalkToStand"); } function ToStand2() { return ToStandCommon("AbeWalkToStandMidGrid"); } function WalkToRunCommon(anim) { PlayAnimation(anim); return GoTo(Run); } function WalkToRun() { return WalkToRunCommon("AbeWalkingToRunning"); } function WalkToRun2() { return WalkToRunCommon("AbeWalkingToRunningMidGrid"); } function WalkToSneakCommon(anim) { SetXSpeed(2.777771); SetXVelocity(0); PlayAnimation(anim); return GoTo(Sneak); } function WalkToSneak() { return WalkToSneakCommon("AbeWalkingToSneaking"); } function WalkToSneak2() { return WalkToSneakCommon("AbeWalkingToSneakingMidGrid"); } function StandToRun() { SetXSpeed(6.25); SetXVelocity(0); PlayAnimation("AbeStandToRun"); return GoTo(Run); } function RunToSkidTurnAround() { SetXSpeed(6.25); SetXVelocity(0.375); PlayAnimation("AbeRunningToSkidTurn", { endFrame = 15, onFrame = function(obj) { if (obj.FrameIs(14)) { log_trace("Handle last frame of AbeRunningToSkidTurn"); obj.SetXVelocity(0); obj.SnapXToGrid(); } } }); if (Actions.Run(mInput.IsHeld)) { SetXSpeed(6.25); SetXVelocity(0); // TODO: Probably better to have a FlipSpriteX and FlipDirectionX instead? mInvertX = true; PlayAnimation("AbeRunningTurnAround"); mInvertX = false; FlipXDirection(); //SnapXToGrid(); return GoTo(Run); } else { SetXSpeed(2.777771); SetXVelocity(0); mInvertX = true; PlayAnimation("AbeRunningTurnAroundToWalk"); mInvertX = false; FlipXDirection(); return GoTo(Walk); } } function RunToRoll() { SetXVelocity(0); SetXSpeed(6.25); PlayAnimation("AbeRunningToRoll"); return GoTo(Roll); } function RunToJump() { PlayAnimation("AbeRuningToJump", { onFrame = function(obj) { if (obj.FrameIs(2)) { obj.SetYVelocity(9.6); } } }); SetYVelocity(-1.8); SetXSpeed(7.6); PlayAnimation("AbeRunningJumpInAir", { onFrame = function(obj) { if (obj.FrameIs(10)) { obj.SetYVelocity(1.8); obj.SetXSpeed(4.9); } } }); SetYSpeed(0); SetYVelocity(0); SnapXToGrid(); if (InputSameAsDirection()) { if (Actions.Run(mInput.IsHeld)) { SetXSpeed(6.250000); PlayAnimation("AbeLandToRunning"); return GoTo(Abe.Run); } else { SetXSpeed(2.777771); PlayAnimation("AbeLandToWalking"); return GoTo(Abe.Walk); } } else { PlayAnimation("AbeFallingToLand"); return RunToSkidStop(); } } function Run() { if (FrameIs(0) && base.AnimationComplete() == false) { // SetXSpeed(12.5); // the real game uses 12.5 sometimes depending on the previous state, but 6.25 // seems to always look correct.. SetXSpeed(6.25); } else { SetXSpeed(6.25); } if (FrameIs(0+1) || FrameIs(8+1)) { SnapXToGrid(); if (InputSameAsDirection() && Actions.Run(mInput.IsHeld) && Actions.Jump(mInput.IsHeld)) { return RunToJump(); } } if (FrameIs(4+1) || FrameIs(12+1)) { SnapXToGrid(); if (InputNotSameAsDirection()) { return RunToSkidTurnAround(); } else if (InputSameAsDirection()) { base.PlaySoundEffect("MOVEMENT_MUD_STEP"); // TODO: Always play fx? if (Actions.Run(mInput.IsHeld) == false) { if (FrameIs(4+1)) { return RunToWalk(); } else { return RunToWalk2(); } } else if (Actions.Jump(mInput.IsHeld)) { return RunToJump(); } else if (Actions.RollOrFart(mInput.IsHeld)) { return RunToRoll(); } } else { return RunToSkidStop(); } } } function RunToSkidStop() { SetXVelocity(0.375); PlayAnimation("AbeRunningSkidStop", { endFrame = 15, onFrame = function(obj) { if (obj.FrameIs(14)) { log_trace("Handle last frame of AbeRunningSkidStop"); obj.SetXVelocity(0); obj.SnapXToGrid(); } } }); return GoTo(Stand); } function RunToWalkCommon(anim) { SetXSpeed(2.777771); SetXVelocity(0); PlayAnimation(anim); return GoTo(Walk); } function RunToWalk() { return RunToWalkCommon("AbeRunningToWalk"); } function RunToWalk2() { return RunToWalkCommon("AbeRunningToWalkingMidGrid"); } function StandToSneak() { SetXSpeed(2.5); PlayAnimation("AbeStandToSneak"); return GoTo(Sneak); } function Sneak() { if (InputSameAsDirection()) { if (FrameIs(6+1) || FrameIs(16+1)) { SnapXToGrid(); local collision = WillStepIntoWall(); if (collision) { return collision; } base.PlaySoundEffect("MOVEMENT_MUD_STEP"); if (Actions.Sneak(mInput.IsHeld) == false) { if (FrameIs(6+1)) { return SneakToWalk(); } else { return SneakToWalk2(); } } } } else { if (FrameIs(3+1) || FrameIs(13+1)) { if (FrameIs(3+1)) { return AbeSneakToStand(); } else { return AbeSneakToStand2(); } } } } function AbeSneakToStandCommon(anim) { PlayAnimation(anim); return GoTo(Stand); } function AbeSneakToStand() { return AbeSneakToStandCommon("AbeSneakToStand"); } function AbeSneakToStand2() { return AbeSneakToStandCommon("AbeSneakToStandMidGrid"); } function SneakToWalkCommon(anim) { PlayAnimation(anim); return GoTo(Walk); } function SneakToWalk() { return SneakToWalkCommon("AbeSneakingToWalking"); } function SneakToWalk2() { return SneakToWalkCommon("AbeSneakingToWalkingMidGrid"); } function CalculateYSpeed() { local newYSpeed = mYSpeed - mYVelocity; if (newYSpeed > 20) { newYSpeed = 20; } return newYSpeed; } function ApplyMovement() { if (mXSpeed > 0) { mXSpeed = mXSpeed - mXVelocity; if (base.FacingLeft()) { if (mInvertX) { mBase.mXPos = mBase.mXPos + mXSpeed; } else { mBase.mXPos = mBase.mXPos - mXSpeed; } } else { if (mInvertX) { mBase.mXPos = mBase.mXPos - mXSpeed; } else { mBase.mXPos = mBase.mXPos + mXSpeed; } } } //if (mYSpeed < 0) //{ //log_error("YSpeed from " + mYSpeed + " to " + mYSpeed - mYVelocity); mYSpeed = CalculateYSpeed(); mBase.mYPos += mYSpeed; //} } function WillStepIntoWall() { // Blocked by wall at head height? if (base.WallCollision(25, -50)) { SetXSpeed(0); SetXVelocity(0); // Blocked at knee height? if (base.WallCollision(25, -20)) { // Way to get through PlayAnimation("AbeStandPushWall"); return GoTo(Stand); } else { // Goto crouch so we can roll through return StandToCrouch(); } } } function CollisionWithFloor() { return base.FloorCollision(); } // TODO Merge with StandFalling function StandFalling2() { log_info("StandFalling2"); // TODO: Fix XVelocity, only correct for walking? local ret = CollisionWithFloor(); if (ret.collision == false || (ret.collision == true && ret.y > mBase.mYPos)) { log_info("Not touching floor or floor is far away " + ret.y + " VS " + mBase.mYPos + " distance " + ret.distance); local ySpeed = CalculateYSpeed(); local expectedYPos = mBase.mYPos + ySpeed; if (ret.collision == true && expectedYPos > ret.y) { log_info("going to pass through the floor, glue to it!"); mBase.mYPos = ret.y; SetXSpeed(0); SetXVelocity(0); SetYSpeed(0); SetYVelocity(0); SnapXToGrid(); PlayAnimation("AbeHitGroundToStand"); return GoTo(Stand); } } else { log_info("hit floor or gone through it"); SetXSpeed(0); SetXVelocity(0); SetYSpeed(0); SetYVelocity(0); SnapXToGrid(); PlayAnimation("AbeHitGroundToStand"); return GoTo(Stand); } } // TODO function StandFalling() { // TODO: Fix XVelocity, only correct for walking? local ret = CollisionWithFloor(); if (ret.collision == false || (ret.collision == true && ret.y > mBase.mYPos)) { log_info("Not touching floor or floor is far away " + ret.y + " VS " + mBase.mYPos + " distance " + ret.distance); local ySpeed = CalculateYSpeed(); local expectedYPos = mBase.mYPos + ySpeed; if (ret.collision == true && expectedYPos > ret.y) { log_info("going to pass through the floor, glue to it!"); mBase.mYPos = ret.y; SetXSpeed(0); SetXVelocity(0); SetYSpeed(0); SetYVelocity(0); SnapXToGrid(); PlayAnimation("AbeHitGroundToStand"); return GoTo(Stand); } } else { log_info("hit floor or gone through it"); SetXSpeed(0); SetXVelocity(0); SetYSpeed(0); SetYVelocity(0); SnapXToGrid(); PlayAnimation("AbeHitGroundToStand"); return GoTo(Stand); } } function Walk() { local ret = CollisionWithFloor(); if (ret.collision == false || (ret.collision == true && ret.y > mBase.mYPos)) { log_info("Not on the floor " + ret.y + " VS " + mBase.mYPos); return GoTo(StandFalling); } if (FrameIs(5+1) || FrameIs(14+1)) { base.PlaySoundEffect("MOVEMENT_MUD_STEP"); SnapXToGrid(); local collision = WillStepIntoWall(); if (collision) { return collision; } if (InputSameAsDirection() == true) { if (Actions.Run(mInput.IsHeld)) { if (FrameIs(5+1)) { return WalkToRun(); } else { return WalkToRun2(); } } else if (Actions.Sneak(mInput.IsHeld)) { if (FrameIs(5+1)) { return WalkToSneak(); } else { return WalkToSneak2(); } } } } else if (FrameIs(2+1) || FrameIs(11+1)) { if (InputSameAsDirection() == false) { if (FrameIs(2+1)) { return ToStand(); } else { return ToStand2(); } } } } function PlayAnimation(name, params = null) { base.SetAnimation(name); if ("startFrame" in params) { log_info("Start animation at frame " + params.startFrame); SetAnimationFrame(params.startFrame-1); // first update will frame+1 } else { log_info("Start animation at beginning"); } local stop = false; while (true) { local frameChanged = base.AnimUpdate(); base.FrameNumber(); if (frameChanged) { if (("endFrame" in params && base.FrameNumber() == params.endFrame+1) || (base.FrameNumber() == base.NumberOfFrames()-1)) { log_info("Wait for complete done at frame " + base.FrameNumber()); stop = true; } if ("onFrame" in params) { if (params.onFrame(this)) { log_info("Request to stop at frame " + base.FrameNumber()); stop = true; } } ApplyMovement(); } else { log_info("No change frame no:" + base.FrameNumber() + " num frames: " + base.NumberOfFrames()); } ::suspend(); if (stop) { log_info("-PlayAnimation (callback): " + name); return; } } } function GoTo(func) { log_info("Goto " + func); local data = mAnims[func]; mData = { mFunc = func, Animation = data.name }; if ("xspeed" in data) { SetXSpeed(data.xspeed); } SetXVelocity(data.xvel); if ("yvel" in data) { SetYVelocity(data.yvel); } if (mData.Animation == null) { log_error("An animation mapping is missing!"); mData.Animation = mLastAnimationName; } log_info("Goto sets " + mData.Animation); return true; } function StandToWalk() { SetXSpeed(2.777771); SetXVelocity(0); PlayAnimation("AbeStandToWalk"); return GoTo(Walk); } function StandToCrouch() { PlayAnimation("AbeStandToCrouch"); return GoTo(Crouch); } function CrouchToStand() { PlayAnimation("AbeCrouchToStand"); return GoTo(Stand); } function StandTurnAround() { log_info("StandTurnAround"); base.PlaySoundEffect("GRAVEL_SMALL"); // TODO: Add to json local toRun = false; // stop at frame 3 if we want to go to running PlayAnimation("AbeStandTurnAround", { onFrame = function(obj) { if (obj.FrameIs(3) && Actions.Run(obj.mInput.IsHeld)) { toRun = true; return true; } } }); FlipXDirection() if (toRun) { SetXSpeed(6.25); SetXVelocity(0); PlayAnimation("AbeStandTurnAroundToRunning"); return GoTo(Run); } return GoTo(Stand); } function CrouchTurnAround() { PlayAnimation("AbeCrouchTurnAround"); FlipXDirection(); return GoTo(Crouch); } function CrouchToRoll() { SetXSpeed(6.25); SetXVelocity(0); PlayAnimation("AbeCrouchToRoll"); return GoTo(Roll); } function Roll() { if (FrameIs(0+1) || FrameIs(6+1)) { base.PlaySoundEffect("MOVEMENT_MUD_STEP"); } if (FrameIs(0+1) || FrameIs(4+1) || FrameIs(8+1)) { SnapXToGrid(); if (InputSameAsDirection() == false) { return GoTo(Crouch); } } else if (FrameIs(1+1) || FrameIs(5+1) || FrameIs(9+1)) { if (InputSameAsDirection()) { if (Actions.Run(mInput.IsHeld)) { // TODO: Fix InputRunPressed and the likes, will be missed if pressed between frames return StandToRun(); } } } } static game_speak = { GameSpeak1 = { anims = [ "AbeStandSpeak2", "AbeCrouchSpeak1" ], sound = "GAMESPEAK_MUD_HELLO"}, GameSpeak2 = { anims = [ "AbeStandSpeak3", "AbeCrouchSpeak1" ], sound = "GAMESPEAK_MUD_FOLLOWME"}, GameSpeak3 = { anims = [ "AbeStandingSpeak4", "AbeCrouchSpeak2" ], sound = "GAMESPEAK_MUD_WAIT"}, GameSpeak4 = { anims = [ "AbeStandingSpeak4", "AbeCrouchSpeak1" ], sound = "GAMESPEAK_MUD_ANGRY"}, GameSpeak5 = { anims = [ "AbeStandingSpeak4", "AbeCrouchSpeak2" ], sound = "GAMESPEAK_MUD_WORK"}, GameSpeak6 = { anims = [ "AbeStandSpeak2", "AbeCrouchSpeak2" ], sound = "GAMESPEAK_MUD_ALLYA"}, GameSpeak7 = { anims = [ "AbeStandSpeak5", "AbeCrouchSpeak1" ], sound = "GAMESPEAK_MUD_SORRY"}, GameSpeak8 = { anims = [ "AbeStandSpeak3", "AbeCrouchSpeak2" ], sound = "GAMESPEAK_MUD_NO_SAD"}, // TODO: actually "Stop it" // TODO: Laugh, whistle1/2 for AO }; function HandleGameSpeak(standing) { local numGameSpeaks = game_speak.len(); foreach(key, item in game_speak) { if (Actions[key](mInput.IsPressed)) { if (standing == 1) { GameSpeakStanding(item.anims[0], item.sound); } else { GameSpeakCrouching(item.anims[1], item.sound); } return true; } } return false; } function GameSpeakStanding(anim, soundEffect) { PlayAnimation("AbeStandSpeak1"); base.PlaySoundEffect(soundEffect); PlayAnimation(anim); SetAnimation("AbeStandIdle"); } function GameSpeakFartStanding() { base.PlaySoundEffect("GAMESPEAK_MUD_FART"); PlayAnimation("AbeStandSpeak5"); SetAnimation("AbeStandIdle"); } function GameSpeakCrouching(anim, soundEffect) { base.PlaySoundEffect(soundEffect); PlayAnimation(anim); SetAnimation("AbeCrouchIdle"); } function GameSpeakFartCrouching() { GameSpeakCrouching("AbeCrouchSpeak1", "GAMESPEAK_MUD_FART"); SetAnimation("AbeCrouchIdle"); } function IsCellingAbove() { // If we move up will we smack the celling? if (base.CellingCollision(0, -60)) { return true; } return false; } function Crouch() { if (Actions.Up(mInput.IsHeld)) { if (IsCellingAbove() == false) { return CrouchToStand(); } else { log_info("Can't stand due to celling"); } } else if (InputSameAsDirection()) { return CrouchToRoll(); } else if (InputNotSameAsDirection()) { return CrouchTurnAround(); } else if (HandleGameSpeak(0)) { // stay in this state } else if (Actions.RollOrFart(mInput.IsHeld)) { GameSpeakFartCrouching(); } // TODO: Crouching object pick up } function StandToHop() { PlayAnimation("AbeStandToHop", { startFrame = 9, endFrame = 11, onFrame = function(obj) { if (obj.FrameNumber() == 9) { obj.SetXSpeed(17); } else { obj.SetXSpeed(13.569992); obj.SetYSpeed(-2.7); } } }); SetYVelocity(-1.8); PlayAnimation("AbeHopping", { endFrame = 3, onFrame = function(obj) { if (obj.FrameIs(3)) { obj.SetXSpeed(0); obj.SetYSpeed(0); obj.SetYVelocity(0); obj.SnapXToGrid(); } } }); PlayAnimation("AbeHoppingToStand"); return GoTo(Stand); } function Stand() { if (InputNotSameAsDirection()) { log_info("StandTurnAround"); return StandTurnAround(); } else if (InputSameAsDirection()) { if (Actions.Run(mInput.IsHeld)) { return StandToRun(); } else if (Actions.Sneak(mInput.IsHeld)) { local collision = WillStepIntoWall(); if (collision) { return collision }; return StandToSneak(); } else { local collision = WillStepIntoWall(); if (collision) { return collision; } return StandToWalk(); } } else if (Actions.Down(mInput.IsHeld)) { return StandToCrouch(); } else if (HandleGameSpeak(1)) { // stay in this state } else if (Actions.RollOrFart(mInput.IsHeld)) { GameSpeakFartStanding(); } else if (Actions.Jump(mInput.IsHeld)) { return StandToHop(); } else if (Actions.Up(mInput.IsHeld)) { return JumpUp(); } } function HoistHang() { while(true) { // loop the animation until the user breaks out of it local toDown = false; local toUp = false; PlayAnimation("AbeHoistDangling", { onFrame = function(obj) { if (Actions.Down(obj.mInput.IsHeld)) { toDown = true; } if (Actions.Up(obj.mInput.IsHeld)) { toUp = true; } if (toDown || toUp) { return true; } } }); if (toDown) { // TODO: Use the line ypos! mBase.mYPos = mBase.mYPos + 78; return GoTo(StandFalling2); } if (toUp) { PlayAnimation("AbeHoistPullSelfUp"); return GoTo(Stand); } } } function JumpUp() { local oldY = mBase.mYPos; PlayAnimation("AbeStandToJump", { onFrame = function(obj) { if (obj.FrameNumber() == 9) { obj.SetYSpeed(-8); } } }); // Look for a hoist at the head pos local hoist = mMap.GetMapObject(mBase.mXPos, mBase.mYPos-50, "Hoist"); SetYVelocity(-1.8); PlayAnimation("AbeJumpUpFalling", { onFrame = function(obj) { if (obj.FrameNumber() >= 3) { if (hoist) { // TODO: Calculate pos to collision line, we can't reach // the hoist if its higher than the pos in this frame as its when // we start to fall back to the ground log_info("TODO: Hoist check"); return true; } } } }); SetYSpeed(0); SetYVelocity(0); if (hoist) { // TODO: Use the next line or hoist ypos! mBase.mYPos = mBase.mYPos - 78; return GoTo(HoistHang); } else { log_info("TODO: Check for door, rope, well etc"); mBase.mYPos = oldY; PlayAnimation("AbeHitGroundToStand"); return GoTo(Stand); } } mData = {}; function Exec() { while (true) { while (true) { // TODO Keep "pressed" flags for buttons that we can check mid animation // TODO Clear pressed flags before we change states // TODO: Change pressed checking to use stored flags/pressed states SetAnimation(mData.Animation); local frameChanged = base.AnimUpdate(); //log_info("call mFunc.."); if (mData.mFunc.bindenv(this)()) { //ApplyMovement(); break; } if (frameChanged) { ApplyMovement(); } //log_info("suspending.."); ::suspend(); //log_info("resumed"); } } } function CoRoutineProc(thisPtr) { log_info("set first state.."); thisPtr.GoTo.bindenv(thisPtr)(Abe.Stand); log_info("inf exec.."); thisPtr.Exec.bindenv(thisPtr)(); } oldX = 0; oldY = 0; function DebugPrintPosDeltas() { if (oldX != mXPos || oldY != mBase.mYPos) { local deltaX = mBase.mXPos - oldX; local deltaY = mBase.mYPos - oldY; if (deltaX != mBase.mXPos || deltaY != mBase.mYPos) { log_trace( "XD:" + string.format("%.6f", deltaX) + " YD:" + string.format("%.6f", deltaY) + " F:" + base.FrameNumber() + //" X:" + string.format("%.2f", mBase.mXPos) + //" Y:" + string.format("%.2f", mBase.mYPos) + " XS:" + string.format("%.2f", mXSpeed) + " YS:" + string.format("%.2f", mYSpeed) + " XV:" + string.format("%.2f", mXVelocity) + " YV:" + string.format("%.2f", mYVelocity)); } } oldX = mBase.mXPos; oldY = mBase.mYPos; } mFirst = true; function Update(actions) { //log_info("+Update"); mInput = actions; if (mFirst) { mThread.call(this); mFirst = false; } else { mThread.wakeup(this); } //log_info("-Update"); // TODO: Fix me //DebugPrintPosDeltas(); } mAnims = {}; mInvertX = false; mXSpeed = 0; mXVelocity = 0; mYSpeed = 0; mYVelocity = 0; mNextFunction = ""; mThread = ""; mInput = 0; function constructor(mapObj, map) { base.constructor(mapObj, map, "Abe"); mAnims[Abe.Stand] <- { name = "AbeStandIdle", xspeed = 0, xvel = 0 }; mAnims[Abe.Walk] <- { name = "AbeWalking", xspeed = 2.777771, xvel = 0 }; mAnims[Abe.Run] <- { name = "AbeRunning", xspeed = 6.25, xvel = 0 }; mAnims[Abe.Crouch] <- { name = "AbeCrouchIdle", xspeed = 0, xvel = 0 }; mAnims[Abe.Sneak] <- { name = "AbeSneaking", xspeed = 2.5, xvel = 0 }; mAnims[Abe.Roll] <- { name = "AbeRolling", xspeed = 6.25, xvel = 0 }; mAnims[Abe.StandFalling] <- { name = "AbeStandToFallingFromTrapDoor", xvel = 0.3, yvel = -1.8 }; mAnims[Abe.StandFalling2] <- { name = "AbeHoistDropDown", xvel = 0, yvel = -1.8 }; mAnims[Abe.HoistHang] <- { name = "AbeHoistDangling", xvel = 0.0, yvel = 0 }; mNextFunction = Abe.Stand; mThread = ::newthread(CoRoutineProc); } }
Squirrel
4
mouzedrift/alive
data/scripts/abe.nut
[ "MIT" ]
#lang scribble/manual @(require scribble/eval pollen/decode pollen/setup txexpr (for-label pollen/unstable/typography txexpr racket (except-in pollen #%module-begin))) @(define my-eval (make-base-eval)) @(my-eval `(require pollen pollen/unstable/typography)) @(require "mb-tools.rkt") @title{Typography} @defmodule[pollen/unstable/typography] Quick & dirty utilities. I use them, but I haven't tested them with enough edge cases to feel like they deserve to live outside @racket[unstable]. I welcome improvements. @defproc[ (smart-quotes [xexpr (or/c string? txexpr?)] [#:apostophe apostrophe-str string? "’"] [#:single-open single-open-str string? "‘"] [#:single-close single-close-str string? "’"] [#:double-open double-open-str string? "“"] [#:double-close double-close-str string? "”"]) (or/c string? txexpr?)]{ Convert straight quotes in @racket[xexpr] to curly. By default, American English curly quotes are used. The optional keyword arguments can be used to set different quotes suited to other languages or script systems. @examples[#:eval my-eval (define tricky-string "\"Why,\" she could've asked, \"are we in O‘ahu watching 'Mame'?\"") (display tricky-string) (display (smart-quotes tricky-string)) (display (smart-quotes tricky-string #:double-open "«" #:double-close "»" #:single-open "‹" #:single-close "›")) (display (smart-quotes tricky-string #:double-open "„" #:double-close "”" #:single-open "‚" #:single-close "’")) ] } @defproc[ (smart-dashes [str string?]) string?] In @racket[_str], convert three hyphens to an em dash, and two hyphens to an en dash, and remove surrounding spaces. @examples[#:eval my-eval (define tricky-string "I had a few --- OK, like 6--8 --- thin mints.") (display tricky-string) (display (smart-dashes tricky-string)) (code:comment @#,t{Monospaced font not great for showing dashes, but you get the idea}) ] @defproc[ (smart-ellipses [str string?]) string?] In @racket[_str], convert three periods to an ellipsis. @examples[#:eval my-eval (define tricky-string "I had a few ... OK, like 6--8 ... thin mints.") (display tricky-string) (display (smart-ellipses tricky-string)) ] @defproc[ (wrap-hanging-quotes [tx txexpr?] [#:single-preprend single-preprender txexpr-tag? 'squo] [#:double-preprend double-preprender txexpr-tag? 'dquo] ) txexpr?] Find single or double quote marks at the beginning of @racket[_tx] and wrap them in an X-expression with the tag @racket[_single-preprender] or @racket[_double-preprender], respectively. The default values are @racket['squo] and @racket['dquo]. @examples[#:eval my-eval (wrap-hanging-quotes '(p "No quote to hang.")) (wrap-hanging-quotes '(p "“What? We need to hang quotes?”")) ] In pro typography, quotation marks at the beginning of a line or paragraph are often shifted into the margin slightly to make them appear more optically aligned with the left edge of the text. With a reflowable layout model like HTML, you don't know where your line breaks will be. This function will simply insert the @racket['squo] and @racket['dquo] tags, which provide hooks that let you do the actual hanging via CSS, like so (actual measurement can be refined to taste): @verbatim{squo {margin-left: -0.25em;} dquo {margin-left: -0.50em;} } Be warned: there are many edge cases this function does not handle well. @examples[#:eval my-eval (code:comment @#,t{Argh: this edge case is not handled properly}) (wrap-hanging-quotes '(p "“" (em "What?") "We need to hang quotes?”")) ] @defproc[ (whitespace? [v any/c]) boolean?] A predicate that returns @racket[#t] for any stringlike @racket[_v] that's entirely whitespace, but also the empty string, as well as lists and vectors that are made only of @racket[whitespace?] members. Following the @racket[regexp-match] convention, @racket[whitespace?] does not return @racket[#t] for a nonbreaking space. If you prefer that behavior, use @racket[whitespace/nbsp?]. @examples[#:eval my-eval (whitespace? "\n\n ") (whitespace? (string->symbol "\n\n ")) (whitespace? "") (whitespace? '("" " " "\n\n\n" " \n")) (define nonbreaking-space (format "~a" #\u00A0)) (whitespace? nonbreaking-space) ] @defproc[ (whitespace/nbsp? [v any/c]) boolean?] Like @racket[whitespace?], but also returns @racket[#t] for nonbreaking spaces. @examples[#:eval my-eval (whitespace/nbsp? "\n\n ") (whitespace/nbsp? (string->symbol "\n\n ")) (whitespace/nbsp? "") (whitespace/nbsp? '("" " " "\n\n\n" " \n")) (define nonbreaking-space (format "~a" #\u00A0)) (whitespace/nbsp? nonbreaking-space) ]
Racket
5
otherjoel/pollen
pollen/scribblings/typography.scrbl
[ "MIT" ]
import { createServer } from '@graphql-yoga/node' import gql from 'graphql-tag' import resolvers from 'lib/resolvers' import typeDefs from 'lib/schema' const server = createServer({ schema: { typeDefs: gql(typeDefs), resolvers, }, endpoint: '/api/graphql', // graphiql: false // uncomment to disable GraphiQL }) export default server
TypeScript
4
nazarepiedady/next.js
examples/with-typescript-graphql/pages/api/graphql.ts
[ "MIT" ]
@import "~common/stylesheet/index"; .list_item { height: $line-height; .label { flex: 1; } &.indent { padding-left: 24px; } }
SCSS
4
dajibapb/algorithm-visualizer
src/components/ListItem/ListItem.module.scss
[ "MIT" ]
# config of tidb new_collations_enabled_on_first_bootstrap = true [security] ssl-ca = "/tmp/backup_restore_test/certs/ca.pem" ssl-cert = "/tmp/backup_restore_test/certs/tidb.pem" ssl-key = "/tmp/backup_restore_test/certs/tidb.key" cluster-ssl-ca = "/tmp/backup_restore_test/certs/ca.pem" cluster-ssl-cert = "/tmp/backup_restore_test/certs/tidb.pem" cluster-ssl-key = "/tmp/backup_restore_test/certs/tidb.key"
TOML
2
WizardXiao/tidb
br/tests/br_charset_gbk/tidb-new-collation.toml
[ "Apache-2.0" ]
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Text; #if CODE_STYLE using Formatter = Microsoft.CodeAnalysis.Formatting.FormatterHelper; using FormatterState = Microsoft.CodeAnalysis.Formatting.ISyntaxFormattingService; using OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions; #else using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Formatting; using FormatterState = Microsoft.CodeAnalysis.Workspace; #endif namespace Microsoft.CodeAnalysis.CodeStyle { internal static class FormattingAnalyzerHelper { internal static void AnalyzeSyntaxTree(SyntaxTreeAnalysisContext context, FormatterState formatterState, DiagnosticDescriptor descriptor, OptionSet options) { var tree = context.Tree; var cancellationToken = context.CancellationToken; var oldText = tree.GetText(cancellationToken); var formattingChanges = Formatter.GetFormattedTextChanges(tree.GetRoot(cancellationToken), formatterState, options, cancellationToken); // formattingChanges could include changes that impact a larger section of the original document than // necessary. Before reporting diagnostics, process the changes to minimize the span of individual // diagnostics. foreach (var formattingChange in formattingChanges) { var change = formattingChange; if (change.NewText.Length > 0 && !change.Span.IsEmpty) { // Handle cases where the change is a substring removal from the beginning. In these cases, we want // the diagnostic span to cover the unwanted leading characters (which should be removed), and // nothing more. var offset = change.Span.Length - change.NewText.Length; if (offset >= 0) { if (oldText.GetSubText(new TextSpan(change.Span.Start + offset, change.NewText.Length)).ContentEquals(SourceText.From(change.NewText))) { change = new TextChange(new TextSpan(change.Span.Start, offset), ""); } else { // Handle cases where the change is a substring removal from the end. In these cases, we want // the diagnostic span to cover the unwanted trailing characters (which should be removed), and // nothing more. if (oldText.GetSubText(new TextSpan(change.Span.Start, change.NewText.Length)).ContentEquals(SourceText.From(change.NewText))) { change = new TextChange(new TextSpan(change.Span.Start + change.NewText.Length, offset), ""); } } } } if (change.NewText.Length == 0 && change.Span.IsEmpty) { // No actual change (allows for the formatter to report a NOP change without triggering a // diagnostic that can't be fixed). continue; } var location = Location.Create(tree, change.Span); context.ReportDiagnostic(Diagnostic.Create( descriptor, location, additionalLocations: null, properties: null)); } } } }
C#
5
ffMathy/roslyn
src/CodeStyle/Core/Analyzers/FormattingAnalyzerHelper.cs
[ "MIT" ]
/* * Copyright (c) 2021, Luke Wilde <lukew@serenityos.org> * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include <AK/RefCounted.h> #include <AK/Weakable.h> #include <LibJS/Heap/Handle.h> #include <LibWeb/Bindings/Wrappable.h> #include <LibWeb/DOM/ExceptionOr.h> #include <LibWeb/Forward.h> namespace Web::HTML { class History final : public RefCounted<History> , public Weakable<History> , public Bindings::Wrappable { public: using WrapperType = Bindings::HistoryWrapper; static NonnullRefPtr<History> create(DOM::Document& document) { return adopt_ref(*new History(document)); } virtual ~History() override; DOM::ExceptionOr<void> push_state(JS::Value data, String const& unused, String const& url); DOM::ExceptionOr<void> replace_state(JS::Value data, String const& unused, String const& url); private: explicit History(DOM::Document&); enum class IsPush { No, Yes, }; DOM::ExceptionOr<void> shared_history_push_replace_state(JS::Value data, String const& url, IsPush is_push); DOM::Document& m_associated_document; }; }
C
4
r00ster91/serenity
Userland/Libraries/LibWeb/HTML/History.h
[ "BSD-2-Clause" ]
<!DOCTYPE html> <html> <head> <title>advanced staggering • anime.js</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta property="og:title" content="anime.js"> <meta property="og:url" content="https://animejs.com"> <meta property="og:description" content="Javascript Animation Engine"> <meta property="og:image" content="https://animejs.com/documentation/assets/img/icons/og.png"> <meta name="twitter:card" content="summary"> <meta name="twitter:title" content="anime.js"> <meta name="twitter:site" content="@juliangarnier"> <meta name="twitter:description" content="Javascript Animation Engine"> <meta name="twitter:image" content="https://animejs.com/documentation/assets/img/icons/twitter.png"> <link rel="apple-touch-icon-precomposed" href="../assets/img/social-media-image.png"> <link rel="icon" type="image/png" href="../assets/img/favicon.png" > <link href="../assets/css/animejs.css" rel="stylesheet"> <link href="../assets/css/documentation.css" rel="stylesheet"> <style> :root { font-size: 20px; } body { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; height: 100vh; background-color: #000; } .stagger-visualizer { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; position: relative; width: 32rem; height: 16rem; } .dots-wrapper { position: absolute; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; width: 100%; height: 100%; } .stagger-visualizer .dot { position: relative; width: calc(1rem - 8px); height: calc(1rem - 8px); margin: 4px; border-radius: 50%; background-color: currentColor; } </style> </head> <body> <div class="stagger-visualizer"> <div class="dots-wrapper"></div> </div> </body> <script type="module"> import anime from '../../src/index.js'; var advancedStaggeringAnimation = (function() { var staggerVisualizerEl = document.querySelector('.stagger-visualizer'); var dotsWrapperEl = staggerVisualizerEl.querySelector('.dots-wrapper'); var dotsFragment = document.createDocumentFragment(); var grid = [32, 16]; var cellSize = 1; var numberOfElements = grid[0] * grid[1]; var animation; var paused = true; for (var i = 0; i < numberOfElements; i++) { var dotEl = document.createElement('div'); dotEl.classList.add('dot'); dotsFragment.appendChild(dotEl); } dotsWrapperEl.appendChild(dotsFragment); var index = anime.random(0, numberOfElements-1); var nextIndex = 0; function play() { paused = false; if (animation) animation.pause(); nextIndex = anime.random(0, numberOfElements-1); var saturation = 75; var colorStart = anime.random(0, 256); var colorEnd = anime.random(0, 256); var colorRangeValue = [colorStart, colorEnd]; var luminosityStart = anime.random(60, 80); var luminosityEnd = anime.random(20, 40); var luminosityRangeValue = [luminosityStart, luminosityEnd]; function staggeredGridColors(el, i, total) { var hue = Math.round(anime.stagger(colorRangeValue, {grid: grid, from: index})(el, i, total)); var luminosity = Math.round(anime.stagger(luminosityRangeValue, {grid: grid, from: index})(el, i, total)); return 'hsl(' + hue + ', ' + saturation + '%, ' + luminosity + '%)'; } animation = anime({ targets: '.stagger-visualizer .dot', keyframes: [ { zIndex: function(el, i, total) { return Math.round(anime.stagger([numberOfElements, 0], {grid: grid, from: index})(el, i, total)); }, translateX: anime.stagger('-.001rem', {grid: grid, from: index, axis: 'x'}), translateY: anime.stagger('-.001rem', {grid: grid, from: index, axis: 'y'}), duration: 200 }, { translateX: anime.stagger('.075rem', {grid: grid, from: index, axis: 'x'}), translateY: anime.stagger('.075rem', {grid: grid, from: index, axis: 'y'}), scale: anime.stagger([2, .2], {grid: grid, from: index}), backgroundColor: staggeredGridColors, duration: 450 }, { translateX: 0, translateY: 0, scale: 1, duration: 500, } ], delay: anime.stagger(60, {grid: grid, from: index}), easing: 'easeInOutQuad', complete: play }, 30) index = nextIndex; } play(); })(); </script> </html>
HTML
4
HJ959/anime
documentation/examples/advanced-staggering-2.html
[ "MIT" ]
"""Tests for the Nest integration API glue library. There are two interesting cases to exercise that have different strategies for token refresh and for testing: - API based requests, tested using aioclient_mock - Pub/sub subcriber initialization, intercepted with patch() The tests below exercise both cases during integration setup. """ import time from unittest.mock import patch import pytest from homeassistant.components.nest import DOMAIN from homeassistant.components.nest.const import API_URL, OAUTH2_TOKEN, SDM_SCOPES from homeassistant.setup import async_setup_component from homeassistant.util import dt from .common import ( CLIENT_ID, CLIENT_SECRET, CONFIG, FAKE_REFRESH_TOKEN, FAKE_TOKEN, PROJECT_ID, TEST_CONFIGFLOW_YAML_ONLY, create_config_entry, ) FAKE_UPDATED_TOKEN = "fake-updated-token" async def async_setup_sdm(hass): """Set up the integration.""" assert await async_setup_component(hass, DOMAIN, CONFIG) await hass.async_block_till_done() @pytest.mark.parametrize("nest_test_config", [TEST_CONFIGFLOW_YAML_ONLY]) async def test_auth(hass, aioclient_mock): """Exercise authentication library creates valid credentials.""" expiration_time = time.time() + 86400 create_config_entry(expiration_time).add_to_hass(hass) # Prepare to capture credentials in API request. Empty payloads just mean # no devices or structures are loaded. aioclient_mock.get(f"{API_URL}/enterprises/{PROJECT_ID}/structures", json={}) aioclient_mock.get(f"{API_URL}/enterprises/{PROJECT_ID}/devices", json={}) # Prepare to capture credentials for Subscriber captured_creds = None async def async_new_subscriber(creds, subscription_name, loop, async_callback): """Capture credentials for tests.""" nonlocal captured_creds captured_creds = creds return None # GoogleNestSubscriber with patch( "google_nest_sdm.google_nest_subscriber.DefaultSubscriberFactory.async_new_subscriber", side_effect=async_new_subscriber, ) as new_subscriber_mock: await async_setup_sdm(hass) # Verify API requests are made with the correct credentials calls = aioclient_mock.mock_calls assert len(calls) == 2 (method, url, data, headers) = calls[0] assert headers == {"Authorization": f"Bearer {FAKE_TOKEN}"} (method, url, data, headers) = calls[1] assert headers == {"Authorization": f"Bearer {FAKE_TOKEN}"} # Verify the susbcriber was created with the correct credentials assert len(new_subscriber_mock.mock_calls) == 1 assert captured_creds creds = captured_creds assert creds.token == FAKE_TOKEN assert creds.refresh_token == FAKE_REFRESH_TOKEN assert int(dt.as_timestamp(creds.expiry)) == int(expiration_time) assert creds.valid assert not creds.expired assert creds.token_uri == OAUTH2_TOKEN assert creds.client_id == CLIENT_ID assert creds.client_secret == CLIENT_SECRET assert creds.scopes == SDM_SCOPES @pytest.mark.parametrize("nest_test_config", [TEST_CONFIGFLOW_YAML_ONLY]) async def test_auth_expired_token(hass, aioclient_mock): """Verify behavior of an expired token.""" expiration_time = time.time() - 86400 create_config_entry(expiration_time).add_to_hass(hass) # Prepare a token refresh response aioclient_mock.post( OAUTH2_TOKEN, json={ "access_token": FAKE_UPDATED_TOKEN, "expires_at": time.time() + 86400, "expires_in": 86400, }, ) # Prepare to capture credentials in API request. Empty payloads just mean # no devices or structures are loaded. aioclient_mock.get(f"{API_URL}/enterprises/{PROJECT_ID}/structures", json={}) aioclient_mock.get(f"{API_URL}/enterprises/{PROJECT_ID}/devices", json={}) # Prepare to capture credentials for Subscriber captured_creds = None async def async_new_subscriber(creds, subscription_name, loop, async_callback): """Capture credentials for tests.""" nonlocal captured_creds captured_creds = creds return None # GoogleNestSubscriber with patch( "google_nest_sdm.google_nest_subscriber.DefaultSubscriberFactory.async_new_subscriber", side_effect=async_new_subscriber, ) as new_subscriber_mock: await async_setup_sdm(hass) calls = aioclient_mock.mock_calls assert len(calls) == 3 # Verify refresh token call to get an updated token (method, url, data, headers) = calls[0] assert data == { "client_id": CLIENT_ID, "client_secret": CLIENT_SECRET, "grant_type": "refresh_token", "refresh_token": FAKE_REFRESH_TOKEN, } # Verify API requests are made with the new token (method, url, data, headers) = calls[1] assert headers == {"Authorization": f"Bearer {FAKE_UPDATED_TOKEN}"} (method, url, data, headers) = calls[2] assert headers == {"Authorization": f"Bearer {FAKE_UPDATED_TOKEN}"} # The subscriber is created with a token that is expired. Verify that the # credential is expired so the subscriber knows it needs to refresh it. assert len(new_subscriber_mock.mock_calls) == 1 assert captured_creds creds = captured_creds assert creds.token == FAKE_TOKEN assert creds.refresh_token == FAKE_REFRESH_TOKEN assert int(dt.as_timestamp(creds.expiry)) == int(expiration_time) assert not creds.valid assert creds.expired assert creds.token_uri == OAUTH2_TOKEN assert creds.client_id == CLIENT_ID assert creds.client_secret == CLIENT_SECRET assert creds.scopes == SDM_SCOPES
Python
5
mib1185/core
tests/components/nest/test_api.py
[ "Apache-2.0" ]
; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-unknown-linux-gnu -no-integrated-as | FileCheck %s define void @f() { ; CHECK: @f entry: %0 = tail call double* asm sideeffect "qvstfdux $2,$0,$1", "=b,{r7},{f11},0,~{memory}"(i32 64, double undef, double* undef) ret void ; CHECK: qvstfdux 11,{{[0-9]+}},7 }
LLVM
4
medismailben/llvm-project
llvm/test/CodeGen/PowerPC/in-asm-f64-reg.ll
[ "Apache-2.0" ]
///////////////////////////////////////////////////////////////////////////// // Name: splash.pov // Purpose: POV-Ray scene used to generate splash image for wxWidgets // Author: Wlodzimierz ABX Skiba // Modified by: // Created: 04/08/2004 // Copyright: (c) Wlodzimierz Skiba // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #version 3.6; // Rendering options : +FN +W638 +H478 +AM1 +A0.05 +R5 #include "colors.inc" #include "rad_def.inc" #include "screen.inc" #include "shapes.inc" global_settings { assumed_gamma 1.0 radiosity {} } #local Location = <0,5,-100> ; Set_Camera_Location(Location) Set_Camera_Look_At(<0,0,0>) background { rgb White } light_source { 1000*y color White } light_source { Location color White } union{ Center_Object( text { ttf "crystal.ttf", ". wxWidgets ." .01, 0 scale 20 translate 22*y pigment { color Black } } , x ) Center_Object( text { ttf "crystal.ttf", ". Cross-Platform GUI Library ." .01, 0 scale 10 translate 10*y pigment { color Black } } , x ) Center_Object( text { ttf "crystal.ttf", ". wxSplashScreen sample ." .01, 0 scale 2 translate 3 * y translate -z*84 pigment { color Gray } } , x ) plane { y 0 pigment { checker Black White } } rotate z*25 } #local Square = mesh { triangle { <0,0,0> <0,1,0> <1,0,0> } triangle { <1,1,0> <0,1,0> <1,0,0> } } #macro Round_Cone3(PtA, RadiusA, PtB, RadiusB, UseMerge) #local Axis = vnormalize(PtB - PtA); #local Len = VDist(PtA, PtB); #local SA = atan2(RadiusB - RadiusA, Len); #local Pt_A = PtA + Axis*RadiusA; #local Pt_B = PtB - Axis*RadiusB; #if(UseMerge) merge { #else union { #end cone {Pt_A, RadiusA, Pt_B, RadiusB} sphere {Pt_A + Axis*tan(SA)*RadiusA, RadiusA/cos(SA)} sphere {Pt_B + Axis*tan(SA)*RadiusB, RadiusB/cos(SA)} } #end #local Line = object { Round_Cone3_Union( <.15,.15,0>, .05, <.15,.9,0>, .05) pigment { color White } finish { ambient 1 diffuse 0 } scale <1,1,.01> } #macro Put_Square ( With_Pigment , At_Location , Order ) #local Next_Square = union{ object{ Square pigment { With_Pigment } } object{ Line } scale .15 }; Screen_Object (Next_Square, At_Location, 0, false, .1 + Order / 100 ) #end Put_Square( pigment {color Red} , <0.65,0.1> , 3 ) Put_Square( pigment {color Blue} , <0.72,0.2> , 2 ) Put_Square( pigment {color Yellow} , <0.81,0.13> , 1 )
POV-Ray SDL
4
madanagopaltcomcast/pxCore
examples/pxScene2d/external/WinSparkle/3rdparty/wxWidgets/samples/splash/splash.pov
[ "Apache-2.0" ]
(ns hu.test.equality (:require [assert :refer [equal deep-equal not-equal not-deep-equal]] [hu.lib.equality :as _])) (suite :isPatternEqual (fn [] (test :basic (fn [] (equal (.pattern-equal? _ #"[a-z]+" #"[a-z]+") true) (equal (.pattern-equal? _ #"[a-z]+" #"[0-9]+") false))))) (suite :isDateEqual (fn [] (test :basic (fn [] (equal (.date-equal? _ (Date. 1) (Date. 1)) true) (equal (.date-equal? _ (Date.) (Date. 1)) false))))) (suite :isArrayEqual (fn [] (test :basic (fn [] (equal (.array-equal? _ [1 2] [1 2]) true) (equal (.array-equal? _ [1 2] [1 3]) false))))) (suite :isObjectEqual (fn [] (test :basic (fn [] (equal (.object-equal? _ {:a {:b 2 :c 3}} {:a {:b 2 :c 3}}) true) (equal (.object-equal? _ {:a {:b 2 :c 3}} {:a {:b 2 :c 1}}) false))))) (suite :isEqual (fn [] (test :null (fn [] (equal (.equal? _ null null) true) (equal (.equal? _ null nil) false))) (test :boolean (fn [] (equal (.equal? _ true true) true) (equal (.equal? _ false true) false))) (test :number (fn [] (equal (.equal? _ 3.1 3.1) true) (equal (.equal? _ 3 4) false))) (test :string (fn [] (equal (.equal? _ :a :a) true) (equal (.equal? _ :a :z) false))) (test :date (fn [] (equal (.equal? _ (Date. 1) (Date. 1)) true) (equal (.equal? _ (Date.) (Date. 1)) false))) (test :regexp (fn [] (equal (.equal? _ #"[a-z]+" #"[a-z]+") true) (equal (.equal? _ #"[a-z]+" #"[a-z0-9]+") false))) (test :array (fn [] (equal (.equal? _ [1 2] [1 2]) true) (equal (.equal? _ [1 2] [1 3]) false))) (test :object (fn [] (equal (.equal? _ {:a {:b 2 :c 3}} {:a {:b 2 :c 3}}) true) (equal (.equal? _ {:a {:b 2 :c 3}} {:a {:x 1}}) false)))))
wisp
4
h2non/hu
test/equality.wisp
[ "MIT" ]
GalaxyID,x,y,e1,e2 Galaxy1,1894.56,3795.03,0.031137,-0.231662 Galaxy2,3378.43,3368.09,-0.431046,-0.138815 Galaxy3,1497.26,4032.20,0.048362,-0.174822 Galaxy4,992.56,3105.72,0.176375,-0.066931 Galaxy5,2151.59,0.14,0.018745,0.187097 Galaxy6,3706.41,1463.44,0.228807,-0.005380 Galaxy7,126.01,2510.77,-0.345459,0.055949 Galaxy8,2106.39,1582.37,0.153251,-0.247672 Galaxy9,989.34,2192.27,0.641680,-0.090298 Galaxy10,3969.55,1744.53,-0.013959,0.024075 Galaxy11,3247.41,2141.22,-0.087541,-0.211548 Galaxy12,2028.18,4163.91,0.043302,-0.248231 Galaxy13,1121.26,2694.45,0.196387,-0.008137 Galaxy14,2060.25,2615.96,-0.284287,-0.104882 Galaxy15,1254.84,396.61,0.051620,-0.060496 Galaxy16,2968.54,1434.82,0.144357,0.173696 Galaxy17,874.30,4122.78,-0.053170,0.056414 Galaxy18,536.10,956.70,-0.133667,-0.195481 Galaxy19,3365.75,574.31,-0.420034,0.358755 Galaxy20,294.39,3650.52,0.036228,-0.206912 Galaxy21,1932.52,2780.28,-0.224380,0.111382 Galaxy22,2792.56,3538.89,-0.145225,-0.017505 Galaxy23,2952.33,765.17,-0.271480,-0.066535 Galaxy24,3874.88,3239.84,-0.148126,-0.052540 Galaxy25,3841.06,2456.87,-0.178727,0.030781 Galaxy26,2424.79,955.51,-0.027007,0.146828 Galaxy27,2959.11,798.24,-0.219051,0.278982 Galaxy28,4109.76,1074.27,-0.075668,0.340348 Galaxy29,323.91,3308.11,-0.172734,-0.022189 Galaxy30,1626.50,356.90,-0.012018,0.053048 Galaxy31,2520.02,1436.61,-0.051261,0.216585 Galaxy32,1016.27,1851.32,0.239277,-0.395563 Galaxy33,2430.49,1615.77,0.626890,-0.009931 Galaxy34,1305.79,2091.70,0.062276,-0.291435 Galaxy35,426.52,1463.77,0.323251,-0.281680 Galaxy36,1121.26,1664.96,0.203334,0.277232 Galaxy37,1313.64,1181.69,-0.143632,-0.086695 Galaxy38,1638.70,1167.08,-0.126951,0.186246 Galaxy39,439.12,547.95,0.278203,0.072543 Galaxy40,3709.59,4086.02,-0.405152,0.067159 Galaxy41,2029.35,4035.90,-0.476516,0.027684 Galaxy42,2142.86,1768.84,0.104522,-0.109537 Galaxy43,2472.37,273.04,-0.320858,-0.414379 Galaxy44,2616.95,263.79,0.232594,0.138969 Galaxy45,2107.49,1953.31,-0.167453,0.416578 Galaxy46,2844.35,1343.89,0.312098,-0.132455 Galaxy47,103.49,1377.93,0.201065,-0.021201 Galaxy48,2823.82,1865.46,-0.252410,0.225418 Galaxy49,866.77,1833.07,0.139489,-0.073910 Galaxy50,600.57,4151.77,0.239507,-0.030816 Galaxy51,1677.62,187.86,0.349527,0.233974 Galaxy52,576.18,602.96,0.040288,0.284280 Galaxy53,324.36,2666.32,0.089549,-0.021100 Galaxy54,1773.87,3985.30,-0.107841,0.208561 Galaxy55,3054.65,1627.14,-0.226329,0.317200 Galaxy56,2263.16,3971.51,-0.251556,0.075891 Galaxy57,4164.96,3140.23,0.216131,-0.050950 Galaxy58,1003.86,2403.60,0.296303,-0.140973 Galaxy59,1744.12,848.12,0.013975,0.144546 Galaxy60,3880.08,2770.51,0.077921,0.162755 Galaxy61,1056.58,1289.65,-0.320246,-0.212687 Galaxy62,2458.59,2723.55,0.149455,-0.304388 Galaxy63,2616.33,1386.39,-0.118330,0.149105 Galaxy64,3918.07,3045.11,0.185081,-0.241131 Galaxy65,3617.60,4039.03,-0.250805,0.177176 Galaxy66,1751.58,3471.07,-0.121549,0.285100 Galaxy67,3493.32,222.83,0.273355,0.114007 Galaxy68,1048.33,3886.33,0.135080,-0.148447 Galaxy69,3326.86,2751.39,-0.047273,0.045898 Galaxy70,134.10,3378.95,-0.043794,-0.163742 Galaxy71,3793.57,2106.29,0.144562,0.128173 Galaxy72,3534.12,916.20,-0.034294,0.032929 Galaxy73,1375.32,3481.04,0.005547,-0.160662 Galaxy74,493.64,150.87,0.191187,0.270602 Galaxy75,1105.38,1584.57,0.367027,-0.258307 Galaxy76,2747.91,2327.93,0.158206,-0.184450 Galaxy77,3908.64,382.82,-0.060852,0.005845 Galaxy78,886.59,3877.50,0.040644,-0.046944 Galaxy79,4140.18,2119.34,0.344572,-0.119713 Galaxy80,4178.11,2448.49,-0.142095,-0.165414 Galaxy81,981.15,305.79,-0.096931,0.129590 Galaxy82,1635.92,200.11,0.187957,-0.441220 Galaxy83,1210.01,1908.26,-0.084451,0.498011 Galaxy84,1485.41,2298.14,-0.401678,-0.382373 Galaxy85,1082.58,2776.80,0.435976,-0.001382 Galaxy86,1356.29,2726.70,0.000209,-0.347392 Galaxy87,4113.97,1072.80,-0.126005,-0.328910 Galaxy88,2165.54,1515.73,0.084394,0.032395 Galaxy89,671.59,1018.91,-0.029854,-0.075742 Galaxy90,1701.69,819.94,-0.395312,0.502967 Galaxy91,1524.11,1988.32,0.122318,0.054063 Galaxy92,852.66,1304.61,-0.030032,-0.130826 Galaxy93,1119.92,4191.63,0.405659,-0.311486 Galaxy94,2690.87,1120.59,-0.156083,0.080594 Galaxy95,55.88,3406.18,0.243564,-0.057946 Galaxy96,1613.69,619.00,-0.031819,-0.191866 Galaxy97,70.94,3972.21,0.456996,-0.158689 Galaxy98,605.76,443.35,0.119577,0.113483 Galaxy99,4127.36,1751.47,0.010259,-0.222994 Galaxy100,3045.23,1898.94,-0.232909,0.089650 Galaxy101,2896.30,3788.10,0.125853,0.004954 Galaxy102,3000.41,3264.20,-0.188481,0.028092 Galaxy103,3588.51,699.26,-0.060088,-0.006024 Galaxy104,1720.71,1787.80,0.104335,-0.394630 Galaxy105,2291.67,3092.12,0.042888,0.117594 Galaxy106,2051.81,1134.43,-0.042061,0.243980 Galaxy107,520.83,1818.25,-0.133255,-0.327225 Galaxy108,1177.28,4064.72,-0.098040,0.018439 Galaxy109,3721.55,580.04,0.150922,-0.091406 Galaxy110,2041.12,2364.93,0.048136,-0.040830 Galaxy111,2545.36,1947.22,-0.084925,-0.041914 Galaxy112,3762.89,1973.61,-0.112127,-0.098790 Galaxy113,908.79,624.49,-0.207557,-0.038718 Galaxy114,1140.15,1934.46,0.148844,-0.053788 Galaxy115,1859.71,2059.94,-0.212941,-0.034228 Galaxy116,1672.30,3833.39,-0.220495,0.078413 Galaxy117,137.66,3165.12,-0.258430,0.260286 Galaxy118,2562.40,3132.25,-0.223415,0.075294 Galaxy119,3799.85,3236.54,-0.059325,0.236456 Galaxy120,865.98,1522.19,0.321131,0.160734 Galaxy121,243.65,810.55,0.083826,0.049772 Galaxy122,800.62,2728.93,0.065145,0.007445 Galaxy123,1754.65,3847.02,0.031444,-0.444019 Galaxy124,2385.83,1681.10,-0.308451,-0.322221 Galaxy125,1082.47,2285.78,-0.168625,-0.174063 Galaxy126,3119.15,151.31,0.624089,0.549921 Galaxy127,2926.68,1865.49,-0.117977,-0.054182 Galaxy128,2587.44,2898.16,-0.231445,-0.300470 Galaxy129,1673.16,3714.20,0.003856,-0.229479 Galaxy130,3486.10,1770.96,0.024354,-0.117765 Galaxy131,2848.68,4012.13,0.072834,0.114813 Galaxy132,230.04,902.77,0.146780,0.038107 Galaxy133,2122.03,3992.96,-0.029243,-0.085348 Galaxy134,65.75,2659.30,0.411529,-0.083631 Galaxy135,3396.79,2042.44,0.076677,-0.292864 Galaxy136,1722.51,1818.16,0.081849,-0.075072 Galaxy137,1744.36,2539.48,0.425290,-0.322694 Galaxy138,781.55,3566.89,0.212623,0.158532 Galaxy139,522.06,1152.37,0.143735,0.384472 Galaxy140,1298.25,3438.46,-0.216189,0.159086 Galaxy141,459.80,236.26,0.126928,0.338487 Galaxy142,1988.00,2282.01,0.172249,-0.102013 Galaxy143,2509.18,862.05,-0.213289,-0.008743 Galaxy144,3775.59,486.17,0.049709,0.140540 Galaxy145,131.49,4043.71,-0.292793,0.196845 Galaxy146,618.10,176.31,0.366503,0.185523 Galaxy147,1440.69,3074.32,-0.330817,0.481252 Galaxy148,793.54,3340.28,0.156901,-0.291201 Galaxy149,325.42,3554.75,0.141024,-0.248887 Galaxy150,3517.53,3179.98,-0.148925,-0.092938 Galaxy151,4125.51,738.94,0.177236,-0.490275 Galaxy152,3784.69,1553.11,-0.137831,-0.262135 Galaxy153,2327.36,4149.61,-0.171968,-0.258895 Galaxy154,2293.72,2601.61,-0.047663,-0.270070 Galaxy155,1046.96,3729.72,0.159582,-0.173554 Galaxy156,2134.58,3669.47,-0.265614,-0.008422 Galaxy157,2530.97,1800.86,-0.405114,-0.213829 Galaxy158,1535.70,869.18,0.188607,-0.044737 Galaxy159,2508.45,3906.83,-0.217143,-0.113423 Galaxy160,625.22,3965.10,0.312347,-0.072936 Galaxy161,3525.94,1947.25,-0.288010,-0.088984 Galaxy162,57.00,638.33,-0.155277,0.053899 Galaxy163,1816.23,1450.88,0.001087,-0.324177 Galaxy164,2892.16,3626.93,-0.158462,0.080131 Galaxy165,3346.78,357.82,-0.318058,0.134229 Galaxy166,3091.27,1840.90,-0.093957,0.062794 Galaxy167,3884.70,486.45,0.050629,-0.032929 Galaxy168,1897.90,725.32,-0.170756,0.189698 Galaxy169,1172.72,3303.40,-0.183656,-0.103679 Galaxy170,1360.29,35.41,-0.367561,-0.069003 Galaxy171,1687.76,2789.69,0.364944,-0.099168 Galaxy172,949.46,1982.63,0.212338,-0.145770 Galaxy173,323.33,2832.25,0.242054,-0.068469 Galaxy174,1972.09,1829.22,0.067002,0.075724 Galaxy175,3665.69,475.30,0.065838,0.036556 Galaxy176,3878.65,2384.27,0.177349,0.120228 Galaxy177,431.60,2394.17,0.000584,0.094705 Galaxy178,1268.58,490.64,0.011430,0.169915 Galaxy179,3299.68,3235.23,0.202322,-0.222576 Galaxy180,3872.08,3229.85,-0.114794,-0.052130 Galaxy181,616.33,2845.81,0.032367,0.212810 Galaxy182,3503.25,1342.63,-0.019910,0.188907 Galaxy183,2724.23,962.75,-0.225520,-0.231053 Galaxy184,1589.46,423.15,-0.559781,0.071905 Galaxy185,3126.40,865.56,-0.281742,0.135609 Galaxy186,2928.63,194.52,-0.166222,0.231850 Galaxy187,1398.83,911.90,-0.485381,-0.026389 Galaxy188,1446.57,4026.81,-0.362393,0.286443 Galaxy189,3986.12,265.92,0.092986,-0.052601 Galaxy190,27.33,2391.42,0.295049,-0.232188 Galaxy191,310.15,3564.52,0.114036,0.019477 Galaxy192,2880.44,4002.90,0.087377,-0.095095 Galaxy193,1816.53,63.08,0.233597,-0.113855 Galaxy194,581.55,1993.66,0.599770,0.174215 Galaxy195,392.71,2909.29,0.142536,-0.140385 Galaxy196,89.06,3569.86,0.526103,-0.335842 Galaxy197,3976.90,2760.66,-0.493147,-0.152360 Galaxy198,2509.88,4102.50,0.008290,-0.060587 Galaxy199,1576.70,131.63,0.019925,0.446180 Galaxy200,118.59,2133.40,-0.163970,0.007454 Galaxy201,314.34,872.01,0.254606,0.318119 Galaxy202,2765.53,428.88,-0.081457,0.242638 Galaxy203,2110.81,4139.39,-0.172051,-0.002471 Galaxy204,3079.82,328.69,0.011194,0.112281 Galaxy205,1717.60,2476.33,0.376626,0.026912 Galaxy206,484.76,2839.56,0.348703,0.096487 Galaxy207,976.57,1357.43,0.266175,-0.333984 Galaxy208,184.48,758.83,-0.192183,-0.137171 Galaxy209,409.53,2934.02,0.180003,-0.162514 Galaxy210,3106.44,201.47,0.098448,-0.158504 Galaxy211,415.86,1760.96,-0.061991,0.088906 Galaxy212,2721.66,52.81,-0.162798,0.129741 Galaxy213,1747.43,3380.67,0.251264,-0.034582 Galaxy214,2038.92,4179.64,-0.119568,-0.326511 Galaxy215,3576.00,992.97,-0.079245,0.141521 Galaxy216,567.04,1700.53,-0.097916,-0.242566 Galaxy217,2836.23,2024.20,-0.014432,0.344315 Galaxy218,3347.42,3034.30,-0.309500,0.057936 Galaxy219,497.54,2579.57,-0.072570,0.264745 Galaxy220,3857.75,3465.28,-0.070433,0.134930 Galaxy221,2053.69,3428.51,-0.104388,0.217641 Galaxy222,843.99,3212.77,-0.053635,-0.349203 Galaxy223,2821.37,1790.41,0.305485,0.033291 Galaxy224,3626.77,3984.48,-0.085781,-0.278028 Galaxy225,748.55,2749.63,0.285584,-0.478414 Galaxy226,2969.45,2659.12,-0.013985,-0.591550 Galaxy227,3922.03,2936.39,-0.342225,-0.546827 Galaxy228,109.67,63.29,-0.010574,0.132767 Galaxy229,3392.53,2110.44,-0.190922,-0.327148 Galaxy230,1204.18,2612.04,0.192537,0.555636 Galaxy231,2381.61,4166.70,0.315460,-0.187184 Galaxy232,1060.99,2918.22,-0.144694,-0.296181 Galaxy233,3445.56,4085.26,0.155108,0.004739 Galaxy234,2230.80,4001.42,-0.409866,-0.079419 Galaxy235,1190.21,4136.61,0.006259,0.173661 Galaxy236,3640.20,1856.84,-0.265387,-0.172977 Galaxy237,4058.72,3927.17,-0.016615,-0.075347 Galaxy238,1275.21,3625.66,0.354155,-0.286915 Galaxy239,3021.41,4061.78,0.008500,-0.182533 Galaxy240,81.28,2784.25,0.010297,0.277805 Galaxy241,1251.24,3183.40,-0.027797,-0.191535 Galaxy242,711.27,1722.46,-0.117886,-0.266316 Galaxy243,1090.08,3346.74,0.298009,0.058834 Galaxy244,3117.36,1612.41,-0.237063,-0.129814 Galaxy245,3632.19,3867.46,0.093311,0.063111 Galaxy246,445.44,4187.88,-0.123535,-0.056642 Galaxy247,2552.18,810.62,0.116062,0.416035 Galaxy248,2299.18,2941.90,0.190782,0.164175 Galaxy249,104.81,1375.41,-0.568016,0.001412 Galaxy250,1902.74,604.01,0.089505,0.005777 Galaxy251,1529.96,2806.47,0.221124,0.390907 Galaxy252,1285.80,2670.98,-0.140722,0.279925 Galaxy253,287.16,2947.74,0.350112,0.080771 Galaxy254,805.75,274.20,-0.007144,0.019705 Galaxy255,3634.49,4148.61,0.330922,0.211342 Galaxy256,3466.53,743.61,0.184703,0.243129 Galaxy257,3281.85,3901.07,0.146944,0.034069 Galaxy258,3595.65,3842.99,-0.221196,-0.361659 Galaxy259,1538.37,1944.59,-0.206377,-0.226192 Galaxy260,2724.79,587.09,0.040338,0.309476 Galaxy261,1.18,2930.78,0.074002,-0.199546 Galaxy262,1465.20,4134.56,0.253037,-0.288851 Galaxy263,2736.36,2970.42,-0.400106,-0.319867 Galaxy264,597.46,2768.10,-0.112765,-0.206384 Galaxy265,1281.10,668.94,0.279459,-0.057769 Galaxy266,2950.66,1263.22,-0.079469,0.012710 Galaxy267,2493.46,2040.15,0.069715,0.224254 Galaxy268,401.92,1801.46,-0.190597,-0.014506 Galaxy269,232.94,2709.02,-0.245775,0.000531 Galaxy270,1260.03,3398.82,-0.122400,-0.042044 Galaxy271,417.86,3983.92,-0.055481,-0.108007 Galaxy272,1070.94,3126.62,0.239737,0.279384 Galaxy273,2678.71,1001.67,0.073774,-0.420139 Galaxy274,961.38,3227.27,-0.580893,-0.200913 Galaxy275,3755.13,2287.82,-0.018661,0.187800 Galaxy276,133.39,962.37,-0.238863,-0.228493 Galaxy277,44.55,3835.19,0.066045,0.073804 Galaxy278,2878.60,3972.35,0.012604,-0.155367 Galaxy279,345.81,2789.60,0.210249,-0.239969 Galaxy280,2174.83,2505.58,-0.016259,-0.207409 Galaxy281,1426.62,1302.99,-0.302997,-0.328906 Galaxy282,3633.00,3833.53,-0.069181,-0.197665 Galaxy283,3903.40,1718.77,0.429569,0.133813 Galaxy284,3663.47,3836.40,0.309811,-0.264675 Galaxy285,3170.48,751.20,-0.016726,-0.390711 Galaxy286,1495.43,2902.65,0.350034,-0.226673 Galaxy287,2891.58,1733.71,-0.040050,0.327457 Galaxy288,3884.88,357.13,-0.153605,0.661325 Galaxy289,1055.07,380.70,-0.214417,0.150351 Galaxy290,2434.56,1228.96,0.002631,-0.111546 Galaxy291,2723.87,1071.66,-0.160142,-0.138647 Galaxy292,2329.21,2090.98,-0.134336,-0.112661 Galaxy293,3286.24,3084.53,0.205617,-0.175887 Galaxy294,1606.58,2382.51,0.134507,0.096787 Galaxy295,2669.36,1466.74,-0.058169,-0.338824 Galaxy296,2816.59,2082.08,0.042597,0.122872 Galaxy297,2463.60,1008.74,0.166749,0.321876 Galaxy298,3282.66,3590.39,-0.211925,0.579871 Galaxy299,17.06,3224.17,0.119786,0.122583 Galaxy300,1606.90,1514.73,0.014546,0.276513 Galaxy301,1084.32,1661.03,-0.360070,0.136541 Galaxy302,3582.72,2903.09,-0.335746,-0.244297 Galaxy303,3513.27,175.00,-0.031859,-0.009826 Galaxy304,3674.95,1614.63,0.197598,0.141619 Galaxy305,694.97,310.23,-0.145794,0.114011 Galaxy306,3904.12,3983.33,-0.063594,0.203777 Galaxy307,971.59,2763.28,0.169217,0.043548 Galaxy308,115.90,310.21,-0.323002,-0.204119 Galaxy309,1677.53,1176.73,-0.178413,0.049350 Galaxy310,620.43,2938.16,-0.400006,0.235975 Galaxy311,3009.23,596.26,-0.004892,-0.104576 Galaxy312,259.47,890.65,0.314530,0.167170 Galaxy313,1953.43,3234.13,0.523268,0.004539 Galaxy314,3946.88,3500.52,0.039355,-0.202226 Galaxy315,3527.43,1476.37,0.292279,0.166748 Galaxy316,918.10,1609.97,0.200949,0.385879 Galaxy317,1492.36,442.54,-0.151150,0.041403 Galaxy318,123.54,2660.13,0.240576,-0.106598 Galaxy319,34.48,3948.91,0.080986,0.135137 Galaxy320,2098.94,1914.93,0.280451,0.002518 Galaxy321,505.63,2277.55,0.100880,0.216105 Galaxy322,2084.22,51.69,0.231805,0.363340 Galaxy323,1334.56,53.97,0.109054,-0.055553 Galaxy324,1120.48,2238.61,0.626058,-0.018490 Galaxy325,2739.89,2929.75,-0.119425,0.245543 Galaxy326,3829.63,2768.94,-0.037786,-0.332048 Galaxy327,3640.77,2289.03,-0.227292,-0.287169 Galaxy328,1978.87,3175.93,-0.152824,-0.165391 Galaxy329,3929.23,4030.80,-0.317612,-0.095052 Galaxy330,1961.51,3640.39,0.060367,-0.427806 Galaxy331,1556.05,2013.47,-0.192144,-0.179835 Galaxy332,1557.14,3080.51,0.102140,0.062849 Galaxy333,923.97,1769.47,-0.272939,0.143770 Galaxy334,2929.62,908.58,-0.264994,0.219939 Galaxy335,363.78,783.11,0.319958,-0.331698 Galaxy336,1781.08,393.99,-0.039756,0.225017 Galaxy337,1929.02,2797.94,-0.129816,0.040138 Galaxy338,1348.12,1177.41,-0.401961,0.244911 Galaxy339,1755.20,2475.56,0.085345,-0.155017 Galaxy340,2284.19,303.98,-0.190213,-0.199075 Galaxy341,2710.45,3277.45,0.247734,-0.192962 Galaxy342,666.95,3072.98,0.163744,-0.066925 Galaxy343,301.11,648.72,0.303106,-0.342984 Galaxy344,3291.42,3046.86,-0.120302,0.126591 Galaxy345,4042.60,1408.62,0.080513,-0.490418 Galaxy346,2194.78,2963.68,0.373846,0.075279 Galaxy347,2029.66,1684.02,-0.153961,0.085775 Galaxy348,1987.53,2583.77,-0.213703,-0.361478 Galaxy349,3658.18,3747.88,0.144565,0.068709 Galaxy350,609.65,2664.23,-0.094529,0.106704 Galaxy351,1535.32,224.87,-0.148035,-0.094168 Galaxy352,622.97,2275.49,-0.033662,-0.196370 Galaxy353,1260.53,292.60,-0.035645,0.137294 Galaxy354,4165.43,3486.06,-0.224813,0.043745 Galaxy355,2841.59,2299.69,0.146575,-0.054975 Galaxy356,2624.19,3428.80,-0.250673,-0.154492 Galaxy357,503.54,1066.05,0.108946,0.031695 Galaxy358,2787.86,1181.86,0.164045,-0.028626 Galaxy359,1473.63,2735.35,-0.232874,-0.078626 Galaxy360,949.35,2919.28,0.057495,0.096498 Galaxy361,271.26,3767.93,0.085041,-0.069091 Galaxy362,3606.15,1820.76,0.275965,-0.003598 Galaxy363,1082.05,116.61,-0.167712,0.027781 Galaxy364,3050.57,3062.69,-0.180012,-0.384084 Galaxy365,1603.71,2951.06,0.047416,0.019050 Galaxy366,2369.66,386.33,-0.154503,-0.193651 Galaxy367,1747.76,1336.28,-0.000817,-0.260586 Galaxy368,2506.41,897.52,-0.098742,-0.044442 Galaxy369,3954.52,3279.73,0.005927,0.263624 Galaxy370,3629.15,4131.38,-0.033829,0.703423 Galaxy371,2848.04,3137.15,0.110071,0.422811 Galaxy372,2556.37,2933.40,0.170889,0.111034 Galaxy373,1977.47,2809.95,0.242917,0.195392 Galaxy374,1595.01,2268.01,-0.080026,-0.030943 Galaxy375,42.62,1990.37,0.028961,-0.051509 Galaxy376,1417.09,971.55,-0.413046,-0.104152 Galaxy377,4019.69,159.87,-0.103508,0.206101 Galaxy378,335.59,236.79,0.035233,-0.041440 Galaxy379,17.91,2558.30,0.006200,-0.434346 Galaxy380,3373.21,734.80,0.253488,-0.213355 Galaxy381,3317.57,3030.80,0.034120,-0.215843 Galaxy382,1499.94,2408.26,0.213745,0.089231 Galaxy383,3522.68,2414.83,-0.154863,-0.013336 Galaxy384,1223.29,3212.17,0.170949,0.476776 Galaxy385,2159.49,1882.54,-0.218369,-0.167536 Galaxy386,1822.43,741.19,-0.176253,0.219267 Galaxy387,1604.65,4167.99,0.109195,0.164219 Galaxy388,321.85,1758.33,0.031808,0.290813 Galaxy389,3550.29,3941.83,0.188248,0.144588 Galaxy390,1620.59,110.66,-0.051184,0.481866 Galaxy391,1633.77,3983.58,-0.136137,-0.033330 Galaxy392,2627.35,9.54,0.144553,-0.281490 Galaxy393,2528.54,3587.92,0.039715,0.372840 Galaxy394,177.41,2133.80,0.339388,0.058201 Galaxy395,1577.51,1037.40,0.109018,-0.160804 Galaxy396,1054.22,2528.54,-0.120593,0.265318 Galaxy397,2288.69,3563.40,-0.219304,-0.082475 Galaxy398,2234.49,965.87,-0.380375,-0.025543 Galaxy399,3422.56,1097.94,0.193951,-0.069129 Galaxy400,3223.22,1679.08,0.120457,0.033423 Galaxy401,3246.54,1112.16,-0.312397,0.141266 Galaxy402,1336.58,3815.12,0.162551,0.178533 Galaxy403,1033.11,2303.86,-0.162083,-0.112563 Galaxy404,1911.06,1036.28,-0.118946,0.139595 Galaxy405,1136.45,3440.18,0.028699,0.084707 Galaxy406,3227.51,1858.97,0.173981,-0.124486 Galaxy407,857.31,2807.70,0.342221,0.008808 Galaxy408,3366.41,3241.20,0.293705,-0.075104 Galaxy409,1592.79,1076.44,0.100245,0.000561 Galaxy410,920.00,1355.30,-0.062647,0.218680 Galaxy411,2063.01,3676.33,-0.035915,-0.240882 Galaxy412,183.84,986.80,-0.308571,0.226720 Galaxy413,1229.86,3828.57,-0.072507,0.189875 Galaxy414,1361.86,310.18,0.037909,0.015041 Galaxy415,1538.05,3728.63,0.285345,0.228322 Galaxy416,2284.28,2415.86,0.512278,-0.314934 Galaxy417,2705.33,1815.57,-0.037722,-0.305681 Galaxy418,2823.63,474.24,-0.025079,0.065997 Galaxy419,2347.38,2433.47,-0.194102,0.428168 Galaxy420,3375.53,2618.78,0.047279,0.099217 Galaxy421,1279.05,2292.76,0.300875,0.649744 Galaxy422,2613.12,3532.40,0.028847,0.043587 Galaxy423,2193.39,1803.59,-0.471750,0.386772 Galaxy424,1778.04,983.81,-0.001799,-0.150373 Galaxy425,2707.19,4093.69,0.109844,0.220705 Galaxy426,3062.64,1366.08,0.272751,0.115282 Galaxy427,927.11,1979.86,0.015569,0.053610 Galaxy428,607.02,1168.50,0.397401,0.063117 Galaxy429,1384.27,2024.59,-0.363399,0.192622 Galaxy430,495.96,2780.21,-0.149209,-0.089329 Galaxy431,2269.89,838.84,-0.024441,0.045023 Galaxy432,178.82,4004.10,-0.246196,-0.072305 Galaxy433,2001.60,1187.85,0.168256,0.085187 Galaxy434,1897.92,2280.01,-0.466637,0.068740 Galaxy435,2198.46,3490.76,0.348098,-0.003860 Galaxy436,879.01,1194.90,0.335222,0.269130 Galaxy437,649.36,3756.33,0.000487,0.263582 Galaxy438,3343.47,1300.40,-0.317095,-0.056070 Galaxy439,2772.53,893.28,0.181158,-0.230292 Galaxy440,1.36,2603.84,-0.417914,-0.210691 Galaxy441,1280.12,3363.10,-0.187490,0.035003 Galaxy442,3244.77,3022.12,0.413771,0.249341 Galaxy443,1501.12,743.38,0.075964,0.070159 Galaxy444,3673.94,3740.30,-0.133412,-0.219074 Galaxy445,2227.73,3599.36,-0.059754,-0.207848 Galaxy446,2763.18,217.94,0.269834,0.358498 Galaxy447,3322.46,2170.85,0.210680,0.146054 Galaxy448,2666.81,1441.41,0.169690,-0.533530 Galaxy449,1707.50,1835.04,0.289067,0.063640 Galaxy450,2378.62,205.67,-0.322565,0.135494 Galaxy451,3939.35,2204.17,0.274602,0.385573 Galaxy452,387.43,3373.88,-0.177474,-0.155654 Galaxy453,471.07,3158.54,0.050813,0.080902 Galaxy454,2292.05,2070.36,-0.013151,0.126043 Galaxy455,617.23,1904.73,-0.123583,0.020344
CSV
2
jColeChanged/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers
Chapter5_LossFunctions/data/Train_Skies/Train_Skies/Training_Sky270.csv
[ "MIT" ]
DROP TABLE IF EXISTS visits; CREATE TABLE visits (str String) ENGINE = MergeTree ORDER BY (str); SELECT 1 FROM visits ARRAY JOIN arrayFilter(t -> 1, arrayMap(x -> tuple(x), [42])) AS i WHERE ((str, i.1) IN ('x', 0)); DROP TABLE visits;
SQL
2
pdv-ru/ClickHouse
tests/queries/0_stateless/00876_wrong_arraj_join_column.sql
[ "Apache-2.0" ]
transport : (0 eq : a === b) -> a -> b transport eq x = rewrite sym eq in x nested : (0 _ : a === b) -> (0 _ : b === c) -> a === c nested eq1 eq2 = rewrite eq1 in rewrite eq2 in let prf : c === c := Refl in prf
Idris
4
ska80/idris-jvm
tests/ideMode/ideMode005/Rewrite.idr
[ "BSD-3-Clause" ]
DROP TYPE IF EXISTS "Role"; CREATE TYPE "Role" AS ENUM ('USER', 'ADMIN'); DROP TABLE IF EXISTS "public"."Post" CASCADE; CREATE TABLE "public"."Post" ( "id" text NOT NULL, "createdAt" timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" timestamp(3) NOT NULL DEFAULT '1970-01-01 00:00:00'::timestamp without time zone, "published" boolean NOT NULL DEFAULT false, "title" text NOT NULL, "content" text, "authorId" text, "jsonData" jsonb, "coinflips" _bool, PRIMARY KEY ("id") ); DROP TABLE IF EXISTS "public"."User" CASCADE; CREATE TABLE "public"."User" ( "id" text, "email" text NOT NULL, "name" text, PRIMARY KEY ("id") ); CREATE UNIQUE INDEX "User.email" ON "public"."User"("email"); ALTER TABLE "public"."Post" ADD FOREIGN KEY ("authorId") REFERENCES "public"."User"("id") ON DELETE SET NULL ON UPDATE CASCADE; INSERT INTO "public"."User" (email, id, name) VALUES ( 'a@a.de', '576eddf9-2434-421f-9a86-58bede16fd95', 'Alice' );
SQL
3
safareli/prisma
packages/migrate/src/__tests__/fixtures/introspection/postgresql/setup.sql
[ "Apache-2.0" ]
9,D 20,20 85,85 A0,A0 1680,1680 2000,200A 2028,2029 202F,202F 205F,205F 3000,3000
Component Pascal
0
janosch-x/character_set
lib/character_set/predefined_sets/whitespace.cps
[ "MIT" ]
<#ftl encoding="utf-8" /> <#setting locale="en_US" /> <#import "library" as lib /> <#-- FreeMarker comment ${abc} <#assign a=12 /> --> <!DOCTYPE html> <html lang="en-us"> <head> <meta charset="utf-8" /> <title>${title!"FreeMarker"}<title> </head> <body> <h1>Hello ${name!""}</h1> <p>Today is: ${.now?date}</p> <#assign x = 13> <#if x &gt; 12 && x lt 14>x equals 13: ${x}</#if> <ul> <#list items as item> <li>${item_index}: ${item.name!?split("\n")[0]}</li> </#list> </ul> User directive: <@lib.function attr1=true attr2='value' attr3=-42.12>Test</@lib.function> <@anotherOne /> <#if variable?exists> Deprecated <#elseif variable??> Better <#else> Default </#if> <img src="images/${user.id}.png" /> </body> </html>
FreeMarker
3
websharks/ace-builds
demo/kitchen-sink/docs/ftl.ftl
[ "BSD-3-Clause" ]
@import './_variables.scss' .v-input--checkbox &.v-input--indeterminate &.v-input--is-disabled opacity: $checkbox-disabled-opacity &.v-input--dense margin-top: $checkbox-dense-margin-top
Sass
3
vanillamasonry/vuetify
packages/vuetify/src/components/VCheckbox/VCheckbox.sass
[ "MIT" ]
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. ' vbc /t:module /out:Source4Module.netmodule /vbruntime- Source4.vb ' vbc /t:library /out:c4.dll /vbruntime- Source4.vb Public Class C4 End Class
Visual Basic
2
ffMathy/roslyn
src/Compilers/Test/Resources/Core/SymbolsTests/MultiTargeting/Source4.vb
[ "MIT" ]
lkf_rabbitmq_vhost
ApacheConf
0
rushoooooo/beacon-iot
third-party/rabbitmq/config/lib/mnesia/rabbit@rabbitmq_node1/msg_stores/vhosts/80Q5R61TMWIHBR2O0SO6JOFQ6/.vhost
[ "MIT" ]
2019-09-18 23:18:41 --> kky (~kky@103.117.23.112) has joined #sect-ctf 2019-09-18 23:18:42 -- Topic for #sect-ctf is "SECT-CTF - flag: SECT{SECT_CTF_2019} https://sect.ctf.rocks/ - September 18th, 15:00 UTC - September 19th 2019, 21:00 UTC (31h) - Theme: Cyberpunk" 2019-09-18 23:18:42 -- Topic set by likvidera (~likvidera@elakkod.se) on Thu, 29 Aug 2019 21:02:48 2019-09-18 23:18:42 -- Channel #sect-ctf: 75 nicks (8 ops, 2 voices, 65 normals) 2019-09-18 23:18:43 <-- tmk (05ad50df@gateway/web/cgi-irc/kiwiirc.com/ip.5.173.80.223) has quit (Remote host closed the connection) 2019-09-18 23:18:44 -- Channel created on Wed, 16 Sep 2015 16:50:56 2019-09-18 23:19:26 kky capsizes 2019-09-18 23:19:30 --> kiwi_18 (030843c8@gateway/web/cgi-irc/kiwiirc.com/ip.3.8.67.200) has joined #sect-ctf 2019-09-18 23:20:40 --> onotch (~onotch@ZP107130.ppp.dion.ne.jp) has joined #sect-ctf 2019-09-18 23:21:15 --> noopnoop (~noopnoop@unaffiliated/noopnoop) has joined #sect-ctf 2019-09-18 23:21:22 <-- kiwi_5093 (5ebf9251@gateway/web/cgi-irc/kiwiirc.com/ip.94.191.146.81) has quit (Remote host closed the connection) 2019-09-18 23:22:06 <-- mutluexe (5f0c7829@gateway/web/cgi-irc/kiwiirc.com/ip.95.12.120.41) has quit (Remote host closed the connection) 2019-09-18 23:22:16 <-- gruf (48c53f92@ip72-197-63-146.sd.sd.cox.net) has quit (Remote host closed the connection) 2019-09-18 23:23:17 --> tenflo (~tenflo@1-163-190-109.dsl.ovh.fr) has joined #sect-ctf 2019-09-18 23:23:37 <-- tenflo (~tenflo@1-163-190-109.dsl.ovh.fr) has quit (Client Quit) 2019-09-18 23:27:48 <-- Error (5eea2420@gateway/web/cgi-irc/kiwiirc.com/ip.94.234.36.32) has quit (Remote host closed the connection) 2019-09-18 23:32:53 --> kiwi_32 (5164f196@gateway/web/cgi-irc/kiwiirc.com/ip.81.100.241.150) has joined #sect-ctf 2019-09-18 23:33:24 mikeoola k 2019-09-18 23:33:28 mikeoola test 2019-09-18 23:34:57 <-- kiwi_9 (6d4eba46@gateway/web/cgi-irc/kiwiirc.com/ip.109.78.186.70) has quit (Remote host closed the connection) 2019-09-18 23:35:21 -- irc: disconnected from server
IRC log
0
akshaykumar23399/DOTS
weechat/logs/irc.freenode.#sect-ctf.weechatlog
[ "Unlicense" ]
Raw <%= {:safe, @message} %>
HTML+EEX
1
faheempatel/phoenix
test/fixtures/templates/safe.html.eex
[ "MIT" ]
(* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) type id val compare_id : id -> id -> int val equal_id : id -> id -> bool val id_of_int : int -> id val id_as_int : id -> int option val id_of_aloc_id : ALoc.id -> id val string_of_id : id -> string val generate_id : unit -> id
OCaml
3
Hans-Halverson/flow
src/typing/source_or_generated_id.mli
[ "MIT" ]
\begin{code} module OverView where import Prelude hiding ((.), filter) import Language.Haskell.Liquid.Prelude {-@ LIQUID "--no-termination" @-} \end{code} \begin{code} {-@ filter :: forall <p :: a -> Bool, w :: a -> Bool -> Bool>. {y :: a, b::{v:Bool<w y> | v}|- {v:a| v == y} <: a<p>} (x:a -> Bool<w x>) -> [a] -> [a<p>] @-} filter :: (a -> Bool) -> [a] -> [a] filter f (x:xs) | f x = x : filter f xs | otherwise = filter f xs filter _ [] = [] {-@ measure isPrime :: Int -> Bool @-} isPrimeP :: Int -> Bool {-@ isPrimeP :: n:Int -> {v:Bool | v <=> isPrime n} @-} isPrimeP = undefined -- | `positives` works by instantiating: -- p := \v -> isPrime v -- q := \n v -> Bool v <=> isPrime n {-@ primes :: [Int] -> [{v:Int | isPrime v}] @-} primes = filter isPrimeP \end{code}
Literate Haskell
5
curiousleo/liquidhaskell
benchmarks/icfp15/pos/Filter.lhs
[ "MIT", "BSD-3-Clause" ]
# SCAMP shell include "getopt.sl"; include "glob.sl"; include "grarr.sl"; include "malloc.sl"; include "parse.sl"; include "stdio.sl"; include "strbuf.sl"; include "string.sl"; include "sys.sl"; var sherr; # return static "path/name" if name exists in path, otherwise return 0 var tryname_sz = 128; var tryname = malloc(tryname_sz); var try = func(path, name) { var lenpath = strlen(path); var lenname = strlen(name); if (lenpath+1+lenname+1 > tryname_sz) return 0; strcpy(tryname, path); *(tryname + lenpath) = '/'; strcpy(tryname+lenpath+1, name); *(tryname + lenpath + 1 + lenname) = 0; # if we can open the name for reading, we'll allow it var fd = open(tryname, O_READ); if (fd < 0) return 0; close(fd); return tryname; }; # search for path to "name" # return pointer to static buffer var search = func(name) { var s; # if "name" contains slashes, leave it alone s = name; while (*s) { if (*s == '/') return name; s++; }; # look under "/bin" s = try("/bin", name); if (s) return s; # TODO: take path from $PATH? return 0; }; # see if args[0] is an internal command - if so, run it and return 1; # if not, return 0 var internal = func(args) { var n; if (strcmp(args[0], "cd") == 0) { if (args[1]) n = chdir(args[1]) else n = chdir("/home"); # TODO: [nice] take from $HOME? if (n < 0) fprintf(2, "sh: %s: %s\n", [args[1], strerror(n)]); } else if (strcmp(args[0], "exit") == 0) { n = 0; if (args[1]) n = atoi(args[1]); exit(n); } else { return 0; }; return 1; }; # redirect "name" to "fd" with the given "mode"; return an fd that stores # the previous state, suitable for use with "unredirect()"; # if "name" is a null pointer, do nothing and return -1 var redirect = func(fd, name, mode) { if (name == 0) return -1; var filefd = open(name, mode); if (filefd < 0) die("can't open %s: %s", [name, strerror(filefd)]); var prev = copyfd(-1, fd); # backup the current configuration of "fd" copyfd(fd, filefd); # overwrite it with the new file close(filefd); return prev; }; # close the "fd" and restore "prev" # if "fd" is -1, do nothing var unredirect = func(fd, prev) { if (prev == -1) return 0; close(fd); copyfd(fd, prev); close(prev); }; # TODO: [nice] communicate parse errors better var parse_strp; var parse_args; var in_redirect; var in_is_tmp; var out_redirect; var err_redirect; var maxargument = 2048; var ARGUMENT = malloc(maxargument); # forward declarations var execute_parse_args; var StringExcept = func(except) { *ARGUMENT = peekchar(); if (!parse(NotAnyChar, except)) return 0; var i = 1; while (i < maxargument) { *(ARGUMENT+i) = peekchar(); if (!parse(NotAnyChar, except)) { *(ARGUMENT+i) = 0; skip(); return 1; }; if (ARGUMENT[i] == '\\') *(ARGUMENT+i) = nextchar(); i++; }; die("argument too long:%d,%d,%d",[ARGUMENT[0],ARGUMENT[4], ARGUMENT[7]]); }; var BareWord = func(x) return StringExcept("|<> \t\r\n`'\""); # TODO: [nice] implement backticks var Backticks = func(x) { return 0; }; var SingleQuotes = func(x) { if (!parse(Char,'\'')) return 0; if (!parse(StringExcept,"'")) return 0; if (!parse(Char,'\'')) return 0; grpush(parse_args, strdup(ARGUMENT)); return 1; }; var DoubleQuotes = func(x) { if (!parse(Char,'"')) return 0; if (!parse(StringExcept,"\"")) return 0; if (!parse(Char,'"')) return 0; grpush(parse_args, strdup(ARGUMENT)); return 1; }; var Argument = func(x) { var g; if (parse(BareWord,0)) { g = glob(ARGUMENT); if (g) { grwalk(g, func(word) { grpush(parse_args, strdup(word)); }); globfree(g); }; # if (!g), most likely a directory doesn't exist return 1; }; if (parse(Backticks,0)) return 1; if (parse(SingleQuotes,0)) return 1; if (parse(DoubleQuotes,0)) return 1; return 0; }; # TODO: [nice] support appending with ">>" var IORedirection = func(x) { if (parse(CharSkip,'<')) { if (!parse(BareWord,0)) die("< needs argument",0); in_redirect = strdup(ARGUMENT); in_is_tmp = 0; return 1; } else if (parse(CharSkip,'>')) { if (!parse(BareWord,0)) die("> needs argument",0); out_redirect = strdup(ARGUMENT); return 1; } else if (parse(String,"2>")) { # TODO: [nice] should support more generic fd redirection skip(); if (!parse(BareWord,0)) die("2> needs argument",0); err_redirect = strdup(ARGUMENT); return 1; }; return 0; }; var Pipe = func(x) { if (parse(CharSkip,'|')) return 1; return 0; }; var CommandLine = func(x) { while (1) { if (parse(Argument,0)) { # ... } else if (parse(IORedirection,0)) { # ... } else if (parse(Pipe,0)) { out_redirect = strdup(tmpnam()); execute_parse_args(); parse_args = grnew(); in_redirect = out_redirect; in_is_tmp = 1; out_redirect = 0; } else { return 1; }; }; }; var execute_arr = func(args) { # handle internal commands var p; if (internal(args)) { return 0; }; # search for binaries and set absolute path var path = search(args[0]); if (!path) { fprintf(2, "sh: %s: not found in path\n", [args[0]]); return 1; }; var oldargs0 = args[0]; *args = strdup(path); free(oldargs0); # setup io redirection var prev_in = redirect(0, in_redirect, O_READ); var prev_out = redirect(1, out_redirect, O_WRITE|O_CREAT); var prev_err = redirect(2, err_redirect, O_WRITE|O_CREAT); # execute binaries var rc = system(args); # undo io redirection unredirect(0, prev_in); unredirect(1, prev_out); unredirect(2, prev_err); if (rc < 0) fprintf(2, "sh: %s: %s\n", [args[0], strerror(rc)]); return rc; }; execute_parse_args = func() { if (grlen(parse_args) == 0) { grfree(parse_args); return 0; }; grpush(parse_args, 0); var args_arr = malloc(grlen(parse_args)); memcpy(args_arr, grbase(parse_args), grlen(parse_args)); grfree(parse_args); var rc = execute_arr(args_arr); var p = args_arr; while (*p) free(*(p++)); free(args_arr); return rc; }; # parse the input string and return an array of args # caller needs to free the returned array and each of # the strings in it var parse_input = func(str) { parse_strp = str; parse_args = grnew(); in_redirect = 0; in_is_tmp = 0; out_redirect = 0; err_redirect = 0; parse_init(func() { if (*parse_strp) return *(parse_strp++); return EOF; }); skip(); if (!parse(CommandLine,0)) { grfree(parse_args); sherr = "parse error"; return 1; }; if (nextchar() != EOF) { grfree(parse_args); sherr = "parse error"; return 1; }; var rc = execute_parse_args(); # free names of redirection filenames if (in_is_tmp) unlink(in_redirect); free(in_redirect); free(out_redirect); free(err_redirect); return rc; }; # parse & execute the given string var execute = func(str) { sherr = 0; var rc = parse_input(str); if (sherr) fprintf(2, "sh: %s\n", [sherr]); return rc; }; var in_fd = 0; # stdin var dashc = 0; var args = getopt(cmdargs()+1, "", func(ch, arg) { if (ch == 'c') { dashc = 1; } else { fprintf(2, "sh: error: unrecognised option -%c\n", [ch]); exit(1); }; }); # sh -c ... : concatenate the args and execute them var sb; if (dashc) { sb = sbnew(); while (*args) { sbputs(sb, *args); sbputc(sb, ' '); args++; }; exit(execute(sbbase(sb))); }; if (*args) { in_fd = open(*args, O_READ); if (in_fd < 0) die("sh: open %s: %s", [*args, strerror(in_fd)]); }; var buf = malloc(256); var SP = 0xffff; var trap_sp = *SP; var restarted = 0; var restart = asm { }; # we'll return to here when ^C is typed if (restarted) { fputc(2, '\n'); }; restarted = 1; trap(restart); *SP = trap_sp; # override the die() from parse.sl so that it is non-fatal die = func(fmt, args){ fprintf(2, fmt, args); restart(); }; while (1) { if (in_fd == 0) fputs(2, "$ "); # TODO: [nice] not if stderr is not a terminal if (fgets(in_fd, buf, 256) == 0) break; execute(buf); };
Slash
5
jes/scamp-cpu
sys/sh.sl
[ "Unlicense" ]
note description: "API tests for FAKE_API" date: "$Date$" revision: "$Revision$" class FAKE_API_TEST inherit EQA_TEST_SET feature -- Test routines test_fake_outer_boolean_serialize -- -- -- Test serialization of outer boolean types local l_response: OUTER_BOOLEAN l_body: OUTER_BOOLEAN do -- TODO: Initialize required params. -- l_response := api.fake_outer_boolean_serialize(l_body) assert ("not_implemented", False) end test_fake_outer_composite_serialize -- -- -- Test serialization of object with outer number type local l_response: OUTER_COMPOSITE l_body: OUTER_COMPOSITE do -- TODO: Initialize required params. -- l_response := api.fake_outer_composite_serialize(l_body) assert ("not_implemented", False) end test_fake_outer_number_serialize -- -- -- Test serialization of outer number types local l_response: OUTER_NUMBER l_body: OUTER_NUMBER do -- TODO: Initialize required params. -- l_response := api.fake_outer_number_serialize(l_body) assert ("not_implemented", False) end test_fake_outer_string_serialize -- -- -- Test serialization of outer string types local l_response: OUTER_STRING l_body: OUTER_STRING do -- TODO: Initialize required params. -- l_response := api.fake_outer_string_serialize(l_body) assert ("not_implemented", False) end test_test_client_model -- To test \&quot;client\&quot; model -- -- To test \&quot;client\&quot; model local l_response: CLIENT l_body: CLIENT do -- TODO: Initialize required params. -- l_body -- l_response := api.test_client_model(l_body) assert ("not_implemented", False) end test_test_endpoint_parameters -- Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -- -- Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 local l_number: REAL_32 l_double: REAL_64 l_pattern_without_delimiter: STRING_32 l_byte: ARRAY [NATURAL_8] l_integer: INTEGER_32 l_int32: INTEGER_32 l_int64: INTEGER_64 l_float: REAL_32 l_string: STRING_32 l_binary: STRING_32 l_date: DATE l_date_time: DATE_TIME l_password: STRING_32 l_callback: STRING_32 do -- TODO: Initialize required params. -- l_number -- l_double -- l_pattern_without_delimiter -- l_byte -- api.test_endpoint_parameters(l_number, l_double, l_pattern_without_delimiter, l_byte, l_integer, l_int32, l_int64, l_float, l_string, l_binary, l_date, l_date_time, l_password, l_callback) assert ("not_implemented", False) end test_test_enum_parameters -- To test enum parameters -- -- To test enum parameters local l_enum_form_string_array: LIST [STRING_32] l_enum_form_string: STRING_32 l_enum_header_string_array: LIST [STRING_32] l_enum_header_string: STRING_32 l_enum_query_string_array: LIST [STRING_32] l_enum_query_string: STRING_32 l_enum_query_integer: INTEGER_32 l_enum_query_double: REAL_64 do -- TODO: Initialize required params. -- api.test_enum_parameters(l_enum_form_string_array, l_enum_form_string, l_enum_header_string_array, l_enum_header_string, l_enum_query_string_array, l_enum_query_string, l_enum_query_integer, l_enum_query_double) assert ("not_implemented", False) end test_test_json_form_data -- test json serialization of form data -- -- local l_param: STRING_32 l_param2: STRING_32 do -- TODO: Initialize required params. -- l_param -- l_param2 -- api.test_json_form_data(l_param, l_param2) assert ("not_implemented", False) end feature {NONE} -- Implementation api: FAKE_API -- Create an object instance of `FAKE_API'. once create { FAKE_API } Result end end
Eiffel
4
MalcolmScoffable/openapi-generator
samples/client/petstore/eiffel/test/apis/fake_api_test.e
[ "Apache-2.0" ]
(***********************************************************************) (* *) (* Applied Type System *) (* *) (***********************************************************************) (* ** ATS/Postiats - Unleashing the Potential of Types! ** Copyright (C) 2011-2016 Hongwei Xi, ATS Trustful Software, Inc. ** All rights reserved ** ** ATS is free software; you can redistribute it and/or modify it under ** the terms of the GNU GENERAL PUBLIC LICENSE (GPL) as published by the ** Free Software Foundation; either version 3, or (at your option) any ** later version. ** ** ATS is distributed in the hope that it will be useful, but WITHOUT ANY ** WARRANTY; without even the implied warranty of MERCHANTABILITY or ** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ** for more details. ** ** You should have received a copy of the GNU General Public License ** along with ATS; see the file COPYING. If not, please write to the ** Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA ** 02110-1301, USA. *) (* ****** ****** *) (* Author: Hongwei Xi *) (* Authoremail: gmmhwxiATgmailDOTcom *) (* Start time: October, 2016 *) (* ****** ****** *) // abstype qlistref_vt0ype_type(a:vt@ype) = ptr // typedef qlistref(a:vt0ype) = qlistref_vt0ype_type(a) // (* ****** ****** *) // fun{} qlistref_make_nil {a:vt0ype}((*void*)):<!wrt> qlistref(a) // (* ****** ****** *) fun {a:vt0p} qlistref_is_nil(q0: qlistref(a)): bool fun {a:vt0p} qlistref_isnot_nil(q0: qlistref(a)): bool (* ****** ****** *) fun {a:vt0p} qlistref_length(q0: qlistref(a)): intGte(0) (* ****** ****** *) // fun {a:vt0p} qlistref_insert(qlistref(a), a):<!ref> void // (* ****** ****** *) // fun {a:vt0p} qlistref_takeout_exn(qlistref(a)):<!ref> (a) fun {a:vt0p} qlistref_takeout_opt(qlistref(a)):<!ref> Option_vt(a) // (* ****** ****** *) // fun {a:vt0p} qlistref_takeout_list(qlistref(a)):<!ref> List0_vt(a) // (* ****** ****** *) // // overloading for certain symbols // (* ****** ****** *) // overload iseqz with qlistref_is_nil overload isneqz with qlistref_isnot_nil // (* ****** ****** *) overload length with qlistref_length (* ****** ****** *) // overload .insert with qlistref_insert // (* ****** ****** *) // overload .takeout with qlistref_takeout_exn overload .takeout_opt with qlistref_takeout_opt // (* ****** ****** *) (* end of [qlistref.sats] *)
ATS
4
bbarker/ATS-Postiats-contrib
projects/LARGE/TUTORIATS/in-browsers/PATSHOME/libats/ML/SATS/qlistref.sats
[ "MIT" ]
defprotocol Protocol.ConsolidationTest.Sample do @type t :: any @doc "Ok" @deprecated "Reason" @spec ok(t) :: boolean def ok(term) end
Elixir
4
doughsay/elixir
lib/elixir/test/elixir/fixtures/consolidation/sample.ex
[ "Apache-2.0" ]
globals [ initial-trees ;; how many trees (green patches) we started with burned-trees ;; how many have burned so far ] breed [fires fire] ;; bright red turtles -- the leading edge of the fire breed [embers ember] ;; turtles gradually fading from red to near black to setup clear-all set-default-shape turtles "square" ;; make some green trees ask patches with [(random-float 100) < density] [ set pcolor green ] ;; make a column of burning trees ask patches with [pxcor = min-pxcor] [ ignite ] ;; set tree counts set initial-trees count patches with [pcolor = green] set burned-trees 0 reset-ticks end to go if not any? turtles ;; either fires or embers [ stop ] ask fires [ ask neighbors4 with [pcolor = green] [ ignite ] set breed embers ] fade-embers tick end ;; creates the fire turtles to ignite ;; patch procedure sprout-fires 1 [ set color red ] set pcolor black set burned-trees burned-trees + 1 end ;; achieve fading color effect for the fire as it burns to fade-embers ask embers [ set color color - 0.3 ;; make red darker if color < red - 3.5 ;; are we almost at black? [ set pcolor color die ] ] end ; Copyright 1997 Uri Wilensky. ; See Info tab for full copyright and license. @#$#@#$#@ GRAPHICS-WINDOW 200 10 710 521 -1 -1 2.0 1 10 1 1 1 0 0 0 1 -125 125 -125 125 1 1 1 ticks 30.0 MONITOR 43 131 158 176 percent burned (burned-trees / initial-trees)\n* 100 1 1 11 SLIDER 5 38 190 71 density density 0.0 99.0 57.0 1.0 1 % HORIZONTAL BUTTON 106 79 175 115 go go T 1 T OBSERVER NIL NIL NIL NIL 0 BUTTON 26 79 96 115 setup setup NIL 1 T OBSERVER NIL NIL NIL NIL 1 @#$#@#$#@ ## WHAT IS IT? This project simulates the spread of a fire through a forest. It shows that the fire's chance of reaching the right edge of the forest depends critically on the density of trees. This is an example of a common feature of complex systems, the presence of a non-linear threshold or critical parameter. ## HOW IT WORKS The fire starts on the left edge of the forest, and spreads to neighboring trees. The fire spreads in four directions: north, east, south, and west. The model assumes there is no wind. So, the fire must have trees along its path in order to advance. That is, the fire cannot skip over an unwooded area (patch), so such a patch blocks the fire's motion in that direction. ## HOW TO USE IT Click the SETUP button to set up the trees (green) and fire (red on the left-hand side). Click the GO button to start the simulation. The DENSITY slider controls the density of trees in the forest. (Note: Changes in the DENSITY slider do not take effect until the next SETUP.) ## THINGS TO NOTICE When you run the model, how much of the forest burns. If you run it again with the same settings, do the same trees burn? How similar is the burn from run to run? Each turtle that represents a piece of the fire is born and then dies without ever moving. If the fire is made of turtles but no turtles are moving, what does it mean to say that the fire moves? This is an example of different levels in a system: at the level of the individual turtles, there is no motion, but at the level of the turtles collectively over time, the fire moves. ## THINGS TO TRY Set the density of trees to 55%. At this setting, there is virtually no chance that the fire will reach the right edge of the forest. Set the density of trees to 70%. At this setting, it is almost certain that the fire will reach the right edge. There is a sharp transition around 59% density. At 59% density, the fire has a 50/50 chance of reaching the right edge. Try setting up and running a BehaviorSpace experiment (see Tools menu) to analyze the percent burned at different tree density levels. ## EXTENDING THE MODEL What if the fire could spread in eight directions (including diagonals)? To do that, use "neighbors" instead of "neighbors4". How would that change the fire's chances of reaching the right edge? In this model, what "critical density" of trees is needed for the fire to propagate? Add wind to the model so that the fire can "jump" greater distances in certain directions. ## NETLOGO FEATURES Unburned trees are represented by green patches; burning trees are represented by turtles. Two breeds of turtles are used, "fires" and "embers". When a tree catches fire, a new fire turtle is created; a fire turns into an ember on the next turn. Notice how the program gradually darkens the color of embers to achieve the visual effect of burning out. The `neighbors4` primitive is used to spread the fire. You could also write the model without turtles by just having the patches spread the fire, and doing it that way makes the code a little simpler. Written that way, the model would run much slower, since all of the patches would always be active. By using turtles, it's much easier to restrict the model's activity to just the area around the leading edge of the fire. See the "CA 1D Rule 30" and "CA 1D Rule 30 Turtle" for an example of a model written both with and without turtles. ## RELATED MODELS * Percolation * Rumor Mill ## CREDITS AND REFERENCES https://en.wikipedia.org/wiki/Forest-fire_model ## HOW TO CITE If you mention this model or the NetLogo software in a publication, we ask that you include the citations below. For the model itself: * Wilensky, U. (1997). NetLogo Fire model. http://ccl.northwestern.edu/netlogo/models/Fire. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL. Please cite the NetLogo software as: * Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL. ## COPYRIGHT AND LICENSE Copyright 1997 Uri Wilensky. ![CC BY-NC-SA 3.0](http://ccl.northwestern.edu/images/creativecommons/byncsa.png) This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu. This model was created as part of the project: CONNECTED MATHEMATICS: MAKING SENSE OF COMPLEX PHENOMENA THROUGH BUILDING OBJECT-BASED PARALLEL MODELS (OBPML). The project gratefully acknowledges the support of the National Science Foundation (Applications of Advanced Technologies Program) -- grant numbers RED #9552950 and REC #9632612. This model was developed at the MIT Media Lab using CM StarLogo. See Resnick, M. (1994) "Turtles, Termites and Traffic Jams: Explorations in Massively Parallel Microworlds." Cambridge, MA: MIT Press. Adapted to StarLogoT, 1997, as part of the Connected Mathematics Project. This model was converted to NetLogo as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227. Converted from StarLogoT to NetLogo, 2001. <!-- 1997 2001 MIT --> @#$#@#$#@ 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 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 x false 0 Polygon -7500403 true true 270 75 225 30 30 225 75 270 Polygon -7500403 true true 30 75 75 30 270 225 225 270 @#$#@#$#@ NetLogo 6.0.2 @#$#@#$#@ set density 60.0 setup repeat 180 [ go ] @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ 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
fsancho/IA
07. Complexity/Fire.nlogo
[ "MIT" ]
/* * This file is part of the X10 project (http://x10-lang.org). * * This file is licensed to You under the Eclipse Public License (EPL); * You may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.opensource.org/licenses/eclipse-1.0.php * * (C) Copyright IBM Corporation 2006-2014. */ import x10.io.Console; import x10.util.Random; /** * A KMeans object o can compute K means of a given set of * points of dimension o.myDim. * <p> * This class implements a sequential program, that is readily parallelizable. * * For a scalable, high-performance version of this benchmark see * KMeans.x10 in the X10 Benchmarks (separate download from x10-lang.org) */ public class KMeans(myDim:Long) { static val DIM=2; static val K=4; static val POINTS=2000; static val ITERATIONS=50; static val EPS=0.01F; static type ValVector(k:Long) = Rail[Float]{self.size==k}; static type ValVector = ValVector(DIM); static type Vector(k:Long) = Rail[Float]{self.size==k}; static type Vector = Vector(DIM); static type SumVector(d:Long) = V{self.dim==d}; static type SumVector = SumVector(DIM); /** * V represents the sum of 'count' number of vectors of dimension 'dim'. */ static class V(dim:Long) implements (Long)=>Float { var vec: Vector(dim); var count:Int; def this(dim:Long, init:(Long)=>Float): SumVector(dim) { property(dim); vec = new Rail[Float](this.dim, init); count = 0n; } public operator this(i:Long) = vec(i); def makeZero() { for (i in 0..(dim-1)) vec(i) =0.0F; count=0n; } def addIn(a:ValVector(dim)) { for (i in 0..(dim-1)) vec(i) += a(i); count++; } def div(f:Int) { for (i in 0..(dim-1)) vec(i) /= f; } def dist(a:ValVector(dim)):Float { var dist:Float=0.0F; for (i in 0..(dim-1)) { val tmp = vec(i)-a(i); dist += tmp*tmp; } return dist; } def dist(a:SumVector(dim)):Float { var dist:Float=0.0F; for (i in 0..(dim-1)) { val tmp = vec(i)-a(i); dist += tmp*tmp; } return dist; } def print() { Console.OUT.println(); for (i in 0..(dim-1)) { Console.OUT.print((i>0? " " : "") + vec(i)); } } def normalize() { div(count);} def count() = count; } def this(myDim:Long):KMeans{self.myDim==myDim} { property(myDim); } static type KMeansData(myK:Long, myDim:Long)= Rail[SumVector(myDim)]{self.size==myK}; /** * Compute myK means for the given set of points of dimension myDim. */ def computeMeans(myK:Long, points:Rail[ValVector(myDim)]):KMeansData(myK, myDim) { var redCluster : KMeansData(myK, myDim) = new Rail[SumVector(myDim)](myK, (i:long)=> new V(myDim, (j:long)=>points(i)(j))); var blackCluster: KMeansData(myK, myDim) = new Rail[SumVector(myDim)](myK, (i:long)=> new V(myDim, (j:long)=>0.0F)); for (i in 1..ITERATIONS) { val tmp = redCluster; redCluster = blackCluster; blackCluster=tmp; for (p in 0..(POINTS-1)) { var closest:Long = -1; var closestDist:Float = Float.MAX_VALUE; val point = points(p); for (k in 0..(myK-1)) { // compute closest mean in cluster. val dist = blackCluster(k).dist(point); if (dist < closestDist) { closestDist = dist; closest = k; } } redCluster(closest).addIn(point); } for (k in 0..(myK-1)) redCluster(k).normalize(); var b:Boolean = true; for (k in 0..(myK-1)) { if (redCluster(k).dist(blackCluster(k)) > EPS) { b=false; break; } } if (b) break; for (k in 0..(myK-1)) blackCluster(k).makeZero(); } return redCluster; } public static def main (Rail[String]) { val rnd = new Random(0); val points = new Rail[ValVector](POINTS, (long)=>new Rail[Float](DIM, (long)=>rnd.nextFloat())); val result = new KMeans(DIM).computeMeans(K, points); for (k in 0..(K-1)) result(k).print(); } } // vim: shiftwidth=4:tabstop=4:expandtab
X10
5
JavascriptID/sourcerer-app
src/test/resources/samples/langs/X10/KMeans.x10
[ "MIT" ]
use Datascope; use sysinfo; use Cwd; use Term::ANSIColor qw/uncolor/; use POSIX; use FileHandle; use Getopt::Std; sub show_available { if( scalar( @Module_names ) <= 0 ) { print "\n\n\tNo modules configured in $Pf.pf\n\n"; } else { print "\nAvailable modules:\n\n"; foreach $module ( @Module_names ) { print "\t$module\n"; } print "\n"; } } sub quit { $Windows{"Main"}->destroy(); } sub save_as { $FSref = $Windows{"Main"}->FileSelect( -directory => getcwd() ); $file = $FSref->Show; if( defined( $file ) && $file ne "" ) { open( S, "> $file" ); print S $Windows{"CompileOut"}->Contents(); close( S ); } } sub inform { my( $msg ) = @_; if( $opt_v ) { if( $Gui_mode && defined( $Windows{"CompileOut"} ) ) { $Windows{"CompileOut"}->insert( "end", $msg, "localmake_inform" ); $Windows{"CompileOut"}->see( 'end' ); $Windows{"Main"}->update(); } else { elog_notify( $msg ); } } return; } sub load_modules { my( %modules, $val, $p ); my( @exclude ) = ( "tarball_time_format", "tar_command", "make_command", "pf_revision_time", "antelope", "dest", "extra_rules", "platform_rules", "capabilities", "header", "macros", "output_file" ); $p = pfget( $Pf, "" ); foreach $key ( keys( %$p ) ) { next if( grep( /^$key$/, @exclude ) ); next if( $key =~ /src_subdir/ ); if( $key eq "modules" ) { elog_die( "Your $Pf.pf file still contains the 'modules' array, indicating " . "that it is out of date. Please update $Pf.pf per the localmake(1) " . "documentation. Exiting.\n" ); } $val = pfget( $Pf, $key ); if( ref( $val ) eq "HASH" ) { $modules{$key} = $val; } else { elog_complain( "Unexpected parameter '$key' in $Pf.pf. " . "Ignoring and attempting to continue \n" ); } } return %modules; } sub ansicolored_to_tagged { my( $line ) = @_; if( $line eq "ANSICODE_00 \n" ) { return ( "\n" ); } my( @line_parts ) = split( /(?=ANSICODE_)/, $line ); my( @tagged ) = (); while( @line_parts ) { my( @tag_parts ) = (); my( $layer ) = "foreground"; my( $underline ) = 0; my( $color ) = "black"; my( $clear ) = 0; my( $bold ) = 0; my( $blink ) = 0; # ignore # Tag parsing is approximate, for standard combinations my( $token ) = ""; while( $line_parts[0] =~ /^ANSICODE_(\d\d)/ && $token eq "" ) { my( $tag ) = uncolor( $1 ); # Only use the last of these on fall-through; preceding should be empty if( $tag eq "reverse" ) { $layer = "background"; } elsif( $tag eq "underline" ) { $underline++; } elsif( $tag eq "clear" ) { $clear++; } elsif( $tag eq "bold" ) { $bold++; } elsif( $tag eq "blink" ) { $blink++; } elsif( $tag =~ /black|red|green|yellow|blue|magenta|cyan|white/ ) { $color = $tag; # HACK to make this show up: if( $color eq "cyan" ) { $color = "dark cyan"; } } push( @tag_parts, $tag ); $token = substr( shift( @line_parts ), length( "ANSICODE_?? " ) ); } my( $tag_name ) = join( "_", @tag_parts ); if( ! defined( $Defined_tags{$tag_name} ) ) { my( @tagopts ) = (); my( $font ) = $Windows{"CompileOut"}->cget( -font ); if( $clear ) { $Windows{"CompileOut"}->tagConfigure( $tag_name, -foreground => "black", -background => "", -font => $font, -underline => 0 ); } if( $underline ) { push( @tagopts, "-underline", 1 ); } if( $bold ) { $font_bold = $font->Clone( -weight => "bold" ); push( @tagopts, "-font", $font_bold ); } if( $layer eq "foreground" ) { push( @tagopts, "-foreground", $color ); } else { push( @tagopts, "-background", $color, "-foreground", "black" ); } $Windows{"CompileOut"}->tagConfigure( $tag_name, @tagopts ); } push( @tagged, $token, $tag_name ); $Defined_tags{$tag_name}++; } return @tagged; } sub freeze_size { $Windows{"Main"}->resizable( 0, 0 ); } sub unfreeze_size { $Windows{"Main"}->resizable( 1, 1 ); } sub make_target { my( $target ) = @_; my( $cf, $rc ); if( -x "$ENV{'ANTELOPE'}/bin/cf" ) { if( $Gui_mode ) { $cf = "| cf -c"; } else { $cf = "| cf"; } } else { $cf = ""; } my( $cmd, $quiet ); if( $target =~ /^VERIFY/ ) { $cmd = $target; $cmd =~ s/VERIFY/localmake_config/; $quiet = $cmd . " > /dev/null 2>&1"; $cmd = $cmd . " 2>&1 $cf"; } else { $cmd = "$Make_command $target 2>&1 < /dev/null $cf"; } inform( "localmake: executing '$cmd'\n" ); if( $Gui_mode ) { $fh = new FileHandle; $fh->open( "$cmd |" ); $fh->autoflush(1); while( $line = <$fh> ) { @tagged = ansicolored_to_tagged( $line ); $Windows{"CompileOut"}->insert( "end", @tagged ); $Windows{"CompileOut"}->see( 'end' ); $Windows{"Main"}->update(); } $fh->close(); # Re-run the verify command rather than construct an entire # auto-flushing spawn architecture: if( $target =~ /^VERIFY/ ) { $rc = system( $quiet ); } else { $rc = 0; } } else { if( $target =~ /^VERIFY/ ) { $rc = system( $quiet ); if( $rc != 0 ) { # Re-run to show output without overwriting return code: system( $cmd ); } } else { $rc = system( $cmd ); if( $rc != 0 ) { elog_die( "Command '$cmd' failed in directory '$Dir'\n" ); } } } return $rc; } sub clear_compileout { my( $geom ) = $Windows{"Main"}->geometry(); $Windows{"CompileOut"}->destroy(); %Defined_tags = (); $Windows{"CompileOut"} = $Windows{"compile"}->Scrolled( "ROText", -wrap => "word", -scrollbars => "oe", -background => "white" ); $Windows{"CompileOut"}->tagConfigure( "localmake_inform", -foreground => "brown" ); $Windows{"CompileOut"}->grid( -row => $CompileOut_Row, -column => 0, -sticky => "nsew" ); $Windows{"Main"}->gridRowconfigure( $CompileOut_Row, -weight => 1 ); $Windows{"Main"}->geometry( $geom ); $Windows{"Main"}->update(); return; } sub localmake_module { my( $module ) = @_; if( $Gui_mode ) { freeze_size(); $Windows{"compilebutton_$module"}->configure( -relief => "sunken" ); destroy_followup_buttons(); clear_compileout(); $Windows{"Main"}->afterIdle( \&unfreeze_size ); } my( @steps ) = @{$Modules{$module}{build}}; if( @steps <= 0 ) { show_available(); elog_die( "No steps listed for module '$module' in parameter-file '$Pf'\n" ); } if( grep( /^nobuild/, @steps ) ) { my( $msg ) = "WARNING: Module '$module' contains elements in the 'nobuild' directory " . "of the contributed-code repository. Installing them may conflict " . "with your existing Antelope installation, at worst making it necessary " . "to erase Antelope and reinstall from scratch."; if( $Gui_mode ) { my( $dialog ) = $Windows{"Main"}->Dialog( -title => "nobuild warning", -text => "$msg How do you wish to proceed ? ", -buttons => ['Install Despite Warning', 'Do Not Install'], -default_button => 'Do Not Install' ); my( $ans ) = $dialog->Show(); unless( $ans eq 'Install Despite Warning' ) { elog_complain( "Skipping install of potentially conflicting software module '$module'" ); $Windows{"compilebutton_$module"}->configure( -relief => "raised" ); return -1; } } else { elog_complain( "$msg" ); my( $ans ) = askyn( "Install '$module' despite WARNING [yN] ? " ); unless( $ans ) { elog_complain( "Skipping install of potentially conflicting software module '$module'" ); return -1; } } } my( $src_subdir, $product ); $product = $Modules{$module}{product}; if( $opt_s ) { $src_subdir = $opt_s; } else { $src_subdir = $Modules{$module}{src_subdir}; } $start_time = now(); $start_time_str = epoch2str( $start_time, "%A %B %o, %Y at %T %Z", "" ); inform( "localmake: making module '$module' starting on $start_time_str\n" ); my( @capabilities ) = @{$Modules{$module}{capabilities_required}}; if( scalar( @capabilities ) > 0 ) { $target = "VERIFY " . join( " ", @capabilities ); if( make_target( $target ) != 0 ) { if( $Gui_mode ) { $Windows{"compilebutton_$module"}->configure( -relief => "raised" ); } return -1; } } my( $cwd ) = Cwd::cwd(); foreach $step ( @steps ) { if( $step =~ m@^/.*@ ) { $Dir = $step; } elsif( $src_subdir =~ m@^/.*@ ) { $Dir = "$src_subdir/$step"; } else { $Dir = "$product/$src_subdir/$step"; } if( ! -d "$Dir" ) { elog_die( "Directory '$Dir' does not exist (Have you downloaded the Antelope " . "contributed source-code distribution and is it in the right place?). " . "Exiting.\n" ); } inform( "localmake: changing directory to '$Dir'\n" ); my( $rc ) = chdir( $Dir ); if( ! $rc ) { elog_die( "Couldn't change directory to '$Dir'. Exiting.\n" ); } make_target( "clean" ); make_target( "Include" ); make_target( "install" ); } chdir( $cwd ); if( $Gui_mode ) { $Windows{"compilebutton_$module"}->configure( -relief => "raised" ); #HARD-WIRE tag names (colors) interpreted as warnings and errors @warning_blocks = $Windows{"CompileOut"}->tagRanges("magenta"); @error_blocks = $Windows{"CompileOut"}->tagRanges("red"); $num_warning_blocks = scalar( @warning_blocks ) / 2; $num_error_blocks = scalar( @error_blocks ) / 2; if( $num_warning_blocks > 0 || $num_error_blocks > 0 ) { add_followup_buttons(); } $end_time = now(); $end_time_str = epoch2str( $end_time, "%A %B %o, %Y at %T %Z", "" ); $delta = strtdelta( $end_time - $start_time ); $delta =~ s/^[[:space:]]+//; $delta =~ s/[[:space:]]+$//; $msg = "localmake: done making module '$module'\n" . "\tStarted: $start_time_str\n" . "\tFinished: $end_time_str\n" . "\tElapsed: $delta\n"; $Windows{"CompileOut"}->insert( "end", $msg, "localmake_inform" ); $msg = "\tWarnings: $num_warning_blocks blocks of warning messages\n"; if( $num_warning_blocks > 0 ) { $tag = "magenta"; } else { $tag = "localmake_inform"; } $Windows{"CompileOut"}->insert( "end", $msg, $tag ); $msg = "\tErrors: $num_error_blocks blocks of error messages\n"; if( $num_error_blocks > 0 ) { $tag = "red"; } else { $tag = "localmake_inform"; } $Windows{"CompileOut"}->insert( "end", $msg, $tag ); $Windows{"CompileOut"}->see( 'end' ); $Windows{"Main"}->update(); } else { inform( "localmake: done making module '$module' with " . "$num_warning_blocks blocks of warning messages and " . "$num_error_blocks blocks of error messages\n\n" ); } if( $Gui_mode && $module eq "bootstrap" ) { inform( "localmake: RESTARTING localmake IN 5 SECONDS due to bootstrap recompilation\n" ); sleep( 5 ); exec( "$0" ); exit( 0 ); } return 0; } sub compute_font_height { if( $Windows{"CompileOut"}->height() == 1 ) { $Windows{"Main"}->after( 100, \&compute_font_height ); return; } $Font_height = $Windows{"CompileOut"}->height() / $Windows{"CompileOut"}->cget( -height ); return; } sub get_next_hidden_message { my( $listref, $indexref ) = @_; my( $height_rows ) = int( $Windows{"CompileOut"}->height() / $Font_height ); my( $last_visible ) = $Windows{"CompileOut"}->index('@0,0') + $height_rows; $$indexref++; my( $next_start ) = $$listref[$$indexref * 2]; while( $next_start <= $last_visible && $$indexref * 2 < scalar( @{$listref} ) ) { $$indexref++; $next_start = $$listref[$$indexref * 2]; } if( ! defined( $next_start ) || $next_start eq "" || $$indexref >= scalar( @{$listref} ) - 1 ) { $$indexref = scalar( @{$listref} ) / 2 - 1; } return $$indexref; } sub show_first_error { my( $start ) = $errorslist[0]; $current_error = 0; $Windows{"CompileOut"}->see( $start ); $Windows{"CompileOut"}->update(); if( ( $current_error + 1 ) * 2 < scalar( @errorslist ) ) { $Windows{"NextError"}->configure( -state => "normal" ); } } sub show_first_warning { my( $start ) = $warningslist[0]; $current_warning = 0; $Windows{"CompileOut"}->see( $start ); $Windows{"CompileOut"}->update(); if( ( $current_warning + 1 ) * 2 < scalar( @warningslist ) ) { $Windows{"NextWarning"}->configure( -state => "normal" ); } } sub show_next_error { $current_error = get_next_hidden_message( \@errorslist, \$current_error ); my( $start ) = $errorslist[$current_error * 2]; $Windows{"CompileOut"}->see( $start ); $Windows{"CompileOut"}->update(); if( ( $current_error + 1 ) * 2 >= scalar( @errorslist ) ) { $Windows{"NextError"}->configure( -state => "disabled" ); } } sub show_next_warning { $current_warning = get_next_hidden_message( \@warningslist, \$current_warning ); my( $start ) = $warningslist[$current_warning * 2]; $Windows{"CompileOut"}->see( $start ); $Windows{"CompileOut"}->update(); if( ( $current_warning + 1 ) * 2 >= scalar( @warningslist ) ) { $Windows{"NextWarning"}->configure( -state => "disabled" ); } } sub create_compile_button { my( $w, $module ) = @_; my( $b ) = $w->Button( -text => "$module", -relief => "raised", -command => [\&localmake_module, $module] ); return( $b ); } sub write_makerules { $output_file = pfget( $Pf, "output_file" ); $dest = pfget( $Pf, "dest" ); $dest_output_file = "$dest/$output_file"; $temp_output_file = "/tmp/$output_file\_$$\_$>"; if( -e "$dest_output_file" && ( -M "$dest_output_file" <= -M "$Pf_config_file" ) ) { return; } else { inform( "Rebuilding '$dest_output_file' since it is older than '$Pf_config_file'\n" ); } open( O, ">$temp_output_file" ); print O "$header\n\n"; foreach $macro ( keys( %macros ) ) { if( ! defined( $macros{$macro} ) ) { next; } else { $contents = $macros{$macro}; } if( ref( $contents ) eq "HASH" ) { if( defined( $contents->{$Os} ) && $contents->{$Os} ne "" ) { print O "$macro = $contents->{$Os}\n"; $$macro = "$contents->{$Os}"; } } else { print O "$macro = $contents\n"; } } print O "\n$extra_rules\n"; print O "\n$platform_rules{$Os}\n"; close( O ); makedir( $dest ); system( "/bin/cp $temp_output_file $dest_output_file" ); inform( "Generated '$dest_output_file' from parameter-file '$Pf_config'\n" ); unlink( $temp_output_file ); return; } sub set_macros { foreach $macro ( keys( %macros ) ) { if( ! defined( $macros{$macro} ) ) { next; } else { $contents = $macros{$macro}; } if( ref( $contents ) eq "HASH" ) { if( defined( $contents->{$Os} ) && $contents->{$Os} ne "" ) { $$macro = "$contents->{$Os}"; } } } } sub set_initial_config { foreach $macro ( keys( %macros_initial_config ) ) { if( ! defined( $macros{$macro} ) ) { elog_complain( "File '$Pf_config_file' refers to decommissioned macro '$macro'\n" ); next; } else { $macros{$macro}->{$Os} = $macros_initial_config{$macro}; } } foreach $capability ( keys( %capabilities_initial_config ) ) { if( ! defined( $capabilities{$capability} ) ) { elog_complain( "File '$Pf_config_file' refers to decommissioned capability '$capability'\n" ); next; } else { $capabilities{$capability}{enable}{$Os} = $capabilities_initial_config{$capability}; } } return; } sub set_orig_enabled { foreach $capability ( keys( %capabilities ) ) { $orig_enabled{$capability} = $capabilities{$capability}{enable}{$Os}; } } sub freeze_size { $Windows{"Main"}->resizable( 0, 0 ); } sub resticky { my( $w, $sticky ) = @_; my( $parent ) = $w->parent(); my( %params ) = $parent->gridInfo(); $params{"-sticky"} = $sticky; $parent->gridForget(); $parent->grid( %params ); return; } sub init_config_File_menu { my( $w ) = @_; my( $menubutton, $filemenu ); $menubutton = $w->Menubutton ( -text => 'File', -pady => 0, -anchor => 'w', ); $menubutton->pack( -side => "left" ); $filemenu = $menubutton->Menu( -tearoff => 0 ); $filemenu->add( "command", -label => "Quit without saving", -command => \&quit ); $filemenu->add( "command", -label => "Save and Quit", -command => \&save_and_quit ); $menubutton->configure( -menu => $filemenu ); return; } sub init_localmake_File_menu { my( $w ) = @_; my( $menubutton, $filemenu ); $menubutton = $w->Menubutton ( -text => 'File', -pady => 0, -anchor => 'w', )->pack( -side => "left" ); $filemenu = $menubutton->Menu( -tearoff => 0 ); $filemenu->add( "command", -label => "Save compile log as...", -command => \&save_as ); $filemenu->add( "command", -label => "Quit", -command => \&quit ); $menubutton->configure( -menu => $filemenu ); my( $button ); $button = $w->Button( -text => "configure", -bg => "green", -command => \&run_configure ); $button->pack( -side => "right" ); return; } sub init_localmake_menubar { my( $w ) = @_; my( $menubar ); $menubar = $w->Frame( -relief => 'raised', -borderwidth => 2 ); init_localmake_File_menu( $menubar ); return $menubar; } sub add_followup_buttons { my( $firsterror_state, $nexterror_state, $firstwarning_state, $nextwarning_state ); @errorslist = $Windows{"CompileOut"}->tagRanges( "red" ); @warningslist = $Windows{"CompileOut"}->tagRanges( "magenta" ); $current_error = 0; $current_warning = 0; if( scalar( @errorslist ) <= 0 ) { $firsterror_state = 'disabled'; $nexterror_state = 'disabled'; } else { $firsterror_state = 'normal'; $nexterror_state = 'disabled'; } if( scalar( @warningslist ) <= 0 ) { $firstwarning_state = 'disabled'; $nextwarning_state = 'disabled'; } else { $firstwarning_state = 'normal'; $nextwarning_state = 'disabled'; } $w = $Windows{"Main"}; my( $frame ) = $w->Frame( -relief => 'raised', -borderwidth => 5 ); $Windows{"FirstError"} = $frame->Button( -text => "First Error", -relief => 'raised', -foreground => 'red', -state => $firsterror_state, -command => \&show_first_error ); $Windows{"FirstError"}->pack( -side => 'left', -fill => 'x', -expand => 'yes' ); $Windows{"NextError"} = $frame->Button( -text => "Next Error", -relief => 'raised', -foreground => 'red', -state => $nexterror_state, -command => \&show_next_error ); $Windows{"NextError"}->pack( -side => 'left', -fill => 'x', -expand => 'yes' ); $Windows{"FirstWarning"} = $frame->Button( -text => "First Warning", -relief => 'raised', -foreground => 'magenta', -state => $firstwarning_state, -command => \&show_first_warning ); $Windows{"FirstWarning"}->pack( -side => 'left', -fill => 'x', -expand => 'yes' ); $Windows{"NextWarning"} = $frame->Button( -text => "Next Warning", -relief => 'raised', -foreground => 'magenta', -state => $nextwarning_state, -command => \&show_next_warning ); $Windows{"NextWarning"}->pack( -side => 'left', -fill => 'x', -expand => 'yes' ); $frame->grid( -row => 3, -column => 0, -sticky => "new" ); $w->gridRowconfigure( 3, -weight => 0 ); $Windows{"FollowUpButtons"} = $frame; $Windows{"Main"}->update(); return; } sub destroy_followup_buttons { undef( @errorslist ); undef( @warningslist ); undef( $current_error ); undef( $current_warning ); if( Exists( $Windows{"FollowUpButtons"} ) ) { $Windows{"FollowUpButtons"}->destroy(); } return; } sub test_configuration_unsaved { my( $tf ) = "false"; foreach $macro ( keys( %macros_orig ) ) { if( $$macro ne $macros_orig{$macro}{$Os} ) { $tf = "true"; return $tf; } } foreach $capability ( keys( %capabilities ) ) { if( $capabilities{$capability}{enable}{$Os} != $orig_enabled{$capability} ) { $tf = "true"; return $tf; } } return $tf; } sub mark_configuration_unsaved { my( $tft ) = @_; if( $tft eq "test" ) { $tft = test_configuration_unsaved(); } if( defined( $Windows{"save_config"} ) ) { if( $tft eq "true" ) { $Windows{"save_config"}->configure( -text => "save configuration (SOME CHANGES UNSAVED)", -bg => "yellow", -state => "normal" ); } else { $Windows{"save_config"}->configure( -text => "save configuration", -bg => "gray", -state => "disabled" ); } } } sub commit_configuration { %config_macros = (); %config_capabilities = (); foreach $macro ( keys( %macros ) ) { $config_macros{$macro} = $$macro; } foreach $capability ( keys( %capabilities ) ) { $config_capabilities{$capability} = $capabilities{$capability}{enable}{$Os}; } pfput( "macros", \%config_macros, $Pf_config ); pfput( "capabilities", \%config_capabilities, $Pf_config ); pfwrite( $Pf_config_file, $Pf_config ); write_makerules(); mark_configuration_unsaved( "false" ); %macros_orig = %macros; set_orig_enabled(); return; } sub toggle_capability { my( $c ) = @_; if( $capabilities{$c}{enable}{$Os} ) { $capabilities{$c}{enable}{$Os} = 0; $test_result = test_capability( $c, "configure" ); $Widgets{"b$c"}->configure( -text => "Enable '$c' capability", -bg => "light green" ); } else { $capabilities{$c}{enable}{$Os} = 1; $test_result = test_capability( $c, "configure" ); $Widgets{"b$c"}->configure( -text => "Disable '$c' capability", -bg => "#ffdddd" ); } mark_configuration_unsaved( "true" ); return; } sub explain { my( $detail ) = @_; $detail =~ s/\n//g; $detail =~ s/[[:space:]]+/ /g; $detail =~ s/^[[:space:]]+//; $detail =~ s/[[:space:]]+$//; my( $w ) = $Windows{"Main"}->Toplevel(); my( $f ) = $w->Frame(); $f->pack( -side => "top", -fill => "both", -expand => "yes" ); my( $text ) = $f->Scrolled( "ROText", -wrap => "word", -scrollbars => "oe"); $text->pack( -side => "left", -fill => "both", -expand => "yes" ); $text->insert( "end", $detail ); my( $b ) = $w->Button( -text => "Dismiss", -command => sub { $w->destroy } ); $b->pack( -side => "top", -fill => "both", -expand => "yes" ); $w->waitWindow(); return; } sub tweak_capability { mark_configuration_unsaved( "test" ); test_capability( @_ ); } sub test_capability { if( ref( $_[0] ) ) { shift( @_ ); } my( $c, $mode ) = @_; my( $passed ) = 1; if( $mode eq "configure" ) { $Widgets{"t$c"}->delete( '0.0', 'end' ); } if( ! defined( $capabilities{$c} ) ) { if( $mode eq "verify" ) { elog_complain( "Requested capability '$c' not defined in '$Pf_config'. " . "Stopping compilation.\n" ); exit( -1 ); } } if( ! pfget_boolean( $Pf, "capabilities{$c}{enable}{$Os}" ) && $mode eq "verify" ) { elog_complain( "Requested capability '$c' marked as disabled in '$Pf_config'.\n" . "Run localmake_config(1) (or edit '$Pf_config_file')\nto enable and configure " . "'$c' if desired.\n" ); exit( -1 ); } if( ! $capabilities{$c}{enable}{$Os} && $mode eq "configure" ) { $Widgets{"t$c"}->insert( "end", "Capability '$c' disabled\n", 'disabled' ); $passed = 0; $Var{"en$c"} = "Capability '$c' is disabled"; $Widgets{"en$c"}->configure( -fg => "grey30" ); return $passed; } @required_macros = @{pfget( $Pf, "capabilities{$c}{required_macros}" )}; @tests = @{pfget( $Pf, "capabilities{$c}{tests}" )}; while( $required_macro = shift( @required_macros ) ) { if( ! defined( $$required_macro ) || $$required_macro eq "" ) { if( $mode eq "verify" ) { elog_complain( "Macro '$required_macro', required for '$c' capability, " . "is not defined.\nRun localmake_config(1) (or edit '$Pf_config_file')\n" . "to configure.\n" ); exit( -1 ); } else { $Widgets{"t$c"}->insert( "end", "Failed check for capability '$c': " . "Required macro '$required_macro' is not defined\n\n", 'failed' ); $passed = 0; } } else { if( $mode eq "configure" ) { $Widgets{"t$c"}->insert( "end", "Passed check for capability '$c': " . "Required macro '$required_macro' is defined\n\n", 'passed' ); } } } while( $test = shift( @tests ) ) { if( ! eval( $test ) ) { if( $mode eq "verify" ) { elog_complain( "Test failed for capability '$c': $failure_msg\n" ); exit( -1 ); } else { $Widgets{"t$c"}->insert( "end", "Failed: Test failed for capability '$c': $failure_msg\n\n", 'failed' ); $passed = 0; } } else { if( $mode eq "configure" ) { $Widgets{"t$c"}->insert( "end", "Passed test for capability '$c': $success_msg\n\n", 'passed' ); } } } if( $mode eq "configure" ) { if( $passed ) { $Var{"en$c"} = "Capability '$c' is enabled"; $Widgets{"en$c"}->configure( -fg => "darkgreen" ); } else { $Var{"en$c"} = "Capability '$c' is enabled but failed test(s)"; $Widgets{"en$c"}->configure( -fg => "red" ); } } return; } sub update_config_pf { if( -e $Pf_config_file && ! system( "grep platform_rules $Pf_config_file" ) ) { elog_complain( "The file '$Pf_config_file' is out of date. Moving it to '$Pf_config_file-' and updating." ); } else { return 0; } system( "/bin/mv $Pf_config_file $Pf_config_file-" ); commit_configuration(); return 1; } sub save_and_quit { commit_configuration(); quit(); } sub run_configure { $Windows{"Main"}->gridForget( $Windows{"localmake_menubar"}, $Windows{"compile"} ); destroy_followup_buttons(); init_configure_window(); return; } sub init_configure_window { $Windows{"Main"}->title( my_hostname() . ": localmake_config" ); $Windows{"config_menubar"} = init_config_menubar( $Windows{"Main"} ); $Windows{"config_menubar"}->grid( -row => 0, -column => 0, -sticky => 'new', ); $Windows{"capabilities"} = init_capabilities( $Windows{"Main"} ); $Windows{"capabilities"}->grid( -row => 1, -column => 0, -sticky => 'nsew', ); $Windows{"save_config"} = $Windows{"Main"}->Button( -text => "save configuration", -command => \&commit_configuration, -bg => "gray", -state => "disabled" ); $Windows{"save_config"}->grid( -row => 2, -column => 0, -sticky => 'nsew', ); $Windows{"Main"}->gridColumnconfigure( 0, -weight => 1 ); $Windows{"Main"}->gridRowconfigure( 1, -weight => 1 ); $Windows{"Main"}->gridRowconfigure( 2, -weight => 0 ); MainLoop; } sub init_config_menubar { my( $w ) = @_; my( $menubar ); $menubar = $w->Frame( -relief => 'raised', -borderwidth => 2 ); init_config_File_menu( $menubar ); my( $b ) = $menubar->Button( -text => "compile", -bg => "green", -command => \&run_compile ); $b->pack( -side => "right" ); return $menubar; } sub init_capabilities { my( $w ) = @_; my( $capabilities_window ); my( @specs, @lefttop, @righttop, @leftbottom, @rightbottom, $i ); $capabilities_window = $w->Frame( -relief => 'raised', -borderwidth => 2 ); push( @specs, "notebook capabilities - 0,0 Capabilities" ); foreach $c ( sort( keys( %capabilities ) ) ) { push( @specs, "notebookpage $c - xxx $c" ); @lefttop = (); @righttop = (); @leftbottom = (); @rightbottom = (); push( @lefttop, "label np$c - 0,0 Capability:" ); push( @lefttop, "label en$c - +,0 Status:" ); push( @righttop, "button b$c - 0,0 Toggle" ); push( @righttop, "button e$c - +,0 Explain '$c' capability" ); foreach $m ( @{$capabilities{$c}{required_macros}} ) { push( @leftbottom, "entry e$c$m - +,0 $m { $macros{$m}{Description} }" ); push( @rightbottom, "button b$c$m - +,0 Explain '$m' macro" ); } push( @specs, "frame top$c - 0,0" ); push( @specs, "frame lefttop$c - 0,0" ); push( @specs, @lefttop ); push( @specs, "endframe" ); push( @specs, "frame righttop$c - 0,1" ); push( @specs, @righttop ); push( @specs, "endframe" ); push( @specs, "endframe" ); push( @specs, "frame bottom$c - 1,0" ); push( @specs, "frame leftbottom$c - 0,0" ); push( @specs, @leftbottom ); push( @specs, "endframe" ); push( @specs, "frame rightbottom$c - 0,1" ); push( @specs, @rightbottom ); push( @specs, "endframe" ); push( @specs, "endframe" ); push( @specs, "rotext t$c - 2,0 Tests:" ); } push( @specs, "endnotebook" ); ptkform( $capabilities_window, \%Var, \%Widgets, @specs ); $capabilities_window->gridColumnconfigure( 0, -weight => 1 ); foreach $c ( keys( %capabilities ) ) { $Widgets{"top$c"}->gridColumnconfigure( 0, -weight => 1 ); $Widgets{"bottom$c"}->gridColumnconfigure( 0, -weight => 1 ); $Widgets{"t$c"}->tagConfigure( 'failed', -foreground => "red" ); $Widgets{"t$c"}->tagConfigure( 'passed', -foreground => "darkgreen" ); $Widgets{"t$c"}->tagConfigure( 'disabled', -foreground => "grey30" ); $Widgets{"np$c"}->parent()->parent()->gridColumnconfigure( 0, -weight => 1 ); resticky( $Widgets{"np$c"}->parent(), "nsew" ); resticky( $Widgets{"lefttop$c"}, "nsew" ); resticky( $Widgets{"leftbottom$c"}, "nsew" ); resticky( $Widgets{"righttop$c"}, "nsew" ); resticky( $Widgets{"b$c"}, "nsew" ); resticky( $Widgets{"e$c"}->parent(), "nsew" ); resticky( $Widgets{"t$c"}, "nsew" ); foreach $m ( @{$capabilities{$c}{required_macros}} ) { $Widgets{"e$c$m"}->parent()->parent()->gridColumnconfigure( 0, -weight => 1 ); resticky( $Widgets{"e$c$m"}->parent(), "nsew" ); resticky( $Widgets{"b$c$m"}, "nsew" ); resticky( $Widgets{"e$c$m"}, "ew" ); resticky( $Widgets{"b$c$m"}->parent(), "nsew" ); resticky( $Widgets{"e$c$m"}->parent(), "ew" ); } $Var{"np$c"} = "$capabilities{$c}{Description}"; $Widgets{"b$c"}->configure( -command => [\&toggle_capability, $c] ); if( pfget_boolean( $Pf, "capabilities{$c}{enable}{$Os}" ) ) { $capabilities{$c}{enable}{$Os} = 1; $test_result = test_capability( $c, "configure" ); $Widgets{"b$c"}->configure( -text => "Disable '$c' capability", -bg => "#ffdddd" ); } else { $capabilities{$c}{enable}{$Os} = 0; $test_result = test_capability( $c, "configure" ); $Widgets{"b$c"}->configure( -text => "Enable '$c' capability", -bg => "light green" ); } $Widgets{"e$c"}->configure( -command => [ \&explain, $capabilities{$c}{Detail} ] ); foreach $m ( @{$capabilities{$c}{required_macros}} ) { $Widgets{"b$c$m"}->configure( -command => [ \&explain, $macros{$m}{Detail} ] ); $Widgets{"e$c$m"}->configure( -textvariable => \$$m ); $Widgets{"e$c$m"}->bind( "<KeyPress-Return>", [ \&tweak_capability, $c, "configure" ] ); $Widgets{"e$c$m"}->bind( "<KeyPress-Tab>", [ \&tweak_capability, $c, "configure" ] ); $Widgets{"e$c$m"}->bind( "<Leave>", [ \&tweak_capability, $c, "configure" ] ); } } return $capabilities_window; } sub init_compile_window { my( $w ) = @_; my( $compilewindow ); $compilewindow = $w->Frame( -relief => 'raised', -borderwidth => 2 ); $Windows{"buttons"} = $compilewindow->Frame( -relief => 'raised', -borderwidth => 5 ); $Windows{"buttons"}->grid( -row => 0, -column => 0, -sticky => "new" ); $compilewindow->gridColumnconfigure( 0, -weight => 1 ); $buttonrow = $buttoncolumn = 0; $gridrank = ceil( sqrt( scalar( @Module_names ) ) ); foreach $module ( @Module_names ) { $Windows{"compilebutton_$module"} = create_compile_button( $Windows{"buttons"}, $module ); $Windows{"compilebutton_$module"}->grid( -row => $buttonrow, -column => $buttoncolumn, -sticky => "new" ); if( $buttonrow == 0 ) { $Windows{"buttons"}->gridColumnconfigure( $buttoncolumn, -weight => 1 ); } if( $buttoncolumn < $gridrank - 1 ) { $buttoncolumn++; } else { $buttoncolumn = 0; $buttonrow++; } } $Windows{"CompileOut"} = $compilewindow->Scrolled( "ROText", -wrap => "word", -scrollbars => "oe", -background => "white", -width => $ROWidth ); $Windows{"CompileOut"}->tagConfigure( "localmake_inform", -foreground => "brown" ); $CompileOut_Row = 1; $Windows{"CompileOut"}->grid( -row => $CompileOut_Row, -column => 0, -sticky => "nsew" ); $compilewindow->gridRowconfigure( $CompileOut_Row, -weight => 1 ); return $compilewindow; } sub run_compile { $Windows{"Main"}->gridForget( $Windows{"config_menubar"}, $Windows{"save_config"}, $Windows{"capabilities"} ); $Windows{"Main"}->gridRowconfigure( 2, -weight => 0 ); init_localmake_window(); return; } sub init_localmake_window { $Windows{"Main"}->title( my_hostname() . ": localmake" ); $Windows{"localmake_menubar"} = init_localmake_menubar( $Windows{"Main"} ); $Windows{"localmake_menubar"}->grid( -row => 0, -column => 0, -sticky => "new" ); $Windows{"compile"} = init_compile_window( $Windows{"Main"} ); $Windows{"compile"}->grid( -row => 1, -column => 0, -sticky => "nsew" ); $Windows{"Main"}->gridColumnconfigure( 0, -weight => 1 ); $Windows{"Main"}->gridRowconfigure( 1, -weight => 1 ); $Windows{"Main"}->afterIdle( \&compute_font_height ); return; } sub init_window { use Tk; use Tk::Toplevel; use Tk::ROText; use Tk::Font; use Tk::FileSelect; use Tk::Dialog; use ptkform; use elog_gui; $Windows{"Main"} = MainWindow->new(); $Windows{"Main"}->minsize(40, 20); elog_gui_init( MW => $Windows{"Main"} ); elog_callback( "::elog_gui" ); $Windows{"Main"}->bind( "<Control-c>", \&quit ); $Windows{"Main"}->bind( "<Control-C>", \&quit ); if( $opt_c ) { init_configure_window(); } else { init_localmake_window(); } MainLoop; } $Pf = "localmake"; $Pf_config = "localmake_config"; $localpf_dir = "$ENV{'ANTELOPE'}/contrib/data/pf"; $ENV{'PFPATH'} = "$localpf_dir:$ENV{'PFPATH'}"; $Pf_config_file = "$localpf_dir/$Pf_config.pf"; $Program = $0; $Program =~ s@.*/@@; elog_init( $Program, @ARGV ); if( !getopts( 'clp:s:tv' ) || scalar( @ARGV ) > 1 ) { elog_die( "Usage: localmake [-c] [-v] [-l] [-t] [-p pfname] [-s src_subdir] [module]\n" ); } if( $opt_l && scalar( @ARGV ) > 0 ) { elog_complain( "Useless specification of module with -l option, ignoring module\n" ); } if( $opt_p ) { $Pf = $opt_p; } $Os = my_os(); $ROWidth = 132; $Tarball_time_format = pfget( $Pf, "tarball_time_format" ); $Tar_command = pfget( $Pf, "tar_command" ); $Make_command = pfget( $Pf, "make_command" ); %macros = %{pfget($Pf,"macros")}; $header = pfget( $Pf, "header" ); $extra_rules = pfget( $Pf, "extra_rules" ); %capabilities = %{pfget( $Pf, "capabilities" )}; if( ! -e "$Pf_config_file" ) { ($adir, $abase, $asuffix) = parsepath( $Pf_config_file ); if( makedir( $adir ) != 0 ) { elog_die( "Failed to make directory '$adir'\n" ); } commit_configuration(); } %macros_initial_config = %{pfget($Pf_config,"macros")}; %capabilities_initial_config = %{pfget($Pf_config,"capabilities")}; if( defined( $ENV{'MAKE'} ) ) { $Make_command = $ENV{'MAKE'}; } if( ! update_config_pf() ) { set_initial_config(); } %macros_orig = %macros; set_orig_enabled(); set_macros(); write_makerules(); %Modules = load_modules(); @Module_names = sort( keys( %Modules ) ); $Gui_mode = 0; if( $opt_l ) { show_available(); exit( 0 ); } elsif( scalar( @ARGV ) == 0 ) { $Gui_mode = 1; $opt_v = 1; # Make automatic for Gui_mode init_window(); exit( 0 ); } $module = pop( @ARGV ); if( localmake_module( $module ) < 0 && ! $Gui_mode ) { elog_die( "Build of module '$module' failed. Exiting.\n" ); } if( $opt_t ) { $tarfilelist = "/tmp/localmake_$<_$$"; if( scalar( @{$Modules{$module}{package}} ) <= 0 ) { elog_die( "No package files defined in $Pf.pf for module '$module'. Exiting.\n" ); } open( T, ">$tarfilelist" ); print T map { "$Modules{$module}{product}/$_\n" } @{$Modules{$module}{package}}; close( T ); $tarfile = epoch2str( str2epoch( "now" ), $Tarball_time_format ); $tarfile .= "_$module"; $tarfile .= "_" . my_hardware(); $tarfile .= "_" . my_os(); $tarfile .= "_tarball.tar"; if( $opt_v ) { $v = "-v"; } else { $v = ""; } $cmd = "$Tar_command -T $tarfilelist -P -c $v -f $tarfile"; inform( "localmake: executing '$cmd'\n" ); system( $cmd ); unlink( $tarfilelist ); inform( "localmake: executing '$cmd'\n" ); $cmd = "bzip2 $tarfile"; inform( "localmake: executing '$cmd'\n" ); system( $cmd ); inform( "localmake: created package file '$tarfile.bz2'\n" ); }
XProc
4
jreyes1108/antelope_contrib
first/localmake/localmake.xpl
[ "BSD-2-Clause", "MIT" ]
--- title: "v0.28.1 - 2018-07-16" linkTitle: "v0.28.1 - 2018-07-16" weight: -41 --- <html> <head> <title>kubernetes/minikube - Leaderboard</title> <link rel="preconnect" href="https://fonts.gstatic.com"> <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;700&display=swap" rel="stylesheet"> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> google.charts.load("current", {packages:["corechart"]}); </script> <style> body { font-family: 'Open Sans', sans-serif; background-color: #f7f7fa; padding: 1em; } h1 { color: rgba(66,133,244); margin-bottom: 0em; } .subtitle { color: rgba(23,90,201); font-size: small; } pre { white-space: pre-wrap; word-wrap: break-word; color: #666; font-size: small; } h2.cli { color: #666; } h2 { color: #333; } .board p { font-size: small; color: #999; text-align: center; } .board { clear: right; display: inline-block; padding: 0.5em; margin: 0.5em; background-color: #fff; } .board:nth-child(4n+3) { border: 2px solid rgba(66,133,244,0.25); color: rgba(66,133,244); } .board:nth-child(4n+2) { border: 2px solid rgba(219,68,55,0.25); color: rgba rgba(219,68,55); } .board:nth-child(4n+1) { border: 2px solid rgba(244,160,0,0.25); color: rgba(244,160,0); } .board:nth-child(4n) { border: 2px solid rgba(15,157,88,0.25); color: rgba(15,157,88); } h3 { text-align: center; } </style> </head> <body> <h1>kubernetes/minikube</h1> <div class="subtitle">2018-06-13 &mdash; 2018-07-16</div> <h2>Reviewers</h2> <div class="board"> <h3>Most Influential</h3> <p># of Merged PRs reviewed</p> <div id="chart_reviewCounts" style="width: 450px; height: 350px;"></div> <script type="text/javascript"> google.charts.setOnLoadCallback(drawreviewCounts); function drawreviewCounts() { var data = new google.visualization.arrayToDataTable([ ['', '# of Merged PRs reviewed', { role: 'annotation' }], ["dlorenc", 9, "9"], ["vishh", 1, "1"], ["Arnavion", 1, "1"], ["jimmidyson", 1, "1"], ]); var options = { axisTitlesPosition: 'none', bars: 'horizontal', // Required for Material Bar Charts. axes: { x: { y: { side: 'top'} // Top x-axis. } }, legend: { position: "none" }, bar: { groupWidth: "85%" } }; var chart = new google.visualization.BarChart(document.getElementById('chart_reviewCounts')); chart.draw(data, options); }; </script> </div> <div class="board"> <h3>Most Helpful</h3> <p># of words written in merged PRs</p> <div id="chart_reviewWords" style="width: 450px; height: 350px;"></div> <script type="text/javascript"> google.charts.setOnLoadCallback(drawreviewWords); function drawreviewWords() { var data = new google.visualization.arrayToDataTable([ ['', '# of words written in merged PRs', { role: 'annotation' }], ["dlorenc", 88, "88"], ["vishh", 52, "52"], ["jimmidyson", 44, "44"], ["Arnavion", 40, "40"], ]); var options = { axisTitlesPosition: 'none', bars: 'horizontal', // Required for Material Bar Charts. axes: { x: { y: { side: 'top'} // Top x-axis. } }, legend: { position: "none" }, bar: { groupWidth: "85%" } }; var chart = new google.visualization.BarChart(document.getElementById('chart_reviewWords')); chart.draw(data, options); }; </script> </div> <div class="board"> <h3>Most Demanding</h3> <p># of Review Comments in merged PRs</p> <div id="chart_reviewComments" style="width: 450px; height: 350px;"></div> <script type="text/javascript"> google.charts.setOnLoadCallback(drawreviewComments); function drawreviewComments() { var data = new google.visualization.arrayToDataTable([ ['', '# of Review Comments in merged PRs', { role: 'annotation' }], ["Arnavion", 2, "2"], ["dlorenc", 1, "1"], ["jimmidyson", 0, "0"], ["vishh", 0, "0"], ]); var options = { axisTitlesPosition: 'none', bars: 'horizontal', // Required for Material Bar Charts. axes: { x: { y: { side: 'top'} // Top x-axis. } }, legend: { position: "none" }, bar: { groupWidth: "85%" } }; var chart = new google.visualization.BarChart(document.getElementById('chart_reviewComments')); chart.draw(data, options); }; </script> </div> <h2>Pull Requests</h2> <div class="board"> <h3>Most Active</h3> <p># of Pull Requests Merged</p> <div id="chart_prCounts" style="width: 450px; height: 350px;"></div> <script type="text/javascript"> google.charts.setOnLoadCallback(drawprCounts); function drawprCounts() { var data = new google.visualization.arrayToDataTable([ ['', '# of Pull Requests Merged', { role: 'annotation' }], ["dlorenc", 4, "4"], ["tanakapayam", 3, "3"], ["aaron-prindle", 2, "2"], ["davidxia", 1, "1"], ["lukeweber", 1, "1"], ["awesley", 1, "1"], ["rohitagarwal003", 1, "1"], ["aledbf", 1, "1"], ["ansiwen", 1, "1"], ["commitay", 1, "1"], ["petertrotman", 1, "1"], ["suntorytimed", 1, "1"], ]); var options = { axisTitlesPosition: 'none', bars: 'horizontal', // Required for Material Bar Charts. axes: { x: { y: { side: 'top'} // Top x-axis. } }, legend: { position: "none" }, bar: { groupWidth: "85%" } }; var chart = new google.visualization.BarChart(document.getElementById('chart_prCounts')); chart.draw(data, options); }; </script> </div> <div class="board"> <h3>Big Movers</h3> <p>Lines of code (delta)</p> <div id="chart_prDeltas" style="width: 450px; height: 350px;"></div> <script type="text/javascript"> google.charts.setOnLoadCallback(drawprDeltas); function drawprDeltas() { var data = new google.visualization.arrayToDataTable([ ['', 'Lines of code (delta)', { role: 'annotation' }], ["rohitagarwal003", 529, "529"], ["dlorenc", 163, "163"], ["ansiwen", 134, "134"], ["aaron-prindle", 28, "28"], ["commitay", 20, "20"], ["tanakapayam", 17, "17"], ["awesley", 10, "10"], ["aledbf", 10, "10"], ["petertrotman", 8, "8"], ["lukeweber", 6, "6"], ["davidxia", 2, "2"], ["suntorytimed", 1, "1"], ]); var options = { axisTitlesPosition: 'none', bars: 'horizontal', // Required for Material Bar Charts. axes: { x: { y: { side: 'top'} // Top x-axis. } }, legend: { position: "none" }, bar: { groupWidth: "85%" } }; var chart = new google.visualization.BarChart(document.getElementById('chart_prDeltas')); chart.draw(data, options); }; </script> </div> <div class="board"> <h3>Most difficult to review</h3> <p>Average PR size (added+changed)</p> <div id="chart_prSize" style="width: 450px; height: 350px;"></div> <script type="text/javascript"> google.charts.setOnLoadCallback(drawprSize); function drawprSize() { var data = new google.visualization.arrayToDataTable([ ['', 'Average PR size (added+changed)', { role: 'annotation' }], ["rohitagarwal003", 525, "525"], ["ansiwen", 134, "134"], ["dlorenc", 16, "16"], ["aaron-prindle", 11, "11"], ["aledbf", 9, "9"], ["awesley", 8, "8"], ["petertrotman", 6, "6"], ["commitay", 4, "4"], ["tanakapayam", 4, "4"], ["lukeweber", 3, "3"], ["suntorytimed", 1, "1"], ["davidxia", 1, "1"], ]); var options = { axisTitlesPosition: 'none', bars: 'horizontal', // Required for Material Bar Charts. axes: { x: { y: { side: 'top'} // Top x-axis. } }, legend: { position: "none" }, bar: { groupWidth: "85%" } }; var chart = new google.visualization.BarChart(document.getElementById('chart_prSize')); chart.draw(data, options); }; </script> </div> <h2>Issues</h2> <div class="board"> <h3>Most Active</h3> <p># of comments</p> <div id="chart_comments" style="width: 450px; height: 350px;"></div> <script type="text/javascript"> google.charts.setOnLoadCallback(drawcomments); function drawcomments() { var data = new google.visualization.arrayToDataTable([ ['', '# of comments', { role: 'annotation' }], ["adampl", 1, "1"], ["Diggsey", 1, "1"], ["amarof", 1, "1"], ["aleksandrov", 1, "1"], ["ptink", 1, "1"], ["AmeyK-Globant", 1, "1"], ["dogonthehorizon", 1, "1"], ]); var options = { axisTitlesPosition: 'none', bars: 'horizontal', // Required for Material Bar Charts. axes: { x: { y: { side: 'top'} // Top x-axis. } }, legend: { position: "none" }, bar: { groupWidth: "85%" } }; var chart = new google.visualization.BarChart(document.getElementById('chart_comments')); chart.draw(data, options); }; </script> </div> <div class="board"> <h3>Most Helpful</h3> <p># of words (excludes authored)</p> <div id="chart_commentWords" style="width: 450px; height: 350px;"></div> <script type="text/javascript"> google.charts.setOnLoadCallback(drawcommentWords); function drawcommentWords() { var data = new google.visualization.arrayToDataTable([ ['', '# of words (excludes authored)', { role: 'annotation' }], ["adampl", 67, "67"], ["dogonthehorizon", 23, "23"], ["ptink", 22, "22"], ["Diggsey", 11, "11"], ["AmeyK-Globant", 9, "9"], ["amarof", 0, "0"], ["aleksandrov", 0, "0"], ]); var options = { axisTitlesPosition: 'none', bars: 'horizontal', // Required for Material Bar Charts. axes: { x: { y: { side: 'top'} // Top x-axis. } }, legend: { position: "none" }, bar: { groupWidth: "85%" } }; var chart = new google.visualization.BarChart(document.getElementById('chart_commentWords')); chart.draw(data, options); }; </script> </div> <div class="board"> <h3>Top Closers</h3> <p># of issues closed (excludes authored)</p> <div id="chart_issueCloser" style="width: 450px; height: 350px;"></div> <script type="text/javascript"> google.charts.setOnLoadCallback(drawissueCloser); function drawissueCloser() { var data = new google.visualization.arrayToDataTable([ ['', '# of issues closed (excludes authored)', { role: 'annotation' }], ["dlorenc", 10, "10"], ["aaron-prindle", 3, "3"], ]); var options = { axisTitlesPosition: 'none', bars: 'horizontal', // Required for Material Bar Charts. axes: { x: { y: { side: 'top'} // Top x-axis. } }, legend: { position: "none" }, bar: { groupWidth: "85%" } }; var chart = new google.visualization.BarChart(document.getElementById('chart_issueCloser')); chart.draw(data, options); }; </script> </div> </body> </html>
HTML
4
skyplaying/minikube
site/content/en/docs/contrib/leaderboard/v0.28.1.html
[ "Apache-2.0" ]
/** Copyright 2015 Acacia Team 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 org.acacia.frontend; import x10.util.StringBuilder; import x10.util.ArrayList; import x10.regionarray.Array; import org.acacia.log.Logger; import org.acacia.util.Conts; import org.acacia.util.Utils; import java.io.IOException; import java.net.BindException; import java.net.ServerSocket; import java.net.Socket; /** * The Acacia front-end. */ public class AcaciaFrontEnd { private var runFlag:Boolean = true; private var srv:ServerSocket; private var sessions:ArrayList[AcaciaFrontEndServiceSession] = new ArrayList[AcaciaFrontEndServiceSession](); public static def main(val args:Rail[String]) { var frontend:AcaciaFrontEnd = new AcaciaFrontEnd(); frontend.run(); } public def run(){ try{ Logger.info("Starting the frontend"); srv = new ServerSocket(Conts.ACACIA_FRONTEND_PORT); Logger.info("Done creating frontend"); val pg = Place.places(); while(runFlag){ var socket:Socket = srv.accept(); val skt = socket; val session:AcaciaFrontEndServiceSession = new AcaciaFrontEndServiceSession(skt,pg); sessions.add(session); session.start(); } }catch(var e:BindException){ Logger.error("Error : " + e.getMessage()); } catch (var e:IOException) { Logger.error("Error : " + e.getMessage()); } } }
X10
4
mdherath/Acacia
src/org/acacia/frontend/AcaciaFrontEnd.x10
[ "Apache-2.0" ]