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 |
|---|---|---|---|---|---|
% LilyBin
\score{
{
c'
}
\layout{}
\midi{}
}
| LilyPond | 2 | RazerMoon/LilyBin | default.ly | [
"MIT"
] |
/*
*
* Copyright 2015 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.
*
*/
#ifndef TEST_QPS_STATS_UTILS_H
#define TEST_QPS_STATS_UTILS_H
#include <string>
#include "test/cpp/qps/histogram.h"
namespace grpc {
namespace testing {
template <class T, class F>
double sum(const T& container, F functor) {
double r = 0;
for (auto v = container.begin(); v != container.end(); v++) {
r += functor(*v);
}
return r;
}
template <class T, class F>
double average(const T& container, F functor) {
return sum(container, functor) / container.size();
}
} // namespace testing
} // namespace grpc
#endif
| C | 4 | samotarnik/grpc | test/cpp/qps/stats.h | [
"Apache-2.0"
] |
// pthreadpool header from https://github.com/Maratyszcza/pthreadpool
// for NNPACK
#ifndef CAFFE2_UTILS_PTHREADPOOL_H_
#define CAFFE2_UTILS_PTHREADPOOL_H_
#include "ThreadPoolCommon.h"
#include <stddef.h> // for size_t
#include <stdint.h> // for uint32_t
#if defined(USE_PTHREADPOOL) && !(defined(__XROS__))
// This is a hack.
// Mainly introduced here because
// 1. NNPACK can be compiled to use internal legacy threadpool implementation because much of C2 depends on that.
// 2. Then if we want to use NNPACK in PyTorch, which uses new pthreadpool, then we will supply new pthreadpool pointer
// to NNPACK. This will not work if NNPACK is compiled with internal legacy threadpool. Thus this guard
// along with changes in pthreadpool_impl.cc allows us to override that behavior.
// It enables us to use NNPACK from pytorch using `caffe2::pthreadpool_()`
namespace caffe2 {
class WithCastToNewThreadPool {
public:
explicit WithCastToNewThreadPool(bool use_new_threadpool);
~WithCastToNewThreadPool();
private:
bool use_new_threadpool_;
};
}
#endif
typedef struct pthreadpool* legacy_pthreadpool_t;
typedef void (*legacy_pthreadpool_function_1d_t)(void*, size_t);
typedef void (*legacy_pthreadpool_function_1d_tiled_t)(void*, size_t, size_t);
typedef void (*legacy_pthreadpool_function_2d_t)(void*, size_t, size_t);
typedef void (*legacy_pthreadpool_function_2d_tiled_t)(void*, size_t, size_t, size_t, size_t);
typedef void (*legacy_pthreadpool_function_3d_tiled_t)(
void*,
size_t,
size_t,
size_t,
size_t,
size_t,
size_t);
typedef void (*legacy_pthreadpool_function_4d_tiled_t)(
void*,
size_t,
size_t,
size_t,
size_t,
size_t,
size_t,
size_t,
size_t);
#ifdef __cplusplus
extern "C" {
#endif
/**
* Creates a thread pool with the specified number of threads.
*
* @param[in] threads_count The number of threads in the thread pool.
* A value of 0 has special interpretation: it creates a thread for each
* processor core available in the system.
*
* @returns A pointer to an opaque thread pool object.
* On error the function returns NULL and sets errno accordingly.
*/
// Returns internal threadpool impl.
legacy_pthreadpool_t legacy_pthreadpool_create(size_t threads_count);
/**
* Queries the number of threads in a thread pool.
*
* @param[in] threadpool The thread pool to query.
*
* @returns The number of threads in the thread pool.
*/
size_t legacy_pthreadpool_get_threads_count(legacy_pthreadpool_t threadpool);
/**
* Processes items in parallel using threads from a thread pool.
*
* When the call returns, all items have been processed and the thread pool is
* ready for a new task.
*
* @note If multiple threads call this function with the same thread pool, the
* calls are serialized.
*
* @param[in] threadpool The thread pool to use for parallelisation.
* @param[in] function The function to call for each item.
* @param[in] argument The first argument passed to the @a function.
* @param[in] items The number of items to process. The @a function
* will be called once for each item.
*/
void legacy_pthreadpool_compute_1d(
legacy_pthreadpool_t threadpool,
legacy_pthreadpool_function_1d_t function,
void* argument,
size_t range);
void legacy_pthreadpool_parallelize_1d(
legacy_pthreadpool_t threadpool,
legacy_pthreadpool_function_1d_t function,
void* argument,
size_t range,
uint32_t flags);
void legacy_pthreadpool_compute_1d_tiled(
legacy_pthreadpool_t threadpool,
legacy_pthreadpool_function_1d_tiled_t function,
void* argument,
size_t range,
size_t tile);
void legacy_pthreadpool_compute_2d(
legacy_pthreadpool_t threadpool,
legacy_pthreadpool_function_2d_t function,
void* argument,
size_t range_i,
size_t range_j);
void legacy_pthreadpool_compute_2d_tiled(
legacy_pthreadpool_t threadpool,
legacy_pthreadpool_function_2d_tiled_t function,
void* argument,
size_t range_i,
size_t range_j,
size_t tile_i,
size_t tile_j);
void legacy_pthreadpool_compute_3d_tiled(
legacy_pthreadpool_t threadpool,
legacy_pthreadpool_function_3d_tiled_t function,
void* argument,
size_t range_i,
size_t range_j,
size_t range_k,
size_t tile_i,
size_t tile_j,
size_t tile_k);
void legacy_pthreadpool_compute_4d_tiled(
legacy_pthreadpool_t threadpool,
legacy_pthreadpool_function_4d_tiled_t function,
void* argument,
size_t range_i,
size_t range_j,
size_t range_k,
size_t range_l,
size_t tile_i,
size_t tile_j,
size_t tile_k,
size_t tile_l);
/**
* Terminates threads in the thread pool and releases associated resources.
*
* @warning Accessing the thread pool after a call to this function constitutes
* undefined behaviour and may cause data corruption.
*
* @param[in,out] threadpool The thread pool to destroy.
*/
void legacy_pthreadpool_destroy(legacy_pthreadpool_t threadpool);
#ifdef USE_INTERNAL_PTHREADPOOL_IMPL
#define pthreadpool_t legacy_pthreadpool_t
#define pthreadpool_function_1d_t legacy_pthreadpool_function_1d_t
#define pthreadpool_function_1d_tiled_t legacy_pthreadpool_function_1d_tiled_t
#define pthreadpool_function_2d_t legacy_pthreadpool_function_2d_t
#define pthreadpool_function_2d_tiled_t legacy_pthreadpool_function_2d_tiled_t
#define pthreadpool_function_3d_tiled_t legacy_pthreadpool_function_3d_tiled_t
#define pthreadpool_function_4d_tiled_t legacy_pthreadpool_function_4d_tiled_t
#define pthreadpool_create legacy_pthreadpool_create
#define pthreadpool_destroy legacy_pthreadpool_destroy
#define pthreadpool_get_threads_count legacy_pthreadpool_get_threads_count
#define pthreadpool_compute_1d legacy_pthreadpool_compute_1d
#define pthreadpool_parallelize_1d legacy_pthreadpool_parallelize_1d
#define pthreadpool_compute_1d_tiled legacy_pthreadpool_compute_1d_tiled
#define pthreadpool_compute_2d legacy_pthreadpool_compute_2d
#define pthreadpool_compute_2d_tiled legacy_pthreadpool_compute_2d_tiled
#define pthreadpool_compute_3d_tiled legacy_pthreadpool_compute_3d_tiled
#define pthreadpool_compute_4d_tiled legacy_pthreadpool_compute_4d_tiled
#endif /* USE_INTERNAL_PTHREADPOOL_IMPL */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif // CAFFE2_UTILS_PTHREADPOOL_H_
| C | 4 | xiaohanhuang/pytorch | caffe2/utils/threadpool/pthreadpool.h | [
"Intel"
] |
<GameFile>
<PropertyGroup Name="LobbyView" Type="Node" ID="18d60a97-de13-413d-af97-214edf7e8039" Version="3.10.0.0" />
<Content ctype="GameProjectContent">
<Content>
<Animation Duration="0" Speed="1.0000" />
<ObjectData Name="Node" Tag="378" ctype="GameNodeObjectData">
<Size X="0.0000" Y="0.0000" />
<Children>
<AbstractNodeData Name="MainPanel" ActionTag="1240310140" Tag="379" IconVisible="False" PositionPercentXEnabled="True" PositionPercentYEnabled="True" LeftMargin="-568.0000" RightMargin="-568.0000" TopMargin="-320.0000" BottomMargin="-320.0000" TouchEnable="True" ClipAble="False" BackColorAlpha="153" ComboBoxIndex="1" ColorAngle="90.0000" Scale9Width="1" Scale9Height="1" ctype="PanelObjectData">
<Size X="1136.0000" Y="640.0000" />
<Children>
<AbstractNodeData Name="Button_1" ActionTag="-1470904166" CallBackType="Click" CallBackName="clickLogout" Tag="37" IconVisible="False" PositionPercentXEnabled="True" PositionPercentYEnabled="True" LeftMargin="424.0000" RightMargin="424.0000" TopMargin="271.5000" BottomMargin="271.5000" TouchEnable="True" FontSize="26" ButtonText="BACK TO LOGIN UI" LeftEage="15" RightEage="15" TopEage="11" BottomEage="11" Scale9OriginX="15" Scale9OriginY="11" Scale9Width="258" Scale9Height="75" ShadowOffsetX="2.0000" ShadowOffsetY="-2.0000" ctype="ButtonObjectData">
<Size X="288.0000" Y="97.0000" />
<AnchorPoint ScaleX="0.5000" ScaleY="0.5000" />
<Position X="568.0000" Y="320.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<CColor A="255" R="255" G="255" B="255" />
<PrePosition X="0.5000" Y="0.5000" />
<PreSize X="0.2535" Y="0.1516" />
<TextColor A="255" R="255" G="255" B="255" />
<NormalFileData Type="Normal" Path="views/btn/btn_11.png" Plist="" />
<OutlineColor A="255" R="255" G="0" B="0" />
<ShadowColor A="255" R="110" G="110" B="110" />
</AbstractNodeData>
</Children>
<AnchorPoint ScaleX="0.5000" ScaleY="0.5000" />
<Position />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<CColor A="255" R="255" G="255" B="255" />
<PrePosition />
<PreSize X="0.0000" Y="0.0000" />
<SingleColor A="255" R="0" G="0" B="0" />
<FirstColor A="255" R="150" G="200" B="255" />
<EndColor A="255" R="255" G="255" B="255" />
<ColorVector ScaleY="1.0000" />
</AbstractNodeData>
</Children>
</ObjectData>
</Content>
</Content>
</GameFile> | Csound | 3 | darkdukey/cocos2dx-lite | raw/cocosstudio/views/LobbyView.csd | [
"MIT"
] |
// Cannot use now option with tableFind, which is necessary to implementa min.
// Instead use -3y as start.
// option now = () => 2020-02-22T18:00:00Z
@tableflux.h2o_temperature{location, state,
bottom_degrees, surface_degrees, time > -3y}
|> select(fn: min(bottom_degrees))
| FLUX | 3 | RohanSreerama5/flux | colm/tableflux/query18.flux | [
"MIT"
] |
package com.baeldung.insertnull;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class DBConfig {
private static Connection INSTANCE;
public static Connection getConnection() throws SQLException {
if (INSTANCE == null) {
INSTANCE = DriverManager.getConnection("jdbc:h2:mem:insertnull", "user", "password");
createPersonTable();
}
return INSTANCE;
}
private static void createPersonTable() throws SQLException {
try(Statement statement = INSTANCE.createStatement()) {
String sql = "CREATE TABLE Person (id INTEGER not null, name VARCHAR(50), lastName VARCHAR(50), age INTEGER, PRIMARY KEY (id))";
statement.executeUpdate(sql);
}
}
}
| Java | 3 | DBatOWL/tutorials | persistence-modules/core-java-persistence-2/src/main/java/com/baeldung/insertnull/DBConfig.java | [
"MIT"
] |
#include "script_component.hpp"
/*
Name: TFAR_fnc_requestRadios
Author: NKey, Garth de Wet (L-H)
Checks whether the player needs to have radios converted to "instanced" versions,
handles waiting for response from server with radio classnames and applying them to the player.
Arguments:
0: Replace already instanced Radios <BOOL>
Return Value:
None
Example:
call TFAR_fnc_requestRadios;
Public: Yes
*/
if (isDedicated) exitWith {
ERROR("This function should never be called on a dedicated Server");
};
private _lastExec = GVAR(VehicleConfigCacheNamespace) getVariable "TFAR_fnc_requestRadios_lastExec";
//If the loadout didn't change since last execute we don't need to check anything
//Also if player is still in Arsenal don't replace anything
if (_lastExec > TFAR_lastLoadoutChange || GVAR(currentlyInArsenal)) exitWith {};
GVAR(VehicleConfigCacheNamespace) setVariable ["TFAR_fnc_requestRadios_lastExec", diag_tickTime-0.1];
(_this call TFAR_fnc_radioToRequestCount) params ["_radiosToRequest", "_settingsToCopy", "_linkFirstItem"];
if (_radiosToRequest isEqualTo []) exitWith {};
//Answer EH. The server sent us instanciated radios
GVAR(lastRadioRequestEH_ID) = [
"TFAR_RadioRequestResponseEvent", {
params [["_response", [], [[]]]];
if ((_response isEqualTo []) || {(_response select 0) isEqualTo "ERROR:47"}) exitWith {
diag_log ["TFAR_ReceiveRadioRequestResponse", _response];
hintC _response;
call TFAR_fnc_hideHint;
["TFAR_RadioRequestResponseEvent", _thisId] call CBA_fnc_removeEventHandler;
[[15, "radioRequest", round ((diag_tickTime-TFAR_beta_RadioRequestStart)*1000)]] call TFAR_fnc_betaTracker;//#TODO remove on release
};
_thisArgs params ["_radiosToReplace", "_linkFirstItem", "_settingsToCopy", "_requestedUnit"];
//Got a outdated result
if !(_thisId isEqualTo GVAR(lastRadioRequestEH_ID)) exitWith {
["TFAR_RadioRequestResponseEvent", _thisId] call CBA_fnc_removeEventHandler;
//#TODO this should be handled like an error. If this happens the server will discard unique IDs and we only have a limited number of them
//I don't really want a garbage collection system like ACRE. TFAR's system is enough if we take some care not to throw away IDs.
};
diag_log ["TFAR_ReceiveRadioRequestResponse", _response]; //#TODO remove on release
private _newRadios = [];
if (_linkFirstItem) then {
private _oldItem = _radiosToReplace deleteAt 0;
private _newID = _response deleteAt 0;
if (_newID > 0) then {
if (_oldItem == "ItemRadio") then {
_oldItem = (TFAR_currentUnit call TFAR_fnc_getDefaultRadioClasses) param [[2, 1] select ((TFAR_givePersonalRadioToRegularSoldier) || {leader _requestedUnit == _requestedUnit} || {rankId _requestedUnit >= 2}), ""];
};
private _newItem = format["%1_%2", [_oldItem, "tf_parent", "TFAR global default radio setting configured incorrectly"] call DFUNC(getWeaponConfigProperty), _newID];
_requestedUnit linkItem _newItem;
_newRadios pushBack _newItem;
private _settings = _settingsToCopy param [_settingsToCopy find _oldItem, "", [""]];
if !(_settings isEqualTo "") then {
private _localSettings = TFAR_RadioSettingsNamespace getVariable (format["%1_local", _settings]);
if !(isNil "_localSettings") then {
[_newItem, _localSettings, true] call TFAR_fnc_setSwSettings;
};
};
} else {
_requestedUnit unassignItem _oldItem;
_requestedUnit removeItem _oldItem;
};
};
{
private _oldItem = _x;
private _newID = _response deleteAt 0;
_requestedUnit removeItem _oldItem;
if (_oldItem == "ItemRadio") then {
_oldItem = (TFAR_currentUnit call TFAR_fnc_getDefaultRadioClasses) param [[2, 1] select ((TFAR_givePersonalRadioToRegularSoldier) or {leader _requestedUnit == _requestedUnit} or {rankId _requestedUnit >= 2}), ""];
};
private _newItem = format["%1_%2", [_oldItem, "tf_parent", "TFAR global default radio setting configured incorrectly"] call DFUNC(getWeaponConfigProperty), _newID];
if (_requestedUnit canAdd _newItem) then {
_requestedUnit addItem _newItem;
_newRadios pushBack _newItem;
};
private _settings = _settingsToCopy param [_settingsToCopy find _oldItem, "", [""]];
if !(_settings isEqualTo "") then {
private _localSettings = TFAR_RadioSettingsNamespace getVariable (format["%1_local", _settings]);
if !(isNil "_localSettings") then {
[_newItem, _localSettings, true] call TFAR_fnc_setSwSettings;
};
};
} forEach _radiosToReplace;
call TFAR_fnc_hideHint;
["OnRadiosReceived", [_requestedUnit, _newRadios]] call TFAR_fnc_fireEventHandlers;
["TFAR_RadioRequestResponseEvent", _thisId] call CBA_fnc_removeEventHandler;
[[15, "radioRequest", round ((diag_tickTime-TFAR_beta_RadioRequestStart)*1000)]] call TFAR_fnc_betaTracker;//#TODO remove on release
}, [_radiosToRequest, _linkFirstItem, _settingsToCopy, TFAR_currentUnit]
] call CBA_fnc_addEventHandlerArgs;
[parseText(localize LSTRING(wait_radio)), 10] call TFAR_fnc_showHint;
TFAR_beta_RadioRequestStart = diag_tickTime;//#TODO remove on release
//Send request
diag_log ["TFAR_SendRadioRequest", _radiosToRequest, TF_respawnedAt,time];
["TFAR_RadioRequestEvent", [_radiosToRequest,TFAR_currentUnit]] call CBA_fnc_serverEvent;
//MUTEX_UNLOCK(TF_radio_request_mutex);
| SQF | 4 | MrDj200/task-force-arma-3-radio | addons/core/functions/fnc_requestRadios.sqf | [
"RSA-MD"
] |
export function add(a: i32, b: i32): i32 {
return a + b;
}
| ActionScript | 2 | romdotdog/assemblyscript | tests/extension/assembly/other.as | [
"Apache-2.0"
] |
from ray.includes.function_descriptor cimport (
CFunctionDescriptor,
CFunctionDescriptorBuilder,
CPythonFunctionDescriptor,
CJavaFunctionDescriptor,
EmptyFunctionDescriptorType,
JavaFunctionDescriptorType,
PythonFunctionDescriptorType,
)
import hashlib
import cython
import inspect
import uuid
import ray.ray_constants as ray_constants
ctypedef object (*FunctionDescriptor_from_cpp)(const CFunctionDescriptor &)
cdef unordered_map[int, FunctionDescriptor_from_cpp] \
FunctionDescriptor_constructor_map
cdef CFunctionDescriptorToPython(CFunctionDescriptor function_descriptor):
cdef int function_descriptor_type = <int>function_descriptor.get().Type()
it = FunctionDescriptor_constructor_map.find(function_descriptor_type)
if it == FunctionDescriptor_constructor_map.end():
raise Exception("Can't construct FunctionDescriptor from type {}"
.format(function_descriptor_type))
else:
constructor = dereference(it).second
return constructor(function_descriptor)
@cython.auto_pickle(False)
cdef class FunctionDescriptor:
def __cinit__(self, *args, **kwargs):
if type(self) == FunctionDescriptor:
raise Exception("type {} is abstract".format(type(self).__name__))
def __hash__(self):
return hash(self.descriptor.get().ToString())
def __eq__(self, other):
return (type(self) == type(other) and
self.descriptor.get().ToString() ==
(<FunctionDescriptor>other).descriptor.get().ToString())
def __repr__(self):
return <str>self.descriptor.get().ToString()
def to_dict(self):
d = {"type": type(self).__name__}
for k, v in vars(type(self)).items():
if inspect.isgetsetdescriptor(v):
d[k] = v.__get__(self)
return d
FunctionDescriptor_constructor_map[<int>EmptyFunctionDescriptorType] = \
EmptyFunctionDescriptor.from_cpp
@cython.auto_pickle(False)
cdef class EmptyFunctionDescriptor(FunctionDescriptor):
def __cinit__(self):
self.descriptor = CFunctionDescriptorBuilder.Empty()
def __reduce__(self):
return EmptyFunctionDescriptor, ()
@staticmethod
cdef from_cpp(const CFunctionDescriptor &c_function_descriptor):
return EmptyFunctionDescriptor()
FunctionDescriptor_constructor_map[<int>JavaFunctionDescriptorType] = \
JavaFunctionDescriptor.from_cpp
@cython.auto_pickle(False)
cdef class JavaFunctionDescriptor(FunctionDescriptor):
cdef:
CJavaFunctionDescriptor *typed_descriptor
def __cinit__(self,
class_name,
function_name,
signature):
self.descriptor = CFunctionDescriptorBuilder.BuildJava(
class_name, function_name, signature)
self.typed_descriptor = <CJavaFunctionDescriptor*>(
self.descriptor.get())
def __reduce__(self):
return JavaFunctionDescriptor, (self.typed_descriptor.ClassName(),
self.typed_descriptor.FunctionName(),
self.typed_descriptor.Signature())
@staticmethod
cdef from_cpp(const CFunctionDescriptor &c_function_descriptor):
cdef CJavaFunctionDescriptor *typed_descriptor = \
<CJavaFunctionDescriptor*>(c_function_descriptor.get())
return JavaFunctionDescriptor(typed_descriptor.ClassName(),
typed_descriptor.FunctionName(),
typed_descriptor.Signature())
@property
def class_name(self):
"""Get the class name of current function descriptor.
Returns:
The class name of the function descriptor. It could be
empty if the function is not a class method.
"""
return <str>self.typed_descriptor.ClassName()
@property
def function_name(self):
"""Get the function name of current function descriptor.
Returns:
The function name of the function descriptor.
"""
return <str>self.typed_descriptor.FunctionName()
@property
def signature(self):
"""Get the signature of current function descriptor.
Returns:
The signature of the function descriptor.
"""
return <str>self.typed_descriptor.Signature()
FunctionDescriptor_constructor_map[<int>PythonFunctionDescriptorType] = \
PythonFunctionDescriptor.from_cpp
@cython.auto_pickle(False)
cdef class PythonFunctionDescriptor(FunctionDescriptor):
cdef:
CPythonFunctionDescriptor *typed_descriptor
object _function_id
def __cinit__(self,
module_name,
function_name,
class_name="",
function_source_hash=""):
self.descriptor = CFunctionDescriptorBuilder.BuildPython(
module_name, class_name, function_name, function_source_hash)
self.typed_descriptor = <CPythonFunctionDescriptor*>(
self.descriptor.get())
def __reduce__(self):
return PythonFunctionDescriptor, (self.typed_descriptor.ModuleName(),
self.typed_descriptor.FunctionName(),
self.typed_descriptor.ClassName(),
self.typed_descriptor.FunctionHash())
@staticmethod
cdef from_cpp(const CFunctionDescriptor &c_function_descriptor):
cdef CPythonFunctionDescriptor *typed_descriptor = \
<CPythonFunctionDescriptor*>(c_function_descriptor.get())
return PythonFunctionDescriptor(typed_descriptor.ModuleName(),
typed_descriptor.FunctionName(),
typed_descriptor.ClassName(),
typed_descriptor.FunctionHash())
@classmethod
def from_function(cls, function, function_uuid):
"""Create a FunctionDescriptor from a function instance.
This function is used to create the function descriptor from
a python function. If a function is a class function, it should
not be used by this function.
Args:
cls: Current class which is required argument for classmethod.
function: the python function used to create the function
descriptor.
function_uuid: Used to uniquely identify a function.
Ideally we can use the pickled function bytes
but cloudpickle isn't stable in some cases
for the same function.
Returns:
The FunctionDescriptor instance created according to the function.
"""
module_name = cls._get_module_name(function)
function_name = function.__qualname__
class_name = ""
return cls(module_name, function_name, class_name, function_uuid.hex)
@classmethod
def from_class(cls, target_class):
"""Create a FunctionDescriptor from a class.
Args:
cls: Current class which is required argument for classmethod.
target_class: the python class used to create the function
descriptor.
Returns:
The FunctionDescriptor instance created according to the class.
"""
module_name = cls._get_module_name(target_class)
class_name = target_class.__qualname__
# Use a random uuid as function hash to solve actor name conflict.
return cls(module_name, "__init__", class_name, uuid.uuid4().hex)
@property
def module_name(self):
"""Get the module name of current function descriptor.
Returns:
The module name of the function descriptor.
"""
return <str>self.typed_descriptor.ModuleName()
@property
def class_name(self):
"""Get the class name of current function descriptor.
Returns:
The class name of the function descriptor. It could be
empty if the function is not a class method.
"""
return <str>self.typed_descriptor.ClassName()
@property
def function_name(self):
"""Get the function name of current function descriptor.
Returns:
The function name of the function descriptor.
"""
return <str>self.typed_descriptor.FunctionName()
@property
def function_hash(self):
"""Get the hash string of the function source code.
Returns:
The hex of function hash if the source code is available.
Otherwise, it will be an empty string.
"""
return <str>self.typed_descriptor.FunctionHash()
@property
def function_id(self):
"""Get the function id calculated from this descriptor.
Returns:
The value of ray.ObjectRef that represents the function id.
"""
if not self._function_id:
self._function_id = self._get_function_id()
return self._function_id
def _get_function_id(self):
"""Calculate the function id of current function descriptor.
This function id is calculated from all the fields of function
descriptor.
Returns:
ray.ObjectRef to represent the function descriptor.
"""
function_id_hash = hashlib.shake_128()
# Include the function module and name in the hash.
function_id_hash.update(self.typed_descriptor.ModuleName())
function_id_hash.update(self.typed_descriptor.FunctionName())
function_id_hash.update(self.typed_descriptor.ClassName())
function_id_hash.update(self.typed_descriptor.FunctionHash())
# Compute the function ID.
function_id = function_id_hash.digest(ray_constants.ID_SIZE)
return ray.FunctionID(function_id)
@staticmethod
def _get_module_name(object):
"""Get the module name from object. If the module is __main__,
get the module name from file.
Returns:
Module name of object.
"""
module_name = object.__module__
if module_name == "__main__":
try:
file_path = inspect.getfile(object)
n = inspect.getmodulename(file_path)
if n:
module_name = n
except TypeError:
pass
return module_name
def is_actor_method(self):
"""Wether this function descriptor is an actor method.
Returns:
True if it's an actor method, False if it's a normal function.
"""
return not self.typed_descriptor.ClassName().empty()
| Cython | 4 | linyiyue/ray | python/ray/includes/function_descriptor.pxi | [
"Apache-2.0"
] |
---
title: This page is foos
tags:
- foos
---
Foos. | Liquid | 0 | binyamin/eleventy | test/stubs/issue-115/template-foos.liquid | [
"MIT"
] |
/**************************************************************
* This is just a test of Blynk library build in Arduino IDE
*
* You should NOT flash this program
* to your hardware or try to run it.
*
**************************************************************/
#if defined(ARDUINO_AVR_GEMMA) \
|| defined(ARDUINO_attiny) \
|| defined(ARDUINO_AVR_TRINKET3) \
|| defined(ARDUINO_AVR_TRINKET5) \
|| defined(ARDUINO_AVR_DIGISPARK)
#define BLYNK_NO_INFO
#define BLYNK_NO_BUILTIN
#define SKIP_WRITES_TEST
#endif
#include <BlynkSimpleUserDefined.h>
char auth[] = "12345678901234567890123456789012";
volatile uint8_t test;
// This function is used by Blynk to receive data
size_t BlynkStreamRead(void* buf, size_t len)
{
uint8_t* byte_buff = (uint8_t*)buf;
size_t res = len;
while (len--) {
*byte_buff++ = test;
}
return res;
}
// This function is used by Blynk to send data
size_t BlynkStreamWrite(const void* buf, size_t len)
{
uint8_t* byte_buff = (uint8_t*)buf;
size_t res = len;
while (len--) {
test = *byte_buff++;
}
return res;
}
void setup()
{
Blynk.begin(auth);
Blynk.connect();
}
BLYNK_WRITE(V3)
{
test = param.asInt();
}
BLYNK_READ(V4)
{
Blynk.virtualWrite(V10, millis(), BlynkFreeRam());
Blynk.virtualWrite(V10, 1, 1U);
Blynk.virtualWrite(V10, 1L, 1UL);
Blynk.virtualWrite(V10, 1LL, 1ULL);
#ifndef SKIP_WRITES_TEST
Blynk.virtualWrite(V10, (int8_t)1, (uint8_t)1);
Blynk.virtualWrite(V10, (int16_t)1, (uint16_t)1);
Blynk.virtualWrite(V10, (int32_t)1, (uint32_t)1);
//Blynk.virtualWrite(V10, (int64_t)1, (uint64_t)1);
Blynk.virtualWrite(V10, (size_t)1);
#ifndef BLYNK_NO_FLOAT
Blynk.virtualWrite(V10, (float)1.0F);
Blynk.virtualWrite(V10, (double)1.0);
#endif
Blynk.virtualWrite(V10, String("Some string as String)"));
Blynk.virtualWrite(V10, "Some string from RAM");
Blynk.virtualWrite(V10, BLYNK_F("Some string from Flash"));
BlynkParamAllocated param(128);
Blynk.virtualWrite(V10, param);
Blynk.virtualWriteBinary(V10, "buffer", 6);
#endif
}
void loop()
{
bool hasIncomingData = (test > 0);
if (!Blynk.run(hasIncomingData)) {
}
}
| Arduino | 4 | kayatmin/blynk-library | tests/BlynkBuildTest/BlynkBuildTest.ino | [
"MIT"
] |
; UserVars.nsi
;
; This script shows you how to declare and user variables.
;--------------------------------
Name "User Variables Text"
OutFile "UserVars.exe"
InstallDir "$PROGRAMFILES\User Variables Test"
RequestExecutionLevel admin
;--------------------------------
;Pages
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
;--------------------------------
; Declaration of user variables (Var command), allowed charaters for variables names : [a-z][A-Z][0-9] and '_'
Var "Name"
Var "Serial"
Var "Info"
;--------------------------------
; Installer
Section "Dummy Section" SecDummy
StrCpy $0 "Admin"
StrCpy "$Name" $0
StrCpy "$Serial" "12345"
MessageBox MB_OK "User Name: $Name $\n$\nSerial Number: $Serial"
CreateDirectory $INSTDIR
WriteUninstaller "$INSTDIR\Uninst.exe"
SectionEnd
Section "Another Section"
Var /GLOBAL "AnotherVar"
StrCpy $AnotherVar "test"
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
StrCpy $Info "User variables test uninstalled successfully."
Delete "$INSTDIR\Uninst.exe"
RmDir $INSTDIR
SectionEnd
Function un.OnUninstSuccess
HideWindow
MessageBox MB_OK "$Info"
FunctionEnd
| NSIS | 4 | vbillet/Torque3D | Engine/bin/tools/nsis/app/Examples/UserVars.nsi | [
"MIT"
] |
do ("Hello") type
---
do type ("Hello");
=============================================
section {
div id='foo'
}
---
section >
#foo;
=============================================
header {
div .test.baz.~[name];
span > 'foo'
}
---
header {
.test.baz.~[name];
span >
'foo'
}
=============================================
module path = "foo.mask" {
define foo {
a;
}
};
import from './foo.mask';
import a as X from 'foo';
a;
----------------
module path='foo.mask' {
define foo {
a;
}
}
import from './foo.mask';
import a as X from 'foo';
a; | Mask | 2 | atmajs/MaskJS | test/tmpl/stringify/misc.mask | [
"MIT"
] |
func &foo ( var %i i32 ) void {
var %p ptr
dassign %p ( malloc ptr ( constval i32 8 ))
dassign %p ( alloca ptr ( constval i32 16 ))
dassign %p ( gcmalloc ref i32 )
dassign %p ( gcmallocjarray ref <[] i32> ( constval i32 5 ))
free ( dread ref %p)
}
# EXEC: %irbuild Main.mpl
# EXEC: %irbuild Main.irb.mpl
# EXEC: %cmp Main.irb.mpl Main.irb.irb.mpl
| Maple | 2 | harmonyos-mirror/OpenArkCompiler-test | test/testsuite/irbuild_test/I0054-mapleall-irbuild-edge-malloc/Main.mpl | [
"MulanPSL-1.0"
] |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>child.html</title>
</head>
<body>
<h1>child</h1>
</body>
</html> | HTML | 2 | namaljayathunga/nw.js | test/remoting/issue3780-jailed/child.html | [
"MIT"
] |
fileFormatVersion: 2
guid: 9f890146b0795ba41af8e4f78c481496
folderAsset: yes
timeCreated: 1455706231
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
| Unity3D Asset | 0 | jiahaodev/xLua | Assets/XLua/Tutorial.meta | [
"BSD-3-Clause"
] |
This is for testing an ssi include. {{ test }}
| HTML | 0 | ni-ning/django | tests/template_tests/templates/ssi_include.html | [
"CNRI-Python-GPL-Compatible",
"BSD-3-Clause"
] |
--TEST--
DateTime::diff() -- fall type3 type3
--CREDITS--
Daniel Convissor <danielc@php.net>
--XFAIL--
Various bugs exist
--FILE--
<?php
require 'examine_diff.inc';
define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_DIFF);
require 'DateTime_data-fall-type3-type3.inc';
?>
--EXPECT--
test_time_fall_type3_prev_type3_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-10-04 02:18:48 EDT = **P+0Y1M2DT16H19M40S**
test_time_fall_type3_prev_type3_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-06 18:38:28 EDT = **P+0Y0M0DT5H31M52S**
test_time_fall_type3_prev_type3_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-06 18:38:28 EDT = **P+0Y0M0DT6H34M5S**
test_time_fall_type3_prev_type3_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-06 18:38:28 EDT = **P+0Y0M0DT7H36M16S**
test_time_fall_type3_prev_type3_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-06 18:38:28 EDT = **P+0Y0M0DT9H38M27S**
test_time_fall_type3_prev_type3_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-06 18:38:28 EDT = **P+0Y0M2DT1H21M31S**
test_time_fall_type3_dt_type3_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-07 00:10:20 EDT = **P-0Y0M0DT5H31M52S**
test_time_fall_type3_dt_type3_dt: DIFF: 2010-11-07 00:15:35 EDT - 2010-11-07 00:10:20 EDT = **P+0Y0M0DT0H5M15S**
test_time_fall_type3_dt_type3_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-07 00:10:20 EDT = **P+0Y0M0DT1H2M13S**
test_time_fall_type3_dt_type3_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-07 00:10:20 EDT = **P+0Y0M0DT2H4M24S**
test_time_fall_type3_dt_type3_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-07 00:10:20 EDT = **P+0Y0M0DT4H6M35S**
test_time_fall_type3_dt_type3_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-07 00:10:20 EDT = **P+0Y0M1DT20H49M39S**
test_time_fall_type3_redodt_type3_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-07 01:12:33 EDT = **P-0Y0M0DT6H34M5S**
test_time_fall_type3_redodt_type3_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-07 01:12:33 EDT = **P-0Y0M0DT1H2M13S**
test_time_fall_type3_redodt_type3_redodt: DIFF: 2010-11-07 01:15:35 EDT - 2010-11-07 01:12:33 EDT = **P+0Y0M0DT0H3M2S**
test_time_fall_type3_redodt_type3_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-07 01:12:33 EDT = **P+0Y0M0DT1H2M11S**
test_time_fall_type3_redodt_type3_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-07 01:12:33 EDT = **P+0Y0M0DT3H4M22S**
test_time_fall_type3_redodt_type3_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-07 01:12:33 EDT = **P+0Y0M1DT19H47M26S**
test_time_fall_type3_redost_type3_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-07 01:14:44 EST = **P-0Y0M0DT7H36M16S**
test_time_fall_type3_redost_type3_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-07 01:14:44 EST = **P-0Y0M0DT2H4M24S**
test_time_fall_type3_redost_type3_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-07 01:14:44 EST = **P-0Y0M0DT1H2M11S**
test_time_fall_type3_redost_type3_redost: DIFF: 2010-11-07 01:16:54 EST - 2010-11-07 01:14:44 EST = **P+0Y0M0DT0H2M10S**
test_time_fall_type3_redost_type3_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-07 01:14:44 EST = **P+0Y0M0DT2H2M11S**
test_time_fall_type3_redost_type3_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-07 01:14:44 EST = **P+0Y0M1DT18H45M15S**
test_time_fall_type3_st_type3_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-07 03:16:55 EST = **P-0Y0M0DT9H38M27S**
test_time_fall_type3_st_type3_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-07 03:16:55 EST = **P-0Y0M0DT4H6M35S**
test_time_fall_type3_st_type3_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-07 03:16:55 EST = **P-0Y0M0DT3H4M22S**
test_time_fall_type3_st_type3_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-07 03:16:55 EST = **P-0Y0M0DT2H2M11S**
test_time_fall_type3_st_type3_st: DIFF: 2010-11-07 05:19:56 EST - 2010-11-07 03:16:55 EST = **P+0Y0M0DT2H3M1S**
test_time_fall_type3_st_type3_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-07 03:16:55 EST = **P+0Y0M1DT16H43M4S**
test_time_fall_type3_post_type3_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-08 19:59:59 EST = **P-0Y0M2DT1H21M31S**
test_time_fall_type3_post_type3_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-08 19:59:59 EST = **P-0Y0M1DT20H49M39S**
test_time_fall_type3_post_type3_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-08 19:59:59 EST = **P-0Y0M1DT19H47M26S**
test_time_fall_type3_post_type3_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-08 19:59:59 EST = **P-0Y0M1DT18H45M15S**
test_time_fall_type3_post_type3_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-08 19:59:59 EST = **P-0Y0M1DT16H43M4S**
test_time_fall_type3_post_type3_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-08 18:57:55 EST = **P+0Y0M0DT1H2M4S**
test_time_fall_type3_dtsec_type3_stsec: DIFF: 2010-11-07 01:00:00 EST - 2010-11-07 01:59:59 EDT = **P+0Y0M0DT0H0M1S**
test_time_fall_type3_stsec_type3_dtsec: DIFF: 2010-11-07 01:59:59 EDT - 2010-11-07 01:00:00 EST = **P-0Y0M0DT0H0M1S**
| PHP | 3 | thiagooak/php-src | ext/date/tests/DateTime_diff-fall-type3-type3.phpt | [
"PHP-3.01"
] |
FOR I=1:1:1 QUIT:NoLoop DO YesLoop
QUIT Returnvalue
| M | 0 | LaudateCorpus1/RosettaCodeData | Task/Flow-control-structures/MUMPS/flow-control-structures-7.mumps | [
"Info-ZIP"
] |
{-#LANGUAGE ForeignFunctionInterface, ScopedTypeVariables, UnicodeSyntax, ViewPatterns#-}
#include "cvWrapLEO.h"
module CV.Morphology (StructuringElement
,structuringElement
,customSE
,basicSE,bigSE
,geodesic
,openOp,closeOp
,open,close
,erode,dilate
,blackTopHat,whiteTopHat
,skeletonize
,dilateOp,erodeOp,KernelShape(EllipseShape,CrossShape,RectShape)
, ConvKernel
)
where
import Foreign.C.Types
import Foreign.C.String
import Foreign.ForeignPtr
import Foreign.Ptr
import Foreign.Marshal.Array
import CV.Image
import CV.ImageOp
import qualified CV.ImageMath as IM
import System.IO.Unsafe
-- Morphological opening
openOp :: StructuringElement -> ImageOperation GrayScale d
openOp se = erodeOp se 1 #> dilateOp se 1
open se = unsafeOperate (openOp se)
a ○ b = open b a
-- a ○ b = (a ⊖ b) ⊕ b
-- Morphological closing
closeOp :: StructuringElement -> ImageOperation GrayScale d
closeOp se = dilateOp se 1 #> erodeOp se 1
close se = unsafeOperate (closeOp se)
a ● b = close b a
geodesic :: Image GrayScale D32 -> ImageOperation GrayScale d -> ImageOperation GrayScale d
geodesic mask op = op #> IM.limitToOp mask
-- | Perform a black tophat filtering of size
blackTopHat size i =
let se = structuringElement
(size,size) (size `div` 2, size `div` 2) RectShape
x = unsafeOperate (closeOp se) i
in x `IM.sub` i
-- | Perform a white tophat filtering of size
whiteTopHat size i =
let se = structuringElement
(size,size) (size `div` 2, size `div` 2) RectShape
x = unsafeOperate (openOp se) i
in i `IM.sub` x
basicSE = structuringElement (3,3) (1,1) RectShape
bigSE = structuringElement (9,9) (4,4) RectShape
---------- Low level wrapper
#c
enum KernelShape {
RectShape = CV_SHAPE_RECT
,CrossShape = CV_SHAPE_CROSS
,EllipseShape = CV_SHAPE_ELLIPSE
,CustomShape = CV_SHAPE_CUSTOM
};
#endc
{#enum KernelShape {} #}
{#pointer *IplConvKernel as ConvKernel foreign newtype#}
type StructuringElement = ConvKernel
foreign import ccall "& wrapReleaseStructuringElement"
releaseSE :: FinalizerPtr ConvKernel
-- Check morphology element
isGoodSE s@(w,h) d@(x,y) | x>=0 && y>=0
&& w>=0 && h>=0
&& x<w && y<h
= True
| otherwise = False
-- |Create a structuring element for morphological operations
-- The first pair is @(width,height)@ while the second is the origin @(x,y)@
structuringElement :: (Int, Int) -> (Int, Int) -> KernelShape -> StructuringElement
structuringElement s d | isGoodSE s d = createSE s d
| otherwise = error "Bad values in structuring element"
-- Create SE with custom shape that is taken from flat list shape.
createSE :: (Int, Int) -> (Int, Int) -> KernelShape -> StructuringElement
createSE (fromIntegral -> w,fromIntegral -> h) (fromIntegral -> x,fromIntegral -> y) shape = unsafePerformIO $ do
iptr <- {#call cvCreateStructuringElementEx#}
w h x y (fromIntegral . fromEnum $ shape) nullPtr
fptr <- newForeignPtr releaseSE iptr
return (ConvKernel fptr)
customSE :: (CInt, CInt) -> (CInt, CInt) -> [CInt] -> ConvKernel
customSE s@(w,h) o shape | isGoodSE s o
&& length shape == fromIntegral (w*h)
= createCustomSE s o shape
createCustomSE (w,h) (x,y) shape = unsafePerformIO $ do
iptr <- withArray shape $ \arr ->
{#call cvCreateStructuringElementEx#}
w h x y (fromIntegral . fromEnum $ CustomShape) arr
fptr <- newForeignPtr releaseSE iptr
return (ConvKernel fptr)
{#fun cvErode as erosion
{withGenBareImage* `BareImage'
,withGenBareImage* `BareImage'
,withConvKernel* `ConvKernel'
,`Int'} -> `()' #}
{#fun cvDilate as dilation
{withGenBareImage* `BareImage'
,withGenBareImage* `BareImage'
,withConvKernel* `ConvKernel'
,`Int'} -> `()' #}
erodeOp se count = ImgOp $ \(unS -> img) -> erosion img img se count
dilateOp se count = ImgOp $ \(unS -> img) -> dilation img img se count
erode se count i = unsafeOperate (erodeOp se count) i
dilate se count i = unsafeOperate (dilateOp se count) i
a ⊕ b = dilate b 1 a
a ⊖ b = erode b 1 a
erode' se count img = withImage img $ \image ->
withConvKernel se $ \ck ->
{#call cvErode#} (castPtr image)
(castPtr image)
ck count
dilate' se count img = withImage img $ \image ->
withConvKernel se $ \ck ->
{#call cvDilate#} (castPtr image)
(castPtr image)
ck count
skeletonize :: Image GrayScale D8 -> Image GrayScale D8
skeletonize i = fst . snd . head . dropWhile (\x -> fst x > 0) . iterate (skeletonize'.snd)
$ (1,(CV.Image.empty (getSize i),i))
skeletonize' :: (Image GrayScale D8, Image GrayScale D8) -> (Int, (Image GrayScale D8, Image GrayScale D8))
skeletonize' (skel,img) = (IM.countNonZero img, (tmp, erode se 1 img))
where
tmp = unsafeOperateOn img $ openOp se #> IM.notOp #> IM.andOp img Nothing #> IM.orOp skel Nothing
se = structuringElement (3,3) (1,1) CrossShape
| C2hs Haskell | 5 | maaleske/CV | CV/Morphology.chs | [
"BSD-3-Clause"
] |
class Foo { Void f() { switch (3) { default: return; default: return; } } } | Fantom | 0 | fanx-dev/fanx | compiler/testCompilerx/res/parser/testBadStmts.fan | [
"AFL-3.0"
] |
@media ( max-width:600px ) {}
@media ( min-width:700px) and ( orientation: landscape){}
@media (min-width: 700px), handheld and (orientation: landscape) {}
@media not all and ( monochrome ) {}
@media ( not all ) and ( monochrome ) {}
@media ( not ( screen and ( color ) ) ) , print and ( color ){}
@media screen and ( device-aspect-ratio: 16/9 ), screen and (device-aspect-ratio:16/10 ) {}
@media ( -webkit-min-device-pixel-ratio:2),
(min--moz-device-pixel-ratio: 2 ),
(min-resolution: 2dppx),
(min-resolution: 192dpi ){}
| CSS | 2 | fuelingtheweb/prettier | tests/stylefmt/at-media/at-media.css | [
"MIT"
] |
GalaxyID,x,y,e1,e2
Galaxy1,802.16,4038.35,0.011816,0.251732
Galaxy2,2274.28,3322.19,0.073310,-0.164279
Galaxy3,1719.04,1631.63,0.081222,0.058514
Galaxy4,270.84,751.30,-0.476619,0.525915
Galaxy5,2787.61,713.03,0.134413,0.213420
Galaxy6,1089.16,2010.42,-0.023602,0.281272
Galaxy7,2885.65,3392.29,0.042675,-0.064270
Galaxy8,4145.13,1438.15,-0.286750,-0.112068
Galaxy9,4193.21,2557.70,0.036113,-0.042751
Galaxy10,2106.14,2112.81,-0.062457,0.182315
Galaxy11,2423.38,145.74,0.117184,0.135832
Galaxy12,2949.00,2558.99,0.251103,-0.389065
Galaxy13,1620.34,4030.40,0.097724,-0.184779
Galaxy14,3169.27,2280.42,-0.356114,-0.209354
Galaxy15,1309.88,2714.96,0.232269,0.234743
Galaxy16,2631.80,3136.29,-0.207090,-0.082682
Galaxy17,3538.73,2950.79,0.257891,-0.408810
Galaxy18,898.44,3773.60,-0.052956,0.068842
Galaxy19,1735.38,1298.57,0.008670,-0.092742
Galaxy20,3815.90,787.05,0.044653,-0.061542
Galaxy21,1903.42,1425.92,0.041319,0.033258
Galaxy22,304.26,2222.35,-0.102577,0.046577
Galaxy23,2973.31,3706.32,0.118898,-0.363886
Galaxy24,3154.05,2476.34,-0.124962,0.101007
Galaxy25,2485.80,571.78,0.319595,-0.174118
Galaxy26,2454.41,902.33,-0.451422,0.246691
Galaxy27,1038.19,2803.97,-0.031115,-0.007877
Galaxy28,3369.74,3756.30,-0.211389,0.052030
Galaxy29,538.03,4104.96,-0.324151,0.074183
Galaxy30,4057.31,1612.28,-0.148082,-0.033925
Galaxy31,131.15,2581.50,-0.178927,-0.003022
Galaxy32,3731.19,439.63,-0.219534,-0.025139
Galaxy33,3682.13,702.04,0.149608,0.045519
Galaxy34,2946.34,3533.40,0.351043,-0.272521
Galaxy35,1741.57,2464.15,-0.060245,0.289763
Galaxy36,633.93,2791.94,0.114982,-0.198514
Galaxy37,2449.66,3284.05,0.383914,-0.151393
Galaxy38,944.03,2413.55,-0.203155,-0.347341
Galaxy39,2310.27,995.00,0.316762,0.027804
Galaxy40,2619.63,3401.98,-0.006987,-0.460332
Galaxy41,1288.64,3723.68,-0.317277,-0.347961
Galaxy42,2324.73,3774.97,0.155874,0.012490
Galaxy43,1622.96,2925.35,0.045638,0.212148
Galaxy44,193.46,1753.45,-0.552788,-0.632086
Galaxy45,1232.27,1913.23,-0.016999,0.060289
Galaxy46,4076.22,1982.15,-0.272282,0.009756
Galaxy47,353.14,769.76,-0.148592,-0.120341
Galaxy48,3968.62,1194.08,-0.154470,0.112902
Galaxy49,4081.64,1865.00,0.132368,-0.229922
Galaxy50,2535.76,2661.99,0.005798,0.276404
Galaxy51,2312.83,3977.58,0.234189,-0.230941
Galaxy52,1164.63,1333.25,-0.365790,0.178651
Galaxy53,3133.85,1685.67,-0.202946,-0.244908
Galaxy54,1919.95,1171.94,0.079278,0.008001
Galaxy55,2315.50,2593.17,-0.080887,-0.088233
Galaxy56,2244.27,1089.83,-0.136208,-0.019624
Galaxy57,301.51,3093.63,-0.160623,-0.150280
Galaxy58,535.11,2485.61,0.111642,0.097311
Galaxy59,867.58,1222.08,0.007323,-0.309207
Galaxy60,1138.74,3381.59,-0.251180,0.342723
Galaxy61,2126.90,1121.08,0.097636,0.330178
Galaxy62,2991.50,2976.39,0.230919,-0.040770
Galaxy63,3514.55,2078.93,-0.325253,0.081614
Galaxy64,4007.76,4101.64,-0.137831,0.105848
Galaxy65,4.49,2544.42,0.034838,0.028260
Galaxy66,1772.73,257.69,-0.123218,-0.298418
Galaxy67,1364.09,3172.93,-0.191862,0.097745
Galaxy68,2169.29,580.28,0.303666,0.042150
Galaxy69,4131.77,630.51,0.199909,0.109652
Galaxy70,4170.31,2716.85,-0.008183,-0.099331
Galaxy71,2640.49,569.68,-0.348409,0.183538
Galaxy72,3716.88,1365.07,-0.201969,-0.238771
Galaxy73,1395.25,3458.27,0.041099,0.023496
Galaxy74,1793.93,3967.69,-0.108679,0.063724
Galaxy75,2280.56,1458.31,-0.029195,0.069664
Galaxy76,2697.53,3071.40,0.009626,-0.040141
Galaxy77,2142.78,4146.81,0.075117,0.200251
Galaxy78,1923.92,1732.06,0.052865,0.063005
Galaxy79,4042.28,2722.70,-0.252187,0.354672
Galaxy80,2097.55,1664.72,-0.336123,0.122493
Galaxy81,934.08,2282.24,-0.246712,0.219008
Galaxy82,399.18,2837.34,-0.217388,0.205936
Galaxy83,3125.75,421.86,0.032763,0.190034
Galaxy84,220.10,3765.04,-0.082382,-0.033606
Galaxy85,547.05,2101.62,-0.358951,-0.286537
Galaxy86,1815.05,3122.83,-0.115266,0.238043
Galaxy87,1678.51,3357.64,0.088517,-0.207980
Galaxy88,3440.73,211.27,-0.094382,0.094311
Galaxy89,2099.00,1413.92,-0.064287,0.109021
Galaxy90,3082.22,2416.60,-0.201716,-0.044689
Galaxy91,2146.28,845.33,0.271365,0.111217
Galaxy92,3223.91,498.13,0.168520,0.280390
Galaxy93,1761.93,1287.23,0.127062,0.128694
Galaxy94,629.13,589.64,-0.239507,-0.534270
Galaxy95,2279.40,3265.62,0.044093,-0.186169
Galaxy96,728.06,1703.91,0.004703,-0.241551
Galaxy97,1872.55,136.23,-0.107158,-0.102323
Galaxy98,2503.19,1665.38,-0.114451,-0.094364
Galaxy99,2154.78,585.87,0.260106,-0.139629
Galaxy100,3748.89,4162.50,0.198587,0.034781
Galaxy101,3590.73,2438.85,-0.247939,-0.275520
Galaxy102,176.12,2173.34,-0.257909,0.312738
Galaxy103,3939.40,1474.27,0.005581,-0.009416
Galaxy104,3737.34,2895.19,-0.154078,-0.357159
Galaxy105,2298.19,2248.60,-0.233977,-0.163201
Galaxy106,3112.25,854.02,-0.027013,-0.221621
Galaxy107,1210.29,2284.73,-0.311310,0.464452
Galaxy108,910.10,1743.53,-0.318280,-0.272025
Galaxy109,1730.23,490.24,-0.293251,0.115096
Galaxy110,3129.83,126.51,-0.178681,0.200814
Galaxy111,2160.97,4193.89,0.067212,0.191949
Galaxy112,2053.80,1242.71,-0.164486,0.129459
Galaxy113,511.64,2814.74,0.131175,-0.383334
Galaxy114,3108.12,3266.36,-0.025213,-0.099023
Galaxy115,2357.19,686.80,-0.166918,0.041699
Galaxy116,636.85,2485.34,-0.036918,-0.077408
Galaxy117,3445.97,275.05,-0.161831,-0.106329
Galaxy118,1678.28,1503.68,0.024149,0.279301
Galaxy119,3370.86,2910.26,0.084545,-0.372343
Galaxy120,1913.92,555.18,0.233811,-0.487121
Galaxy121,521.38,3714.73,-0.077453,-0.059712
Galaxy122,3885.93,1515.20,-0.013405,0.229939
Galaxy123,1479.44,3700.19,0.094432,0.296886
Galaxy124,951.40,3744.86,0.016644,0.136131
Galaxy125,2167.08,2318.82,0.039374,-0.036441
Galaxy126,3110.37,2345.32,-0.110508,-0.223846
Galaxy127,4073.28,666.45,-0.086381,-0.424493
Galaxy128,1102.64,1684.05,0.177587,-0.062322
Galaxy129,3859.53,2371.81,-0.408712,0.091923
Galaxy130,2881.03,877.22,-0.023344,0.017616
Galaxy131,4114.23,1657.49,0.269004,0.110111
Galaxy132,1440.13,3373.58,0.039713,-0.065583
Galaxy133,2082.63,84.56,0.127212,0.384047
Galaxy134,3815.18,1894.13,-0.209909,0.198461
Galaxy135,3544.53,522.81,-0.178454,0.072028
Galaxy136,3935.80,3559.12,0.200868,0.165999
Galaxy137,3946.88,1747.97,0.172372,0.256278
Galaxy138,1408.44,3067.55,-0.107491,-0.033879
Galaxy139,1551.67,2258.39,-0.014004,-0.003291
Galaxy140,2428.65,3374.54,0.641262,-0.329552
Galaxy141,1829.26,220.22,-0.058269,0.147033
Galaxy142,2336.37,2489.81,0.562052,0.116972
Galaxy143,1492.64,2199.16,0.050315,0.155792
Galaxy144,955.96,56.50,0.021695,0.075164
Galaxy145,2351.59,4021.37,-0.311711,-0.009055
Galaxy146,2180.07,1414.57,0.110511,-0.290805
Galaxy147,3415.08,1576.12,-0.311640,0.165948
Galaxy148,191.22,2496.74,-0.438079,0.019591
Galaxy149,29.05,3996.45,-0.232876,-0.028089
Galaxy150,2424.25,1725.23,0.223160,-0.077514
Galaxy151,2754.76,4154.36,-0.210659,-0.127317
Galaxy152,1246.68,3745.67,-0.016133,-0.213501
Galaxy153,1332.24,984.95,0.177250,-0.205865
Galaxy154,2.31,192.24,-0.181158,-0.271889
Galaxy155,2431.23,1956.75,0.151060,-0.030334
Galaxy156,2569.64,742.85,-0.129148,-0.259578
Galaxy157,205.56,4072.22,-0.085167,0.145051
Galaxy158,3894.31,164.18,-0.534707,-0.413222
Galaxy159,927.27,1715.34,0.097449,0.490519
Galaxy160,4179.47,1311.59,-0.096960,0.230872
Galaxy161,3508.07,1152.17,-0.226351,0.008370
Galaxy162,1134.67,2039.20,-0.093258,-0.212725
Galaxy163,3380.59,763.38,-0.338963,-0.205638
Galaxy164,1873.81,307.02,0.056446,0.035325
Galaxy165,1173.01,3298.76,-0.198365,0.381909
Galaxy166,270.94,921.76,-0.396042,-0.010965
Galaxy167,10.13,1140.53,-0.065972,-0.012729
Galaxy168,265.68,2465.26,0.419542,0.270101
Galaxy169,1277.88,1022.28,-0.350993,-0.172384
Galaxy170,2826.01,755.61,0.019295,-0.421878
Galaxy171,604.07,2912.83,-0.093423,-0.090074
Galaxy172,4008.39,1281.46,-0.445845,0.030717
Galaxy173,2445.55,4053.97,-0.123788,-0.150330
Galaxy174,296.95,1064.42,-0.279048,-0.068202
Galaxy175,1260.48,3474.40,-0.318901,0.212721
Galaxy176,3682.36,3147.07,0.144508,-0.325125
Galaxy177,2841.23,3447.92,0.211923,-0.110215
Galaxy178,1163.85,2010.45,-0.191130,0.048026
Galaxy179,2198.02,3322.29,-0.155107,0.010089
Galaxy180,2627.07,2880.56,-0.063900,0.262354
Galaxy181,2949.43,1531.42,0.012538,0.084956
Galaxy182,1553.00,1142.92,-0.131165,0.007587
Galaxy183,558.41,715.15,0.269141,-0.584435
Galaxy184,581.41,3162.88,-0.027530,-0.243629
Galaxy185,3803.03,957.70,0.423198,0.366427
Galaxy186,2351.45,1009.51,-0.088990,0.311494
Galaxy187,4113.78,1363.07,-0.288632,-0.172335
Galaxy188,3294.81,1437.72,-0.147872,0.074310
Galaxy189,3760.63,3778.98,-0.019218,-0.112459
Galaxy190,2658.18,3100.39,0.282301,0.294400
Galaxy191,50.97,3590.92,0.052608,-0.234869
Galaxy192,1288.98,3723.73,0.495634,0.256540
Galaxy193,605.01,4001.23,-0.295140,-0.092504
Galaxy194,24.74,253.71,0.159929,-0.081912
Galaxy195,2331.76,2475.12,-0.368100,-0.072354
Galaxy196,3808.29,1607.22,-0.065967,-0.251601
Galaxy197,3018.08,1350.41,-0.411820,0.284676
Galaxy198,547.12,482.04,-0.129920,0.183215
Galaxy199,1129.38,1525.88,0.318596,0.123366
Galaxy200,1436.94,2620.05,0.085139,0.135932
Galaxy201,1880.48,128.42,-0.040301,0.193443
Galaxy202,3797.93,2881.32,-0.187218,0.189731
Galaxy203,1724.35,1548.70,0.083889,0.040073
Galaxy204,1496.92,1362.38,0.024062,-0.394316
Galaxy205,2456.69,3211.20,0.001714,-0.044114
Galaxy206,3301.16,1613.39,-0.134416,-0.023243
Galaxy207,2346.23,640.78,0.214003,0.160295
Galaxy208,3100.65,1926.61,0.415479,-0.658230
Galaxy209,2799.24,3872.26,0.813053,-0.503685
Galaxy210,1446.03,3457.01,0.337071,0.311731
Galaxy211,2723.66,1596.62,0.139993,0.077291
Galaxy212,2634.59,131.20,0.138093,0.230178
Galaxy213,1119.72,375.51,0.048022,-0.110450
Galaxy214,2216.53,2183.94,0.090914,-0.056247
Galaxy215,693.79,3956.04,-0.103265,0.211181
Galaxy216,3705.60,2421.59,0.161452,-0.090095
Galaxy217,2479.91,2012.39,-0.235455,-0.097192
Galaxy218,1846.12,434.53,0.307916,0.352324
Galaxy219,2109.01,2952.79,-0.110747,-0.463841
Galaxy220,1033.41,3406.41,0.079899,0.124434
Galaxy221,1864.46,3597.73,0.090806,-0.023436
Galaxy222,2384.52,2641.04,0.399293,-0.106140
Galaxy223,1580.20,3114.93,-0.239070,-0.244219
Galaxy224,1646.40,2747.04,-0.169143,0.006889
Galaxy225,1544.16,505.77,-0.045441,0.412138
Galaxy226,2756.59,1141.05,-0.033571,0.231441
Galaxy227,2531.56,3589.84,0.028190,0.081703
Galaxy228,2750.19,3475.05,-0.297004,-0.060373
Galaxy229,4037.42,1175.00,0.044598,-0.711180
Galaxy230,4122.73,2095.72,0.181403,-0.040634
Galaxy231,1119.89,167.28,0.000621,0.110509
Galaxy232,979.92,3754.83,-0.160121,-0.035260
Galaxy233,3145.99,2771.68,-0.189596,-0.335892
Galaxy234,679.04,3158.02,-0.252760,0.331586
Galaxy235,3186.88,1672.02,-0.078846,-0.166584
Galaxy236,2259.04,3685.71,0.532051,0.121974
Galaxy237,2974.55,3728.10,0.291329,-0.001613
Galaxy238,212.18,3431.10,0.016810,0.077563
Galaxy239,437.00,1418.14,-0.126924,-0.535834
Galaxy240,3161.78,124.05,-0.472914,-0.101127
Galaxy241,2588.05,561.52,-0.009871,-0.116918
Galaxy242,597.22,1703.78,-0.062377,0.221781
Galaxy243,3690.74,831.76,0.033546,0.023477
Galaxy244,324.39,1776.36,-0.298629,-0.051242
Galaxy245,3556.96,2926.94,-0.201581,0.089837
Galaxy246,1344.74,3793.67,-0.069183,0.093275
Galaxy247,12.68,2876.17,-0.147985,0.071466
Galaxy248,2739.59,62.65,-0.097497,-0.144430
Galaxy249,1115.73,110.70,0.304836,-0.272494
Galaxy250,2600.22,1050.90,0.230876,0.036845
Galaxy251,3112.03,1215.69,0.042393,0.620545
Galaxy252,1559.13,2298.06,-0.119256,0.257393
Galaxy253,1383.60,3953.20,0.007773,-0.124374
Galaxy254,2760.41,3842.93,0.159699,0.125682
Galaxy255,2091.13,2995.63,0.080428,-0.054189
Galaxy256,346.01,3320.37,-0.003092,-0.044029
Galaxy257,2012.50,1202.41,0.394787,-0.259249
Galaxy258,1314.04,3279.30,-0.302229,-0.083209
Galaxy259,2377.01,2115.58,0.323274,-0.180006
Galaxy260,2397.35,1515.28,0.279939,0.126714
Galaxy261,3434.55,2144.22,-0.664558,-0.009333
Galaxy262,3267.86,794.06,-0.002416,-0.277428
Galaxy263,3492.11,3036.43,0.435116,-0.416591
Galaxy264,3071.64,2212.44,0.141747,-0.016150
Galaxy265,2723.64,3930.86,0.007556,-0.267823
Galaxy266,1416.23,2479.63,0.056909,-0.056624
Galaxy267,1710.62,989.85,-0.238892,0.026246
Galaxy268,1259.47,17.35,0.211848,-0.209938
Galaxy269,2355.02,6.65,-0.104097,0.484301
Galaxy270,2169.03,1448.20,-0.046166,0.125369
Galaxy271,757.15,4104.49,0.259590,0.177792
Galaxy272,1751.03,2812.13,0.230803,0.010871
Galaxy273,1161.95,1176.33,-0.095540,-0.344758
Galaxy274,4193.24,2288.38,-0.197127,0.462133
Galaxy275,970.28,3655.70,-0.194578,-0.416513
Galaxy276,3909.54,4156.48,0.138518,0.020355
Galaxy277,2729.48,3103.50,-0.170770,0.298241
Galaxy278,3866.17,249.54,0.342497,-0.028909
Galaxy279,266.96,1516.78,-0.434444,-0.306302
Galaxy280,2938.44,2858.26,0.058671,-0.082085
Galaxy281,499.92,1416.87,-0.492881,0.024240
Galaxy282,2865.14,1661.28,0.025484,0.369403
Galaxy283,221.91,2647.58,-0.015994,0.193756
Galaxy284,1192.19,3511.17,0.357416,-0.415503
Galaxy285,2200.81,3399.45,-0.268505,-0.378289
Galaxy286,739.29,2944.38,0.212086,-0.108861
Galaxy287,314.39,2950.96,0.095206,-0.312251
Galaxy288,2846.08,113.81,-0.008086,0.193368
Galaxy289,43.80,2202.33,0.013855,-0.076077
Galaxy290,233.03,257.23,-0.258223,-0.220214
Galaxy291,1085.93,563.65,0.065787,0.037034
Galaxy292,770.22,3637.22,-0.269625,-0.125439
Galaxy293,3402.97,2334.54,-0.042047,-0.426551
Galaxy294,1860.10,74.93,0.077161,0.030012
Galaxy295,3054.23,1269.71,-0.688973,0.007310
Galaxy296,901.16,580.13,-0.219952,0.026699
Galaxy297,3929.92,2908.41,0.238646,0.087549
Galaxy298,3865.03,2040.70,0.156524,-0.053937
Galaxy299,1270.88,2424.23,-0.165829,0.254559
Galaxy300,3556.68,1147.77,-0.358621,-0.340435
Galaxy301,502.07,558.27,-0.015850,0.010698
Galaxy302,1819.87,3091.05,-0.112057,0.202852
Galaxy303,2002.93,2003.18,-0.237997,-0.222284
Galaxy304,974.29,3511.06,-0.343015,-0.197145
Galaxy305,1298.54,2396.75,0.009324,-0.342038
Galaxy306,3042.53,42.07,0.288980,-0.093380
Galaxy307,3937.34,3686.58,0.286592,-0.082213
Galaxy308,739.93,1142.67,-0.200317,0.184900
Galaxy309,2862.90,3455.73,0.154121,-0.145287
Galaxy310,2573.37,1860.06,-0.200668,0.214933
Galaxy311,612.40,3211.86,-0.079714,0.194297
Galaxy312,1057.66,353.58,0.391820,0.040944
Galaxy313,43.94,2382.21,0.163150,0.164711
Galaxy314,3991.46,4076.04,-0.131942,0.211337
Galaxy315,3142.38,2732.73,-0.131191,-0.157332
Galaxy316,3550.91,2530.78,0.109406,-0.023543
Galaxy317,3705.09,1171.49,0.482366,-0.201382
Galaxy318,2789.45,1233.83,-0.097426,-0.060746
Galaxy319,29.73,3512.41,-0.020397,-0.523026
Galaxy320,1326.14,3208.33,0.077215,-0.172563
Galaxy321,1333.82,2480.28,-0.140550,-0.021961
Galaxy322,1117.65,329.47,0.456523,-0.341486
Galaxy323,2873.74,2459.89,0.030621,0.110721
Galaxy324,2817.49,3297.33,-0.145378,-0.474355
Galaxy325,2963.02,952.99,0.122638,0.118214
Galaxy326,3178.47,615.72,-0.028153,0.444796
Galaxy327,1750.72,3583.19,0.349446,0.297453
Galaxy328,2588.28,1948.64,0.019005,-0.297862
Galaxy329,2420.62,492.72,0.196484,0.109789
Galaxy330,1129.77,1613.35,0.113472,-0.340026
Galaxy331,2761.01,31.40,-0.179020,0.319125
Galaxy332,1917.87,1510.58,0.381777,0.034593
Galaxy333,2672.03,1462.56,-0.097115,0.055916
Galaxy334,666.27,966.24,-0.301474,0.016896
Galaxy335,2336.22,1942.98,0.444533,-0.092710
Galaxy336,3083.64,2940.52,0.311543,-0.380833
Galaxy337,2448.23,1965.66,0.160773,-0.315800
Galaxy338,2812.89,3283.05,-0.059240,-0.189625
Galaxy339,212.44,754.10,0.048483,-0.320201
Galaxy340,1795.67,652.09,0.326751,-0.245001
Galaxy341,3791.74,1997.78,-0.239311,-0.440599
Galaxy342,2392.40,1426.88,0.003977,0.267332
Galaxy343,3255.17,3708.86,0.264238,0.448571
Galaxy344,1377.71,855.21,0.317746,-0.352774
Galaxy345,2275.78,2275.96,0.110986,-0.253427
Galaxy346,1295.38,3781.20,0.071621,0.021905
Galaxy347,362.50,1797.87,-0.135765,-0.136336
Galaxy348,1347.51,3153.01,-0.040365,0.252013
Galaxy349,1616.84,1565.67,-0.146830,-0.281799
Galaxy350,301.76,2700.23,-0.169255,0.187218
Galaxy351,479.86,217.03,0.495211,0.064118
Galaxy352,3689.99,2592.20,0.225392,-0.443383
Galaxy353,3282.12,3694.70,-0.058937,-0.079410
Galaxy354,2183.39,3898.47,0.010125,-0.038754
Galaxy355,3534.07,1652.80,-0.196773,-0.060276
Galaxy356,3697.12,240.12,-0.321729,0.315078
Galaxy357,3898.01,682.72,-0.039588,0.174457
Galaxy358,1943.03,907.71,0.009403,-0.084587
Galaxy359,1750.06,2343.22,0.428815,0.229705
Galaxy360,2081.94,18.18,-0.145107,0.262890
Galaxy361,4083.02,2374.66,0.006014,-0.116914
Galaxy362,2222.68,1807.81,0.190048,-0.091405
Galaxy363,720.23,444.56,0.283156,0.096608
Galaxy364,3420.76,24.51,-0.128386,-0.002801
Galaxy365,2719.35,102.77,0.088612,-0.201816
Galaxy366,2989.81,3976.38,-0.016196,0.033161
Galaxy367,864.83,4128.60,0.102792,0.083464
Galaxy368,920.46,1773.20,-0.340299,0.077179
Galaxy369,2514.85,995.53,0.500859,-0.153634
Galaxy370,610.34,124.53,-0.377861,-0.143498
Galaxy371,3749.72,3094.14,0.035162,-0.157226
Galaxy372,2681.20,64.36,-0.233146,-0.032600
Galaxy373,4020.50,196.63,-0.168308,0.181999
Galaxy374,2899.62,3406.31,0.195421,-0.323165
Galaxy375,2101.46,3072.99,0.125256,-0.176113
Galaxy376,3163.51,749.74,-0.018431,0.132363
Galaxy377,2939.03,4097.12,0.219770,-0.216275
Galaxy378,1819.91,3448.24,0.204944,-0.072168
Galaxy379,429.17,1350.02,0.101535,-0.275541
Galaxy380,3958.95,2156.85,-0.531382,-0.113424
Galaxy381,4151.10,2054.34,0.109734,-0.307606
Galaxy382,508.61,2193.96,-0.018371,-0.175022
Galaxy383,2345.99,3505.18,-0.113595,-0.205479
Galaxy384,2765.08,1557.26,0.089657,0.007098
Galaxy385,2523.28,3847.24,0.046409,-0.143164
Galaxy386,3990.34,2756.18,-0.175430,-0.322217
Galaxy387,1607.12,4100.79,0.147004,0.293534
Galaxy388,1806.12,1190.14,-0.145969,0.032346
Galaxy389,327.59,3945.56,-0.092554,-0.160759
Galaxy390,1186.96,548.14,-0.110571,-0.207841
Galaxy391,2364.60,2169.57,-0.096526,-0.291370
Galaxy392,1789.59,282.08,-0.070296,-0.216183
Galaxy393,3107.12,1294.55,-0.205868,-0.310851
Galaxy394,3248.03,2594.48,-0.119165,-0.541809
Galaxy395,1578.61,1268.10,-0.019145,0.022483
Galaxy396,3795.66,3741.42,0.009073,0.136277
Galaxy397,2693.14,3868.62,0.036224,0.110120
Galaxy398,2069.20,1782.16,-0.468219,0.151275
Galaxy399,2037.98,2194.72,0.308770,0.243165
Galaxy400,1567.90,2835.21,0.409053,0.187680
Galaxy401,684.76,1957.54,-0.165222,0.108983
Galaxy402,3363.59,3547.04,0.043751,0.026555
| CSV | 2 | jColeChanged/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers | Chapter5_LossFunctions/data/Train_Skies/Train_Skies/Training_Sky253.csv | [
"MIT"
] |
NB. Test Pool Layer.
coclass 'TestPoolLayer'
coinsert 'TestBase'
create=: 3 : 0
''
)
test1=: 3 : 0
p1 =: 2 conew 'PoolLayer'
a=: 3 3 8 8 $ 1 NB. batchsize x depth x width x height
out=: forward__p1 a
3 3 4 4&= assertTrue ($out)
3 3 8 8&= assertTrue ($backward__p1 out)
destroy__p1 ''
)
test2=: 3 : 0
p1 =: 5 conew 'PoolLayer'
a=: 3 3 20 20 $ 1 NB. batchsize x depth x width x height
out=: forward__p1 a
3 3 4 4&= assertTrue ($out)
3 3 20 20&= assertTrue ($backward__p1 out)
destroy__p1 ''
)
test3=: 3 : 0
p1 =: 8 conew 'PoolLayer'
a=: 2 20 16 16 $ 1 NB. batchsize x depth x width x height
out=: forward__p1 a
2 20 2 2&= assertTrue ($out)
2 20 16 16&= assertTrue ($backward__p1 out)
destroy__p1 ''
)
run=: 3 : 0
test1 testWrapper 'PoolLayer Test 1'
test2 testWrapper 'PoolLayer Test 2'
test3 testWrapper 'PoolLayer Test 3'
''
)
destroy=: 3 : 0
codestroy ''
)
tpool=: '' conew 'TestPoolLayer'
run__tpool 0 | J | 3 | jonghough/jlearn | test/testpoollayer.ijs | [
"MIT"
] |
import React from 'react'
import {shell} from 'electron'
import {RetinaImg} from 'nylas-component-kit'
import SalesforceEnv from '../salesforce-env'
export default function OpenInSalesforceBtn({objectId, size = "small"}) {
const openLink = (event) => {
event.stopPropagation()
event.preventDefault()
shell.openExternal(`${SalesforceEnv.instanceUrl()}/${objectId}`)
}
return (
<div
className={`open-in-salesforce-btn action-icon ${size}`}
onClick={openLink}
title="Open in Salesforce.com"
>
<RetinaImg
mode={RetinaImg.Mode.ContentPreserve}
url={`nylas://nylas-private-salesforce/static/images/ic-salesforce-cloud-btn-${size}@2x.png`}
/>
</div>
)
}
OpenInSalesforceBtn.propTypes = {
objectId: React.PropTypes.string,
size: React.PropTypes.string,
}
| JSX | 4 | cnheider/nylas-mail | packages/client-app/internal_packages/nylas-private-salesforce/lib/shared-components/open-in-salesforce-btn.jsx | [
"MIT"
] |
# Check that we recognize the console pool as built-in.
#
# RUN: %{llbuild} ninja load-manifest %s > %t
# RUN: %{FileCheck} < %t %s
rule TRUE
command = true
pool = console
# CHECK: build "output": TRUE
# CHECK: command = "true"
# CHECK: pool = console
build output: TRUE
| Ninja | 4 | uraimo/swift-llbuild | tests/Ninja/Loader/console-pool.ninja | [
"Apache-2.0"
] |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.spark.network.shuffle.protocol;
import com.google.common.base.Objects;
import io.netty.buffer.ByteBuf;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.spark.network.protocol.Encoders;
/**
* Base class for fetch shuffle blocks and chunks.
*
* @since 3.2.0
*/
public abstract class AbstractFetchShuffleBlocks extends BlockTransferMessage {
public final String appId;
public final String execId;
public final int shuffleId;
protected AbstractFetchShuffleBlocks(
String appId,
String execId,
int shuffleId) {
this.appId = appId;
this.execId = execId;
this.shuffleId = shuffleId;
}
public ToStringBuilder toStringHelper() {
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
.append("appId", appId)
.append("execId", execId)
.append("shuffleId", shuffleId);
}
/**
* Returns number of blocks in the request.
*/
public abstract int getNumBlocks();
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AbstractFetchShuffleBlocks that = (AbstractFetchShuffleBlocks) o;
return shuffleId == that.shuffleId
&& Objects.equal(appId, that.appId) && Objects.equal(execId, that.execId);
}
@Override
public int hashCode() {
int result = appId.hashCode();
result = 31 * result + execId.hashCode();
result = 31 * result + shuffleId;
return result;
}
@Override
public int encodedLength() {
return Encoders.Strings.encodedLength(appId)
+ Encoders.Strings.encodedLength(execId)
+ 4; /* encoded length of shuffleId */
}
@Override
public void encode(ByteBuf buf) {
Encoders.Strings.encode(buf, appId);
Encoders.Strings.encode(buf, execId);
buf.writeInt(shuffleId);
}
}
| Java | 4 | akhalymon-cv/spark | common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/protocol/AbstractFetchShuffleBlocks.java | [
"Apache-2.0"
] |
% This MATLAB file generates figure 1 in the paper by
% Izhikevich E.M. (2004)
% Which Model to Use For Cortical Spiking Neurons?
% use MATLAB R13 or later. November 2003. San Diego, CA
%%%%%%%%%%%%%%% (A) tonic spiking %%%%%%%%%%%%%%%%%%%%%%
subplot(5,4,1)
a=0.02; b=0.2; c=-65; d=6;
V=-70; u=b*V;
VV=[]; uu=[];
tau = 0.25; tspan = 0:tau:100;
T1=tspan(end)/10;
for t=tspan
if (t>T1)
I=14;
else
I=0;
end;
V = V + tau*(0.04*V^2+5*V+140-u+I);
u = u + tau*a*(b*V-u);
if V > 30
VV(end+1)=30;
V = c;
u = u + d;
else
VV(end+1)=V;
end;
uu(end+1)=u;
end;
plot(tspan,VV,[0 T1 T1 max(tspan)],-90+[0 0 10 10]);
axis([0 max(tspan) -90 30])
axis off;
title('(A) tonic spiking');
%%%%%%%%%%%%%%%%%% (B) phasic spiking %%%%%%%%%%%%%%%%%%%%%%%%%
subplot(5,4,2)%
a=0.02; b=0.25; c=-65; d=6;
V=-64; u=b*V;
VV=[]; uu=[];
tau = 0.25;tspan = 0:tau:200;
T1=20;
for t=tspan
if (t>T1)
I=0.5;
else
I=0;
end;
V = V + tau*(0.04*V^2+5*V+140-u+I);
u = u + tau*a*(b*V-u);
if V > 30
VV(end+1)=30;
V = c;
u = u + d;
else
VV(end+1)=V;
end;
uu(end+1)=u;
end;
plot(tspan,VV,[0 T1 T1 max(tspan)],-90+[0 0 10 10]);
axis([0 max(tspan) -90 30])
axis off;
title('(B) phasic spiking');
%%%%%%%%%%%%%% (C) tonic bursting %%%%%%%%%%%%%%%%%%%%%%%%%%%%
subplot(5,4,3)
a=0.02; b=0.2; c=-50; d=2;
V=-70; u=b*V;
VV=[]; uu=[];
tau = 0.25; tspan = 0:tau:220;
T1=22;
for t=tspan
if (t>T1)
I=15;
else
I=0;
end;
V = V + tau*(0.04*V^2+5*V+140-u+I);
u = u + tau*a*(b*V-u);
if V > 30
VV(end+1)=30;
V = c;
u = u + d;
else
VV(end+1)=V;
end;
uu(end+1)=u;
end;
plot(tspan,VV,[0 T1 T1 max(tspan)],-90+[0 0 10 10]);
axis([0 max(tspan) -90 30])
axis off;
title('(C) tonic bursting');
%%%%%%%%%%%%%%% (D) phasic bursting %%%%%%%%%%%%%%%%%%%%%%%%%%
subplot(5,4,4)
a=0.02; b=0.25; c=-55; d=0.05;
V=-64; u=b*V;
VV=[]; uu=[];
tau = 0.2; tspan = 0:tau:200;
T1=20;
for t=tspan
if (t>T1)
I=0.6;
else
I=0;
end;
V = V + tau*(0.04*V^2+5*V+140-u+I);
u = u + tau*a*(b*V-u);
if V > 30
VV(end+1)=30;
V = c;
u = u + d;
else
VV(end+1)=V;
end;
uu(end+1)=u;
end;
plot(tspan,VV,[0 T1 T1 max(tspan)],-90+[0 0 10 10]);
axis([0 max(tspan) -90 30])
axis off;
title('(D) phasic bursting');
%%%%%%%%%%%%%%% (E) mixed mode %%%%%%%%%%%%%%%%%%%%%%%%%
subplot(5,4,5)
a=0.02; b=0.2; c=-55; d=4;
V=-70; u=b*V;
VV=[]; uu=[];
tau = 0.25; tspan = 0:tau:160;
T1=tspan(end)/10;
for t=tspan
if (t>T1)
I=10;
else
I=0;
end;
V = V + tau*(0.04*V^2+5*V+140-u+I);
u = u + tau*a*(b*V-u);
if V > 30
VV(end+1)=30;
V = c;
u = u + d;
else
VV(end+1)=V;
end;
uu(end+1)=u;
end;
plot(tspan,VV,[0 T1 T1 max(tspan)],-90+[0 0 10 10]);
axis([0 max(tspan) -90 30])
axis off;
title('(E) mixed mode');
%%%%%%%%%%%%%%%% (F) spike freq. adapt %%%%%%%%%%%%%%%%%%%%%%%%
subplot(5,4,6)
a=0.01; b=0.2; c=-65; d=8;
V=-70; u=b*V;
VV=[]; uu=[];
tau = 0.25; tspan = 0:tau:85;
T1=tspan(end)/10;
for t=tspan
if (t>T1)
I=30;
else
I=0;
end;
V = V + tau*(0.04*V^2+5*V+140-u+I);
u = u + tau*a*(b*V-u);
if V > 30
VV(end+1)=30;
V = c;
u = u + d;
else
VV(end+1)=V;
end;
uu(end+1)=u;
end;
plot(tspan,VV,[0 T1 T1 max(tspan)],-90+[0 0 10 10]);
axis([0 max(tspan) -90 30])
axis off;
title('(F) spike freq. adapt');
%%%%%%%%%%%%%%%%% (G) Class 1 exc. %%%%%%%%%%%%%%%%%%%%%%%%%%
subplot(5,4,7)
a=0.02; b=-0.1; c=-55; d=6;
V=-60; u=b*V;
VV=[]; uu=[];
tau = 0.25; tspan = 0:tau:300;
T1=30;
for t=tspan
if (t>T1)
I=(0.075*(t-T1));
else
I=0;
end;
V = V + tau*(0.04*V^2+4.1*V+108-u+I);
u = u + tau*a*(b*V-u);
if V > 30
VV(end+1)=30;
V = c;
u = u + d;
else
VV(end+1)=V;
end;
uu(end+1)=u;
end;
plot(tspan,VV,[0 T1 max(tspan) max(tspan)],-90+[0 0 20 0]);
axis([0 max(tspan) -90 30])
axis off;
title('(G) Class 1 excitable');
%%%%%%%%%%%%%%%%%% (H) Class 2 exc. %%%%%%%%%%%%%%%%%%%%%%%%%%
subplot(5,4,8)
a=0.2; b=0.26; c=-65; d=0;
V=-64; u=b*V;
VV=[]; uu=[];
tau = 0.25; tspan = 0:tau:300;
T1=30;
for t=tspan
if (t>T1)
I=-0.5+(0.015*(t-T1));
else
I=-0.5;
end;
V = V + tau*(0.04*V^2+5*V+140-u+I);
u = u + tau*a*(b*V-u);
if V > 30
VV(end+1)=30;
V = c;
u = u + d;
else
VV(end+1)=V;
end;
uu(end+1)=u;
end;
plot(tspan,VV,[0 T1 max(tspan) max(tspan)],-90+[0 0 20 0]);
axis([0 max(tspan) -90 30])
axis off;
title('(H) Class 2 excitable');
%%%%%%%%%%%%%%%%% (I) spike latency %%%%%%%%%%%%%%%%%%%%%%%%%%%%
subplot(5,4,9)
a=0.02; b=0.2; c=-65; d=6;
V=-70; u=b*V;
VV=[]; uu=[];
tau = 0.2; tspan = 0:tau:100;
T1=tspan(end)/10;
for t=tspan
if t>T1 & t < T1+3
I=7.04;
else
I=0;
end;
V = V + tau*(0.04*V^2+5*V+140-u+I);
u = u + tau*a*(b*V-u);
if V > 30
VV(end+1)=30;
V = c;
u = u + d;
else
VV(end+1)=V;
end;
uu(end+1)=u;
end;
plot(tspan,VV,[0 T1 T1 T1+3 T1+3 max(tspan)],-90+[0 0 10 10 0 0]);
axis([0 max(tspan) -90 30])
axis off;
title('(I) spike latency');
%%%%%%%%%%%%%%%%% (J) subthresh. osc. %%%%%%%%%%%%%%%%%%%%%%%%%%%
subplot(5,4,10)
a=0.05; b=0.26; c=-60; d=0;
V=-62; u=b*V;
VV=[]; uu=[];
tau = 0.25; tspan = 0:tau:200;
T1=tspan(end)/10;
for t=tspan
if (t>T1) & (t < T1+5)
I=2;
else
I=0;
end;
V = V + tau*(0.04*V^2+5*V+140-u+I);
u = u + tau*a*(b*V-u);
if V > 30
VV(end+1)=30;
V = c;
u = u + d;
else
VV(end+1)=V;
end;
uu(end+1)=u;
end;
plot(tspan,VV,[0 T1 T1 (T1+5) (T1+5) max(tspan)],-90+[0 0 10 10 0 0],...
tspan(220:end),-10+20*(VV(220:end)-mean(VV)));
axis([0 max(tspan) -90 30])
axis off;
title('(J) subthreshold osc.');
%%%%%%%%%%%%%%%%%% (K) resonator %%%%%%%%%%%%%%%%%%%%%%%%
subplot(5,4,11)
a=0.1; b=0.26; c=-60; d=-1;
V=-62; u=b*V;
VV=[]; uu=[];
tau = 0.25; tspan = 0:tau:400;
T1=tspan(end)/10;
T2=T1+20;
T3 = 0.7*tspan(end);
T4 = T3+40;
for t=tspan
if ((t>T1) & (t < T1+4)) | ((t>T2) & (t < T2+4)) | ((t>T3) & (t < T3+4)) | ((t>T4) & (t < T4+4))
I=0.65;
else
I=0;
end;
V = V + tau*(0.04*V^2+5*V+140-u+I);
u = u + tau*a*(b*V-u);
if V > 30
VV(end+1)=30;
V = c;
u = u + d;
else
VV(end+1)=V;
end;
uu(end+1)=u;
end;
plot(tspan,VV,[0 T1 T1 (T1+8) (T1+8) T2 T2 (T2+8) (T2+8) T3 T3 (T3+8) (T3+8) T4 T4 (T4+8) (T4+8) max(tspan)],-90+[0 0 10 10 0 0 10 10 0 0 10 10 0 0 10 10 0 0]);
axis([0 max(tspan) -90 30])
axis off;
title('(K) resonator');
%%%%%%%%%%%%%%%% (L) integrator %%%%%%%%%%%%%%%%%%%%%%%%
subplot(5,4,12)
a=0.02; b=-0.1; c=-55; d=6;
V=-60; u=b*V;
VV=[]; uu=[];
tau = 0.25; tspan = 0:tau:100;
T1=tspan(end)/11;
T2=T1+5;
T3 = 0.7*tspan(end);
T4 = T3+10;
for t=tspan
if ((t>T1) & (t < T1+2)) | ((t>T2) & (t < T2+2)) | ((t>T3) & (t < T3+2)) | ((t>T4) & (t < T4+2))
I=9;
else
I=0;
end;
V = V + tau*(0.04*V^2+4.1*V+108-u+I);
u = u + tau*a*(b*V-u);
if V > 30
VV(end+1)=30;
V = c;
u = u + d;
else
VV(end+1)=V;
end;
uu(end+1)=u;
end;
plot(tspan,VV,[0 T1 T1 (T1+2) (T1+2) T2 T2 (T2+2) (T2+2) T3 T3 (T3+2) (T3+2) T4 T4 (T4+2) (T4+2) max(tspan)],-90+[0 0 10 10 0 0 10 10 0 0 10 10 0 0 10 10 0 0]);
axis([0 max(tspan) -90 30])
axis off;
title('(L) integrator');
%%%%%%%%%%%%%%%%% (M) rebound spike %%%%%%%%%%%%%%%%%%%%%%%%%%%%
subplot(5,4,13)
a=0.03; b=0.25; c=-60; d=4;
V=-64; u=b*V;
VV=[]; uu=[];
tau = 0.2; tspan = 0:tau:200;
T1=20;
for t=tspan
if (t>T1) & (t < T1+5)
I=-15;
else
I=0;
end;
V = V + tau*(0.04*V^2+5*V+140-u+I);
u = u + tau*a*(b*V-u);
if V > 30
VV(end+1)=30;
V = c;
u = u + d;
else
VV(end+1)=V;
end;
uu(end+1)=u;
end;
plot(tspan,VV,[0 T1 T1 (T1+5) (T1+5) max(tspan)],-85+[0 0 -5 -5 0 0]);
axis([0 max(tspan) -90 30])
axis off;
title('(M) rebound spike');
%%%%%%%%%%%%%%%%% (N) rebound burst %%%%%%%%%%%%%%%%%%%%%%%%%%%%
subplot(5,4,14)
a=0.03; b=0.25; c=-52; d=0;
V=-64; u=b*V;
VV=[]; uu=[];
tau = 0.2; tspan = 0:tau:200;
T1=20;
for t=tspan
if (t>T1) & (t < T1+5)
I=-15;
else
I=0;
end;
V = V + tau*(0.04*V^2+5*V+140-u+I);
u = u + tau*a*(b*V-u);
if V > 30
VV(end+1)=30;
V = c;
u = u + d;
else
VV(end+1)=V;
end;
uu(end+1)=u;
end;
plot(tspan,VV,[0 T1 T1 (T1+5) (T1+5) max(tspan)],-85+[0 0 -5 -5 0 0]);
axis([0 max(tspan) -90 30])
axis off;
title('(N) rebound burst');
%%%%%%%%%%%%%%%%% (O) thresh. variability %%%%%%%%%%%%%%%%%%%%%%%%%%
subplot(5,4,15)
a=0.03; b=0.25; c=-60; d=4;
V=-64; u=b*V;
VV=[]; uu=[];
tau = 0.25; tspan = 0:tau:100;
for t=tspan
if ((t>10) & (t < 15)) | ((t>80) & (t < 85))
I=1;
elseif (t>70) & (t < 75)
I=-6;
else
I=0;
end;
V = V + tau*(0.04*V^2+5*V+140-u+I);
u = u + tau*a*(b*V-u);
if V > 30
VV(end+1)=30;
V = c;
u = u + d;
else
VV(end+1)=V;
end;
uu(end+1)=u;
end;
plot(tspan,VV,[0 10 10 15 15 70 70 75 75 80 80 85 85 max(tspan)],...
-85+[0 0 5 5 0 0 -5 -5 0 0 5 5 0 0]);
axis([0 max(tspan) -90 30])
axis off;
title('(O) thresh. variability');
%%%%%%%%%%%%%% (P) bistability %%%%%%%%%%%%%%%%%%%%%%%%%%
subplot(5,4,16)
a=0.1; b=0.26; c=-60; d=0;
V=-61; u=b*V;
VV=[]; uu=[];
tau = 0.25; tspan = 0:tau:300;
T1=tspan(end)/8;
T2 = 216;
for t=tspan
if ((t>T1) & (t < T1+5)) | ((t>T2) & (t < T2+5))
I=1.24;
else
I=0.24;
end;
V = V + tau*(0.04*V^2+5*V+140-u+I);
u = u + tau*a*(b*V-u);
if V > 30
VV(end+1)=30;
V = c;
u = u + d;
else
VV(end+1)=V;
end;
uu(end+1)=u;
end;
plot(tspan,VV,[0 T1 T1 (T1+5) (T1+5) T2 T2 (T2+5) (T2+5) max(tspan)],-90+[0 0 10 10 0 0 10 10 0 0]);
axis([0 max(tspan) -90 30])
axis off;
title('(P) bistability');
%%%%%%%%%%%%%% (Q) DAP %%%%%%%%%%%%%%%%%%%%%%%%%%
subplot(5,4,17)
a=1; b=0.2; c=-60; d=-21;
V=-70; u=b*V;
VV=[]; uu=[];
tau = 0.1; tspan = 0:tau:50;
T1 = 10;
for t=tspan
if abs(t-T1)<1
I=20;
else
I=0;
end;
V = V + tau*(0.04*V^2+5*V+140-u+I);
u = u + tau*a*(b*V-u);
if V > 30
VV(end+1)=30;
V = c;
u = u + d;
else
VV(end+1)=V;
end;
uu(end+1)=u;
end;
plot(tspan,VV,[0 T1-1 T1-1 T1+1 T1+1 max(tspan)],-90+[0 0 10 10 0 0]);
axis([0 max(tspan) -90 30])
axis off;
title('(Q) DAP ');
%%%%%%%%%%%%%% (R) accomodation %%%%%%%%%%%%%%%%%%%%%%%%%%
subplot(5,4,18)
a=0.02; b=1; c=-55; d=4;
V=-65; u=-16;
VV=[]; uu=[]; II=[];
tau = 0.5; tspan = 0:tau:400;
for t=tspan
if (t < 200)
I=t/25;
elseif t < 300
I=0;
elseif t < 312.5
I=(t-300)/12.5*4;
else
I=0;
end;
V = V + tau*(0.04*V^2+5*V+140-u+I);
u = u + tau*a*(b*(V+65));
if V > 30
VV(end+1)=30;
V = c;
u = u + d;
else
VV(end+1)=V;
end;
uu(end+1)=u;
II(end+1)=I;
end;
plot(tspan,VV,tspan,II*1.5-90);
axis([0 max(tspan) -90 30])
axis off;
title('(R) accomodation');
%%%%%%%%%%%%%% (S) inhibition induced spiking %%%%%%%%%%%%%%%%%%%%%%%%%%
subplot(5,4,19)
a=-0.02; b=-1; c=-60; d=8;
V=-63.8; u=b*V;
VV=[]; uu=[];
tau = 0.5; tspan = 0:tau:350;
for t=tspan
if (t < 50) | (t>250)
I=80;
else
I=75;
end;
V = V + tau*(0.04*V^2+5*V+140-u+I);
u = u + tau*a*(b*V-u);
if V > 30
VV(end+1)=30;
V = c;
u = u + d;
else
VV(end+1)=V;
end;
uu(end+1)=u;
end;
plot(tspan,VV,[0 50 50 250 250 max(tspan)],-80+[0 0 -10 -10 0 0]);
axis([0 max(tspan) -90 30])
axis off;
title('(S) inh. induced sp.');
%%%%%%%%%%%%%% (T) inhibition induced bursting %%%%%%%%%%%%%%%%%%%%%%%%%%
subplot(5,4,20)
a=-0.026; b=-1; c=-45; d=-2;
V=-63.8; u=b*V;
VV=[]; uu=[];
tau = 0.5; tspan = 0:tau:350;
for t=tspan
if (t < 50) | (t>250)
I=80;
else
I=75;
end;
V = V + tau*(0.04*V^2+5*V+140-u+I);
u = u + tau*a*(b*V-u);
if V > 30
VV(end+1)=30;
V = c;
u = u + d;
else
VV(end+1)=V;
end;
uu(end+1)=u;
end;
plot(tspan,VV,[0 50 50 250 250 max(tspan)],-80+[0 0 -10 -10 0 0]);
axis([0 max(tspan) -90 30])
axis off;
title('(T) inh. induced brst.');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
set(gcf,'Units','normalized','Position',[0.3 0.1 0.6 0.8]);
| Matlab | 5 | nmsutton/MemoryModule | python_version/examples/izhikevich.matlab | [
"MIT"
] |
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {browser, by, element} from 'protractor';
import {verifyNoBrowserErrors} from '../../../../../test-utils';
function loadPage() {
browser.rootEl = 'example-app';
browser.get('/');
}
describe('upgrade/static (full)', () => {
beforeEach(loadPage);
afterEach(verifyNoBrowserErrors);
it('should render the `ng2-heroes` component', () => {
expect(element(by.css('h1')).getText()).toEqual('Heroes');
expect(element.all(by.css('p')).get(0).getText()).toEqual('There are 3 heroes.');
});
it('should render 3 ng1-hero components', () => {
const heroComponents = element.all(by.css('ng1-hero'));
expect(heroComponents.count()).toEqual(3);
});
it('should add a new hero when the "Add Hero" button is pressed', () => {
const addHeroButton = element.all(by.css('button')).last();
expect(addHeroButton.getText()).toEqual('Add Hero');
addHeroButton.click();
const heroComponents = element.all(by.css('ng1-hero'));
expect(heroComponents.last().element(by.css('h2')).getText()).toEqual('Kamala Khan');
});
it('should remove a hero when the "Remove" button is pressed', () => {
let firstHero = element.all(by.css('ng1-hero')).get(0);
expect(firstHero.element(by.css('h2')).getText()).toEqual('Superman');
const removeHeroButton = firstHero.element(by.css('button'));
expect(removeHeroButton.getText()).toEqual('Remove');
removeHeroButton.click();
const heroComponents = element.all(by.css('ng1-hero'));
expect(heroComponents.count()).toEqual(2);
firstHero = element.all(by.css('ng1-hero')).get(0);
expect(firstHero.element(by.css('h2')).getText()).toEqual('Wonder Woman');
});
});
| TypeScript | 4 | raghavendramohan/angular | packages/examples/upgrade/static/ts/full/e2e_test/static_full_spec.ts | [
"MIT"
] |
SUMMARY = "spawn-fcgi is used to spawn FastCGI applications"
HOMEPAGE = "http://redmine.lighttpd.net/projects/spawn-fcgi"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://COPYING;md5=e4dac5c6ab169aa212feb5028853a579"
SRC_URI = "http://download.lighttpd.net/spawn-fcgi/releases-1.6.x/spawn-fcgi-${PV}.tar.gz \
file://fix_configure_ipv6_test.patch"
SRC_URI[md5sum] = "e970de4efe8045c01dd76280f39901aa"
SRC_URI[sha256sum] = "ab327462cb99894a3699f874425a421d934f957cb24221f00bb888108d9dd09e"
inherit autotools
PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}"
PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
| BitBake | 3 | nunojsa/meta-openembedded | meta-webserver/recipes-support/spawn-fcgi/spawn-fcgi_1.6.4.bb | [
"MIT"
] |
# frozen_string_literal: true
module RuboCop
module RSpec
module Language
# Helper methods to detect RSpec DSL used with send and block
module NodePattern
def send_pattern(string)
"(send #rspec? #{string} ...)"
end
def block_pattern(string)
"(block #{send_pattern(string)} ...)"
end
end
end
end
end
| Ruby | 4 | ylht/brew | Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.4.0/lib/rubocop/rspec/language/node_pattern.rb | [
"BSD-2-Clause"
] |
#version 330
// Input vertex attributes (from vertex shader)
in vec2 fragTexCoord;
in vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 colDiffuse;
// Output fragment color
out vec4 finalColor;
// NOTE: Add here your custom variables
uniform vec2 resolution = vec2(800, 450);
void main()
{
float x = 1.0/resolution.x;
float y = 1.0/resolution.y;
vec4 horizEdge = vec4(0.0);
horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y - y))*1.0;
horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y ))*2.0;
horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y + y))*1.0;
horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y - y))*1.0;
horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y ))*2.0;
horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y + y))*1.0;
vec4 vertEdge = vec4(0.0);
vertEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y - y))*1.0;
vertEdge -= texture2D(texture0, vec2(fragTexCoord.x , fragTexCoord.y - y))*2.0;
vertEdge -= texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y - y))*1.0;
vertEdge += texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y + y))*1.0;
vertEdge += texture2D(texture0, vec2(fragTexCoord.x , fragTexCoord.y + y))*2.0;
vertEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y + y))*1.0;
vec3 edge = sqrt((horizEdge.rgb*horizEdge.rgb) + (vertEdge.rgb*vertEdge.rgb));
finalColor = vec4(edge, texture2D(texture0, fragTexCoord).a);
} | F# | 4 | chrisws/raylib | examples/shaders/resources/shaders/glsl330/sobel.fs | [
"Zlib"
] |
package com.baeldung.guava.tutorial;
import com.google.common.collect.Comparators;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
public class ComparatorsExamples {
public static void main(String[] args) {
List<Integer> integers = Arrays.asList(1, 2, 3, 4, 4, 6, 7, 8, 9, 10);
boolean isInAscendingOrder = Comparators.isInOrder(integers, new AscedingOrderComparator());
System.out.println(isInAscendingOrder);
}
private static class AscedingOrderComparator implements Comparator<Integer> {
@Override
public int compare(Integer o1, Integer o2) {
return o1.compareTo(o2);
}
}
}
| Java | 4 | zeesh49/tutorials | guava-modules/guava-21/src/main/java/com/baeldung/guava/tutorial/ComparatorsExamples.java | [
"MIT"
] |
No more data available, the cursor timed out. Re-execute the query to retrieve more results.
<!-- Keep without space/new line before so the comma stick to the value of the object-->
| Handlebars | 0 | zadcha/rethinkdb | admin/static/handlebars/dataexplorer-cursor_timed_out.hbs | [
"Apache-2.0"
] |
CREATE TABLE EMPLOYEE(
ID INT NOT NULL PRIMARY KEY,
FIRST_NAME VARCHAR(255),
LAST_NAME VARCHAR(255),
SALARY DOUBLE,
);
CREATE TABLE EMAIL(
ID INT NOT NULL PRIMARY KEY,
ID_EMPLOYEE VARCHAR(255),
ADDRESS VARCHAR(255)
);
INSERT INTO EMPLOYEE VALUES (1, 'John', 'Doe', 10000.10);
INSERT INTO EMPLOYEE VALUES (2, 'Kevin', 'Smith', 20000.20);
INSERT INTO EMPLOYEE VALUES (3, 'Kim', 'Smith', 30000.30);
INSERT INTO EMPLOYEE VALUES (4, 'Stephen', 'Torvalds', 40000.40);
INSERT INTO EMPLOYEE VALUES (5, 'Christian', 'Reynolds', 50000.50);
INSERT INTO EMAIL VALUES (1, 1, 'john@baeldung.com');
INSERT INTO EMAIL VALUES (2, 1, 'john@gmail.com');
INSERT INTO EMAIL VALUES (3, 2, 'kevin@baeldung.com');
INSERT INTO EMAIL VALUES (4, 3, 'kim@baeldung.com');
INSERT INTO EMAIL VALUES (5, 3, 'kim@gmail.com');
INSERT INTO EMAIL VALUES (6, 3, 'kim@outlook.com');
INSERT INTO EMAIL VALUES (7, 4, 'stephen@baeldung.com');
INSERT INTO EMAIL VALUES (8, 5, 'christian@gmail.com');
| SQL | 3 | zeesh49/tutorials | spring-all/src/main/resources/employee-schema.sql | [
"MIT"
] |
$red = #ff0101
| Stylus | 0 | dev-itsheng/wepy | packages/compiler-stylus/test/fixtures/stylus/vars/colors.styl | [
"BSD-3-Clause"
] |
infixl 3 ($);
infixr 4 (#);
infix 4 (.);
prefix 10 (-);
postfix 10 (!);
let a = y in a $ a $ (-a)!;
let b = y in a # a # a $ b;
let c = y in a # a # a # b;
| Standard ML | 3 | Average-user/write-you-a-haskell | chapter9/operators/test.fun | [
"MIT"
] |
/* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/cc/experimental/libexport/save.h"
#include "tensorflow/core/lib/core/status_test_util.h"
#include "tensorflow/core/platform/env.h"
#include "tensorflow/core/platform/path.h"
#include "tensorflow/core/platform/test.h"
namespace tensorflow {
namespace libexport {
namespace {
TEST(SaveTest, TestDirectoryStructure) {
const string base_dir = tensorflow::io::JoinPath(
tensorflow::testing::TmpDir(), "test_directory_structure");
TF_ASSERT_OK(Save(base_dir));
TF_ASSERT_OK(Env::Default()->IsDirectory(base_dir));
}
} // namespace
} // namespace libexport
} // namespace tensorflow
| C++ | 3 | EricRemmerswaal/tensorflow | tensorflow/cc/experimental/libexport/save_test.cc | [
"Apache-2.0"
] |
import { imageDemoTest } from '../../../tests/shared/imageTest';
describe('Affix image', () => {
imageDemoTest('affix');
});
| TypeScript | 4 | chnliquan/ant-design | components/affix/__tests__/image.test.ts | [
"MIT"
] |
DESCRIPTION = "Add ANSI colors and decorations to your strings"
LICENSE = "ISC"
LIC_FILES_CHKSUM = "file://LICENSE;md5=aef5566ac4fede9815eccf124c281317"
SRC_URI[sha256sum] = "99f94f5e3348a0bcd43c82e5fc4414013ccc19d70bd939ad71e0133ce9c372e0"
PYPI_PACKAGE_EXT = "zip"
inherit pypi setuptools3 ptest
SRC_URI += " \
file://run-ptest \
"
RDEPENDS:${PN}-ptest += " \
${PYTHON_PN}-pytest \
"
do_install_ptest() {
cp -f ${S}/test/test.py ${D}${PTEST_PATH}/
}
BBCLASSEXTEND = "native nativesdk"
| BitBake | 2 | shipinglinux/meta-openembedded | meta-python/recipes-devtools/python/python3-ansicolors_1.1.8.bb | [
"MIT"
] |
/*--------------------------------------------------*/
/* SAS Programming for R Users - code for exercises */
/* Copyright 2016 SAS Institute Inc. */
/*--------------------------------------------------*/
/*SP4R04s03*/
/*Part A*/
data sp4r.hist;
call streaminit(123);
do i=1 to 1000;
rchisq = rand('chisquare',20);
output;
end;
run;
/*Part B*/
proc sgplot data=sp4r.hist;
histogram rchisq / binwidth=1 scale=count;
density rchisq / type=normal;
density rchisq / type=kernel;
title 'My Random Chi-Square Distribution';
xaxis label='Random Chi-Square Deviates' min=5 max=40;
run;
title;
| SAS | 4 | snowdj/sas-prog-for-r-users | code/SP4R04s03.sas | [
"CC-BY-4.0"
] |
Mode m;
| ChucK | 0 | ccdarabundit/chugins | ExpEnv/temp.ck | [
"MIT"
] |
def cube_root(c, q):
F = FiniteField(q)
R.<x> = PolynomialRing(F,'x')
while 1:
a = F.random_element()
b = F.random_element()
fx = x**3 - a*x**2 + b*x - c
fc = list(factor(fx))
if len(fc) <= 1:
root = pow(x, (q**2+q+1)//3, fx)
root %= x
return int(root)
def cube_roots(c,mod):
c = c % mod
rems = []
if gcd( (mod-1), 3) == 1:
d = inverse_mod(3, mod - 1)
rems.append( int(pow(c, d, mod)) )
else:
g = GF(mod).multiplicative_generator()
u = int(g ** ((mod-1)//3))
r1 = int(cube_root(c, mod))
for i in range(3):
rems.append( int(r1 * pow(u, i, mod) % mod) )
for m in rems :
if pow(m,3,p) != c :
print('%d = m^3 mod %d, m has no integer solutions.' % (c,p) )
exit()
return rems
if __name__ == '__main__':
# Debug
# p = random_prime(2^128-1,False,2^127)
# x = randint(2^127,2^128) % p
# c = pow(x, 3, p)
# print(f"{x}^{3} mod {p} = {c}")
# rems = cube_roots(c%p, p)
# print(f'x = {rems}')
# assert x in rems
print("x^3 mod p = c")
c = int(input("c = "))
p = int(input("p = "))
rems = cube_roots(c%p,p)
print(f"x = {rems}")
| Sage | 4 | bearbear1100/Cryptools | cytro/sage/cube_root.sage | [
"MIT"
] |
import "../small?1";
import "../small?2";
import "../small?3";
import "../small?4";
import "../small?5";
import "../small?6";
import "../small?7";
import "../small?8";
import "../small?9";
| JavaScript | 0 | 1shenxi/webpack | test/statsCases/split-chunks-max-size/async/a.js | [
"MIT"
] |
#tag Module
Protected Module Colors
#tag Constant, Name = AliceBlue, Type = Color, Dynamic = False, Default = \"&cF0F8FF", Scope = Public
#tag EndConstant
#tag Constant, Name = AntiqueWhite, Type = Color, Dynamic = False, Default = \"&cFAEBD7", Scope = Public
#tag EndConstant
#tag Constant, Name = Aqua, Type = Color, Dynamic = False, Default = \"&c00FFFF", Scope = Public
#tag EndConstant
#tag Constant, Name = Aquamarine, Type = Color, Dynamic = False, Default = \"&c7FFFD4", Scope = Public
#tag EndConstant
#tag Constant, Name = Azure, Type = Color, Dynamic = False, Default = \"&cF0FFFF", Scope = Public
#tag EndConstant
#tag Constant, Name = Beige, Type = Color, Dynamic = False, Default = \"&cF5F5DC", Scope = Public
#tag EndConstant
#tag Constant, Name = Bisque, Type = Color, Dynamic = False, Default = \"&cFFE4C4", Scope = Public
#tag EndConstant
#tag Constant, Name = Black, Type = Color, Dynamic = False, Default = \"&c000000", Scope = Public
#tag EndConstant
#tag Constant, Name = BlanchedAlmond, Type = Color, Dynamic = False, Default = \"&cFFEBCD", Scope = Public
#tag EndConstant
#tag Constant, Name = Blue, Type = Color, Dynamic = False, Default = \"&c0000FF", Scope = Public
#tag EndConstant
#tag Constant, Name = BlueViolet, Type = Color, Dynamic = False, Default = \"&c8A2BE2", Scope = Public
#tag EndConstant
#tag Constant, Name = Brown, Type = Color, Dynamic = False, Default = \"&cA52A2A", Scope = Public
#tag EndConstant
#tag Constant, Name = BurlyWood, Type = Color, Dynamic = False, Default = \"&cDEB887", Scope = Public
#tag EndConstant
#tag Constant, Name = CadetBlue, Type = Color, Dynamic = False, Default = \"&c5F9EA0", Scope = Public
#tag EndConstant
#tag Constant, Name = Chartreuse, Type = Color, Dynamic = False, Default = \"&c7FFF00", Scope = Public
#tag EndConstant
#tag Constant, Name = Chocolate, Type = Color, Dynamic = False, Default = \"&cD2691E", Scope = Public
#tag EndConstant
#tag Constant, Name = Coral, Type = Color, Dynamic = False, Default = \"&cFF7F50", Scope = Public
#tag EndConstant
#tag Constant, Name = CornflowerBlue, Type = Color, Dynamic = False, Default = \"&c6495ED", Scope = Public
#tag EndConstant
#tag Constant, Name = Cornsilk, Type = Color, Dynamic = False, Default = \"&cFFF8DC", Scope = Public
#tag EndConstant
#tag Constant, Name = Crimson, Type = Color, Dynamic = False, Default = \"&cDC143C", Scope = Public
#tag EndConstant
#tag Constant, Name = Cyan, Type = Color, Dynamic = False, Default = \"&c00FFFF", Scope = Public
#tag EndConstant
#tag Constant, Name = DarkBlue, Type = Color, Dynamic = False, Default = \"&c00008B", Scope = Public
#tag EndConstant
#tag Constant, Name = DarkCyan, Type = Color, Dynamic = False, Default = \"&c008B8B", Scope = Public
#tag EndConstant
#tag Constant, Name = DarkGoldenRod, Type = Color, Dynamic = False, Default = \"&cB8860B", Scope = Public
#tag EndConstant
#tag Constant, Name = DarkGray, Type = Color, Dynamic = False, Default = \"&cA9A9A9", Scope = Public
#tag EndConstant
#tag Constant, Name = DarkGreen, Type = Color, Dynamic = False, Default = \"&c006400", Scope = Public
#tag EndConstant
#tag Constant, Name = DarkGrey, Type = Color, Dynamic = False, Default = \"&cA9A9A9", Scope = Public
#tag EndConstant
#tag Constant, Name = DarkKhaki, Type = Color, Dynamic = False, Default = \"&cBDB76B", Scope = Public
#tag EndConstant
#tag Constant, Name = DarkMagenta, Type = Color, Dynamic = False, Default = \"&c8B008B", Scope = Public
#tag EndConstant
#tag Constant, Name = DarkOliveGreen, Type = Color, Dynamic = False, Default = \"&c556B2F", Scope = Public
#tag EndConstant
#tag Constant, Name = DarkOrange, Type = Color, Dynamic = False, Default = \"&cFF8C00", Scope = Public
#tag EndConstant
#tag Constant, Name = DarkOrchid, Type = Color, Dynamic = False, Default = \"&c9932CC", Scope = Public
#tag EndConstant
#tag Constant, Name = DarkRed, Type = Color, Dynamic = False, Default = \"&c8B0000", Scope = Public
#tag EndConstant
#tag Constant, Name = DarkSalmon, Type = Color, Dynamic = False, Default = \"&cE9967A", Scope = Public
#tag EndConstant
#tag Constant, Name = DarkSeaGreen, Type = Color, Dynamic = False, Default = \"&c8FBC8F", Scope = Public
#tag EndConstant
#tag Constant, Name = DarkSlateBlue, Type = Color, Dynamic = False, Default = \"&c483D8B", Scope = Public
#tag EndConstant
#tag Constant, Name = DarkSlateGray, Type = Color, Dynamic = False, Default = \"&c2F4F4F", Scope = Public
#tag EndConstant
#tag Constant, Name = DarkSlateGrey, Type = Color, Dynamic = False, Default = \"&c2F4F4F", Scope = Public
#tag EndConstant
#tag Constant, Name = DarkTurquoise, Type = Color, Dynamic = False, Default = \"&c00CED1", Scope = Public
#tag EndConstant
#tag Constant, Name = DarkViolet, Type = Color, Dynamic = False, Default = \"&c9400D3", Scope = Public
#tag EndConstant
#tag Constant, Name = DeepPink, Type = Color, Dynamic = False, Default = \"&cFF1493", Scope = Public
#tag EndConstant
#tag Constant, Name = DeepSkyBlue, Type = Color, Dynamic = False, Default = \"&c00BFFF", Scope = Public
#tag EndConstant
#tag Constant, Name = DimGray, Type = Color, Dynamic = False, Default = \"&c696969", Scope = Public
#tag EndConstant
#tag Constant, Name = DimGrey, Type = Color, Dynamic = False, Default = \"&c696969", Scope = Public
#tag EndConstant
#tag Constant, Name = DodgerBlue, Type = Color, Dynamic = False, Default = \"&c1E90FF", Scope = Public
#tag EndConstant
#tag Constant, Name = FireBrick, Type = Color, Dynamic = False, Default = \"&cB22222", Scope = Public
#tag EndConstant
#tag Constant, Name = FloralWhite, Type = Color, Dynamic = False, Default = \"&cFFFAF0", Scope = Public
#tag EndConstant
#tag Constant, Name = ForestGreen, Type = Color, Dynamic = False, Default = \"&c228B22", Scope = Public
#tag EndConstant
#tag Constant, Name = Fuchsia, Type = Color, Dynamic = False, Default = \"&cFF00FF", Scope = Public
#tag EndConstant
#tag Constant, Name = Gainsboro, Type = Color, Dynamic = False, Default = \"&cDCDCDC", Scope = Public
#tag EndConstant
#tag Constant, Name = GhostWhite, Type = Color, Dynamic = False, Default = \"&cF8F8FF", Scope = Public
#tag EndConstant
#tag Constant, Name = Gold, Type = Color, Dynamic = False, Default = \"&cFFD700", Scope = Public
#tag EndConstant
#tag Constant, Name = GoldenRod, Type = Color, Dynamic = False, Default = \"&cDAA520", Scope = Public
#tag EndConstant
#tag Constant, Name = Gray, Type = Color, Dynamic = False, Default = \"&c808080", Scope = Public
#tag EndConstant
#tag Constant, Name = Green, Type = Color, Dynamic = False, Default = \"&c008000", Scope = Public
#tag EndConstant
#tag Constant, Name = GreenYellow, Type = Color, Dynamic = False, Default = \"&cADFF2F", Scope = Public
#tag EndConstant
#tag Constant, Name = Grey, Type = Color, Dynamic = False, Default = \"&c808080", Scope = Public
#tag EndConstant
#tag Constant, Name = HoneyDew, Type = Color, Dynamic = False, Default = \"&cF0FFF0", Scope = Public
#tag EndConstant
#tag Constant, Name = HotPink, Type = Color, Dynamic = False, Default = \"&cFF69B4", Scope = Public
#tag EndConstant
#tag Constant, Name = IndianRed, Type = Color, Dynamic = False, Default = \"&cCD5C5C", Scope = Public
#tag EndConstant
#tag Constant, Name = Indigo, Type = Color, Dynamic = False, Default = \"&c4B0082", Scope = Public
#tag EndConstant
#tag Constant, Name = Ivory, Type = Color, Dynamic = False, Default = \"&cFFFFF0", Scope = Public
#tag EndConstant
#tag Constant, Name = Khaki, Type = Color, Dynamic = False, Default = \"&cF0E68C", Scope = Public
#tag EndConstant
#tag Constant, Name = Lavender, Type = Color, Dynamic = False, Default = \"&cE6E6FA", Scope = Public
#tag EndConstant
#tag Constant, Name = LavenderBrush, Type = Color, Dynamic = False, Default = \"&cFFF0F5", Scope = Public
#tag EndConstant
#tag Constant, Name = LawnGreen, Type = Color, Dynamic = False, Default = \"&c7CFC00", Scope = Public
#tag EndConstant
#tag Constant, Name = LemonChiffon, Type = Color, Dynamic = False, Default = \"&cFFFACD", Scope = Public
#tag EndConstant
#tag Constant, Name = LightBlue, Type = Color, Dynamic = False, Default = \"&cADD8E6", Scope = Public
#tag EndConstant
#tag Constant, Name = LightCoral, Type = Color, Dynamic = False, Default = \"&cF08080", Scope = Public
#tag EndConstant
#tag Constant, Name = LightCyan, Type = Color, Dynamic = False, Default = \"&cE0FFFF", Scope = Public
#tag EndConstant
#tag Constant, Name = LightGoldenRodYellow, Type = Color, Dynamic = False, Default = \"&cFAFAD2", Scope = Public
#tag EndConstant
#tag Constant, Name = LightGray, Type = Color, Dynamic = False, Default = \"&cD3D3D3", Scope = Public
#tag EndConstant
#tag Constant, Name = LightGreen, Type = Color, Dynamic = False, Default = \"&c90EE90", Scope = Public
#tag EndConstant
#tag Constant, Name = LightGrey, Type = Color, Dynamic = False, Default = \"&cD3D3D3", Scope = Public
#tag EndConstant
#tag Constant, Name = LightPink, Type = Color, Dynamic = False, Default = \"&cFFB6C1", Scope = Public
#tag EndConstant
#tag Constant, Name = LightSalmon, Type = Color, Dynamic = False, Default = \"&cFFA07A", Scope = Public
#tag EndConstant
#tag Constant, Name = LightSeaGreen, Type = Color, Dynamic = False, Default = \"&c20B2AA", Scope = Public
#tag EndConstant
#tag Constant, Name = LightSkyBlue, Type = Color, Dynamic = False, Default = \"&c87CEFA", Scope = Public
#tag EndConstant
#tag Constant, Name = LightSlateGray, Type = Color, Dynamic = False, Default = \"&c778899", Scope = Public
#tag EndConstant
#tag Constant, Name = LightSlateGrey, Type = Color, Dynamic = False, Default = \"&c778899", Scope = Public
#tag EndConstant
#tag Constant, Name = LightSteelBlue, Type = Color, Dynamic = False, Default = \"&cB0C4DE", Scope = Public
#tag EndConstant
#tag Constant, Name = LightYellow, Type = Color, Dynamic = False, Default = \"&cFFFFE0", Scope = Public
#tag EndConstant
#tag Constant, Name = Lime, Type = Color, Dynamic = False, Default = \"&c00FF00", Scope = Public
#tag EndConstant
#tag Constant, Name = LimeGreen, Type = Color, Dynamic = False, Default = \"&c32CD32", Scope = Public
#tag EndConstant
#tag Constant, Name = Linen, Type = Color, Dynamic = False, Default = \"&cFAF0E6", Scope = Public
#tag EndConstant
#tag Constant, Name = Magenta, Type = Color, Dynamic = False, Default = \"&cFF00FF", Scope = Public
#tag EndConstant
#tag Constant, Name = Maroon, Type = Color, Dynamic = False, Default = \"&c800000", Scope = Public
#tag EndConstant
#tag Constant, Name = MediumAquaMarine, Type = Color, Dynamic = False, Default = \"&c66CDAA", Scope = Public
#tag EndConstant
#tag Constant, Name = MediumBlue, Type = Color, Dynamic = False, Default = \"&c0000CD", Scope = Public
#tag EndConstant
#tag Constant, Name = MediumOrchid, Type = Color, Dynamic = False, Default = \"&cBA55D3", Scope = Public
#tag EndConstant
#tag Constant, Name = MediumPurple, Type = Color, Dynamic = False, Default = \"&c9370D8", Scope = Public
#tag EndConstant
#tag Constant, Name = MediumSeaGreen, Type = Color, Dynamic = False, Default = \"&c3CB371", Scope = Public
#tag EndConstant
#tag Constant, Name = MediumSlateBlue, Type = Color, Dynamic = False, Default = \"&c7B68EE", Scope = Public
#tag EndConstant
#tag Constant, Name = MediumSpringGreen, Type = Color, Dynamic = False, Default = \"&c00FA9A", Scope = Public
#tag EndConstant
#tag Constant, Name = MediumTurquoise, Type = Color, Dynamic = False, Default = \"&c48D1CC", Scope = Public
#tag EndConstant
#tag Constant, Name = MediumVioletRed, Type = Color, Dynamic = False, Default = \"&cC71585", Scope = Public
#tag EndConstant
#tag Constant, Name = MidnightBlue, Type = Color, Dynamic = False, Default = \"&c191970", Scope = Public
#tag EndConstant
#tag Constant, Name = MintCream, Type = Color, Dynamic = False, Default = \"&cF5FFFA", Scope = Public
#tag EndConstant
#tag Constant, Name = MistyRose, Type = Color, Dynamic = False, Default = \"&cFFE4E1", Scope = Public
#tag EndConstant
#tag Constant, Name = Moccasin, Type = Color, Dynamic = False, Default = \"&cFFE4B5", Scope = Public
#tag EndConstant
#tag Constant, Name = NavajoWhite, Type = Color, Dynamic = False, Default = \"&cFFDEAD", Scope = Public
#tag EndConstant
#tag Constant, Name = Navy, Type = Color, Dynamic = False, Default = \"&c000080", Scope = Public
#tag EndConstant
#tag Constant, Name = OldLace, Type = Color, Dynamic = False, Default = \"&cFDF5E6", Scope = Public
#tag EndConstant
#tag Constant, Name = Olive, Type = Color, Dynamic = False, Default = \"&c808080", Scope = Public
#tag EndConstant
#tag Constant, Name = OliveDrab, Type = Color, Dynamic = False, Default = \"&c6B8E23", Scope = Public
#tag EndConstant
#tag Constant, Name = Orange, Type = Color, Dynamic = False, Default = \"&cFFA500", Scope = Public
#tag EndConstant
#tag Constant, Name = OrangeRed, Type = Color, Dynamic = False, Default = \"&cFF4500", Scope = Public
#tag EndConstant
#tag Constant, Name = Orchid, Type = Color, Dynamic = False, Default = \"&cDA70D6", Scope = Public
#tag EndConstant
#tag Constant, Name = PaleGoldenRod, Type = Color, Dynamic = False, Default = \"&cEEE8AA", Scope = Public
#tag EndConstant
#tag Constant, Name = PaleGreen, Type = Color, Dynamic = False, Default = \"&c98FB98", Scope = Public
#tag EndConstant
#tag Constant, Name = PaleTurquoise, Type = Color, Dynamic = False, Default = \"&cAFEEEE", Scope = Public
#tag EndConstant
#tag Constant, Name = PaleVioletRed, Type = Color, Dynamic = False, Default = \"&cD87093", Scope = Public
#tag EndConstant
#tag Constant, Name = PapayaWhip, Type = Color, Dynamic = False, Default = \"&cFFEFD5", Scope = Public
#tag EndConstant
#tag Constant, Name = PeachPuff, Type = Color, Dynamic = False, Default = \"&cFFDAB9", Scope = Public
#tag EndConstant
#tag Constant, Name = Peru, Type = Color, Dynamic = False, Default = \"&cCD853F", Scope = Public
#tag EndConstant
#tag Constant, Name = Pink, Type = Color, Dynamic = False, Default = \"&cFFC0CB", Scope = Public
#tag EndConstant
#tag Constant, Name = Plum, Type = Color, Dynamic = False, Default = \"&cDDA0DD", Scope = Public
#tag EndConstant
#tag Constant, Name = PowderBlue, Type = Color, Dynamic = False, Default = \"&cB0E0E6", Scope = Public
#tag EndConstant
#tag Constant, Name = Purple, Type = Color, Dynamic = False, Default = \"&c800080", Scope = Public
#tag EndConstant
#tag Constant, Name = Red, Type = Color, Dynamic = False, Default = \"&cFF0000", Scope = Public
#tag EndConstant
#tag Constant, Name = RosyBrown, Type = Color, Dynamic = False, Default = \"&cBC8F8F", Scope = Public
#tag EndConstant
#tag Constant, Name = RoyalBlue, Type = Color, Dynamic = False, Default = \"&c4169E1", Scope = Public
#tag EndConstant
#tag Constant, Name = SaddleBrown, Type = Color, Dynamic = False, Default = \"&c8B4513", Scope = Public
#tag EndConstant
#tag Constant, Name = Salmon, Type = Color, Dynamic = False, Default = \"&cFA8072", Scope = Public
#tag EndConstant
#tag Constant, Name = SandyBrown, Type = Color, Dynamic = False, Default = \"&cF4A460", Scope = Public
#tag EndConstant
#tag Constant, Name = SeaGreen, Type = Color, Dynamic = False, Default = \"&c2E8B57", Scope = Public
#tag EndConstant
#tag Constant, Name = SeaShell, Type = Color, Dynamic = False, Default = \"&cFFF5EE", Scope = Public
#tag EndConstant
#tag Constant, Name = Sienna, Type = Color, Dynamic = False, Default = \"&cA0522D", Scope = Public
#tag EndConstant
#tag Constant, Name = Silver, Type = Color, Dynamic = False, Default = \"&cC0C0C0", Scope = Public
#tag EndConstant
#tag Constant, Name = SkyBlue, Type = Color, Dynamic = False, Default = \"&c87CEEB", Scope = Public
#tag EndConstant
#tag Constant, Name = SlateBlue, Type = Color, Dynamic = False, Default = \"&c6A5ACD", Scope = Public
#tag EndConstant
#tag Constant, Name = SlateGray, Type = Color, Dynamic = False, Default = \"&c708090", Scope = Public
#tag EndConstant
#tag Constant, Name = SlateGrey, Type = Color, Dynamic = False, Default = \"&c708090", Scope = Public
#tag EndConstant
#tag Constant, Name = Snow, Type = Color, Dynamic = False, Default = \"&cFFFAFA", Scope = Public
#tag EndConstant
#tag Constant, Name = SpringGreen, Type = Color, Dynamic = False, Default = \"&c00FF7F", Scope = Public
#tag EndConstant
#tag Constant, Name = SteelBlue, Type = Color, Dynamic = False, Default = \"&c4682B4", Scope = Public
#tag EndConstant
#tag Constant, Name = Tan, Type = Color, Dynamic = False, Default = \"&cD2B48C", Scope = Public
#tag EndConstant
#tag Constant, Name = Teal, Type = Color, Dynamic = False, Default = \"&c008080", Scope = Public
#tag EndConstant
#tag Constant, Name = Thistle, Type = Color, Dynamic = False, Default = \"&cD8BFD8", Scope = Public
#tag EndConstant
#tag Constant, Name = Tomato, Type = Color, Dynamic = False, Default = \"&cFF6347", Scope = Public
#tag EndConstant
#tag Constant, Name = Turquoise, Type = Color, Dynamic = False, Default = \"&c40E0D0", Scope = Public
#tag EndConstant
#tag Constant, Name = Violet, Type = Color, Dynamic = False, Default = \"&cEE82EE", Scope = Public
#tag EndConstant
#tag Constant, Name = Wheat, Type = Color, Dynamic = False, Default = \"&cF5DEB3", Scope = Public
#tag EndConstant
#tag Constant, Name = White, Type = Color, Dynamic = False, Default = \"&cFFFFFF", Scope = Public
#tag EndConstant
#tag Constant, Name = WhiteSmoke, Type = Color, Dynamic = False, Default = \"&cF5F5F5", Scope = Public
#tag EndConstant
#tag Constant, Name = Yellow, Type = Color, Dynamic = False, Default = \"&cFFFF00", Scope = Public
#tag EndConstant
#tag Constant, Name = YellowGreen, Type = Color, Dynamic = False, Default = \"&c9ACD32", Scope = Public
#tag EndConstant
#tag ViewBehavior
#tag ViewProperty
Name="Index"
Visible=true
Group="ID"
InitialValue="-2147483648"
InheritedFrom="Object"
#tag EndViewProperty
#tag ViewProperty
Name="Left"
Visible=true
Group="Position"
InitialValue="0"
InheritedFrom="Object"
#tag EndViewProperty
#tag ViewProperty
Name="Name"
Visible=true
Group="ID"
InheritedFrom="Object"
#tag EndViewProperty
#tag ViewProperty
Name="Super"
Visible=true
Group="ID"
InheritedFrom="Object"
#tag EndViewProperty
#tag ViewProperty
Name="Top"
Visible=true
Group="Position"
InitialValue="0"
InheritedFrom="Object"
#tag EndViewProperty
#tag EndViewBehavior
End Module
#tag EndModule
| REALbasic | 3 | carlbennett/BNRBot | src/Modules/Colors/Colors.rbbas | [
"MIT"
] |
# Copyright (C) 2001-2006, Parrot Foundation.
# $Id$
=head1 NAME
examples/benchmarks/stress2.pasm - Brief
=head1 SYNOPSIS
% time ./parrot examples/benchmarks/stress2.pasm
=head1 DESCRIPTION
Creates 200 arrays of 10000 elements each.
=cut
set I3, 20
new P10, 'ResizableIntegerArray'
ol:
set I0, 10
new P0, 'ResizablePMCArray'
ol1:
local_branch P10, buildarray
set P0[I0], P1
dec I0
if I0, ol1
dec I3
if I3, ol
end
buildarray:
set I1, 10000
new P1, 'ResizablePMCArray'
loop1:
new P2, 'Integer'
set P2, I1
set P1[I1], P2
dec I1
if I1, loop1
local_return P10
=head1 SEE ALSO
F<examples/benchmarks/stress.pasm>,
F<examples/benchmarks/stress.pl>,
F<examples/benchmarks/stress1.pasm>,
F<examples/benchmarks/stress1.pl>,
F<examples/benchmarks/stress2.pl>,
F<examples/benchmarks/stress3.pasm>.
=cut
# Local Variables:
# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir:
| Parrot Assembly | 4 | allisonrandal/pcc_testing | examples/benchmarks/stress2.pasm | [
"Artistic-2.0"
] |
MEMORY
{
/* This SoftDevice requires 96K flash and 8K RAM according to the release
* notes of version 8.0.0 */
FLASH_TEXT (rw) : ORIGIN = 0x00000000 + 96K, LENGTH = 256K - 96K
RAM (xrw) : ORIGIN = 0x20000000 + 8K, LENGTH = 16K - 8K
}
_stack_size = 2K;
INCLUDE "targets/arm.ld"
| Linker Script | 3 | ybkimm/tinygo | targets/nrf51-s110v8.ld | [
"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.
module rec System.Formats.Cbor.Tests.DataModel.CborDocumentSerializer
open System
open System.Formats.Cbor
open System.Formats.Cbor.Tests.DataModel
let createWriter (context : CborPropertyTestContext) =
new CborWriter(
conformanceMode = context.ConformanceMode,
convertIndefiniteLengthEncodings = context.ConvertIndefiniteLengthItems,
allowMultipleRootLevelValues = (context.RootDocuments.Length > 1))
let createReader (context : CborPropertyTestContext) (encoding : byte[]) =
new CborReader(
data = ReadOnlyMemory<byte>.op_Implicit encoding,
conformanceMode = context.ConformanceMode,
allowMultipleRootLevelValues = (context.RootDocuments.Length > 1))
let encode (context : CborPropertyTestContext) =
let writer = createWriter context
for doc in context.RootDocuments do
write writer doc
writer.Encode()
let decode (context : CborPropertyTestContext) (data : byte[]) =
let reader = createReader context data
let values = new System.Collections.Generic.List<_>()
while reader.PeekState() <> CborReaderState.Finished do
values.Add(read reader)
values.ToArray()
let rec write (writer : CborWriter) (doc : CborDocument) =
match doc with
| UnsignedInteger i -> writer.WriteUInt64 i
| NegativeInteger i -> writer.WriteCborNegativeIntegerRepresentation i
| ByteString bs -> writer.WriteByteString bs
| TextString ts -> writer.WriteTextString ts
| ByteStringIndefiniteLength bss ->
writer.WriteStartIndefiniteLengthByteString()
for bs in bss do
writer.WriteByteString bs
writer.WriteEndIndefiniteLengthByteString()
| TextStringIndefiniteLength tss ->
writer.WriteStartIndefiniteLengthTextString()
for ts in tss do
writer.WriteTextString ts
writer.WriteEndIndefiniteLengthTextString()
| Array (isDefiniteLength, elements) ->
writer.WriteStartArray (if isDefiniteLength then Nullable elements.Length else Nullable())
for elem in elements do
write writer elem
writer.WriteEndArray()
| Map (isDefiniteLength, pairs) ->
writer.WriteStartMap (if isDefiniteLength then Nullable pairs.Count else Nullable())
for kv in pairs do
write writer kv.Key ; write writer kv.Value
writer.WriteEndMap()
| Tag (tag, nested) ->
writer.WriteTag (LanguagePrimitives.EnumOfValue tag)
write writer nested
| Double d -> writer.WriteDouble d
| SimpleValue v -> writer.WriteSimpleValue(LanguagePrimitives.EnumOfValue v)
| SemanticValue value ->
writer.WriteTag CborTagExt.SemValueGuard
writeSemanticValue writer value
let private writeSemanticValue (writer : CborWriter) (s : CborSemanticValue) =
match s with
| Null -> writer.WriteTag CborTagExt.Null; writer.WriteNull()
| Bool b -> writer.WriteTag CborTagExt.Bool; writer.WriteBoolean b
| Int32 i -> writer.WriteTag CborTagExt.Int32; writer.WriteInt32 i
| Int64 i -> writer.WriteTag CborTagExt.Int64; writer.WriteInt64 i
| Half f -> writer.WriteTag CborTagExt.Half; writer.WriteHalf f
| Single f -> writer.WriteTag CborTagExt.Single; writer.WriteSingle f
| DateTimeOffset d -> writer.WriteDateTimeOffset d
| UnixTimeSeconds s -> writer.WriteUnixTimeSeconds s
| BigInt i -> writer.WriteBigInteger i
| Decimal d -> writer.WriteDecimal d
let rec read (reader : CborReader) : CborDocument =
match reader.PeekState() with
| CborReaderState.UnsignedInteger -> UnsignedInteger(reader.ReadUInt64())
| CborReaderState.NegativeInteger -> NegativeInteger(reader.ReadCborNegativeIntegerRepresentation())
| CborReaderState.ByteString -> ByteString(reader.ReadByteString())
| CborReaderState.TextString -> TextString(reader.ReadTextString())
| CborReaderState.StartArray ->
let length = reader.ReadStartArray()
if length.HasValue then
let results = Array.zeroCreate<CborDocument> length.Value
for i = 0 to results.Length - 1 do
results.[i] <- read reader
reader.ReadEndArray()
Array(true, results)
else
let results = new System.Collections.Generic.List<_>()
while reader.PeekState() <> CborReaderState.EndArray do
results.Add(read reader)
reader.ReadEndArray()
Array(false, results.ToArray())
| CborReaderState.StartIndefiniteLengthByteString ->
reader.ReadStartIndefiniteLengthByteString()
let chunks = new System.Collections.Generic.List<byte[]>()
while reader.PeekState() <> CborReaderState.EndIndefiniteLengthByteString do
chunks.Add(reader.ReadByteString())
reader.ReadEndIndefiniteLengthByteString()
ByteStringIndefiniteLength(chunks.ToArray())
| CborReaderState.StartIndefiniteLengthTextString ->
reader.ReadStartIndefiniteLengthTextString()
let chunks = new System.Collections.Generic.List<string>()
while reader.PeekState() <> CborReaderState.EndIndefiniteLengthTextString do
chunks.Add(reader.ReadTextString())
reader.ReadEndIndefiniteLengthTextString()
TextStringIndefiniteLength(chunks.ToArray())
| CborReaderState.StartMap ->
let length = reader.ReadStartMap()
if length.HasValue then
let results = Array.zeroCreate<CborDocument * CborDocument> length.Value
for i = 0 to results.Length - 1 do
results.[i] <- (read reader, read reader)
reader.ReadEndMap()
Map(true, Map.ofArray results)
else
let results = new System.Collections.Generic.List<_>()
while reader.PeekState() <> CborReaderState.EndMap do
results.Add(read reader, read reader)
reader.ReadEndMap()
Map(false, Map.ofSeq results)
| CborReaderState.Tag ->
let tag = reader.ReadTag()
if tag = CborTagExt.SemValueGuard then SemanticValue(readSemanticValue reader)
else Tag (LanguagePrimitives.EnumToValue tag, read reader)
| CborReaderState.HalfPrecisionFloat
| CborReaderState.SinglePrecisionFloat
| CborReaderState.DoublePrecisionFloat -> Double (reader.ReadDouble())
| CborReaderState.Null
| CborReaderState.Boolean
| CborReaderState.SimpleValue ->
let value = reader.ReadSimpleValue()
SimpleValue(LanguagePrimitives.EnumToValue value)
| state -> failwithf "Unrecognized reader state %O" state
let private readSemanticValue (reader : CborReader) : CborSemanticValue =
match reader.PeekTag() with
| CborTagExt.Null -> let _ = reader.ReadTag() in reader.ReadNull(); Null
| CborTagExt.Bool -> let _ = reader.ReadTag() in Bool(reader.ReadBoolean())
| CborTagExt.Int32 -> let _ = reader.ReadTag() in Int32(reader.ReadInt32())
| CborTagExt.Int64 -> let _ = reader.ReadTag() in Int64(reader.ReadInt64())
| CborTagExt.Half -> let _ = reader.ReadTag() in Half(reader.ReadHalf())
| CborTagExt.Single -> let _ = reader.ReadTag() in Single(reader.ReadSingle())
| CborTag.DateTimeString -> DateTimeOffset(reader.ReadDateTimeOffset())
| CborTag.UnixTimeSeconds -> let dto = reader.ReadUnixTimeSeconds() in UnixTimeSeconds(dto.ToUnixTimeSeconds())
| CborTag.UnsignedBigNum
| CborTag.NegativeBigNum -> BigInt(reader.ReadBigInteger())
| CborTag.DecimalFraction -> Decimal(reader.ReadDecimal())
| tag -> failwithf "Unrecognized tag %O" tag
// defines a set of custom CBOR tags for semantic value encodings
module private CborTagExt =
let [<Literal>] SemValueGuard : CborTag = LanguagePrimitives.EnumOfValue 50015001uL
let [<Literal>] Null : CborTag = LanguagePrimitives.EnumOfValue 5001uL
let [<Literal>] Bool : CborTag = LanguagePrimitives.EnumOfValue 5002uL
let [<Literal>] Int32 : CborTag = LanguagePrimitives.EnumOfValue 5003uL
let [<Literal>] Int64 : CborTag = LanguagePrimitives.EnumOfValue 5004uL
let [<Literal>] Half : CborTag = LanguagePrimitives.EnumOfValue 5005uL
let [<Literal>] Single : CborTag = LanguagePrimitives.EnumOfValue 5006uL
| F# | 5 | pyracanda/runtime | src/libraries/System.Formats.Cbor/tests/CborDocument/CborDocumentSerializer.fs | [
"MIT"
] |
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
# @ECLASS: npm.eclass
# @MAINTAINER:
# Jesus Rivero <neurogeek@gentoo.org>
# @BLURB: Eclass for NodeJS packages available through the npm registry.
# @DESCRIPTION:
# This eclass contains various functions that may be useful when dealing with
# packages from the npm registry, for NodeJS.
# Requires EAPI=2 or later.
case ${EAPI} in
2|3|4|5) : ;;
*) die "npm.eclass: unsupported EAPI=${EAPI:-0}" ;;
esac
inherit multilib
# @ECLASS-VARIABLE: NPM_MODULE
# @DESCRIPTION:
# Name of the resulting NodeJS/npm module.
# The Default value for NPM_MODULE is ${PN}
#
# Example: NPM_MODULE="${MY_PN}"
if [[ -z $NPM_MODULE ]]; then
NPM_MODULE="${PN}"
fi
# @ECLASS-VARIABLE: NPM_FILES
# @INTERNAL
# @DESCRIPTION:
# Files and directories that usually come in a standard NodeJS/npm module.
NPM_FILES="index.js lib package.json ${NPM_MODULE}.js"
# @ECLASS-VARIABLE: NPM_DOCS
# @DESCRIPTION:
# Document files that come in a NodeJS/npm module, outside of the usual docs
# list of README*, ChangeLog AUTHORS* etc. These are only installed if 'doc' is
# in ${USE}
# NPM_DOCS="README* LICENSE HISTORY*"
# @ECLASS-VARIABLE: NPM_EXTRA_FILES
# @DESCRIPTION:
# If additional dist files are present in the NodeJS/npm module that are not
# listed in NPM_FILES, then this is the place to put them in.
# Can be either files, or directories.
# Example: NPM_EXTRA_FILES="rigger.js modules"
HOMEPAGE="https://www.npmjs.org/package/${PN}"
SRC_URI="http://registry.npmjs.org/${PN}/-/${P}.tgz"
# @FUNCTION: npm-src_unpack
# @DESCRIPTION:
# Default src_unpack function for NodeJS/npm packages. This funtions unpacks
# the source code, then renames the 'package' dir to ${S}.
npm_src_unpack() {
unpack "${A}"
mv "${WORKDIR}/package" ${S}
}
# @FUNCTION: npm-src_compile
# @DESCRIPTION:
# This function does nothing.
npm_src_compile() {
true
}
# @FUNCTION: npm-src_install
# @DESCRIPTION:
# This function installs the NodeJS/npm module to an appropriate location, also
# taking care of NPM_FILES, NPM_EXTRA_FILES, NPM_DOCS
npm_src_install() {
local npm_files="${NPM_FILES} ${NPM_EXTRA_FILES}"
local node_modules="${D}/usr/$(get_libdir)/node_modules/${NPM_MODULE}"
mkdir -p ${node_modules} || die "Could not create DEST folder"
for f in ${npm_files}
do
if [[ -e "${S}/$f" ]]; then
cp -r "${S}/$f" ${node_modules}
fi
done
# Install docs usually found in NodeJS/NPM packages.
local f
for f in README* HISTORY* ChangeLog AUTHORS NEWS TODO CHANGES \
THANKS BUGS FAQ CREDITS CHANGELOG*; do
if [[ -s ${f} ]]; then
dodoc "${f}"
fi
done
if has doc ${USE}; then
local npm_docs="${NPM_DOCS}"
for f in $npm_docs
do
if [[ -e "${S}/$f" ]]; then
dodoc -r "${S}/$f"
fi
done
fi
}
EXPORT_FUNCTIONS src_unpack src_compile src_install
| Gentoo Eclass | 4 | gridgentoo/gentoo-tensorflow-overlay | eclass/npm.eclass | [
"BSD-2-Clause"
] |
/* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_COMPILER_MLIR_LITE_PYTHON_JAX_TO_TFL_FLATBUFFER_H_
#define TENSORFLOW_COMPILER_MLIR_LITE_PYTHON_JAX_TO_TFL_FLATBUFFER_H_
#include "tensorflow/core/lib/core/errors.h"
#include "tensorflow/lite/toco/model_flags.pb.h"
#include "tensorflow/lite/toco/toco_flags.pb.h"
namespace tensorflow {
// Converts the given Jax model to a TF Lite FlatBuffer
// string according to the given model flags, toco flags and tags. Returns error
// status if it fails to convert the input.
Status ConvertJaxToTFLiteFlatBuffer(const std::string& input,
const toco::ModelFlags& model_flags,
const toco::TocoFlags& toco_flags,
string* result);
} // namespace tensorflow
#endif // TENSORFLOW_COMPILER_MLIR_LITE_PYTHON_JAX_TO_TFL_FLATBUFFER_H_
| C | 5 | EricRemmerswaal/tensorflow | tensorflow/compiler/mlir/lite/python/jax_to_tfl_flatbuffer.h | [
"Apache-2.0"
] |
DROP TABLE "public"."table47";
| SQL | 0 | eazyfin/graphql-engine | cli/commands/testdata/migrate-squash-test/migrations/1588172670644_create_table_public_table47/down.sql | [
"Apache-2.0",
"MIT"
] |
{% if doc.renamedDuplicates %}
<section class="renamed-duplicates">
Aliased as
{% for d in doc.renamedDuplicates %}
<i>{$ d.name $}</i>{% if not loop.last %}, {% endif %}
{% endfor %}
</section>
{% endif %}
| HTML | 3 | KevLeong/rxjs | docs_app/tools/transforms/templates/api/includes/renamed-exports.html | [
"Apache-2.0"
] |
--TEST--
DateTime::add() -- fall type2 type2
--CREDITS--
Daniel Convissor <danielc@php.net>
--FILE--
<?php
require 'examine_diff.inc';
define('PHPT_DATETIME_SHOW', PHPT_DATETIME_SHOW_ADD);
require 'DateTime_data-fall-type2-type2.inc';
?>
--EXPECT--
test_time_fall_type2_prev_type2_prev: ADD: 2010-10-04 02:18:48 EDT + P+0Y1M2DT16H19M40S = **2010-11-06 18:38:28 EDT**
test_time_fall_type2_prev_type2_dt: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT5H31M52S = **2010-11-07 00:10:20 EDT**
test_time_fall_type2_prev_type2_redodt: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT6H34M5S = **2010-11-07 01:12:33 EDT**
test_time_fall_type2_prev_type2_redost: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT7H36M16S = **2010-11-07 02:14:44 EDT**
test_time_fall_type2_prev_type2_st: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT9H38M27S = **2010-11-07 04:16:55 EDT**
test_time_fall_type2_prev_type2_post: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M2DT1H21M31S = **2010-11-08 19:59:59 EDT**
test_time_fall_type2_dt_type2_prev: ADD: 2010-11-07 00:10:20 EDT + P-0Y0M0DT5H31M52S = **2010-11-06 18:38:28 EDT**
test_time_fall_type2_dt_type2_dt: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT0H5M15S = **2010-11-07 00:15:35 EDT**
test_time_fall_type2_dt_type2_redodt: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT1H2M13S = **2010-11-07 01:12:33 EDT**
test_time_fall_type2_dt_type2_redost: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT2H4M24S = **2010-11-07 02:14:44 EDT**
test_time_fall_type2_dt_type2_st: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT4H6M35S = **2010-11-07 04:16:55 EDT**
test_time_fall_type2_dt_type2_post: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M1DT20H49M39S = **2010-11-08 20:59:59 EDT**
test_time_fall_type2_redodt_type2_prev: ADD: 2010-11-07 01:12:33 EDT + P-0Y0M0DT6H34M5S = **2010-11-06 18:38:28 EDT**
test_time_fall_type2_redodt_type2_dt: ADD: 2010-11-07 01:12:33 EDT + P-0Y0M0DT1H2M13S = **2010-11-07 00:10:20 EDT**
test_time_fall_type2_redodt_type2_redodt: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M0DT0H3M2S = **2010-11-07 01:15:35 EDT**
test_time_fall_type2_redodt_type2_redost: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M0DT1H2M11S = **2010-11-07 02:14:44 EDT**
test_time_fall_type2_redodt_type2_st: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M0DT3H4M22S = **2010-11-07 04:16:55 EDT**
test_time_fall_type2_redodt_type2_post: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M1DT19H47M26S = **2010-11-08 20:59:59 EDT**
test_time_fall_type2_redost_type2_prev: ADD: 2010-11-07 01:14:44 EST + P-0Y0M0DT7H36M16S = **2010-11-06 17:38:28 EST**
test_time_fall_type2_redost_type2_dt: ADD: 2010-11-07 01:14:44 EST + P-0Y0M0DT2H4M24S = **2010-11-06 23:10:20 EST**
test_time_fall_type2_redost_type2_redodt: ADD: 2010-11-07 01:14:44 EST + P-0Y0M0DT1H2M11S = **2010-11-07 00:12:33 EST**
test_time_fall_type2_redost_type2_redost: ADD: 2010-11-07 01:14:44 EST + P+0Y0M0DT0H2M10S = **2010-11-07 01:16:54 EST**
test_time_fall_type2_redost_type2_st: ADD: 2010-11-07 01:14:44 EST + P+0Y0M0DT2H2M11S = **2010-11-07 03:16:55 EST**
test_time_fall_type2_redost_type2_post: ADD: 2010-11-07 01:14:44 EST + P+0Y0M1DT18H45M15S = **2010-11-08 19:59:59 EST**
test_time_fall_type2_st_type2_prev: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT9H38M27S = **2010-11-06 17:38:28 EST**
test_time_fall_type2_st_type2_dt: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT4H6M35S = **2010-11-06 23:10:20 EST**
test_time_fall_type2_st_type2_redodt: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT3H4M22S = **2010-11-07 00:12:33 EST**
test_time_fall_type2_st_type2_redost: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT2H2M11S = **2010-11-07 01:14:44 EST**
test_time_fall_type2_st_type2_st: ADD: 2010-11-07 03:16:55 EST + P+0Y0M0DT2H3M1S = **2010-11-07 05:19:56 EST**
test_time_fall_type2_st_type2_post: ADD: 2010-11-07 03:16:55 EST + P+0Y0M1DT16H43M4S = **2010-11-08 19:59:59 EST**
test_time_fall_type2_post_type2_prev: ADD: 2010-11-08 19:59:59 EST + P-0Y0M2DT1H21M31S = **2010-11-06 18:38:28 EST**
test_time_fall_type2_post_type2_dt: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT20H49M39S = **2010-11-06 23:10:20 EST**
test_time_fall_type2_post_type2_redodt: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT19H47M26S = **2010-11-07 00:12:33 EST**
test_time_fall_type2_post_type2_redost: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT18H45M15S = **2010-11-07 01:14:44 EST**
test_time_fall_type2_post_type2_st: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT16H43M4S = **2010-11-07 03:16:55 EST**
test_time_fall_type2_post_type2_post: ADD: 2010-11-08 18:57:55 EST + P+0Y0M0DT1H2M4S = **2010-11-08 19:59:59 EST**
test_time_fall_type2_dtsec_type2_stsec: ADD: 2010-11-07 01:59:59 EDT + P+0Y0M0DT0H0M1S = **2010-11-07 02:00:00 EDT**
test_time_fall_type2_stsec_type2_dtsec: ADD: 2010-11-07 01:00:00 EST + P-0Y0M0DT0H0M1S = **2010-11-07 00:59:59 EST**
| PHP | 3 | guomoumou123/php5.5.10 | ext/date/tests/DateTime_add-fall-type2-type2.phpt | [
"PHP-3.01"
] |
msgid ""
msgstr ""
"Project-Id-Version: view_tests\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-09-15 16:45+0200\n"
"PO-Revision-Date: 2010-05-12 12:57-0300\n"
"Last-Translator: Unknown\n"
"Language-Team: Russian <ru@li.org>\n"
"Language: ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n"
"%100<10 || n%100>=20) ? 1 : 2);\n"
msgid "this is to be translated"
msgstr "перевод"
msgid "Choose a time"
msgstr "Выберите время"
msgid "{count} plural2"
msgid_plural "{count} plural2s"
msgstr[0] ""
msgstr[1] ""
msgstr[2] ""
msgid "{count} plural3"
msgid_plural "{count} plural3s"
msgstr[0] "{count} plural3 p3"
msgstr[1] "{count} plural3 p3s"
msgstr[2] "{count} plural3 p3t"
| Gettext Catalog | 3 | jpmallarino/django | tests/view_tests/locale/ru/LC_MESSAGES/djangojs.po | [
"BSD-3-Clause",
"0BSD"
] |
ruleset io.picolabs.operators {
meta {
shares results, returnMapAfterKlog, returnArrayAfterKlog
}
global {
nothing = null
some_string = "foo"
results = {
"str_as_num": "100.25".as("Number"),
"num_as_str": 1.05.as("String"),
"regex_as_str": re#blah#i.as("String"),
"isnull": [
1.isnull(),
some_string.isnull(),
nothing.isnull()
],
"typeof": [
1.typeof(),
some_string.typeof(),
"hi".typeof(),
[1, 2].typeof(),
{"a": 1}.typeof(),
re#foo#.typeof(),
nothing.typeof(),
null.typeof()
],
"75.chr()": 75.chr(),
"0.range(10)": 0.range(10),
"10.sprintf": 10.sprintf("< %d>"),
".capitalize()": "Hello World".capitalize(),
".decode()": "[3, 4, 5]".decode(),
".extract": "This is a string".extract(re#(s.+).*(.ing)#),
".lc()": "Hello World".lc(),
".match true": "Something".match(re#^S.*g$#),
".match false": "Someone".match(re#^S.*g$#),
".ord()": "Hello".ord(),
".replace": "Hello William!".replace(re#will#i, "Bill"),
".split": "a;b;c".split(re#;#),
".sprintf": "Jim".sprintf("Hello %s!"),
".substr(5)": "This is a string".substr(5),
".substr(5, 4)": "This is a string".substr(5, 4),
".substr(5, -5)": "This is a string".substr(5, -5),
".substr(25)": "This is a string".substr(25),
".uc()": "Hello World".uc()
}
returnMapAfterKlog = function(){
{"a": 1}.klog("hi:");
}
returnArrayAfterKlog = function(){
[1, 2].klog("hi:");
}
}
}
| KRL | 4 | CambodianCoder/pico-engine | test-rulesets/operators.krl | [
"MIT"
] |
vec3 customSurfaceShading(const MaterialInputs materialInputs,
const PixelParams pixel, const Light light, float visibility) {
LightData lightData;
lightData.colorIntensity = light.colorIntensity;
lightData.l = light.l;
lightData.NdotL = light.NoL;
lightData.worldPosition = light.worldPosition;
lightData.attenuation = light.attenuation;
lightData.visibility = visibility;
ShadingData shadingData;
shadingData.diffuseColor = pixel.diffuseColor;
shadingData.perceptualRoughness = pixel.perceptualRoughness;
shadingData.f0 = pixel.f0;
shadingData.roughness = pixel.roughness;
return surfaceShading(materialInputs, shadingData, lightData);
}
| F# | 4 | N500/filament | shaders/src/shading_lit_custom.fs | [
"Apache-2.0"
] |
// Copyright 2019 The MediaPipe Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#import "AppDelegate.h"
#import "mediapipe/examples/ios/common/CommonViewController.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for
// certain types of temporary interruptions (such as an incoming phone call or SMS message) or
// when the user quits the application and it begins the transition to the background state. Use
// this method to pause ongoing tasks, disable timers, and invalidate graphics rendering
// callbacks. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store
// enough application state information to restore your application to its current state in case
// it is terminated later. If your application supports background execution, this method is
// called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background to the active state; here you can undo
// many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If
// the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also
// applicationDidEnterBackground:.
}
@end
| Objective-C++ | 3 | virdio/mediapipe | mediapipe/examples/ios/common/AppDelegate.mm | [
"Apache-2.0"
] |
tests/cases/compiler/monorepo/pkg3/src/keys.ts(3,14): error TS2742: The inferred type of 'ADMIN' cannot be named without a reference to '../../pkg2/node_modules/@raymondfeng/pkg1/dist'. This is likely not portable. A type annotation is necessary.
==== tests/cases/compiler/monorepo/pkg3/tsconfig.json (0 errors) ====
{
"compilerOptions": {
"outDir": "dist",
"rootDir": "src",
"target": "es5",
"module": "commonjs",
"strict": true,
"esModuleInterop": true,
"declaration": true
}
}
==== tests/cases/compiler/monorepo/pkg1/dist/index.d.ts (0 errors) ====
export * from './types';
==== tests/cases/compiler/monorepo/pkg1/dist/types.d.ts (0 errors) ====
export declare type A = {
id: string;
};
export declare type B = {
id: number;
};
export declare type IdType = A | B;
export declare class MetadataAccessor<T, D extends IdType = IdType> {
readonly key: string;
private constructor();
toString(): string;
static create<T, D extends IdType = IdType>(key: string): MetadataAccessor<T, D>;
}
==== tests/cases/compiler/monorepo/pkg1/package.json (0 errors) ====
{
"name": "@raymondfeng/pkg1",
"version": "1.0.0",
"description": "",
"main": "dist/index.js",
"typings": "dist/index.d.ts"
}
==== tests/cases/compiler/monorepo/pkg2/dist/index.d.ts (0 errors) ====
export * from './types';
==== tests/cases/compiler/monorepo/pkg2/dist/types.d.ts (0 errors) ====
export {MetadataAccessor} from '@raymondfeng/pkg1';
==== tests/cases/compiler/monorepo/pkg2/package.json (0 errors) ====
{
"name": "@raymondfeng/pkg2",
"version": "1.0.0",
"description": "",
"main": "dist/index.js",
"typings": "dist/index.d.ts"
}
==== tests/cases/compiler/monorepo/pkg3/src/index.ts (0 errors) ====
export * from './keys';
==== tests/cases/compiler/monorepo/pkg3/src/keys.ts (1 errors) ====
import {MetadataAccessor} from "@raymondfeng/pkg2";
export const ADMIN = MetadataAccessor.create<boolean>('1');
~~~~~
!!! error TS2742: The inferred type of 'ADMIN' cannot be named without a reference to '../../pkg2/node_modules/@raymondfeng/pkg1/dist'. This is likely not portable. A type annotation is necessary. | Text | 3 | nilamjadhav/TypeScript | tests/baselines/reference/declarationEmitReexportedSymlinkReference3.errors.txt | [
"Apache-2.0"
] |
\documentclass{article}
\usepackage{agda}
\begin{document}
\begin{code}
variable
A : Set
f : A → A
f x = x
\end{code}
\end{document}
| Literate Agda | 4 | cruhland/agda | test/LaTeXAndHTML/succeed/Issue3112.lagda | [
"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.
// Taskl generation.
// These are called once-per-worker, so they can be slow.
#ifndef AUTOML_ZERO_TASK_H_
#define AUTOML_ZERO_TASK_H_
#include <algorithm>
#include <random>
#include <vector>
#include "task.pb.h"
#include "definitions.h"
#include "gtest/gtest_prod.h"
namespace automl_zero {
constexpr IntegerT kNumTrainExamplesNotSet = -963487122;
constexpr double kDataTolerance = 0.00001;
// Holds data temporarily while it is being created, so that later it can be
// moved to a Task. This allows the Task to store const data.
template <FeatureIndexT F>
class TaskBuffer {
public:
TaskBuffer() : consumed_(false) {}
bool IsConsumed() {return consumed_;}
void Consume() {consumed_ = true;}
// How the tasks are filled is up to each task Creator struct. By the
// end of task creation, the train/valid features/labels should be
// assigned correctly.
std::vector<Vector<F>> train_features_;
std::vector<Vector<F>> valid_features_;
EvalType eval_type_;
std::vector<Scalar> train_labels_;
std::vector<Scalar> valid_labels_;
private:
// Whether this object has already been consumed by moving the data into
// a task. A consumed TaskBuffer has no further use.
bool consumed_;
};
// We define this base class so we can put tasks of different sizes into the
// same container of tasks.
class TaskInterface {
public:
// Always have at least one virtual method in this class. Because it is meant
// to be downcasted, we need to keep it polymorphic.
virtual ~TaskInterface() {}
// Returns the size of the feature vectors in this task.
virtual FeatureIndexT FeaturesSize() const = 0;
// Returns the eval type.
virtual EvalType GetEvalType() const = 0;
// Returns the number of examples in the task. These can only be called
// after the task creation is complete.
virtual IntegerT TrainExamplesPerEpoch() const = 0;
virtual IntegerT NumTrainEpochs() const = 0;
virtual IntegerT MaxTrainExamples() const = 0;
virtual IntegerT ValidSteps() const = 0;
};
template <FeatureIndexT F>
class TaskIterator;
template<typename RankT>
bool ItemEquals(const RankT& data1, const RankT& data2) {
return (data1 - data2).norm() < kDataTolerance;
}
template<>
inline bool ItemEquals<Scalar>(const Scalar& data1, const Scalar& data2) {
return abs(data1 - data2) < kDataTolerance;
}
template <typename RankT>
bool DataEquals(const std::vector<RankT>& data1,
const std::vector<RankT>& data2) {
if (data1.size() != data2.size()) return false;
for (IntegerT index = 0; index < data1.size(); ++index) {
if (!ItemEquals(data1[index], data2[index])) {
return false;
}
}
return true;
}
inline std::vector<std::vector<IntegerT>> GenerateEpochs(
const IntegerT num_examples, const IntegerT num_epochs,
std::mt19937* bit_gen) {
std::vector<IntegerT> indexes;
for (IntegerT i = 0; i < num_examples; ++i) indexes.push_back(i);
std::vector<std::vector<IntegerT>> epochs(num_epochs);
for (std::vector<IntegerT>& epoch : epochs) {
epoch.insert(epoch.begin(), indexes.begin(), indexes.end());
std::shuffle(indexes.begin(), indexes.end(), *bit_gen);
}
return epochs;
}
template <
// The dimensionality of activations.
FeatureIndexT F>
class Task : public TaskInterface {
public:
explicit Task(const size_t index, const EvalType eval_type,
const IntegerT num_train_epochs, std::mt19937* bit_gen,
TaskBuffer<F>* buffer)
: index_(index),
eval_type_(eval_type),
train_features_(std::move(buffer->train_features_)),
train_labels_(std::move(buffer->train_labels_)),
train_epochs_(
GenerateEpochs(train_features_.size(), num_train_epochs, bit_gen)),
valid_features_(std::move(buffer->valid_features_)),
valid_labels_(std::move(buffer->valid_labels_)),
valid_epochs_(GenerateEpochs(valid_features_.size(), 1, bit_gen)) {
CHECK(!buffer->IsConsumed());
buffer->Consume();
CHECK_EQ(train_features_.size(), train_labels_.size());
CHECK_EQ(valid_features_.size(), valid_labels_.size());
}
Task(const Task&) = delete;
Task& operator=(const Task&) = delete;
Task(Task&& other)
: index_(other.index_),
eval_type_(other.eval_type_),
train_features_(std::move(other.train_features_)),
train_labels_(std::move(other.train_labels_)),
train_epochs_(std::move(other.train_epochs_)),
valid_features_(std::move(other.valid_features_)),
valid_labels_(std::move(other.valid_labels_)),
valid_epochs_(std::move(other.valid_epochs_)) {}
Task& operator=(Task&& other) {
this->index_ = other.index_;
this->eval_type_ = other.eval_type_;
this->train_features_ = std::move(other.train_features_);
this->train_labels_ = std::move(other.train_labels_);
this->train_epochs_ = std::move(other.train_epochs_);
this->valid_features_ = std::move(other.valid_features_);
this->valid_labels_ = std::move(other.valid_labels_);
this->valid_epochs_ = std::move(other.valid_epochs_);
return *this;
}
bool operator==(const Task<F>& other) const {
CHECK_EQ(train_features_.size(), train_labels_.size());
CHECK_EQ(other.train_features_.size(), other.train_labels_.size());
if (!DataEquals(train_features_, other.train_features_)) {
return false;
}
if (!DataEquals(train_labels_, other.train_labels_)) {
return false;
}
if (train_epochs_ != other.train_epochs_) {
return false;
}
CHECK_EQ(valid_features_.size(), valid_labels_.size());
CHECK_EQ(other.valid_features_.size(), other.valid_labels_.size());
if (!DataEquals(valid_features_, other.valid_features_)) {
return false;
}
if (!DataEquals(valid_labels_, other.valid_labels_)) {
return false;
}
CHECK_EQ(valid_epochs_.size(), 1);
CHECK_EQ(other.valid_epochs_.size(), 1);
return true;
}
bool operator!=(const Task<F>& other) const { return !(*this == other); }
FeatureIndexT FeaturesSize() const override {return F;}
EvalType GetEvalType() const override {return eval_type_;}
IntegerT TrainExamplesPerEpoch() const override {
return train_features_.size();
}
IntegerT NumTrainEpochs() const override {
return train_epochs_.size();
}
IntegerT MaxTrainExamples() const override {
return TrainExamplesPerEpoch() * NumTrainEpochs();
}
IntegerT ValidSteps() const override {
return valid_features_.size();
}
// Iterate.
TaskIterator<F> TrainIterator() const {
return TaskIterator<F>(&train_features_, &train_labels_, &train_epochs_);
}
TaskIterator<F> ValidIterator() const {
return TaskIterator<F>(&valid_features_, &valid_labels_, &valid_epochs_);
}
// ***IMPORTANT***: if you add a member variable below, you *must* also add it
// to the move constructor. Or else it may just disappear in the middle of
// your experiment.
// Task index. Used to distinguish between different task caches.
const size_t index_;
const EvalType eval_type_;
private:
FRIEND_TEST(FillTasksTest, WorksCorrectly);
FRIEND_TEST(FillTaskWithZerosTest, WorksCorrectly);
FRIEND_TEST(FillTaskWithOnesTest, WorksCorrectly);
FRIEND_TEST(FillTaskWithIncrementingIntegersTest, WorksCorrectly);
FRIEND_TEST(FillTaskWithNonlinearDataTest, PermanenceTest);
FRIEND_TEST(FillTaskWithProjectedBinaryClassificationTaskTest,
WorksCorrectly);
FRIEND_TEST(FillTaskWithProjectedBinaryClassificationTaskTest,
BalancedClass);
FRIEND_TEST(FillTaskWithDownsampledBinaryClassificationTaskTest,
WorksCorrectly);
FRIEND_TEST(FillTaskWithDownsampledBinaryClassificationTaskTest,
BalancedClass);
FRIEND_TEST(FillTaskWithProjectedMulticlassClassificationTaskTest,
WorksCorrectly);
FRIEND_TEST(FillTaskWithProjectedMulticlassClassificationTaskTest,
BalancedClass);
FRIEND_TEST(FillTaskWithProjectedMulticlassClassificationTaskTest,
SoftensLabels);
FRIEND_TEST(FillTaskWithCustomNNClassificationDataTest, BalancedClass);
FRIEND_TEST(FillTaskWithCustomNNDistillationDataTest, PermanenceTest);
FRIEND_TEST(CreateTaskWithPolynomialRegressionDataTest, LabelsAreCorrect);
FRIEND_TEST(CreateTaskWithRandomPolynomialDataTest,
DifferentForDifferentSeeds);
FRIEND_TEST(CreateTaskWithRationalDataTest,
LabelsAreCorrect);
FRIEND_TEST(CreateTaskWithRandomRationalDataTest,
DifferentForDifferentSeeds);
FRIEND_TEST(UnitTestFixedTaskCreatorTest, GeneratesScalarTask);
FRIEND_TEST(UnitTestFixedTaskCreatorTest, GeneratesVectorTask);
FRIEND_TEST(FillWithDynamicMatrix, FillWithDynamicMatrixPermanenceTest);
FRIEND_TEST(TaskTest, HasCorrectSizes);
FRIEND_TEST(CreateTaskWithRandomMulticlassRationalDataTest,
DifferentParamSeedsCoverAllLabelIndexes);
FRIEND_TEST(CreateTaskWithRandomMulticlassRationalDataTest,
SameParamSeedsUsesOnlyTwoLabelIndexes);
// ***IMPORTANT***: if you add a member variable below, you *must* also add it
// to the move constructor. Or else it may just disappear in the middle of
// your experiment.
// The xx_features_ and xx_labels_ only contain one epoch worth of examples.
// The xx_epochs_ is a list of lists where the outer index is the epoch number
// and the inner list is the order of the examples in that epoch.
const std::vector<Vector<F>> train_features_;
const std::vector<Scalar> train_labels_;
const std::vector<std::vector<IntegerT>> train_epochs_;
const std::vector<Vector<F>> valid_features_;
const std::vector<Scalar> valid_labels_;
const std::vector<std::vector<IntegerT>> valid_epochs_;
};
template <FeatureIndexT F>
class TaskIterator {
public:
TaskIterator(const std::vector<Vector<F>>* features,
const std::vector<Scalar>* labels,
const std::vector<std::vector<IntegerT>>* epochs)
: features_(features),
labels_(labels),
epochs_(epochs),
current_example_(0),
current_epoch_(0) {}
TaskIterator(const TaskIterator&) = delete;
TaskIterator& operator=(const TaskIterator&) = delete;
TaskIterator(TaskIterator&& other)
: features_(other.features_),
labels_(other.labels_),
epochs_(other.epochs_),
current_example_(other.current_example_),
current_epoch_(other.current_epoch_) {}
TaskIterator& operator=(TaskIterator&& other) {
this->features_ = other.features_;
this->labels_ = other.labels_;
this->epochs_ = other.epochs_;
this->current_example_ = other.current_example_;
this->current_epoch_ = other.current_epoch_;
return *this;
}
bool Done() const {
return current_epoch_ >= epochs_->size();
}
void Next() {
CHECK_LE(current_epoch_, epochs_->size());
++current_example_;
if (current_example_ >= features_->size()) {
current_example_ = 0;
++current_epoch_;
}
}
inline const Vector<F>& GetFeatures() const {
return features_->at(epochs_->at(current_epoch_).at(current_example_));
}
inline const Scalar& GetLabel() const {
return labels_->at(epochs_->at(current_epoch_).at(current_example_));
}
private:
const std::vector<Vector<F>>* features_;
const std::vector<Scalar>* labels_;
const std::vector<std::vector<IntegerT>>* epochs_;
IntegerT current_example_;
IntegerT current_epoch_;
};
} // namespace automl_zero
#endif // AUTOML_ZERO_TASK_H_
| C | 5 | deepneuralmachine/google-research | automl_zero/task.h | [
"Apache-2.0"
] |
import System
import Boo.Lang.Interpreter from Boo.Lang.Interpreter
class ObjectInterpreter(AbstractInterpreter):
_context as object
[getter(Value)]
_value as object
def constructor(context):
_context = context
self.RememberLastValue = true
override def Lookup(name as string):
property = _context.GetType().GetProperty(name)
return property.PropertyType if property is not null
override def GetValue(name as string):
return _context.GetType().GetProperty(name).GetValue(
_context, null)
override def SetLastValue(value):
_value = value
override def SetValue(name as string, value):
raise InvalidOperationException()
override def Declare(name as string, type as Type):
raise InvalidOperationException()
class Person:
[property(FirstName)]
_fname as string = ""
p = Person(FirstName: "Homer")
i = ObjectInterpreter(p)
i.Eval('"Hello, ${FirstName.ToUpper()}!"')
print i.Value
| Boo | 3 | btashton/pygments | tests/examplefiles/test.boo | [
"BSD-2-Clause"
] |
Private
'#TEXT_FILES+="*.txt|*.xml|*.json|*.glsl"
#TEXT_FILES+="*.glsl"
Import mojo.app
Import opengl.gles20
Import brl.filepath
Import glslparser
Import math3d
Import glutil
Import "data/mojo2_font.png"
Import "data/mojo2_program.glsl"
Import "data/mojo2_fastshader.glsl"
Import "data/mojo2_bumpshader.glsl"
Import "data/mojo2_matteshader.glsl"
Import "data/mojo2_shadowshader.glsl"
Import "data/mojo2_lightmapshader.glsl"
Const VBO_USAGE:=GL_STREAM_DRAW
Const VBO_ORPHANING_ENABLED:=False'True
#If TARGET="glfw" Or TARGET="android" Or TARGET="html5" Or CONFIG="debug"
Const GraphicsCanCrash:=True
#Else
Const GraphicsCanCrash:=False
#Endif
#If TARGET="glfw"
Extern
Global graphicsSeq:Int="glfwGraphicsSeq"
Private
#Else If TARGET="android"
Extern
Global graphicsSeq:Int="gxtkGraphics.seq"
Private
#Else If TARGET="html5"
Extern
Global graphicsSeq:Int="webglGraphicsSeq"
Private
#Else
Global graphicsSeq:Int=1
#Endif
Const MAX_LIGHTS:=4
Const BYTES_PER_VERTEX:=28
'can really be anything <64K (due to 16bit indices) but this keeps total VBO size<64K, and making it bigger doesn't seem to improve performance much.
Const MAX_VERTICES:=65536/BYTES_PER_VERTEX
Const MAX_QUADS:=MAX_VERTICES/4
Const MAX_QUAD_INDICES:=MAX_QUADS*6
Const PRIM_VBO_SIZE:=MAX_VERTICES*BYTES_PER_VERTEX
Global tmpi:Int[16]
Global tmpf:Float[16]
Global defaultFbo:Int
Global tmpMat2d:Float[6]
Global tmpMat3d:Float[16]
Global tmpMat3d2:Float[16]
Global mainShader:String
Global fastShader:Shader
Global bumpShader:Shader
Global matteShader:Shader
Global shadowShader:Shader
Global lightMapShader:Shader
Global defaultFont:Font
Global defaultShader:Shader
Global freeOps:=New Stack<DrawOp>
Global nullOp:=New DrawOp
'shader params
Global rs_projMatrix:=Mat4New()
Global rs_modelViewMatrix:=Mat4New()
Global rs_modelViewProjMatrix:=Mat4New()
Global rs_clipPosScale:=[1.0,1.0,1.0,1.0]
Global rs_globalColor:=[1.0,1.0,1.0,1.0]
Global rs_numLights:Int
Global rs_fogColor:=[0.0,0.0,0.0,0.0]
Global rs_ambientLight:=[0.0,0.0,0.0,1.0]
Global rs_lightColors:Float[MAX_LIGHTS*4]
Global rs_lightVectors:Float[MAX_LIGHTS*4]
Global rs_shadowTexture:Texture
Global rs_program:GLProgram
Global rs_material:Material
Global rs_blend:Int=-1
Global rs_vbo:Int
Global rs_ibo:Int
Function IsPow2:Bool( sz:Int )
Return (sz & (sz-1))=0
End
Class LightData
Field type:Int=0
Field color:Float[]=[1.0,1.0,1.0,1.0]
Field position:Float[]=[0.0,0.0,-10.0]
Field range:Float=10
'
Field vector:Float[]=[0.0,0.0,-10.0,1.0]
Field tvector:Float[4]
End
Global flipYMatrix:=Mat4New()
Global vbosSeq:Int
Function InitVbos:Void()
If vbosSeq=graphicsSeq Return
vbosSeq=graphicsSeq
' Print "InitVbos()"
rs_vbo=glCreateBuffer()
glBindBuffer GL_ARRAY_BUFFER,rs_vbo
glBufferData GL_ARRAY_BUFFER,PRIM_VBO_SIZE,Null,VBO_USAGE
glEnableVertexAttribArray 0 ; glVertexAttribPointer 0,2,GL_FLOAT,False,BYTES_PER_VERTEX,0
glEnableVertexAttribArray 1 ; glVertexAttribPointer 1,2,GL_FLOAT,False,BYTES_PER_VERTEX,8
glEnableVertexAttribArray 2 ; glVertexAttribPointer 2,2,GL_FLOAT,False,BYTES_PER_VERTEX,16
glEnableVertexAttribArray 3 ; glVertexAttribPointer 3,4,GL_UNSIGNED_BYTE,True,BYTES_PER_VERTEX,24
rs_ibo=glCreateBuffer()
glBindBuffer GL_ELEMENT_ARRAY_BUFFER,rs_ibo
Local idxs:=New DataBuffer( MAX_QUAD_INDICES*4*2,True )
For Local j:=0 Until 4
Local k:=j*MAX_QUAD_INDICES*2
For Local i:=0 Until MAX_QUADS
idxs.PokeShort i*12+k+0,i*4+j+0
idxs.PokeShort i*12+k+2,i*4+j+1
idxs.PokeShort i*12+k+4,i*4+j+2
idxs.PokeShort i*12+k+6,i*4+j+0
idxs.PokeShort i*12+k+8,i*4+j+2
idxs.PokeShort i*12+k+10,i*4+j+3
Next
Next
glBufferData GL_ELEMENT_ARRAY_BUFFER,idxs.Length,idxs,GL_STATIC_DRAW
idxs.Discard
End
Global inited:Bool
Function InitMojo2:Void()
If inited Return
inited=True
InitVbos
glGetIntegerv GL_FRAMEBUFFER_BINDING,tmpi
defaultFbo=tmpi[0]
mainShader=LoadString( "monkey://data/mojo2_program.glsl" )
fastShader=New Shader( LoadString( "monkey://data/mojo2_fastshader.glsl" ) )
bumpShader=New BumpShader( LoadString( "monkey://data/mojo2_bumpshader.glsl" ) )
matteShader=New MatteShader( LoadString( "monkey://data/mojo2_matteshader.glsl" ) )
shadowShader=New Shader( LoadString( "monkey://data/mojo2_shadowshader.glsl" ) )
lightMapShader=New Shader( LoadString( "monkey://data/mojo2_lightmapshader.glsl" ) )
defaultShader=bumpShader
defaultFont=Font.Load( "monkey://data/mojo2_font.png",32,96,True )'9,13,1,0,7,13,32,96 )
If Not defaultFont Error "Can't load default font"
flipYMatrix[5]=-1
End
Class RefCounted
Method Retain:Void()
If _refs<=0 Error "Internal error"
_refs+=1
End
Method Release:Void()
If _refs<=0 Error "Internal error"
_refs-=1
If _refs Return
_refs=-1
Destroy
End
Method Destroy:Void() Abstract
Private
Field _refs:=1
End
Function KludgePath:String( path:String )
If path.StartsWith( "." ) Or path.StartsWith( "/" ) Return path
Local i:=path.Find( ":/" )
If i<>-1 And path.Find("/")=i+1 Return path
Return "monkey://data/"+path
End
Public
Function CrashGraphics:Void()
If GraphicsCanCrash graphicsSeq+=1
End
'***** Texture *****
Class Texture Extends RefCounted
'flags
Const Filter:=1
Const Mipmap:=2
Const ClampS:=4
Const ClampT:=8
Const ClampST:=12
Const RenderTarget:=16
Const Managed:=256
Method New( width:Int,height:Int,format:Int,flags:Int )
Init width,height,format,flags
If _flags & Managed
Local data:=New DataBuffer( width*height*4 )
For Local i:=0 Until width*height*4 Step 4
data.PokeInt i,$ffff00ff
Next
_data=data
Endif
' Print "Created texture"
End
Method Destroy:Void()
' Print "Destroying texture"
If _seq=graphicsSeq
If _glTexture glDeleteTexture _glTexture
If _glFramebuffer glDeleteFramebuffer _glFramebuffer
Endif
_glTexture=0
_glFramebuffer=0
End
Method Validate:Void()
If _seq=graphicsSeq Return
Init
If _data LoadData _data
End
Method Width:Int() Property
Return _width
End
Method Height:Int() Property
Return _height
End
Method Format:Int() Property
Return _format
End
Method Flags:Int() Property
Return _flags
End
Method WritePixels:Void( x:Int,y:Int,width:Int,height:Int,data:DataBuffer,dataOffset:Int=0,dataPitch:Int=0 )
glPushTexture2d GLTexture
If Not dataPitch Or dataPitch=width*4
glTexSubImage2D GL_TEXTURE_2D,0,x,y,width,height,GL_RGBA,GL_UNSIGNED_BYTE,data,dataOffset
Else
For Local iy:=0 Until height
glTexSubImage2D GL_TEXTURE_2D,0,x,y+iy,width,1,GL_RGBA,GL_UNSIGNED_BYTE,data,dataOffset+iy*dataPitch
Next
Endif
glPopTexture2d
If _flags & Managed
Local texPitch:=_width*4
If Not dataPitch dataPitch=width*4
For Local iy:=0 Until height
data.CopyBytes( dataOffset+iy*dataPitch,DataBuffer( _data ),(y+iy)*texPitch+x*4,width*4 )
Next
Endif
End
Method UpdateMipmaps:Void()
If Not (_flags & Mipmap) Return
If _seq<>graphicsSeq Return 'we're boned!
glPushTexture2d GLTexture
glGenerateMipmap GL_TEXTURE_2D
glPopTexture2d
End
Method Loading:Bool() Property
#If TARGET="html5"
Return GLTextureLoading( _glTexture )
#Else
Return False
#Endif
End
Method GLTexture:Int() Property
Validate
Return _glTexture
End
Method GLFramebuffer:Int() Property
Validate
Return _glFramebuffer
End
Function TexturesLoading:Int()
#If TARGET="html5"
Return GLTexturesLoading()
#Else
Return 0
#Endif
End
Function Load:Texture( path:String,format:Int=4,flags:Int=Filter|Mipmap|ClampST )
Local info:Int[2]
#If TARGET="glfw" Or TARGET="ios"
Local data:=LoadImageData( KludgePath( path ),info ) 'data is a databuffer
If data
For Local i:=0 Until data.Length Step 4
Local t:=data.PeekInt( i )
Local a:=(t Shr 24 & 255)
Local b:=(t Shr 16 & 255)*a/255
Local g:=(t Shr 8 & 255)*a/255
Local r:=(t & 255)*a/255
data.PokeInt i,a Shl 24 | b Shl 16 | g Shl 8 | r
Next
Endif
#Else
Local data:=LoadStaticTexImage( KludgePath( path ),info ) 'data is an Image/Bitmap
#Endif
If Not data
' Print "Texture.Load - LoadImageData failed: path="+path
Return Null
Endif
Local tex:=New Texture( info[0],info[1],format,flags,data )
#If TARGET="glfw" Or TARGET="ios"
If Not tex._data data.Discard
#Endif
Return tex
End
Function Color:Texture( color:Int )
Local tex:=_colors.Get( color )
If tex Return tex
Local data:=New DataBuffer( 4 )
data.PokeInt 0,color
tex=New Texture( 1,1,4,ClampST,data )
#If TARGET="glfw" Or TARGET="ios"
If Not tex._data data.Discard
#Endif
_colors.Set color,tex
Return tex
End
Function Black:Texture()
If Not _black _black=Color( $ff000000 )
Return _black
End
Function White:Texture()
If Not _white _white=Color( $ffffffff )
Return _white
End
Function Magenta:Texture()
If Not _magenta _magenta=Color( $ffff00ff )
Return _magenta
End
Function Flat:Texture()
If Not _flat _flat=Color( $ff888888 )
Return _flat
End
Private
Global _colors:=New IntMap<Texture>
Global _black:Texture
Global _white:Texture
Global _magenta:Texture
Global _flat:Texture
Field _seq:Int
Field _width:Int
Field _height:Int
Field _format:Int
Field _flags:Int
Field _data:Object
Field _glTexture:Int
Field _glFramebuffer:Int
Method New( width:Int,height:Int,format:Int,flags:Int,data:Object )
Init width,height,format,flags
LoadData data
If GraphicsCanCrash
_data=data
Endif
End
Method Init:Void( width:Int,height:Int,format:Int,flags:Int )
InitMojo2
'TODO: more tex formats
If format<>4 Error "Invalid texture format: "+format
#If TARGET<>"glfw"
'can't mipmap NPOT textures on gles20
If Not IsPow2( width ) Or Not IsPow2( height ) flags&=~Mipmap
#Endif
If Not GraphicsCanCrash
_flags&=~Managed
Endif
_width=width
_height=height
_format=format
_flags=flags
Init
End
Method Init:Void()
_seq=graphicsSeq
_glTexture=glCreateTexture()
glPushTexture2d _glTexture
If _flags & Filter
glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR
Else
glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST
Endif
If (_flags & Mipmap) And (_flags & Filter)
glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR
Else If _flags & Mipmap
glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST_MIPMAP_NEAREST
Else If _flags & Filter
glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR
Else
glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST
Endif
If _flags & ClampS glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE
If _flags & ClampT glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE
glTexImage2D GL_TEXTURE_2D,0,GL_RGBA,_width,_height,0,GL_RGBA,GL_UNSIGNED_BYTE,Null
glPopTexture2d
If _flags & RenderTarget
_glFramebuffer=glCreateFramebuffer()
glPushFramebuffer _glFramebuffer
glBindFramebuffer GL_FRAMEBUFFER,_glFramebuffer
glFramebufferTexture2D GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0,GL_TEXTURE_2D,_glTexture,0
If glCheckFramebufferStatus( GL_FRAMEBUFFER )<>GL_FRAMEBUFFER_COMPLETE Error "Incomplete framebuffer"
glPopFramebuffer
Endif
End
Method LoadData:Void( data:Object )
glPushTexture2d GLTexture
#If TARGET="glfw" Or TARGET="ios"
glTexImage2D GL_TEXTURE_2D,0,GL_RGBA,_width,_height,0,GL_RGBA,GL_UNSIGNED_BYTE,DataBuffer( data )
#Else
If DataBuffer( data )
glTexImage2D GL_TEXTURE_2D,0,GL_RGBA,_width,_height,0,GL_RGBA,GL_UNSIGNED_BYTE,DataBuffer( data )
Else
glTexImage2D GL_TEXTURE_2D,0,GL_RGBA,GL_RGBA,GL_UNSIGNED_BYTE,data
Endif
#Endif
glPopTexture2d
UpdateMipmaps
End
End
'***** Shader ****
Private
Class GLUniform
Field name:String
Field location:Int
Field size:Int
Field type:Int
Method New( name:String,location:Int,size:Int,type:Int )
Self.name=name
Self.location=location
Self.size=size
Self.type=type
End
End
Class GLProgram
Field program:Int
'material uniforms
Field matuniforms:GLUniform[]
'hard coded uniform locations
Field mvpMatrix:Int
Field mvMatrix:Int
Field clipPosScale:Int
Field globalColor:int
Field ambientLight:Int
Field fogColor:int
Field lightColors:Int
Field lightVectors:Int
Field shadowTexture:Int
Method New( program:Int,matuniforms:GLUniform[] )
Self.program=program
Self.matuniforms=matuniforms
mvpMatrix=glGetUniformLocation( program,"ModelViewProjectionMatrix" )
mvMatrix=glGetUniformLocation( program,"ModelViewMatrix" )
clipPosScale=glGetUniformLocation( program,"ClipPosScale" )
globalColor=glGetUniformLocation( program,"GlobalColor" )
fogColor=glGetUniformLocation( program,"FogColor" )
ambientLight=glGetUniformLocation( program,"AmbientLight" )
lightColors=glGetUniformLocation( program,"LightColors" )
lightVectors=glGetUniformLocation( program,"LightVectors" )
shadowTexture=glGetUniformLocation( program,"ShadowTexture" )
End
Method Bind:Void()
glUseProgram program
If mvpMatrix<>-1 glUniformMatrix4fv mvpMatrix,1,False,rs_modelViewProjMatrix
If mvMatrix<>-1 glUniformMatrix4fv mvMatrix,1,False,rs_modelViewMatrix
If clipPosScale<>-1 glUniform4fv clipPosScale,1,rs_clipPosScale
If globalColor<>-1 glUniform4fv globalColor,1,rs_globalColor
If fogColor<>-1 glUniform4fv fogColor,1,rs_fogColor
If ambientLight<>-1 glUniform4fv ambientLight,1,rs_ambientLight
If lightColors<>-1 glUniform4fv lightColors,rs_numLights,rs_lightColors
If lightVectors<>-1 glUniform4fv lightVectors,rs_numLights,rs_lightVectors
glActiveTexture GL_TEXTURE0+7
If shadowTexture<>-1 And rs_shadowTexture
glBindTexture GL_TEXTURE_2D,rs_shadowTexture.GLTexture
glUniform1i shadowTexture,7
Else
glBindTexture GL_TEXTURE_2D,Texture.White().GLTexture
End
glActiveTexture GL_TEXTURE0
End
End
Public
Class Shader
Method New( source:String )
Build source
End
Method DefaultMaterial:Material()
If Not _defaultMaterial _defaultMaterial=New Material( Self )
Return _defaultMaterial
End
Function FastShader:Shader()
Return fastShader
End
Function BumpShader:Shader()
Return bumpShader
End
Function MatteShader:Shader()
Return matteShader
End
Function ShadowShader:Shader()
Return shadowShader
End
Function LightMapShader:Shader()
Return lightMapShader
End
Function DefaultShader:Shader()
Return defaultShader
End
Function SetDefaultShader:Void( shader:Shader )
If Not shader shader=bumpShader
defaultShader=shader
End
Protected
Method Build:Void( source:String )
_source=source
Build
End
Method OnInitMaterial:Void( material:Material )
material.SetTexture "ColorTexture",Texture.White()
End
Method OnLoadMaterial:Material( material:Material,path:String,texFlags:Int )
Local texture:=Texture.Load( path,4,texFlags )
If Not texture Return Null
material.SetTexture "ColorTexture",texture
If texture texture.Release
Return material
End
Private
Const MAX_FLAGS:=8
Field _seq:Int
Field _source:String
Field _vsource:String
Field _fsource:String
Field _uniforms:=New StringSet
Field _glPrograms:GLProgram[MAX_LIGHTS+1]
Field _defaultMaterial:Material
Method Bind:Void()
Local program:=GLProgram()
If program=rs_program Return
rs_program=program
rs_material=Null
program.Bind
End
Method GLProgram:GLProgram() Property
If _seq<>graphicsSeq
_seq=graphicsSeq
rs_program=Null
Build
Endif
Return _glPrograms[rs_numLights]
End
Method Build:GLProgram( numLights:Int )
Local defs:=""
defs+="#define NUM_LIGHTS "+numLights+"~n"
Local vshader:=glCompile( GL_VERTEX_SHADER,defs+_vsource )
Local fshader:=glCompile( GL_FRAGMENT_SHADER,defs+_fsource )
Local program:=glCreateProgram()
glAttachShader program,vshader
glAttachShader program,fshader
glDeleteShader vshader
glDeleteShader fshader
glBindAttribLocation program,0,"Position"
glBindAttribLocation program,1,"Texcoord0"
glBindAttribLocation program,2,"Tangent"
glBindAttribLocation program,3,"Color"
glLink program
'enumerate program uniforms
Local matuniforms:=New Stack<GLUniform>
Local size:Int[1],type:Int[1],name:String[1]
glGetProgramiv program,GL_ACTIVE_UNIFORMS,tmpi
For Local i:=0 Until tmpi[0]
glGetActiveUniform program,i,size,type,name
If _uniforms.Contains( name[0] )
Local location:=glGetUniformLocation( program,name[0] )
If location=-1 Continue 'IE fix...
matuniforms.Push New GLUniform( name[0],location,size[0],type[0] )
' Print "New GLUniform: name="+name[0]+", location="+location+", size="+size[0]+", type="+type[0]
Endif
Next
Return New GLProgram( program,matuniforms.ToArray() )
End
Method Build:Void()
InitMojo2
Local p:=New GlslParser( _source )
Local vars:=New StringSet
While p.Toke
If p.CParse( "uniform" )
'uniform decl
Local ty:=p.ParseType()
Local id:=p.ParseIdent()
p.Parse ";"
_uniforms.Insert id
' Print "uniform "+ty+" "+id+";"
Continue
Endif
Local id:=p.CParseIdent()
If id
If id.StartsWith( "gl_" )
vars.Insert "B3D_"+id.ToUpper()
Else If id.StartsWith( "b3d_" )
vars.Insert id.ToUpper()
Endif
Continue
Endif
p.Bump
Wend
Local vardefs:=""
For Local var:=Eachin vars
vardefs+="#define "+var+" 1~n"
Next
' Print "Vardefs:";Print vardefs
Local source:=mainShader
Local i0:=source.Find( "//@vertex" )
If i0=-1 Error "Can't find //@vertex chunk"
Local i1:=source.Find( "//@fragment" )
If i1=-1 Error "Can't find //@fragment chunk"
Local header:=vardefs+source[..i0]
_vsource=header+source[i0..i1]
_fsource=header+source[i1..].Replace( "${SHADER}",_source )
For Local numLights:=0 To MAX_LIGHTS
_glPrograms[numLights]=Build( numLights )
If numLights Or vars.Contains( "B3D_DIFFUSE" ) Or vars.Contains( "B3D_SPECULAR" ) Continue
For Local i:=1 To MAX_LIGHTS
_glPrograms[i]=_glPrograms[0]
Next
Exit
Next
End
End
Class BumpShader Extends Shader
Method New( source:String )
Super.New( source )
End
Protected
Method OnInitMaterial:Void( material:Material )
material.SetTexture "ColorTexture",Texture.White()
material.SetTexture "SpecularTexture",Texture.Black()
material.SetTexture "NormalTexture",Texture.Flat()
material.SetVector "AmbientColor",[1.0,1.0,1.0,1.0]
material.SetScalar "Roughness",1.0
End
Method OnLoadMaterial:Material( material:Material,path:String,texFlags:Int )
Local format:=4
Local ext:=ExtractExt( path )
If ext path=StripExt( path ) Else ext="png"
Local colorTex:=Texture.Load( path+"."+ext,format,texFlags )
If Not colorTex colorTex=Texture.Load( path+"_d."+ext,format,texFlags )
If Not colorTex colorTex=Texture.Load( path+"_diff."+ext,format,texFlags )
If Not colorTex colorTex=Texture.Load( path+"_diffuse."+ext,format,texFlags )
Local specularTex:=Texture.Load( path+"_s."+ext,format,texFlags )
If Not specularTex specularTex=Texture.Load( path+"_spec."+ext,format,texFlags )
If Not specularTex specularTex=Texture.Load( path+"_specular."+ext,format,texFlags )
If Not specularTex specularTex=Texture.Load( path+"_SPECULAR."+ext,format,texFlags )
Local normalTex:=Texture.Load( path+"_n."+ext,format,texFlags )
If Not normalTex normalTex=Texture.Load( path+"_norm."+ext,format,texFlags )
If Not normalTex normalTex=Texture.Load( path+"_normal."+ext,format,texFlags )
If Not normalTex normalTex=Texture.Load( path+"_NORMALS."+ext,format,texFlags )
If Not colorTex And Not specularTex And Not normalTex Return Null
material.SetTexture "ColorTexture",colorTex
material.SetTexture "SpecularTexture",specularTex
material.SetTexture "NormalTexture",normalTex
If specularTex Or normalTex
material.SetVector "AmbientColor",[0.0,0.0,0.0,1.0]
material.SetScalar "Roughness",.5
Endif
If colorTex colorTex.Release
If specularTex specularTex.Release
If normalTex normalTex.Release
Return material
End
End
Class MatteShader Extends Shader
Method New( source:String )
Super.New( source )
End
Protected
Method OnInitMaterial:Void( material:Material )
material.SetTexture "ColorTexture",Texture.White()
material.SetVector "AmbientColor",[0.0,0.0,0.0,1.0]
material.SetScalar "Roughness",1.0
End
End
'***** Material *****
Class Material Extends RefCounted
Method New( shader:Shader=Null )
InitMojo2
If Not shader shader=defaultShader
_shader=shader
_shader.OnInitMaterial( Self )
_inited=True
End
Method Discard:Void()
Super.Release()
End
Method Destroy:Void()
For Local tex:=Eachin _textures
tex.Value.Release
Next
End
Method Shader:Shader() Property
Return _shader
End
Method ColorTexture:Texture() Property
Return _colorTexture
End
Method Width:Int() Property
If _colorTexture Return _colorTexture._width
Return 0
End
Method Height:Int() Property
If _colorTexture Return _colorTexture._height
Return 0
End
Method SetScalar:Void( param:String,scalar:Float )
If _inited And Not _scalars.Contains( param ) Return
_scalars.Set param,scalar
End
Method GetScalar:Float( param:String,defValue:Float=1.0 )
If Not _scalars.Contains( param ) Return defValue
Return _scalars.Get( param )
End
Method SetVector:Void( param:String,vector:Float[] )
If _inited And Not _vectors.Contains( param ) Return
_vectors.Set param,vector
End
Method GetVector:Float[]( param:String,defValue:Float[]=[1.0,1.0,1.0,1.0] )
If Not _vectors.Contains( param ) Return defValue
Return _vectors.Get( param )
End
Method SetTexture:Void( param:String,texture:Texture )
If Not texture Return
If _inited And Not _textures.Contains( param ) Return
Local old:=_textures.Get( param )
texture.Retain
_textures.Set param,texture
If old old.Release
If param="ColorTexture" _colorTexture=texture
End
Method GetTexture:Texture( param:String,defValue:Texture=Null )
If Not _textures.Contains( param ) Return defValue
Return _textures.Get( param )
End
Method Loading:Bool()
#If TARGET="html5"
For Local it:=Eachin _textures
If it.Value.Loading Return True
Next
#Endif
Return False
End
Function Load:Material( path:String,texFlags:Int,shader:Shader )
Local material:=New Material( shader )
material=material.Shader.OnLoadMaterial( material,path,texFlags )
Return material
End
Private
Field _shader:Shader
Field _colorTexture:Texture
Field _scalars:=New StringMap<Float>
Field _vectors:=New StringMap<Float[]>
Field _textures:=New StringMap<Texture>
Field _inited:Bool
Method Bind:Bool()
_shader.Bind
If rs_material=Self Return True
rs_material=Self
Local texid:=0
For Local u:=Eachin rs_program.matuniforms
Select u.type
Case GL_FLOAT
glUniform1f u.location,GetScalar( u.name )
Case GL_FLOAT_VEC4
glUniform4fv u.location,1,GetVector( u.name )
Case GL_SAMPLER_2D
Local tex:=GetTexture( u.name )
If tex.Loading
rs_material=Null
Exit
Endif
glActiveTexture GL_TEXTURE0+texid
glBindTexture GL_TEXTURE_2D,tex.GLTexture
glUniform1i u.location,texid
texid+=1
Default
Error "Unsupported uniform type: name="+u.name+", location="+u.location+", size="+u.size+", type="+u.type
End
Next
' For Local i:=texid Until 8
' glActiveTexture GL_TEXTURE0+i
' glBindTexture GL_TEXTURE_2D,Texture.White().GLTexture
' Next
If texid glActiveTexture GL_TEXTURE0
Return rs_material=Self
End
End
'***** ShaderCaster *****
Class ShadowCaster
Method New()
End
Method New( verts:Float[],type:Int )
_verts=verts
_type=type
End
Method SetVertices:Void( vertices:Float[] )
_verts=vertices
End
Method Vertices:Float[]() Property
Return _verts
End
Method SetType:Void( type:Int )
_type=type
End
Method Type:Int() Property
Return _type
End
Private
Field _verts:Float[]
Field _type:Int
End
'***** Image *****
Class Image
Const Filter:=Texture.Filter
Const Mipmap:=Texture.Mipmap
Const Managed:=Texture.Managed
Method New( width:Int,height:Int,xhandle:Float=.5,yhandle:Float=.5,flags:Int=Image.Filter )
flags&=_flagsMask
Local texture:=New Texture( width,height,4,flags|Texture.ClampST|Texture.RenderTarget )
_material=New Material( fastShader )
_material.SetTexture "ColorTexture",texture
texture.Release()
_width=width
_height=height
SetHandle xhandle,yhandle
End
Method New( image:Image,x:Int,y:Int,width:Int,height:Int,xhandle:Float=.5,yhandle:Float=.5 )
_material=image._material
_material.Retain
_x=image._x+x
_y=image._y+y
_width=width
_height=height
SetHandle xhandle,yhandle
End
Method New( material:Material,xhandle:Float=.5,yhandle:Float=.5 )
Local texture:=material.ColorTexture
If Not texture Error "Material has no ColorTexture"
_material=material
_material.Retain
_width=_material.Width
_height=_material.Height
SetHandle xhandle,yhandle
End
Method New( material:Material,x:Int,y:Int,width:Int,height:Int,xhandle:Float=.5,yhandle:Float=.5 )
Local texture:=material.ColorTexture
If Not texture Error "Material has no ColorTexture"
_material=material
_material.Retain
_x=x
_y=y
_width=width
_height=height
SetHandle xhandle,yhandle
End
Method Discard:Void()
If _material _material.Release
_material=Null
End
Method Material:Material() Property
Return _material
End
Method X0:Float() Property
Return _x0
End
Method Y0:Float() Property
Return _y0
End
Method X1:Float() Property
Return _x1
End
Method Y1:Float() Property
Return _y1
End
Method Width:Int() Property
Return _width
End
Method Height:Int() Property
Return _height
End
Method HandleX:Float() Property
Return -_x0/(_x1-_x0)
End
Method HandleY:Float() Property
Return -_y0/(_y1-_y0)
End
Method WritePixels:Void( x:Int,y:Int,width:Int,height:Int,data:DataBuffer,dataOffset:Int=0,dataPitch:Int=0 )
_material.ColorTexture.WritePixels( x+_x,y+_y,width,height,data,dataOffset,dataPitch )
End
Method SetHandle:Void( xhandle:Float,yhandle:Float )
_x0=Float(_width)*-xhandle
_x1=Float(_width)*(1-xhandle)
_y0=Float(_height)*-yhandle
_y1=Float(_height)*(1-yhandle)
_s0=Float(_x)/Float(_material.Width)
_t0=Float(_y)/Float(_material.Height)
_s1=Float(_x+_width)/Float(_material.Width)
_t1=Float(_y+_height)/Float(_material.Height)
End
Method SetShadowCaster:Void( shadowCaster:ShadowCaster )
_caster=shadowCaster
End
Method ShadowCaster:ShadowCaster() Property
Return _caster
End
Method Loading:Bool()
Return _material.Loading()
End
Function ImagesLoading:Bool()
Return Texture.TexturesLoading>0
End
Function SetFlagsMask:Void( mask:Int )
_flagsMask=mask
End
Function FlagsMask:Int()
Return _flagsMask
End
Function Load:Image( path:String,xhandle:Float=.5,yhandle:Float=.5,flags:Int=Image.Filter|Image.Mipmap,shader:Shader=Null )
flags&=_flagsMask
Local material:=.Material.Load( path,flags|Texture.ClampST,shader )
If Not material Return Null
Return New Image( material,xhandle,yhandle )
End
Function LoadFrames:Image[]( path:String,numFrames:Int,padded:Bool=False,xhandle:Float=.5,yhandle:Float=.5,flags:Int=Image.Filter|Image.Mipmap,shader:Shader=Null )
flags&=_flagsMask
Local material:=.Material.Load( path,flags|Texture.ClampST,shader )
If Not material Return []
Local cellWidth:=material.Width/numFrames,cellHeight:=material.Height
Local x:=0,width:=cellWidth
If padded x+=1;width-=2
Local frames:=New Image[numFrames]
For Local i:=0 Until numFrames
frames[i]=New Image( material,i*cellWidth+x,0,width,cellHeight,xhandle,yhandle )
Next
Return frames
End
Private
Global _flagsMask:=Filter|Mipmap|Managed
Field _material:Material
Field _x:Int,_y:Int,_width:Int,_height:Int
Field _x0:Float=-1,_y0:Float=-1,_x1:Float=1,_y1:Float=1
Field _s0:Float=0 ,_t0:Float=0 ,_s1:Float=1,_t1:Float=1
Field _caster:ShadowCaster
' Method SetFrame:Void( x0:Float,y0:Float,x1:Float,y1:Float,s0:Float,t0:Float,s1:Float,t1:Float )
' _x0=x0;_y0=y0;_x1=x1;_y1=y1
' _s0=s0;_t0=t0;_s1=s1;_t1=t1
' End
End
'***** Font *****
Class Glyph
Field image:Image
Field char:Int
Field x:Int
Field y:Int
Field width:Int
Field height:Int
Field advance:Float
Method New( image:Image,char:Int,x:Int,y:Int,width:Int,height:Int,advance:Float )
Self.image=image
Self.char=char
Self.x=x
Self.y=y
Self.width=width
Self.height=height
Self.advance=advance
End
End
Class Font
Method New( glyphs:Glyph[],firstChar:Int,height:Float )
_glyphs=glyphs
_firstChar=firstChar
_height=height
End
Method GetGlyph:Glyph( char:Int )
Local i:=char-_firstChar
If i>=0 And i<_glyphs.Length Return _glyphs[i]
Return Null
End
Method TextWidth:Float( text:String )
Local w:=0.0
For Local char:=Eachin text
Local glyph:=GetGlyph( char )
If Not glyph Continue
w+=glyph.advance
Next
Return w
End
Method TextHeight:Float( text:String )
Return _height
End
Function Load:Font( path:String,firstChar:Int,numChars:Int,padded:Bool )
Local image:=Image.Load( path )
If Not image Return Null
Local cellWidth:=image.Width/numChars
Local cellHeight:=image.Height
Local glyphX:=0,glyphY:=0,glyphWidth:=cellWidth,glyphHeight:=cellHeight
If padded glyphX+=1;glyphY+=1;glyphWidth-=2;glyphHeight-=2
Local w:=image.Width/cellWidth
Local h:=image.Height/cellHeight
Local glyphs:=New Glyph[numChars]
For Local i:=0 Until numChars
Local y:=i / w
Local x:=i Mod w
Local glyph:=New Glyph( image,firstChar+i,x*cellWidth+glyphX,y*cellHeight+glyphY,glyphWidth,glyphHeight,glyphWidth )
glyphs[i]=glyph
Next
Return New Font( glyphs,firstChar,glyphHeight )
End
Function Load:Font( path:String,cellWidth:Int,cellHeight:Int,glyphX:Int,glyphY:Int,glyphWidth:Int,glyphHeight:Int,firstChar:Int,numChars:Int )
Local image:=Image.Load( path )
If Not image Return Null
Local w:=image.Width/cellWidth
Local h:=image.Height/cellHeight
Local glyphs:=New Glyph[numChars]
For Local i:=0 Until numChars
Local y:=i / w
Local x:=i Mod w
Local glyph:=New Glyph( image,firstChar+i,x*cellWidth+glyphX,y*cellHeight+glyphY,glyphWidth,glyphHeight,glyphWidth )
glyphs[i]=glyph
Next
Return New Font( glyphs,firstChar,glyphHeight )
End
Private
Field _glyphs:Glyph[]
Field _firstChar:Int
Field _height:Float
End
'***** DrawList *****
Class DrawOp
' Field shader:Shader
Field material:Material
Field blend:Int
Field order:Int
Field count:Int
End
Class BlendMode
Const Opaque:=0
Const Alpha:=1
Const Additive:=2
Const Multiply:=3
Const Multiply2:=4
End
Class DrawList
Method New()
InitMojo2
SetFont Null
SetDefaultMaterial fastShader.DefaultMaterial
End
Method SetBlendMode:Void( blend:Int )
_blend=blend
End
Method BlendMode:Int() Property
Return _blend
End
Method SetColor:Void( r:Float,g:Float,b:Float )
_color[0]=r
_color[1]=g
_color[2]=b
_pmcolor=Int(_alpha) Shl 24 | Int(_color[2]*_alpha) Shl 16 | Int(_color[1]*_alpha) Shl 8 | Int(_color[0]*_alpha)
End
Method SetColor:Void( r:Float,g:Float,b:Float,a:Float )
_color[0]=r
_color[1]=g
_color[2]=b
_color[3]=a
_alpha=a*255
_pmcolor=Int(_alpha) Shl 24 | Int(_color[2]*_alpha) Shl 16 | Int(_color[1]*_alpha) Shl 8 | Int(_color[0]*_alpha)
End
Method SetAlpha:Void( a:Float )
_color[3]=a
_alpha=a*255
_pmcolor=Int(_alpha) Shl 24 | Int(_color[2]*_alpha) Shl 16 | Int(_color[1]*_alpha) Shl 8 | Int(_color[0]*_alpha)
End
Method Color:Float[]() Property
Return [_color[0],_color[1],_color[2],_color[3]]
End
Method GetColor:Void( color:Float[] )
color[0]=_color[0]
color[1]=_color[1]
color[2]=_color[2]
If color.Length>3 color[3]=_color[3]
End
Method Alpha:Float() Property
Return _color[3]
End
Method ResetMatrix:Void()
_ix=1;_iy=0
_jx=0;_jy=1
_tx=0;_ty=0
End
Method SetMatrix:Void( ix:Float,iy:Float,jx:Float,jy:Float,tx:Float,ty:Float )
_ix=ix;_iy=iy
_jx=jx;_jy=jy
_tx=tx;_ty=ty
End
Method GetMatrix:Void( matrix:Float[] )
matrix[0]=_ix
matrix[1]=_iy
matrix[2]=_jx
matrix[3]=_jy
matrix[4]=_tx
matrix[5]=_ty
End
Method Transform:Void( ix:Float,iy:Float,jx:Float,jy:Float,tx:Float,ty:Float )
Local ix2:=ix*_ix+iy*_jx,iy2:=ix*_iy+iy*_jy
Local jx2:=jx*_ix+jy*_jx,jy2:=jx*_iy+jy*_jy
Local tx2:=tx*_ix+ty*_jx+_tx,ty2:=tx*_iy+ty*_jy+_ty
SetMatrix ix2,iy2,jx2,jy2,tx2,ty2
End
Method Translate:Void( tx:Float,ty:Float )
Transform 1,0,0,1,tx,ty
End
Method Rotate( rz:Float )
Transform Cos( rz ),-Sin( rz ),Sin( rz ),Cos( rz ),0,0
End
Method Scale:Void( sx:Float,sy:Float )
Transform sx,0,0,sy,0,0
End
Method TranslateRotate:Void( tx:Float,ty:Float,rz:Float )
Translate tx,ty
Rotate rz
End
Method RotateScale:Void( rz:Float,sx:Float,sy:Float )
Rotate rz
Scale sx,sy
End
Method TranslateScale:Void( tx:Float,ty:Float,sx:Float,sy:Float )
Translate tx,ty
Scale sx,sy
End
Method TranslateRotateScale:Void( tx:Float,ty:Float,rz:Float,sx:Float,sy:Float )
Translate tx,ty
Rotate rz
Scale sx,sy
End
Method SetMatrixStackCapacity:Void( capacity:Int )
_matStack=_matStack.Resize( capacity*6 )
_matSp=0
End
Method MatrixStackCapacity:Int()
Return _matStack.Length/6
End
Method PushMatrix:Void()
_matStack[_matSp+0]=_ix;_matStack[_matSp+1]=_iy
_matStack[_matSp+2]=_jx;_matStack[_matSp+3]=_jy
_matStack[_matSp+4]=_tx;_matStack[_matSp+5]=_ty
_matSp+=6 ; If _matSp>=_matStack.Length _matSp-=_matStack.Length
End
Method PopMatrix:Void()
_matSp-=6 ; If _matSp<0 _matSp+=_matStack.Length
_ix=_matStack[_matSp+0];_iy=_matStack[_matSp+1]
_jx=_matStack[_matSp+2];_jy=_matStack[_matSp+3]
_tx=_matStack[_matSp+4];_ty=_matStack[_matSp+5]
End
Method SetFont:Void( font:Font )
If Not font font=defaultFont
_font=font
End
Method Font:Font() Property
Return _font
End
Method SetDefaultMaterial:Void( material:Material )
_defaultMaterial=material
End
Method DefaultMaterial:Material() Property
Return _defaultMaterial
End
Method DrawPoint:Void( x0:Float,y0:Float,material:Material=Null,s0:Float=0,t0:Float=0 )
BeginPrim material,1
PrimVert x0+.5,y0+.5,s0,t0
End
Method DrawLine:Void( x0:Float,y0:Float,x1:Float,y1:Float,material:Material=Null,s0:Float=0,t0:Float=0,s1:Float=1,t1:Float=0 )
BeginPrim material,2
PrimVert x0+.5,y0+.5,s0,t0
PrimVert x1+.5,y1+.5,s1,t1
End
Method DrawTriangle:Void( x0:Float,y0:Float,x1:Float,y1:Float,x2:Float,y2:Float,material:Material=Null,s0:Float=.5,t0:Float=0,s1:Float=1,t1:Float=1,s2:Float=0,t2:Float=1 )
BeginPrim material,3
PrimVert x0,y0,s0,t0
PrimVert x1,y1,s1,t1
PrimVert x2,y2,s2,t2
End
Method DrawQuad:Void( x0:Float,y0:Float,x1:Float,y1:Float,x2:Float,y2:Float,x3:Float,y3:Float,material:Material=Null,s0:Float=.5,t0:Float=0,s1:Float=1,t1:Float=1,s2:Float=0,t2:Float=1 )
BeginPrim material,4
PrimVert x0,y0,s0,t0
PrimVert x1,y1,s1,t1
PrimVert x2,y2,s2,t2
PrimVert x3,y3,s2,t2
End
Method DrawOval:Void( x:Float,y:Float,width:Float,height:Float,material:Material=Null )
Local xr:=width/2.0,yr:=height/2.0
Local dx_x:=xr*_ix,dx_y:=xr*_iy,dy_x:=yr*_jx,dy_y:=yr*_jy
Local dx:=Sqrt( dx_x*dx_x+dx_y*dx_y ),dy:=Sqrt( dy_x*dy_x+dy_y*dy_y )
Local n:=Int( dx+dy )
If n<12
n=12
Else If n>MAX_VERTICES
n=MAX_VERTICES
Else
n&=~3
Endif
Local x0:=x+xr,y0:=y+yr
BeginPrim material,n
For Local i:=0 Until n
Local th:=i*360.0/n
Local px:=x0+Cos( th ) * xr
Local py:=y0+Sin( th ) * yr
PrimVert px,py,0,0
Next
End
Method DrawEllipse:Void( x:Float,y:Float,xr:Float,yr:Float,material:Material=Null )
DrawOval x-xr,y-yr,xr*2,yr*2,material
End
Method DrawCircle:Void( x:Float,y:Float,r:Float,material:Material=Null )
DrawOval x-r,y-r,r*2,r*2,material
End
Method DrawPoly:Void( vertices:Float[],material:Material=Null )
Local n:=vertices.Length/2
If n<3 Or n>MAX_VERTICES Return
BeginPrim material,n
For Local i:=0 Until n
PrimVert vertices[i*2],vertices[i*2+1],0,0
Next
End
Method DrawPrimitives:Void( order:Int,count:Int,vertices:Float[],material:Material=Null )
BeginPrims material,order,count
Local p:=0
For Local i:=0 Until count
For Local j:=0 Until order
PrimVert vertices[p],vertices[p+1],0,0
p+=2
Next
Next
End
Method DrawPrimitives:Void( order:Int,count:Int,vertices:Float[],texcoords:Float[],material:Material=Null )
BeginPrims material,order,count
Local p:=0
For Local i:=0 Until count
For Local j:=0 Until order
PrimVert vertices[p],vertices[p+1],texcoords[p],texcoords[p+1]
p+=2
Next
Next
End
Method DrawIndexedPrimitives:Void( order:Int,count:Int,vertices:Float[],indices:Int[],material:Material=Null )
BeginPrims material,order,count
Local p:=0
For Local i:=0 Until count
For Local j:=0 Until order
Local k:=indices[p+j]*2
PrimVert vertices[k],vertices[k+1],0,0
Next
p+=order
Next
End
Method DrawIndexedPrimitives:Void( order:Int,count:Int,vertices:Float[],texcoords:Float[],indices:Int[],material:Material=Null )
BeginPrims material,order,count
Local p:=0
For Local i:=0 Until count
For Local j:=0 Until order
Local k:=indices[p+j]*2
PrimVert vertices[k],vertices[k+1],texcoords[k],texcoords[k+1]
Next
p+=order
Next
End
Method DrawRect:Void( x0:Float,y0:Float,width:Float,height:Float,material:Material=Null,s0:Float=0,t0:Float=0,s1:Float=1,t1:Float=1 )
Local x1:=x0+width,y1:=y0+height
BeginPrim material,4
PrimVert x0,y0,s0,t0
PrimVert x1,y0,s1,t0
PrimVert x1,y1,s1,t1
PrimVert x0,y1,s0,t1
End
Method DrawRect:Void( x0:Float,y0:Float,width:Float,height:Float,image:Image )
DrawRect x0,y0,width,height,image._material,image._s0,image._t0,image._s1,image._t1
End
Method DrawRect:Void( x:Float,y:Float,image:Image,sourceX:Int,sourceY:Int,sourceWidth:Int,sourceHeight:Int )
DrawRect( x,y,sourceWidth,sourceHeight,image,sourceX,sourceY,sourceWidth,sourceHeight )
End
Method DrawRect:Void( x0:Float,y0:Float,width:Float,height:Float,image:Image,sourceX:Int,sourceY:Int,sourceWidth:Int,sourceHeight:Int )
Local material:=image._material
Local s0:=Float(image._x+sourceX)/Float(material.Width)
Local t0:=Float(image._y+sourceY)/Float(material.Height)
Local s1:=Float(image._x+sourceX+sourceWidth)/Float(material.Width)
Local t1:=Float(image._y+sourceY+sourceHeight)/Float(material.Height)
DrawRect x0,y0,width,height,material,s0,t0,s1,t1
End
'gradient rect - kinda hacky, but doesn't slow anything else down
Method DrawGradientRect:Void( x0:Float,y0:Float,width:Float,height:Float,r0:Float,g0:Float,b0:Float,a0:Float,r1:Float,g1:Float,b1:Float,a1:Float,axis:Int )
r0*=_color[0];g0*=_color[1];b0*=_color[2];a0*=_alpha
r1*=_color[0];g1*=_color[1];b1*=_color[2];a1*=_alpha
Local pm0:=Int( a0 ) Shl 24 | Int( b0*a0 ) Shl 16 | Int( g0*a0 ) Shl 8 | Int( r0*a0 )
Local pm1:=Int( a1 ) Shl 24 | Int( b1*a0 ) Shl 16 | Int( g1*a0 ) Shl 8 | Int( r1*a0 )
Local x1:=x0+width,y1:=y0+height,s0:=0.0,t0:=0.0,s1:=1.0,t1:=1.0
BeginPrim Null,4
Local pmcolor:=_pmcolor
BeginPrim Null,4
Select axis
Case 0 'left->right
_pmcolor=pm0
PrimVert x0,y0,s0,t0
_pmcolor=pm1
PrimVert x1,y0,s1,t0
PrimVert x1,y1,s1,t1
_pmcolor=pm0
PrimVert x0,y1,s0,t1
Default 'top->bottom
_pmcolor=pm0
PrimVert x0,y0,s0,t0
PrimVert x1,y0,s1,t0
_pmcolor=pm1
PrimVert x1,y1,s1,t1
PrimVert x0,y1,s0,t1
End
_pmcolor=pmcolor
End
Method DrawImage:Void( image:Image )
BeginPrim image._material,4
PrimVert image._x0,image._y0,image._s0,image._t0
PrimVert image._x1,image._y0,image._s1,image._t0
PrimVert image._x1,image._y1,image._s1,image._t1
PrimVert image._x0,image._y1,image._s0,image._t1
If image._caster AddShadowCaster image._caster
End
Method DrawImage:Void( image:Image,tx:Float,ty:Float )
PushMatrix
Translate tx,ty
DrawImage image
PopMatrix
#rem
BeginPrim image._material,4
PrimVert image._x0 + tx,image._y0 + ty,image._s0,image._t0
PrimVert image._x1 + tx,image._y0 + ty,image._s1,image._t0
PrimVert image._x1 + tx,image._y1 + ty,image._s1,image._t1
PrimVert image._x0 + tx,image._y1 + ty,image._s0,image._t1
#end
End
Method DrawImage:Void( image:Image,tx:Float,ty:Float,rz:Float )
PushMatrix
TranslateRotate tx,ty,rz
DrawImage image
PopMatrix
#rem
Local ix:=Cos( rz ),iy:=-Sin( rz )
Local jx:=Sin( rz ),jy:= Cos( rz )
Local x0:=image._x0,y0:=image._y0
Local x1:=image._x1,y1:=image._y1
BeginPrim image._material,4
PrimVert x0 * ix + y0 * jx + tx,x0 * iy + y0 * jy + ty,image._s0,image._t0
PrimVert x1 * ix + y0 * jx + tx,x1 * iy + y0 * jy + ty,image._s1,image._t0
PrimVert x1 * ix + y1 * jx + tx,x1 * iy + y1 * jy + ty,image._s1,image._t1
PrimVert x0 * ix + y1 * jx + tx,x0 * iy + y1 * jy + ty,image._s0,image._t1
#end
End
Method DrawImage:Void( image:Image,tx:Float,ty:Float,rz:Float,sx:Float,sy:Float )
PushMatrix
TranslateRotateScale tx,ty,rz,sx,sy
DrawImage image
PopMatrix
#rem
Local ix:=Cos( rz ),iy:=-Sin( rz )
Local jx:=Sin( rz ),jy:= Cos( rz )
Local x0:=image._x0 * sx,y0:=image._y0 * sy
Local x1:=image._x1 * sx,y1:=image._y1 * sy
BeginPrim image._material,4
PrimVert x0 * ix + y0 * jx + tx,x0 * iy + y0 * jy + ty,image._s0,image._t0
PrimVert x1 * ix + y0 * jx + tx,x1 * iy + y0 * jy + ty,image._s1,image._t0
PrimVert x1 * ix + y1 * jx + tx,x1 * iy + y1 * jy + ty,image._s1,image._t1
PrimVert x0 * ix + y1 * jx + tx,x0 * iy + y1 * jy + ty,image._s0,image._t1
#end
End
Method DrawText:Void( text:String,x:Float,y:Float,xhandle:Float=0,yhandle:Float=0 )
x-=_font.TextWidth( text )*xhandle
y-=_font.TextHeight( text )*yhandle
For Local char:=Eachin text
Local glyph:=_font.GetGlyph( char )
If Not glyph Continue
DrawRect x,y,glyph.image,glyph.x,glyph.y,glyph.width,glyph.height
x+=glyph.advance
Next
End
Method DrawShadow:Bool( lx:Float,ly:Float,x0:Float,y0:Float,x1:Float,y1:Float )
Local ext:=1024
Local dx:=x1-x0,dy:=y1-y0
Local d0:=Sqrt( dx*dx+dy*dy )
Local nx:=-dy/d0,ny:=dx/d0
Local pd:=-(x0*nx+y0*ny)
Local d:=lx*nx+ly*ny+pd
If d<0 Return False
Local x2:=x1-lx,y2:=y1-ly
Local d2:=ext/Sqrt( x2*x2+y2*y2 )
x2=lx+x2*ext;y2=ly+y2*ext
Local x3:=x0-lx,y3:=y0-ly
Local d3:=ext/Sqrt( x3*x3+y3*y3 )
x3=lx+x3*ext;y3=ly+y3*ext
Local x4:=(x2+x3)/2-lx,y4:=(y2+y3)/2-ly
Local d4:=ext/Sqrt( x4*x4+y4*y4 )
x4=lx+x4*ext;y4=ly+y4*ext
DrawTriangle x0,y0,x4,y4,x3,y3
DrawTriangle x0,y0,x1,y1,x4,y4
DrawTriangle x1,y1,x2,y2,x4,y4
Return True
End
Method DrawShadows:Void( x0:Float,y0:Float,drawList:DrawList )
Local lx:= x0 * _ix + y0 * _jx + _tx
Local ly:= x0 * _iy + y0 * _jy + _ty
Local verts:=drawList._casterVerts.Data,v0:=0
For Local i:=0 Until drawList._casters.Length
Local caster:=drawList._casters.Get( i )
Local n:=caster._verts.Length
Select caster._type
Case 0 'closed loop
Local x0:=verts[v0+n-2]
Local y0:=verts[v0+n-1]
For Local i:=0 Until n-1 Step 2
Local x1:=verts[v0+i]
Local y1:=verts[v0+i+1]
DrawShadow( lx,ly,x0,y0,x1,y1 )
x0=x1
y0=y1
Next
Case 1 'open loop
Case 2 'edge soup
End
v0+=n
Next
End
Method AddShadowCaster:Void( caster:ShadowCaster )
_casters.Push caster
Local verts:=caster._verts
For Local i:=0 Until verts.Length-1 Step 2
Local x0:=verts[i]
Local y0:=verts[i+1]
_casterVerts.Push x0*_ix+y0*_jx+_tx
_casterVerts.Push x0*_iy+y0*_jy+_ty
Next
End
Method AddShadowCaster:Void( caster:ShadowCaster,tx:Float,ty:Float )
PushMatrix
Translate tx,ty
AddShadowCaster caster
PopMatrix
End
Method AddShadowCaster:Void( caster:ShadowCaster,tx:Float,ty:Float,rz:Float )
PushMatrix
TranslateRotate tx,ty,rz
AddShadowCaster caster
PopMatrix
End
Method AddShadowCaster:Void( caster:ShadowCaster,tx:Float,ty:Float,rz:Float,sx:Float,sy:Float )
PushMatrix
TranslateRotateScale tx,ty,rz,sx,sy
AddShadowCaster caster
PopMatrix
End
Method IsEmpty:Bool() Property
Return _next=0
End
Method Compact:Void()
If _data.Length=_next Return
Local data:=New DataBuffer( _next,True )
_data.CopyBytes 0,data,0,_next
_data.Discard
_data=data
End
Method Render:Void( op:DrawOp,index:Int,count:Int )
If Not op.material.Bind() Return
If op.blend<>rs_blend
rs_blend=op.blend
Select rs_blend
Case .BlendMode.Opaque
glDisable GL_BLEND
Case .BlendMode.Alpha
glEnable GL_BLEND
glBlendFunc GL_ONE,GL_ONE_MINUS_SRC_ALPHA
Case .BlendMode.Additive
glEnable GL_BLEND
glBlendFunc GL_ONE,GL_ONE
Case .BlendMode.Multiply
glEnable GL_BLEND
glBlendFunc GL_DST_COLOR,GL_ONE_MINUS_SRC_ALPHA
Case .BlendMode.Multiply2
glEnable GL_BLEND
glBlendFunc GL_DST_COLOR,GL_ZERO
End
End
Select op.order
Case 1
glDrawArrays GL_POINTS,index,count
Case 2
glDrawArrays GL_LINES,index,count
Case 3
glDrawArrays GL_TRIANGLES,index,count
Case 4
glDrawElements GL_TRIANGLES,count/4*6,GL_UNSIGNED_SHORT,(index/4*6 + (index&3)*MAX_QUAD_INDICES)*2
Default
Local j:=0
While j<count
glDrawArrays GL_TRIANGLE_FAN,index+j,op.order
j+=op.order
Wend
End
End
Method Render:Void()
If Not _next Return
Local offset:=0,opid:=0,ops:=_ops.Data,length:=_ops.Length
While offset<_next
Local size:=_next-offset,lastop:=length
If size>PRIM_VBO_SIZE
size=0
lastop=opid
While lastop<length
Local op:=ops[lastop]
Local n:=op.count*BYTES_PER_VERTEX
If size+n>PRIM_VBO_SIZE Exit
size+=n
lastop+=1
Wend
If Not size
Local op:=ops[opid]
Local count:=op.count
While count
Local n:=count
If n>MAX_VERTICES n=MAX_VERTICES/op.order*op.order
Local size:=n*BYTES_PER_VERTEX
If VBO_ORPHANING_ENABLED glBufferData GL_ARRAY_BUFFER,PRIM_VBO_SIZE,Null,VBO_USAGE
glBufferSubData GL_ARRAY_BUFFER,0,size,_data,offset
Render op,0,n
offset+=size
count-=n
Wend
opid+=1
Continue
Endif
Endif
If VBO_ORPHANING_ENABLED glBufferData GL_ARRAY_BUFFER,PRIM_VBO_SIZE,Null,VBO_USAGE
glBufferSubData GL_ARRAY_BUFFER,0,size,_data,offset
Local index:=0
While opid<lastop
Local op:=ops[opid]
Render op,index,op.count
index+=op.count
opid+=1
Wend
offset+=size
Wend
glGetError
End
Method Reset:Void()
_next=0
Local data:=_ops.Data
For Local i:=0 Until _ops.Length
data[i].material=Null
freeOps.Push data[i]
Next
_ops.Clear
_op=nullOp
_casters.Clear
_casterVerts.Clear
End
Method Flush:Void()
Render
Reset
End
Protected
Field _blend:=1
Field _alpha:=255.0
Field _color:=[1.0,1.0,1.0,1.0]
Field _pmcolor:Int=$ffffffff
Field _ix:Float=1,_iy:Float
Field _jx:Float,_jy:Float=1
Field _tx:Float,_ty:Float
Field _matStack:Float[64*6]
Field _matSp:Int
Field _font:Font
Field _defaultMaterial:Material
Private
Field _data:DataBuffer=New DataBuffer( 4096,True )
Field _next:=0
Field _op:=nullOp
Field _ops:=New Stack<DrawOp>
Field _casters:=New Stack<ShadowCaster>
Field _casterVerts:=New FloatStack
Method BeginPrim:Void( material:Material,order:Int ) Final
If Not material material=_defaultMaterial
If _next+order*BYTES_PER_VERTEX>_data.Length
' Print "Resizing data"
Local newsize:=Max( _data.Length+_data.Length/2,_next+order*BYTES_PER_VERTEX )
Local data:=New DataBuffer( newsize,True )
_data.CopyBytes 0,data,0,_next
_data.Discard
_data=data
Endif
If material=_op.material And _blend=_op.blend And order=_op.order
_op.count+=order
Return
Endif
If freeOps.Length _op=freeOps.Pop() Else _op=New DrawOp
_ops.Push _op
_op.material=material
_op.blend=_blend
_op.order=order
_op.count=order
End
Method BeginPrims:Void( material:Material,order:Int,count:Int ) Final
If Not material material=_defaultMaterial
count*=order
If _next+count*BYTES_PER_VERTEX>_data.Length
' Print "Resizing data"
Local newsize:=Max( _data.Length+_data.Length/2,_next+count*BYTES_PER_VERTEX )
Local data:=New DataBuffer( newsize,True )
_data.CopyBytes 0,data,0,_next
_data.Discard
_data=data
Endif
If material=_op.material And _blend=_op.blend And order=_op.order
_op.count+=count
Return
Endif
If freeOps.Length _op=freeOps.Pop() Else _op=New DrawOp
_ops.Push _op
_op.material=material
_op.blend=_blend
_op.order=order
_op.count=count
end
Method PrimVert:Void( x0:Float,y0:Float,s0:Float,t0:Float ) Final
_data.PokeFloat _next+0, x0 * _ix + y0 * _jx + _tx
_data.PokeFloat _next+4, x0 * _iy + y0 * _jy + _ty
_data.PokeFloat _next+8, s0
_data.PokeFloat _next+12,t0
_data.PokeFloat _next+16,_ix
_data.PokeFloat _next+20,_iy
_data.PokeInt _next+24,_pmcolor
_next+=BYTES_PER_VERTEX
End
End
'***** Canvas *****
Class Canvas Extends DrawList
Const MaxLights:=MAX_LIGHTS
Method New( target:Object=Null )
Init
SetRenderTarget target
SetViewport 0,0,_width,_height
SetProjection2d 0,_width,0,_height
End
Method Discard:Void()
End
Method SetRenderTarget:Void( target:Object )
FlushPrims
If Not target
_image=Null
_texture=Null
_width=DeviceWidth
_height=DeviceHeight
_twidth=_width
_theight=_height
Else If Image( target )
_image=Image( target )
_texture=_image.Material.ColorTexture
If Not (_texture.Flags & Texture.RenderTarget) Error "Texture is not a render target texture"
_width=_image.Width
_height=_image.Height
_twidth=_texture.Width
_theight=_texture.Height
Else If Texture( target )
_image=Null
_texture=Texture( target )
If Not (_texture.Flags & Texture.RenderTarget) Error "Texture is not a render target texture"
_width=_texture.Width
_height=_texture.Height
_twidth=_texture.Width
_theight=_texture.Height
Else
Error "RenderTarget object must an Image, a Texture or Null"
Endif
_dirty=-1
End
Method RenderTarget:Object() Property
If _image Return _image Else Return _texture
End
Method Width:Int() Property
Return _width
End
Method Height:Int() Property
Return _height
End
Method SetColorMask:Void( r:Bool,g:Bool,b:Bool,a:Bool )
FlushPrims
_colorMask[0]=r
_colorMask[1]=g
_colorMask[2]=b
_colorMask[3]=a
_dirty|=DIRTY_COLORMASK
End
Method ColorMask:Bool[]() Property
Return _colorMask
End
Method SetViewport:Void( x:Int,y:Int,w:Int,h:Int )
FlushPrims
_viewport[0]=x
_viewport[1]=y
_viewport[2]=w
_viewport[3]=h
_dirty|=DIRTY_VIEWPORT
End
Method Viewport:Int[]() Property
Return _viewport
End
Method SetScissor:Void( x:Int,y:Int,w:Int,h:Int )
FlushPrims
_scissor[0]=x
_scissor[1]=y
_scissor[2]=w
_scissor[3]=h
_dirty|=DIRTY_VIEWPORT
End
Method Scissor:Int[]() Property
Return _scissor
End
Method SetProjectionMatrix:Void( projMatrix:Float[] )
FlushPrims
If projMatrix
Mat4Copy projMatrix,_projMatrix
Else
Mat4Init _projMatrix
Endif
_dirty|=DIRTY_SHADER
End
Method SetProjection2d:Void( left:Float,right:Float,top:Float,bottom:Float,znear:Float=-1,zfar:Float=1 )
FlushPrims
Mat4Ortho left,right,top,bottom,znear,zfar,_projMatrix
_dirty|=DIRTY_SHADER
End
Method ProjectionMatrix:Float[]() Property
Return _projMatrix
End
Method SetViewMatrix:Void( viewMatrix:Float[] )
FlushPrims
If viewMatrix
Mat4Copy viewMatrix,_viewMatrix
Else
Mat4Init _viewMatrix
End
_dirty|=DIRTY_SHADER
End
Method ViewMatrix:Float[]() Property
Return _viewMatrix
End
Method SetModelMatrix:Void( modelMatrix:Float[] )
FlushPrims
If modelMatrix
Mat4Copy modelMatrix,_modelMatrix
Else
Mat4Init _modelMatrix
Endif
_dirty|=DIRTY_SHADER
End
Method ModelMatrix:Float[]() Property
Return _modelMatrix
End
Method SetAmbientLight:Void( r:Float,g:Float,b:Float,a:Float=1 )
FlushPrims
_ambientLight[0]=r
_ambientLight[1]=g
_ambientLight[2]=b
_ambientLight[3]=a
_dirty|=DIRTY_SHADER
End
Method AmbientLight:Float[]() Property
Return _ambientLight
End
Method SetFogColor:Void( r:Float,g:Float,b:Float,a:Float )
FlushPrims
_fogColor[0]=r
_fogColor[1]=g
_fogColor[2]=b
_fogColor[3]=a
_dirty|=DIRTY_SHADER
End
Method FogColor:Float[]() Property
Return _fogColor
End
Method SetLightType:Void( index:Int,type:Int )
FlushPrims
Local light:=_lights[index]
light.type=type
_dirty|=DIRTY_SHADER
End
Method GetLightType:Int( index:Int )
Return _lights[index].type
End
Method SetLightColor:Void( index:Int,r:Float,g:Float,b:Float,a:Float=1 )
FlushPrims
Local light:=_lights[index]
light.color[0]=r
light.color[1]=g
light.color[2]=b
light.color[3]=a
_dirty|=DIRTY_SHADER
End
Method GetLightColor:Float[]( index:Int )
Return _lights[index].color
End
Method SetLightPosition:Void( index:Int,x:Float,y:Float,z:Float )
FlushPrims
Local light:=_lights[index]
light.position[0]=x
light.position[1]=y
light.position[2]=z
light.vector[0]=x
light.vector[1]=y
light.vector[2]=z
_dirty|=DIRTY_SHADER
End
Method GetLightPosition:Float[]( index:Int )
Return _lights[index].position
End
Method SetLightRange:Void( index:Int,range:Float )
FlushPrims
Local light:=_lights[index]
light.range=range
_dirty|=DIRTY_SHADER
End
Method GetLightRange:Float( index:Int )
Return _lights[index].range
End
Method SetShadowMap:Void( image:Image )
FlushPrims
_shadowMap=image
_dirty|=DIRTY_SHADER
End
Method ShadowMap:Image() Property
Return _shadowMap
End
Method SetLineWidth:Void( lineWidth:Float )
FlushPrims
_lineWidth=lineWidth
_dirty|=DIRTY_LINEWIDTH
End
Method LineWidth:Float() Property
Return _lineWidth
End
Method Clear:Void( r:Float=0,g:Float=0,b:Float=0,a:Float=1 )
FlushPrims
Validate
If _clsScissor
glEnable GL_SCISSOR_TEST
glScissor _vpx,_vpy,_vpw,_vph
Endif
glClearColor r,g,b,a
glClear GL_COLOR_BUFFER_BIT
If _clsScissor glDisable GL_SCISSOR_TEST
End
Method ReadPixels:Void( x:Int,y:Int,width:Int,height:Int,data:DataBuffer,dataOffset:Int=0,dataPitch:Int=0 )
FlushPrims
If Not dataPitch Or dataPitch=width*4
glReadPixels x,y,width,height,GL_RGBA,GL_UNSIGNED_BYTE,data,dataOffset
Else
For Local iy:=0 Until height
glReadPixels x,y+iy,width,1,GL_RGBA,GL_UNSIGNED_BYTE,data,dataOffset+dataPitch*iy
Next
Endif
End
Method RenderDrawList:Void( drawbuf:DrawList )
Local fast:=_ix=1 And _iy=0 And _jx=0 And _jy=1 And _tx=0 And _ty=0 And _color[0]=1 And _color[1]=1 And _color[2]=1 And _color[3]=1
If fast
FlushPrims
Validate
drawbuf.Render
Return
Endif
tmpMat3d[0]=_ix
tmpMat3d[1]=_iy
tmpMat3d[4]=_jx
tmpMat3d[5]=_jy
tmpMat3d[12]=_tx
tmpMat3d[13]=_ty
tmpMat3d[10]=1
tmpMat3d[15]=1
Mat4Multiply _modelMatrix,tmpMat3d,tmpMat3d2
FlushPrims
Local tmp:=_modelMatrix
_modelMatrix=tmpMat3d2
rs_globalColor[0]=_color[0]*_color[3]
rs_globalColor[1]=_color[1]*_color[3]
rs_globalColor[2]=_color[2]*_color[3]
rs_globalColor[3]=_color[3]
_dirty|=DIRTY_SHADER
Validate
drawbuf.Render
_modelMatrix=tmp
rs_globalColor[0]=1
rs_globalColor[1]=1
rs_globalColor[2]=1
rs_globalColor[3]=1
_dirty|=DIRTY_SHADER
End
Method RenderDrawList:Void( drawList:DrawList,tx:Float,ty:Float,rz:Float=0,sx:Float=1,sy:Float=1 )
Super.PushMatrix
Super.TranslateRotateScale tx,ty,rz,sx,sy
RenderDrawList( drawList )
Super.PopMatrix
End
#rem
Method RenderDrawListEx:Void( drawbuf:DrawList,tx:Float=0,ty:Float=0,rz:Float=0,sx:Float=1,sy:Float=1 )
Super.PushMatrix
Super.TranslateRotateScale tx,ty,rz,sx,sy
Super.GetMatrix tmpMat2d
Super.PopMatrix
tmpMat3d[0]=tmpMat2d[0]
tmpMat3d[1]=tmpMat2d[1]
tmpMat3d[4]=tmpMat2d[2]
tmpMat3d[5]=tmpMat2d[3]
tmpMat3d[12]=tmpMat2d[4]
tmpMat3d[13]=tmpMat2d[5]
tmpMat3d[10]=1
tmpMat3d[15]=1
Local tmp:=_modelMatrix
Mat4Multiply tmp,tmpMat3d,tmpMat3d2
FlushPrims
_modelMatrix=tmpMat3d2
_dirty|=DIRTY_SHADER
Validate
drawbuf.Render
_modelMatrix=tmp
_dirty|=DIRTY_SHADER
End
#end
Method Flush:Void()
FlushPrims
If Not _texture Return
If _texture._flags & Texture.Managed
Validate
glDisable GL_SCISSOR_TEST
glViewport 0,0,_twidth,_theight
If _width=_twidth And _height=_theight
glReadPixels 0,0,_twidth,_theight,GL_RGBA,GL_UNSIGNED_BYTE,DataBuffer( _texture._data )
Else
For Local y:=0 Until _height
glReadPixels _image._x,_image._y+y,_width,1,GL_RGBA,GL_UNSIGNED_BYTE,DataBuffer( _texture._data ),(_image._y+y) * (_twidth*4) + (_image._x*4)
Next
Endif
_dirty|=DIRTY_VIEWPORT
Endif
_texture.UpdateMipmaps
End
Global _tformInvProj:Float[16]
Global _tformT:Float[]=[0.0,0.0,-1.0,1.0]
Global _tformP:Float[4]
Method TransformCoords:Void( coords_in:Float[],coords_out:Float[],mode:Int=0 )
Mat4Inverse _projMatrix,_tformInvProj
Select mode
Case 0
_tformT[0]=(coords_in[0]-_viewport[0])/_viewport[2]*2-1
_tformT[1]=(coords_in[1]-_viewport[1])/_viewport[3]*2-1
Mat4Transform _tformInvProj,_tformT,_tformP
_tformP[0]/=_tformP[3];_tformP[1]/=_tformP[3];_tformP[2]/=_tformP[3];_tformP[3]=1
coords_out[0]=_tformP[0]
coords_out[1]=_tformP[1]
If coords_out.Length>2 coords_out[2]=_tformP[2]
Default
Error "Invalid TransformCoords mode"
End
End
Private
Const DIRTY_RENDERTARGET:=1
Const DIRTY_VIEWPORT:=2
Const DIRTY_SHADER:=4
Const DIRTY_LINEWIDTH:=8
Const DIRTY_COLORMASK:=16
Field _seq:Int
Field _dirty:Int=-1
Field _image:Image
Field _texture:Texture
Field _width:Int
Field _height:Int
Field _twidth:Int
Field _theight:Int
Field _shadowMap:Image
Field _colorMask:=[True,True,True,True]
Field _viewport:=[0,0,640,480]
Field _scissor:=[0,0,10000,10000]
Field _vpx:Int,_vpy:Int,_vpw:Int,_vph:Int
Field _scx:Int,_scy:Int,_scw:Int,_sch:Int
Field _clsScissor:Bool
Field _projMatrix:=Mat4New()
Field _invProjMatrix:=Mat4New()
Field _viewMatrix:=Mat4New()
Field _modelMatrix:=Mat4New()
Field _ambientLight:=[0.0,0.0,0.0,1.0]
Field _fogColor:=[0.0,0.0,0.0,0.0]
Field _lights:LightData[4]
Field _lineWidth:Float=1
Global _active:Canvas
Method Init:Void()
_dirty=-1
For Local i:=0 Until 4
_lights[i]=New LightData
Next
End
Method FlushPrims:Void()
If Super.IsEmpty Return
Validate
Super.Flush
End
Method Validate:Void()
If _seq<>graphicsSeq
_seq=graphicsSeq
InitVbos
If Not _texture
_width=DeviceWidth
_height=DeviceHeight
_twidth=_width
_theight=_height
Endif
_dirty=-1
Endif
If _active=Self
If Not _dirty Return
Else
If _active _active.Flush
_active=Self
_dirty=-1
Endif
' _dirty=-1
If _dirty & DIRTY_RENDERTARGET
If _texture
glBindFramebuffer GL_FRAMEBUFFER,_texture.GLFramebuffer()
Else
glBindFramebuffer GL_FRAMEBUFFER,defaultFbo
Endif
End
If _dirty & DIRTY_VIEWPORT
If Not _texture
_width=DeviceWidth
_height=DeviceHeight
_twidth=_width
_theight=_height
Endif
_vpx=_viewport[0];_vpy=_viewport[1];_vpw=_viewport[2];_vph=_viewport[3]
If _image
_vpx+=_image._x
_vpy+=_image._y
Endif
_scx=_scissor[0];_scy=_scissor[1];_scw=_scissor[2];_sch=_scissor[3]
If _scx<0 _scx=0 Else If _scx>_vpw _scx=_vpw
If _scw<0 _scw=0 Else If _scx+_scw>_vpw _scw=_vpw-_scx
If _scy<0 _scy=0 Else If _scy>_vph _scy=_vph
If _sch<0 _sch=0 Else If _scy+_sch>_vph _sch=_vph-_scy
_scx+=_vpx;_scy+=_vpy
If Not _texture
_vpy=_theight-_vpy-_vph
_scy=_theight-_scy-_sch
Endif
glViewport _vpx,_vpy,_vpw,_vph
If _scx<>_vpx Or _scy<>_vpy Or _scw<>_vpw Or _sch<>_vph
glEnable GL_SCISSOR_TEST
glScissor _scx,_scy,_scw,_sch
_clsScissor=False
Else
glDisable GL_SCISSOR_TEST
_clsScissor=(_scx<>0 Or _scy<>0 Or _vpw<>_twidth Or _vph<>_theight)
Endif
Endif
If _dirty & DIRTY_SHADER
rs_program=Null
If _texture
rs_clipPosScale[1]=1
Mat4Copy _projMatrix,rs_projMatrix
Else
rs_clipPosScale[1]=-1
Mat4Multiply flipYMatrix,_projMatrix,rs_projMatrix
Endif
Mat4Multiply _viewMatrix,_modelMatrix,rs_modelViewMatrix
Mat4Multiply rs_projMatrix,rs_modelViewMatrix,rs_modelViewProjMatrix
Vec4Copy _ambientLight,rs_ambientLight
Vec4Copy _fogColor,rs_fogColor
rs_numLights=0
For Local i:=0 Until MAX_LIGHTS
Local light:=_lights[i]
If Not light.type Continue
Mat4Transform _viewMatrix,light.vector,light.tvector
rs_lightColors[rs_numLights*4+0]=light.color[0]
rs_lightColors[rs_numLights*4+1]=light.color[1]
rs_lightColors[rs_numLights*4+2]=light.color[2]
rs_lightColors[rs_numLights*4+3]=light.color[3]
rs_lightVectors[rs_numLights*4+0]=light.tvector[0]
rs_lightVectors[rs_numLights*4+1]=light.tvector[1]
rs_lightVectors[rs_numLights*4+2]=light.tvector[2]
rs_lightVectors[rs_numLights*4+3]=light.range
rs_numLights+=1
Next
If _shadowMap
rs_shadowTexture=_shadowMap._material._colorTexture
Else
rs_shadowTexture=Null
Endif
rs_blend=-1
End
If _dirty & DIRTY_LINEWIDTH
glLineWidth _lineWidth
Endif
If _dirty & DIRTY_COLORMASK
glColorMask _colorMask[0],_colorMask[1],_colorMask[2],_colorMask[3]
End
_dirty=0
End
End
| Monkey | 5 | blitz-research/monkey | modules/mojo2/graphics.monkey | [
"Zlib"
] |
#!perl
use strict;
use warnings;
use Text::Template;
# Minimum Test::More version; 0.94+ is required for `done_testing`
BEGIN {
unless (eval { require Test::More; "$Test::More::VERSION" >= 0.94; }) {
Test::More::plan(skip_all => '[ Test::More v0.94+ ] is required for testing');
}
Test::More->import;
# Non-CORE module(s)
unless (eval { require Test::Warnings; 1; }) {
plan(skip_all => '[ Test::Warnings ] is required for testing');
}
Test::Warnings->import;
}
my $template = <<'EOT';
{{
if ($good =~ /good/) {
'This template should not produce warnings.'.$bad;
}
}}
EOT
$template = Text::Template->new(type => 'STRING', source => $template);
isa_ok $template, 'Text::Template';
my $result = $template->fill_in(HASH => { good => 'good' });
$result =~ s/(?:^\s+)|(?:\s+$)//gs;
is $result, 'This template should not produce warnings.';
# see https://github.com/mschout/perl-text-template/issues/10
$template = Text::Template->new(type => 'STRING', package => 'MY', source => '');
$template->fill_in(package => 'MY', hash => { include => sub { 'XX' } });
$template = Text::Template->new(type => 'STRING', package => 'MY', source => '');
$template->fill_in(package => 'MY', hash => { include => sub { 'XX' } });
done_testing;
| Perl | 5 | pmesnier/openssl | external/perl/Text-Template-1.56/t/warnings.t | [
"Apache-2.0"
] |
{%- include 'partials/inputs.volt' -%}
{{ flashSession.output() }}
<div class="row">
<div class="col-sm-12">
<div class="card card-secondary">
<div class="card-header">
<h3 class="card-title">Generate Controller</h3>
</div>
<div class="card-body">
<form role="form" class="form-horizontal" name="generate-controller" method="post" action="{{ url.get(webtools_uri ~ "/controllers/generate") }}">
<p>{{ controller_name }} - [{{ controller_path }}]</p>
<div class="form-group">
<label for="name" class="col-sm-2 control-label">Controller name</label>
<div class="col-sm-10">
{{ input("name", "Class name without suffix eg. Users") }}
</div>
</div>
<div class="form-group">
<label for="namespace" class="col-sm-2 control-label">Namespace</label>
<div class="col-sm-10">
{{ input("namespace", 'eg. My\Awesome\Namespace') }}
</div>
</div>
<div class="form-group">
<label for="baseClass" class="col-sm-2 control-label">Base class</label>
<div class="col-sm-10">
{{ input("baseClass", "eg. BaseController") }}
</div>
</div>
<div class="form-group">
<label for="basePath" class="col-sm-2 control-label">Project Root</label>
<div class="col-sm-10">
{{ input("basePath", "The absolute path to the project") }}
</div>
</div>
<div class="form-group">
<label for="controllersDir" class="col-sm-2 control-label">Controller Directory</label>
<div class="col-sm-10">
{{ input("controllersDir", "The absolute path to the controller directory") }}
</div>
</div>
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label for="force">
{{- check_field("force", "value": 1, "id": "force") ~ " Force" -}}
</label>
</div>
</div>
<hr />
{{ submit_button("Generate", "class": "btn btn-success pull-right") }}
</form>
</div>
</div>
</div>
</div>
| Volt | 4 | PSD-Company/phalcon-devtools-docker | src/Web/Tools/Views/controllers/generate.volt | [
"BSD-3-Clause"
] |
./gradlew --quiet :shark-cli:installDist
./shark-cli/build/install/shark-cli/bin/shark-cli "$@" | Shell | 2 | moonfish11/leakcanary | shark-cli.sh | [
"Apache-2.0"
] |
a = -> 1
const b = --> 2
var c = ~> 3
d = ~~>
e = (a) -> (b) ~> (c) --> (d, e) ~~> 5
dashes-identifiers = ->
a - a
b -- c
1-1 1- -1
a- a
a -a
//abc #eaze #@ //
//
a #baze
//
publi
if it is \abc and ($-y = !(a,) ->) ~= map //a#//
then match that | _ | otherwise => implements $("#abc #@a")
switch |a=>b
| a then b
if a => b else c
underscores_i$d = ->
/regexp1/ and //regexp2//g
'strings' and "strings" and \strings
([2 til 10] or [1 to 50])
|> map (* 2)
|> filter (> 5)
|> fold (+)
setTimeout _, 3000 <| do-stuff
_.map; _abc; __
class Class extends Anc-est-or
(args) ->
copy = (from, to, callback) -->
error, data <- read file
return callback error if error?
error <~ write file, data
return callback error if error?
callback()
$(\#gafBr).text $t.fmtFloat(efb.gaf)
->
~>
~~>
-->
# Comment
/* Comment */
# error, data <- read file
/* error, data <- read file */
add = (a=1, b=2) --> a + b
add 1 2
do-stuff!
do-stuff? #
do-stuff? 1
do-stuff + 1
@do-stuff +1
@do-stuff /1
a b c |> d <| e f(g)
'cats' is 'cats'
'cats' `_.is-insensitive` 'CATS'
setTimeout _, 1000 <| !-> console.log 'Who summoned me'
private-list = yield @get-private-list!
switch | true => "#@@spaghetti"
~function add a=1, b=2 => a + b
row.0._id
new Spaghetti
(++a++) (++ 2 ++)
(.cool.) (+ a -) (/ 2 *)
(ina -a in) (-> a)
(ina in$a)
(a is-in)
(in)
((((((+ a((a))))))))
| LiveScript | 2 | ka7/bat | tests/syntax-tests/source/LiveScript/livescript-demo.ls | [
"Apache-2.0",
"MIT"
] |
NF == 2 {
if($2 !~ / or / || $2 ~ /\(or/)
print $0
else {
n = split($2, a, / or /)
for(i = 1; i <= n; i++) {
printf "%s\t%s\n", $1, a[i]
}
}
}
NF != 2 {
print $0
}
| Awk | 3 | newluhux/plan9port | src/cmd/dict/t.awk | [
"MIT"
] |
(import
[bottle [view :as render-template]]
[config [*page-route-base*]])
(with-decorator (render-template "inline-message")
(defn inline-message [level message]
; render a little error message
{"level" level
"message" message}))
(with-decorator (render-template "inline-table")
(defn inline-table [headers rows]
; render a table
{"headers" headers
"rows" rows
"page_base" *page-route-base*}))
| Hy | 4 | CyberFlameGO/sushy | sushy/messages.hy | [
"MIT"
] |
/*******************************************************************************
* Copyright (c) 2008 SpringSource and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* SpringSource
* Andrew Eisenberg (initial implementation)
*******************************************************************************/
package scala.tools.eclipse.contribution.weaving.jdt.imagedescriptor;
/*******************************************************************************
* Added to the Scala plugin to fix interoperability issues between the
* Spring IDE and the Scala IDE. This plugin now implements the cuprovider and
* imagedescriptorselector extension points, previously provided by the
* JDT weaving plugin.
*
* Repo: git://git.eclipse.org/gitroot/ajdt/org.eclipse.ajdt.git
* File: src/org.eclipse.contribution.weaving.jdt/src/org/eclipse/contribution/jdt/imagedescriptor/ImageDescriptorSelectorAspect.aj
*
*******************************************************************************/
import org.eclipse.jdt.core.CompletionProposal;
import org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal;
import org.eclipse.jdt.internal.ui.viewsupport.JavaElementImageProvider;
import org.eclipse.jdt.ui.text.java.CompletionProposalLabelProvider;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
/**
* Captures locations in the code where {@link ImageDescriptor}s are created in the
* context of creating Java elements.
* Allows other providers to plug in their own ImageDescriptors instead for the
* creation of Java-like elements.
*
* @author andrew
* @created Dec 2, 2008
*
*/
public privileged aspect ImageDescriptorSelectorAspect {
/**
* Getting the image for open type dialogs
*
* Note that if multiple image descriptor registries can work on the same kind of element,
* then there is potential for conflicts.
*
* All we do here is return the first descriptor that we find. Conflicts be damned!
* If there ever is a conflict (unlikely), we will deal with the consequences as it comes.
*/
ImageDescriptor around(boolean isInner, boolean isInInterfaceOrAnnotation, int flags, boolean useLightIcons, Object element) :
imageDescriptorCreation(isInner, isInInterfaceOrAnnotation, flags, useLightIcons) &&
cflow(typeSelectionDialogGettingLabel(element)) {
ImageDescriptor descriptor = getImageDescriptor(isInner, isInInterfaceOrAnnotation, flags, useLightIcons, element);
return descriptor != null ?
descriptor :
proceed(isInner, isInInterfaceOrAnnotation, flags, useLightIcons, element);
}
pointcut imageDescriptorCreation(boolean isInner, boolean isInInterfaceOrAnnotation, int flags, boolean useLightIcons) :
execution(public static ImageDescriptor JavaElementImageProvider.getTypeImageDescriptor(boolean, boolean, int, boolean)) &&
args(isInner, isInInterfaceOrAnnotation, flags, useLightIcons);
/**
* This pointcut captures the act of getting a label for elements in the type selection dialog
*/
// XXX I don't want to use wild cards here, but for some reason the methods are not woven if no wild cards are used.
// I should file a bug for this.
pointcut typeSelectionDialogGettingLabel(Object element) :
(execution(public Image *..FilteredTypesSelectionDialog*.TypeItemLabelProvider.getImage(Object)) || // for open type dialog
execution(public Image *..HierarchyLabelProvider.getImage(Object)) || // for type hierarchy view
execution(public Image *..DebugTypeSelectionDialog*.DebugTypeLabelProvider.getImage(Object))) // for choosing a main class
&& within(org.eclipse.jdt.internal..*)
&& args(element);
/**
* Getting {@link ImageDescriptor} for other standard places where java elements go
*/
pointcut computingDescriptor(Object element, int flags) :
execution(ImageDescriptor JavaElementImageProvider.computeDescriptor(Object, int)) &&
within(JavaElementImageProvider) &&
args(element, flags);
ImageDescriptor around(Object element, int flags) : computingDescriptor(element, flags) {
ImageDescriptor descriptor = getImageDescriptor(false, false, flags, false, element);
return descriptor != null ?
descriptor :
proceed(element, flags);
}
private ImageDescriptor getImageDescriptor(boolean isInner, boolean isInInterfaceOrAnnotation, int flags, boolean useLightIcons, Object element) {
try {
for (IImageDescriptorSelector selector : ImageDescriptorSelectorRegistry.getInstance()) {
ImageDescriptor descriptor = selector.getTypeImageDescriptor(isInner, isInInterfaceOrAnnotation, flags, useLightIcons, element);
if (descriptor != null) {
return descriptor;
}
}
} catch (Throwable t) {
// JDTWeavingPlugin.logException(t);
}
return null;
}
//////////////////////////////////////////////////////
// This section of the aspect handles image descriptor creation for content assist
// execution of CompletionProposalLabelProvider.createImageDescriptor && cflow(LazyJavaCompletionProposal.computeImage)
pointcut javaCompletionProposalImageComputing(LazyJavaCompletionProposal proposal) :
execution(protected Image LazyJavaCompletionProposal.computeImage()) && within(LazyJavaCompletionProposal)
&& this(proposal);
pointcut creatingProposalImageDescriptor() : execution(public ImageDescriptor CompletionProposalLabelProvider.createImageDescriptor(CompletionProposal))
&& within(CompletionProposalLabelProvider);
ImageDescriptor around(LazyJavaCompletionProposal proposal) : cflow(javaCompletionProposalImageComputing(proposal)) &&
creatingProposalImageDescriptor() {
ImageDescriptor desc = getAssistImageDescriptor(proposal);
return desc != null ? desc : proceed(proposal);
}
private ImageDescriptor getAssistImageDescriptor(LazyJavaCompletionProposal proposal) {
try {
for (IImageDescriptorSelector selector : ImageDescriptorSelectorRegistry.getInstance()) {
ImageDescriptor descriptor = selector.createCompletionProposalImageDescriptor(proposal);
if (descriptor != null) {
return descriptor;
}
}
} catch (Throwable t) {
// JDTWeavingPlugin.logException(t);
}
return null;
}
} | AspectJ | 4 | dragos/scala-ide | org.scala-ide.sdt.aspects/src/scala/tools/eclipse/contribution/weaving/jdt/imagedescriptor/ImageDescriptorSelectorAspect.aj | [
"BSD-3-Clause"
] |
;;;; -*- Mode: Lisp; Syntax: Common-Lisp -*-
;;;; Code from Paradigms of AI Programming
;;;; Copyright (c) 1991 Peter Norvig
;;;; File edge-tab.lisp: Compile this to save the edge table.
(setf *edge-table* '#.*edge-table*)
| Common Lisp | 2 | sethaldini/paip-lisp | lisp/edge-tab.lisp | [
"MIT"
] |
call json_generate_reset;
call json_generate_begin_object;
set req.http.value = "timestamp";
call json_generate_string;
set req.http.value = strftime("%25F %25T", time.start);
call json_generate_string;
set req.http.value = "time_elapsed";
call json_generate_string;
set req.http.value = time.elapsed.msec;
call json_generate_number;
set req.http.value = "client_ip";
call json_generate_string;
set req.http.value = req.http.Fastly-Client-IP;
call json_generate_string;
set req.http.value = "client_continent";
call json_generate_string;
set req.http.value = client.geo.continent_code;
call json_generate_string;
set req.http.value = "client_country";
call json_generate_string;
set req.http.value = client.geo.country_name.utf8;
call json_generate_string;
set req.http.value = "client_region";
call json_generate_string;
set req.http.value = client.geo.region;
call json_generate_string;
set req.http.value = "client_city";
call json_generate_string;
set req.http.value = client.geo.city.utf8;
call json_generate_string;
set req.http.value = "client_latitude";
call json_generate_string;
set req.http.value = client.geo.latitude;
call json_generate_string;
set req.http.value = "client_longitude";
call json_generate_string;
set req.http.value = client.geo.longitude;
call json_generate_string;
set req.http.value = "client_timezone";
call json_generate_string;
set req.http.value = client.geo.gmt_offset;
call json_generate_string;
set req.http.value = "client_connection";
call json_generate_string;
set req.http.value = client.geo.conn_speed;
call json_generate_string;
set req.http.value = "request";
call json_generate_string;
set req.http.value = req.request;
call json_generate_string;
set req.http.value = "request_host";
call json_generate_string;
set req.http.value = req.http.host;
call json_generate_string;
set req.http.value = "request_path";
call json_generate_string;
set req.http.value = req.url.path;
call json_generate_string;
set req.http.value = "request_query";
call json_generate_string;
set req.http.value = req.url.qs;
call json_generate_string;
set req.http.value = "request_bytes";
call json_generate_string;
set req.http.value = req.bytes_read;
call json_generate_number;
set req.http.value = "user_agent";
call json_generate_string;
set req.http.value = req.http.User-Agent;
call json_generate_string;
set req.http.value = "http2";
call json_generate_string;
set req.http.value = fastly_info.is_h2;
call json_generate_bool;
set req.http.value = "tls_version";
call json_generate_string;
set req.http.value = tls.client.protocol;
call json_generate_string;
set req.http.value = "tls_cipher";
call json_generate_string;
set req.http.value = tls.client.cipher;
call json_generate_string;
set req.http.value = "response_status";
call json_generate_string;
set req.http.value = resp.status;
call json_generate_string;
set req.http.value = "response_text";
call json_generate_string;
set req.http.value = resp.response;
call json_generate_string;
set req.http.value = "response_bytes";
call json_generate_string;
set req.http.value = resp.bytes_written;
call json_generate_number;
set req.http.value = "response_cache";
call json_generate_string;
set req.http.value = resp.http.X-Cache;
call json_generate_string;
set req.http.value = "cache_state";
call json_generate_string;
set req.http.value = fastly_info.state;
call json_generate_string;
set req.http.value = "cache_lastuse";
call json_generate_string;
set req.http.value = obj.lastuse;
call json_generate_number;
set req.http.value = "cache_hits";
call json_generate_string;
set req.http.value = obj.hits;
call json_generate_number;
set req.http.value = "server_region";
call json_generate_string;
set req.http.value = server.region;
call json_generate_string;
set req.http.value = "server_datacenter";
call json_generate_string;
set req.http.value = server.datacenter;
call json_generate_string;
call json_generate_end_object;
log {"syslog 2pDNderOIzEhIsrKfwWurj s3-json :: "} req.http.json_generate_json; | VCL | 3 | tkaitchuck/kirby | previously/00_fastly_to_s3/json_request_logs.vcl | [
"MIT"
] |
:- object(edcg_collect,
implements(expanding)).
:- public([
pred_info/3, acc_info/7, acc_info/5, pass_info/2, pass_info/1
]).
:- dynamic([
pred_info/3, acc_info/7, acc_info/5, pass_info/2, pass_info/1, position/1
]).
cleanup :-
retractall(pred_info(_,_,_)),
retractall(acc_info(_,_,_,_,_,_,_)),
retractall(acc_info(_,_,_,_,_)),
retractall(pass_info(_,_)),
retractall(pass_info(_)).
term_expansion(pred_info(A,B,C), []) :-
assertz(pred_info(A,B,C)).
term_expansion(acc_info(A,B,C,D,E,F,G), []) :-
assertz(acc_info(A,B,C,D,E,F,G)).
term_expansion(acc_info(A,B,C,D,E), []) :-
assertz(acc_info(A,B,C,D,E)).
term_expansion(pass_info(A,B), []) :-
assertz(pass_info(A,B)).
term_expansion(pass_info(A), []) :-
assertz(pass_info(A)).
term_expansion(_, []).
:- end_object.
| Logtalk | 3 | PaulBrownMagic/logtalk3 | library/hook_flows/edcg_collect.lgt | [
"Apache-2.0"
] |
#![allow(dead_code)]
// Test that we report an error for unused type parameters in types and traits,
// and that we offer a helpful suggestion.
struct SomeStruct<A> { x: u32 }
//~^ ERROR parameter `A` is never used
enum SomeEnum<A> { Nothing }
//~^ ERROR parameter `A` is never used
// Here T might *appear* used, but in fact it isn't.
enum ListCell<T> {
//~^ ERROR parameter `T` is never used
Cons(Box<ListCell<T>>),
Nil
}
fn main() {}
| Rust | 4 | Eric-Arellano/rust | src/test/ui/variance/variance-unused-type-param.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "https://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<bean class="org.springframework.scripting.support.ScriptFactoryPostProcessor"/>
<bean id="messenger" class="org.springframework.scripting.groovy.GroovyScriptFactory">
<constructor-arg>
<!-- 'inline:' prefix is preceded by whitespace... -->
<value>
inline:
class Bingo {
@Property String message;
}
</value>
</constructor-arg>
<property name="message" value="Hello World!"/>
</bean>
</beans>
| XML | 3 | nicchagil/spring-framework | spring-context/src/test/resources/org/springframework/scripting/groovy/lwspBadGroovyContext.xml | [
"Apache-2.0"
] |
INSERT INTO `double` VALUES
(-700,9.8596765437597708567e-305),
(-665,1.5637579633862188833e-289),
(-630,2.4801411660927964175e-274),
(-595,3.93353725305949385e-259),
(-560,6.2386429985283768477e-244),
(-525,9.8945717198470043018e-229),
(-490,1.5692923852557387023e-213),
(-455,2.488918833628632497e-198),
(-420,3.9474587518512647549e-183),
(-385,6.2607226828884906754e-168),
(-350,9.9295903962649792963e-153),
(-315,1.5748463944438506468e-137),
(-280,2.4977275669152504367e-122),
(-245,3.9614295213416819065e-107),
(-210,6.2828805112394623313e-92),
(-175,9.964733010103672264e-77),
(-140,1.5804200602736129648e-61),
(-105,2.5065674758999531731e-46),
(-70,3.9754497359086468078e-31),
(-35,6.3051167601469893856e-16),
(0,1.0),
(35,1.5860134523134307281e15),
(70,2.5154386709191670063e30),
(105,3.9895195705472158508e45),
(140,6.3274317071555853643e60),
(175,1.0035391806143294572e76),
(210,1.5916266403779241592e91),
(245,2.5243412626998187771e106),
(280,4.0036392008717845384e121),
(315,6.349825630792043955e136),
(350,1.0070908870280797598e152),
(385,1.5972596945288000308e167),
(420,2.5332753623607179194e182),
(455,4.0178088031182794379e197),
(490,6.3722988105689154742e212),
(525,1.0106551635723173971e228),
(560,1.6029126850757261505e243),
(595,2.5422410814139434033e258),
(630,4.0320285541463578912e273),
(665,6.3948515269879956379e288),
(700,1.0142320547350045095e304);
| SQL | 2 | imtbkcat/tidb-lightning | tests/various_types/data/vt.double.sql | [
"Apache-2.0"
] |
###########################################################################
## ##
## Language Technologies Institute ##
## Carnegie Mellon University ##
## Copyright (c) 2013 ##
## All Rights Reserved. ##
## ##
## Permission is hereby granted, free of charge, to use and distribute ##
## this software and its documentation without restriction, including ##
## without limitation the rights to use, copy, modify, merge, publish, ##
## distribute, sublicense, and/or sell copies of this work, and to ##
## permit persons to whom this work is furnished to do so, subject to ##
## the following conditions: ##
## 1. The code must retain the above copyright notice, this list of ##
## conditions and the following disclaimer. ##
## 2. Any modifications must be clearly marked as such. ##
## 3. Original authors' names are not deleted. ##
## 4. The authors' names are not used to endorse or promote products ##
## derived from this software without specific prior written ##
## permission. ##
## ##
## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ##
## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ##
## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ##
## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ##
## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ##
## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ##
## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ##
## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ##
## THIS SOFTWARE. ##
## ##
###########################################################################
## ##
## LANGNAME lexicon and letter to sound rules ##
## ##
###########################################################################
TOP=../..
DIRNAME=lang/cmu_LANGNAME_lex
BUILD_DIRS =
ALL_DIRS=
H = cmu_LANGNAME_lex.h
SRCS = cmu_LANGNAME_lex.c
SCRIPTS =
OBJS = $(SRCS:.c=.o)
SCM=
FILES = Makefile $(SCM) $(SRCS) $(H) $(SCRIPTS)
LIBNAME = flite_cmu_LANGNAME_lex
LOCAL_INCLUDES =
ALL =
include $(TOP)/config/common_make_rules
| Lex | 2 | rathann/flite | tools/Makefile.lex | [
"Apache-2.0"
] |
//This file is part of "GZE - GroundZero Engine"
//The permisive licence allow to use GZE for free or commercial project (Apache License, Version 2.0).
//For conditions of distribution and use, see copyright notice in Licence.txt, this license must be included with any distribution of the code.
package {
import GZ.Base.Math.Math;
import GZ.Gfx.Pixel;
import GZ.Gfx.Object;
import GZ.Gfx.Buffer;
import GZ.Gfx.Root;
import GZ.Gfx.Face;
import GZ.Gfx.Triangle;
import GZ.File.RcImg;
import GZ.Sys.Interface.Interface;
import GZ.Base.PtA;
import GZ.Base.Pt;
import GZ.Base.Poly4;
import GZ.Base.Quaternion;
/**
* @author Maeiky
*/
public class Shape extends Object { //Not shape but square form
public const var nBorder : UInt = 1; //Must be same ase png.h
use Triangle.uPoint3D;
//use Triangle.uPoint2D;
public var aPt3dOri : CArray<Float, 1, 12>; //ToDO dynamique (only 4 point)
public var aPoint3D : CArray<Float, 1, 12>; //ToDO dynamique (only 4 point)
public var aPoint2D : CArray<Float, 1, 12>; //ToDO dynamique (only 4 point)
public var aPtSource: CArray<Float, 1, 10>; //ToDO dynamique (only 4 point)
public var aNewPt3dOri : Array<PtA>;
public var nIndexPt : UInt = 0; // Todo find better way to save this var
public var nIndexSrc : UInt = 0; // Todo find better way to save this var
public var oFace : Face;
public var nNbPt : UInt = 0;
public var nNbPt3 : UInt = 0;
public var bSmoothBorder : Bool = true;
// public var oGpuObj : SysGpuShape;
public var oRc : RcImg;
///////////////////////////////////////////////
public unit uSPoint {
nX : Float; //Must same as point
nY : Float; //Must same as point
}
public unit uPoint {
nX : Float;
nY : Float;
nZ : Float;
rSPt : uSPoint;
rPt2D: Mapped<uPoint3D>;
}
//qePt : QElement<uPoint>;
/////////////////////////////////////////////////
public function Shape( _oParent : Root, _nX : Float, _nY:Float, _nNbPt : UInt = 4, _bSmoothBorder:Bool = true):Void {
Object(_oParent, _nX , _nY);
nNbPt = _nNbPt;
nNbPt3 = _nNbPt * 3;
bSmoothBorder = _bSmoothBorder
// oGpuObj = new SysGpuShape();
//aPoint3D = malloc ? _nNbPt TODO TODO
}
/*
public function addPoint(_nX:Float, _nY:Float, _nCenterX : Float = 0, _nCenterY : Float = 0, _nLineType : UInt = 0, _nLineWidth : Float = 1): Mapped<uPoint3D> {
var _nIndexReal : UInt = nIndexPt * 3; //XYZ
var _rPt3D : Mapped<uPoint3D> = aPt3dOri[_nIndexReal];
_rPt3D.nX = (_nX - _nCenterX);
_rPt3D.nY = (_nY - _nCenterY);
_rPt3D.nZ = 0; //Z
nIndexPt++;
return _rPt3D;
}
*/
public function fAddPt( _oPt : PtA, _oCenter : Pt<Float> ):Void {
_oPt.vPt.nX = _oPt.vPt.nX - _oCenter.nX;
_oPt.vPt.nY = _oPt.vPt.nY - _oCenter.nY;
_oPt.vPt.nZ =_oPt.vPt.nZ - _oCenter.nZ;
_oPt.fCopyToTf();
aNewPt3dOri.fPush(_oPt);
}
public function fCreateFace(_oRc : RcImg, _oSrc : Poly4):Void {
// public function fCreateFace(_oRc : RcImg, _rPt1 : Mapped<uPoint3D>, _rPt2: Mapped<uPoint3D>, _rPt3 : Mapped<uPoint3D>, _rPt4 : Mapped<uPoint3D>, _nPtS1x:Float, _nPtS1y:Float, _nPtS2x:Float, _nPtS2y:Float, _nPtS3x:Float, _nPtS3y:Float, _nPtS4x:Float, _nPtS4y:Float):Void {
//oFace = new Face(this, _oRc, aNewPt3dOri[0], aNewPt3dOri[1], aNewPt3dOri[2], aNewPt3dOri[3], aPoint2D, _nPtS1x:Float, _nPtS1y:Float, _nPtS2x:Float, _nPtS2y:Float, _nPtS3x:Float, _nPtS3y:Float, _nPtS4x:Float, _nPtS4y:Float);
oFace = new Face(this, _oRc, aNewPt3dOri[0], aNewPt3dOri[1], aNewPt3dOri[2], aNewPt3dOri[3], aPoint2D, _oSrc );
//oFace.aPixelArray = aPixelArray;
//oFace.oRc = _oRc;
//_rPt2D.nX = (_nX + nBorder);
//_rPt2D.nY = (_nY + nBorder);
// oGpuObj.fIni(this);
}
/*
public function addSourcePt(_nX:Float, _nY:Float, _nPt : uPoint):uSPoint {
var _nIndexReal : UInt = (nIndexSrc ) * 2; //XYZ
var _rPt2D : Mapped<uPoint2D> = aPtSource[_nIndexReal];
_rPt2D.nX = (_nX + nBorder);
_rPt2D.nY = (_nY + nBorder);
nIndexSrc++;
return 0;
}
*/
override public function fFinalUpdate():Void {
//oBaseForm.fConvert3Dto2D( aPoint3D[0], aPoint3D[3], aPoint3D[6], aPoint3D[9] );
}
override public function fGpuDraw():Bool {
if(oFace != null){
oFace.fGpuDraw();
}
return true;
}
public function fIsInside():Bool {
var _nL : Float;
var _nR : Float;
var _nT : Float;
var _nB : Float;
if( aPoint2D[0] < aPoint2D[3]){
_nL = aPoint2D[0];
_nR = aPoint2D[3];
}else{
_nL = aPoint2D[3];
_nR = aPoint2D[0];
}
if( aPoint2D[1] < aPoint2D[7]){
_nT = aPoint2D[1];
_nB = aPoint2D[7];
}else{
_nT = aPoint2D[7];
_nB = aPoint2D[1];
}
var _nBuffL : Float = 0;
var _nBuffR : Float = 1024;
var _nBuffT : Float = 0;
var _nBuffB : Float = 800;
if (_nR < _nBuffL || _nL > _nBuffR || _nB < _nBuffT || _nT > _nBuffB ) { //Test if it's outside
return false;
}else{
return true;
}
}
override public function fCpuDraw(_nPosX: Int, _nPosY:Int, _nX_Start : Int, _nX_End : Int, _nY_Start : Int, _nY_End : Int):Bool {
//Debug.fTrace("---------BeginDraw!");
/*
if( oGblPt.vPt.nZ < oItf.nHalfFrameHeight * -1){ //Todo find better way
return false;
}*/
fTransform();
fConvertTo2d();
//if(fIsInside() ){ //Temp comment
var _nRsBrRed : Int = (vGblColor.nRed ) * 255;
var _nRsBrGreen : Int = (vGblColor.nGreen) * 255;
var _nRsBrBlue : Int = (vGblColor.nBlue ) * 255;
var _nRsAlpha : Int = (vGblColor.nAlpha * 255);
if (_nRsAlpha > 256) {
_nRsAlpha = 256;
}
if (_nRsAlpha < 0) {
_nRsAlpha = 0;
}
/*
var _nX_Start:Int = oDstBuff.nBuffPLimL;
var _nX_End:Int = oDstBuff.nBuffPLimR;
var _nY_Start:Int = oDstBuff.nBuffPLimT;
var _nY_End:Int = oDstBuff.nBuffPLimB;
_nX_Start = oDstBuff.nBuffPLimL;
_nX_End = oDstBuff.nBuffPLimR;
_nY_Start = oDstBuff.nBuffPLimT;
_nY_End = oDstBuff.nBuffPLimB;
*/
if(oFace != null){
oFace.fCpuDraw( oDstBuff, Math.nHPrec, Math.nHPrec, _nX_Start, _nX_End, _nY_Start, _nY_End, _nRsAlpha , _nRsBrRed , _nRsBrGreen , _nRsBrBlue , 256 , 256 , 256 , 0 , 0 ,0 );
}
//Debug.fTrace("----------FinishDraw!");
return true;
//}else{
// return false;
// }
}
public function fReversePtTransform(_vPt : Pt<Float> ):Pt<Float> {
//TODO not work, use this intead https://rosettacode.org/wiki/Find_the_intersection_of_a_line_with_a_plane
var _oGblTf : Shape = oParent;
var _oGblPt : PtA = _oGblTf.oGblPt;
var _nX : Float = _oGblPt.vPt.nX + 0.25;
var _nY : Float = _oGblPt.vPt.nY - 0.25;
_vPt.nX -= _nX;
_vPt.nY -= _nY;
// Debug.fTrace("_vPt" + _vPt.nX +"," + _vPt.nX );
var x : Float = _vPt.nX * _oGblTf.vGblSize.nWidth;
var y : Float = _vPt.nY * _oGblTf.vGblSize.nHeight;
var z : Float = _vPt.nZ * _oGblTf.vGblSize.nLength;
_vPt.nX =x;
_vPt.nY =y;
_vPt.nZ =z;
//var _vQuat : Quaternion<Float> = _oGblTf.vQuaternion;
//_vQuat.fInverse();
///_vPt.fRotate(_vQuat);
_vPt.fRotate( _oGblTf.vQuaternion);
//_vPt.nZ *= 1;
//_vPt.fRotate( _oGblTf.vQuaternion); //TODO verify
_vPt.nX =x;
_vPt.nY =y;
//_vPt.nX *= 1;
//_vPt.nY *= 1;
//Perspective
var _nFocal : Float = oDstBuff.oPerspective.nValue;
//var _oPt : PtA = aNewPt3dOri[i];
var _nZ : Float = (_vPt.nZ + _oGblPt.vPt.nZ) * _nFocal + 1;
//var _nZ : Float = 1 - ((_vPt.nZ + _oGblPt.vPt.nZ) * _nFocal) ;
// var _nZ : Float = 1 / (1-((_vPt.nZ + _oGblPt.vPt.nZ) * _nFocal)) ;
// var _nZ : Float = 1 / (1-((_vPt.nZ + _oGblPt.vPt.nZ) * _nFocal)) ;
//Debug.fTrace("_nZ " + _nZ);
//Math.fSqrt Math.fSqrt
_vPt.nX *=(_nZ);
_vPt.nY *=(_nZ);
//_oPt.o2d.nZ = _nZ;
return _vPt;
}
public function fTransform():Void {
//var _nRoll : Float = vGblRot.nRoll;
///var _nPitch : Float = vGblRot.nPitch;
//var _nYaw : Float = vGblRot.nYaw;
//var _nFocal : Float = 1.0 / 270.0;
var _oGblTf : Shape = oParent;
for( var i : UInt = 0; i < aNewPt3dOri.nSize; i++){
var _oPt : PtA = aNewPt3dOri[i];
_oPt.fCopyToFinal();
//var _vFinal : Pt = _oPt.vFinal;
/*
_oPt.vFinal.nX *= nGAttWidth;
_oPt.vFinal.nY *= nGAttHeight;
_oPt.vFinal.nZ *= nGAttLength;
*/
////// SCALE //////
var x : Float = _oPt.vFinal.nX * _oGblTf.vGblSize.nWidth;
var y : Float = _oPt.vFinal.nY * _oGblTf.vGblSize.nHeight;
var z : Float = _oPt.vFinal.nZ * _oGblTf.vGblSize.nLength;
/*
//////// Rotation /////////
var _nTx : Float = (x * Math.fCos(_nYaw)) - (z * Math.fSin(_nYaw));
var _nTz : Float = (x * Math.fSin(_nYaw)) + (z * Math.fCos(_nYaw));
var _nTy : Float = (y * Math.fCos(_nPitch)) - (_nTz * Math.fSin(_nPitch));
z = (y * Math.fSin(_nPitch) * -1) - (_nTz * Math.fCos(_nPitch));
x = (_nTx * Math.fCos(_nRoll)) - (_nTy * Math.fSin(_nRoll));
y = (_nTx * Math.fSin(_nRoll)) + (_nTy * Math.fCos(_nRoll));
///////////////////////
*/
_oPt.vFinal.nX =x;
_oPt.vFinal.nY =y;
_oPt.vFinal.nZ =z;
_oPt.vFinal.fRotate( _oGblTf.vQuaternion);
//Debug.fTrace("vQuaternion:[" + vQuaternion.nX + ", " + vQuaternion.nY + ", " + vQuaternion.nZ + ", " + vQuaternion.nW + "]");
}
}
public function fConvertTo2d():Void {
//Debug.fTrace("AAAA: " +oDstBuff.oPerspective.nFromX + ", " +oDstBuff.oPerspective.nFromY + ", " + oDstBuff.oPerspective.nValue + ", " + oDstBuff.oPerspective.nType )
var _nFocal : Float = oDstBuff.oPerspective.nValue;
//var _nX : Float = oGblPt.vPt.nX + 0.25;
//var _nY : Float = oGblPt.vPt.nY - 0.25;
var _oGblPt : PtA = oParent.oGblPt;
var _nX : Float = _oGblPt.vPt.nX + 0.25;
var _nY : Float = _oGblPt.vPt.nY - 0.25;
if(oDstBuff.oPerspective.nType == 1){
//Debug.fTrace("oDstBuff.oPerspective.nType 1");
for( var i : UInt = 0; i < aNewPt3dOri.nSize; i++){
var _oPt : PtA = aNewPt3dOri[i];
var _nZ : Float = (_oPt.vFinal.nZ + _oGblPt.vPt.nZ) * _nFocal + 1;
_oPt.o2d.nX = _oPt.vFinal.nX / _nZ + _nX;
_oPt.o2d.nY = _oPt.vFinal.nY / _nZ + _nY;
_oPt.o2d.nZ = _nZ;
}
}else {
// Debug.fTrace("oDstBuff.oPerspective.nType else");
var _nFromX : Float = oDstBuff.oPerspective.nFromX;
var _nFromY : Float = oDstBuff.oPerspective.nFromY;
for( var i : UInt = 0; i < aNewPt3dOri.nSize; i++){
var _oPt : PtA = aNewPt3dOri[i];
//var _nZ : Float = (_oPt.vFinal.nZ + oGblPt.vPt.nZ) * _nFocal + 1;
var _nZ : Float = (_oPt.vFinal.nZ + _oGblPt.vPt.nZ) * _nFocal + 1;
_oPt.o2d.nX = (_oPt.vFinal.nX + (_nX - _nFromX)) / _nZ - (_nX - _nFromX) + _nX;
_oPt.o2d.nY = (_oPt.vFinal.nY + (_nY - _nFromY)) / _nZ - (_nY - _nFromY) + _nY;
_oPt.o2d.nZ = _nZ;
}
}
}
override function fContextResume():Void {
// oGpuObj.fRecreate();
}
//TODO Verify with tiles
override public function fApplyGlobalPos():Void {
//vRot.nYaw = vRot.nYaw + 0.1;
for( var i : UInt = 0; i < aNewPt3dOri.nSize; i++){
var _oPt : PtA = aNewPt3dOri[i];
_oPt.vTf.nX = _oPt.vPt.nX * vSize.nWidth ;
_oPt.vTf.nY = _oPt.vPt.nY * vSize.nHeight;
_oPt.vTf.nZ = _oPt.vPt.nZ * vSize.nLength;
_oPt.vTf.fRotate(vQuaternion);
_oPt.vTf.nX += vPos.nX ;
_oPt.vTf.nY += vPos.nY ;
_oPt.vTf.nZ += vPos.nZ ;
}
}
}
}
| Redcode | 4 | VLiance/GZE | src/Lib_GZ/Gfx/Shape.cw | [
"Apache-2.0"
] |
unit aiQuaternion;
interface
type TaiQuaternion = packed record
w, x, y, z: single;
end;
type PaiQuaternion = ^TaiQuaternion;
implementation
end.
| Pascal | 4 | sercand/assimp | port/AssimpDelphi/aiQuaternion.pas | [
"BSD-3-Clause"
] |
#%RAML 1.0
title: Booking Service
version: v1
baseUri: /notification
types:
Cinema:
properties:
name: string
room: string
seats: string
Movie:
properties:
title: string
format: string
schedule: datetime
User:
properties:
name: string
email: string
Payload:
properties:
city: string
userType: string
totalAmount: number
cinema: Cinema
movie: Movie
orderId: string
description: string
user: User
resourceTypes:
POST:
post:
body:
application/json:
type: <<item>>
responses:
201:
body:
application/json:
type: object
/sendEmail:
type: { POST: {item : Payload} }
/sendSMS:
type: { POST: {item : Payload} }
| RAML | 4 | Soundatnj/microservicesdockermongo | raml-spec/notification-service/api.raml | [
"MIT",
"Unlicense"
] |
This is a faked .dm file for download testing purpose only.
| DM | 0 | zealoussnow/chromium | chrome/test/data/android/download/[large]wallpaper.dm | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] |
Red [
Title: "Red/System checksum function test script"
Author: "Gregg Irwin"
File: %checksum-test.red
Version: "0.0.2"
Tabs: 4
Rights: "Copyright (C) 2016 Gregg Irwin. All rights reserved."
License: "BSD-3 - https://github.com/red/red/blob/origin/BSD-3-License.txt"
Notes: {
Online calculators used for result comparisons:
http://www.fileformat.info/tool/hash.htm
https://defuse.ca/checksums.htm
http://tools.bin63.com/hmac-generator
http://www.freeformatter.com/hmac-generator.html
}
]
#include %../../../quick-test/quick-test.red
~~~start-file~~~ "checksum"
===start-group=== "Unknown method tests"
--test-- "ERR MD4" --assert error? try [#{} = checksum "" 'md4]
--test-- "ERR MD4/with" --assert error? try [#{} = checksum/with "" 'md4 ""]
===end-group===
===start-group=== "Invalid args"
--test-- "ERR string method" --assert error? try [#{} = checksum "123" ""]
--test-- "ERR word! spec" --assert error? try [#{} = checksum/with "123" 'crc32 'xxx]
--test-- "ERR CRC32 + /with" --assert error? try [#{} = checksum/with "123" 'crc32 2]
--test-- "ERR TCP + /with" --assert error? try [#{} = checksum/with "123" 'tcp 2]
--test-- "ERR string spec for hash method" --assert error? try [#{} = checksum/with "123" 'hash ""]
===end-group===
===start-group=== "TCP CRC tests"
--test-- "" --assert 65535 = checksum "" 'tcp
--test-- "^@" --assert 65535 = checksum "^@" 'tcp
--test-- "^A" --assert 65534 = checksum "^A" 'tcp
--test-- "^_" --assert 65504 = checksum "^_" 'tcp
--test-- " " --assert 65503 = checksum " " 'tcp
--test-- "Z" --assert 65445 = checksum "Z" 'tcp
--test-- "char 127" --assert 65408 = checksum form make char! 127 'tcp
--test-- "char 255" --assert 15424 = checksum form make char! 255 'tcp
--test-- "tcpcrc1"
data: "12"
--assert 52941 = checksum data 'tcp
--test-- "tcpcrc2"
data: "123"
--assert 52890 = checksum data 'tcp
--test-- "tcpcrc3"
data: "123456789"
--assert 12018 = checksum data 'tcp
--test-- "tcpcrc4"
data: "0123456789"
--assert 64245 = checksum data 'tcp
--test-- "tcpcrc5"
data: "The quick brown fox jumps over the lazy dog"
--assert 55613 = checksum data 'tcp
===end-group===
===start-group=== "CRC32 tests"
--test-- "" --assert 0 = checksum "" 'crc32
--test-- "^@" --assert -771559539 = checksum "^@" 'crc32
--test-- "^A" --assert -1526341861 = checksum "^A" 'crc32
--test-- "^_" --assert 1594548856 = checksum "^_" 'crc32
--test-- " " --assert -378745019 = checksum " " 'crc32
--test-- "Z" --assert 1505515367 = checksum "Z" 'crc32
--test-- "char 127" --assert 314082080 = checksum form make char! 127 'crc32
--test-- "char 255" --assert -87017361 = checksum form make char! 255 'crc32
--test-- "crc32-1"
data: "12"
--assert 1330857165 = checksum data 'crc32
--test-- "crc32-2"
data: "123"
--assert -2008521774 = checksum data 'crc32
--test-- "crc32-3"
data: "123456789"
--assert -873187034 = checksum data 'crc32
--test-- "crc32-4"
data: "0123456789"
--assert -1501247546 = checksum data 'crc32
--test-- "crc32-5"
data: "The quick brown fox jumps over the lazy dog"
--assert 1095738169 = checksum data 'crc32
===end-group===
===start-group=== "adler32 tests"
--test-- ""
--assert 1 = checksum "" 'adler32
--test-- "^@"
--assert 65537 = checksum "^@" 'adler32
--test-- "^A"
--assert 131074 = checksum "^A" 'adler32
--test-- "^_"
--assert 2097184 = checksum "^_" 'adler32
--test-- " "
--assert 2162721 = checksum " " 'adler32
--test-- "Z"
--assert 5963867 = checksum "Z" 'adler32
--test-- "char 127"
--assert 8388736 = checksum #{7F} 'adler32
--test-- "char 255"
--assert 16777472 = checksum #{FF} 'adler32
--test-- "adler32-1"
--assert 9830500 = checksum "12" 'adler32
--test-- "adler32-2"
--assert 19726487 = checksum "123" 'adler32
--test-- "adler32-3"
--assert 152961502 = checksum "123456789" 'adler32
--test-- "adler32-4"
--assert 184484366 = checksum "0123456789" 'adler32
--test-- "adler32-5"
data: "The quick brown fox jumps over the lazy dog"
--assert 1541148634 = checksum data 'adler32
--test-- "adler32-6"
data: "1234567890123456"
--assert 463995715 = checksum data 'adler32
--test-- "adler32-7"
data: "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
--assert -1749675927 = checksum data 'adler32
===end-group===
===start-group=== "adler32 fix-#3631 tests"
--test-- "fix-#3631-1"
--assert 11731034 = checksum "X^A" 'adler32
--test-- "fix-#3631-2"
--assert 260637475 = checksum "qwertyo^G" 'adler32
===end-group===
===start-group=== "MD5 tests"
--test-- "MD5_empty"
data: ""
expected: #{D41D8CD98F00B204E9800998ECF8427E}
--assert expected = checksum data 'md5
--test-- "MD5_quick"
data: "The quick brown fox jumps over the lazy dog"
expected: #{9E107D9D372BB6826BD81D3542A419D6}
--assert expected = checksum data 'md5
--test-- "MD5_1-9"
data: "123456789"
expected: #{25F9E794323B453885F5181F1B624D0B}
--assert expected = checksum data 'md5
--test-- "MD5_0-9"
data: "0123456789"
expected: #{781E5E245D69B566979B86E28D23F2C7}
--assert expected = checksum data 'md5
===end-group===
===start-group=== "SHA1 tests"
--test-- "SHA1_empty"
data: ""
expected: #{DA39A3EE5E6B4B0D3255BFEF95601890AFD80709}
--assert expected = checksum data 'sha1
--test-- "SHA1_quick"
data: "The quick brown fox jumps over the lazy dog"
expected: #{2FD4E1C67A2D28FCED849EE1BB76E7391B93EB12}
--assert expected = checksum data 'sha1
--test-- "SHA1_1-9"
data: "123456789"
expected: #{F7C3BC1D808E04732ADF679965CCC34CA7AE3441}
--assert expected = checksum data 'sha1
--test-- "SHA1_0-9"
data: "0123456789"
expected: #{87ACEC17CD9DCD20A716CC2CF67417B71C8A7016}
--assert expected = checksum data 'sha1
===end-group===
===start-group=== "SHA256 tests"
--test-- "SHA256_empty"
data: ""
expected: #{E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855}
--assert expected = checksum data 'sha256
--test-- "SHA256_quick"
data: "The quick brown fox jumps over the lazy dog"
expected: #{D7A8FBB307D7809469CA9ABCB0082E4F8D5651E46D3CDB762D02D0BF37C9E592}
--assert expected = checksum data 'sha256
--test-- "SHA256_1-9"
data: "123456789"
expected: #{15E2B0D3C33891EBB0F1EF609EC419420C20E320CE94C65FBC8C3312448EB225}
--assert expected = checksum data 'sha256
--test-- "SHA256_0-9"
data: "0123456789"
expected: #{84D89877F0D4041EFB6BF91A16F0248F2FD573E6AF05C19F96BEDB9F882F7882}
--assert expected = checksum data 'sha256
===end-group===
===start-group=== "SHA384 tests"
--test-- "SHA384_empty"
data: ""
expected: #{
38B060A751AC96384CD9327EB1B1E36A21FDB71114BE07434C0CC7BF63F6E1DA
274EDEBFE76F65FBD51AD2F14898B95B
}
--assert expected = checksum data 'sha384
--test-- "SHA384_quick"
data: "The quick brown fox jumps over the lazy dog"
expected: #{
CA737F1014A48F4C0B6DD43CB177B0AFD9E5169367544C494011E3317DBF9A50
9CB1E5DC1E85A941BBEE3D7F2AFBC9B1
}
--assert expected = checksum data 'sha384
--test-- "SHA384_1-9"
data: "123456789"
expected: #{
EB455D56D2C1A69DE64E832011F3393D45F3FA31D6842F21AF92D2FE469C499D
A5E3179847334A18479C8D1DEDEA1BE3
}
--assert expected = checksum data 'sha384
--test-- "SHA384_0-9"
data: "0123456789"
expected: #{
90AE531F24E48697904A4D0286F354C50A350EBB6C2B9EFCB22F71C96CEAEFFC
11C6095E9CA0DF0EC30BF685DCF2E5E5
}
--assert expected = checksum data 'sha384
===end-group===
===start-group=== "SHA512 tests"
data: ""
expected: #{
CF83E1357EEFB8BDF1542850D66D8007D620E4050B5715DC83F4A921D36CE9CE
47D0D13C5D85F2B0FF8318D2877EEC2F63B931BD47417A81A538327AF927DA3E
}
--test-- "SHA512_empty" --assert expected = checksum data 'sha512
data: "The quick brown fox jumps over the lazy dog"
expected: #{
07E547D9586F6A73F73FBAC0435ED76951218FB7D0C8D788A309D785436BBB64
2E93A252A954F23912547D1E8A3B5ED6E1BFD7097821233FA0538F3DB854FEE6
}
--test-- "SHA512_quick" --assert expected = checksum data 'sha512
data: "123456789"
expected: #{
D9E6762DD1C8EAF6D61B3C6192FC408D4D6D5F1176D0C29169BC24E71C3F274A
D27FCD5811B313D681F7E55EC02D73D499C95455B6B5BB503ACF574FBA8FFE85
}
--test-- "SHA512_1-9" --assert expected = checksum data 'sha512
data: "0123456789"
expected: #{
BB96C2FC40D2D54617D6F276FEBE571F623A8DADF0B734855299B0E107FDA32C
F6B69F2DA32B36445D73690B93CBD0F7BFC20E0F7F28553D2A4428F23B716E90
}
--test-- "SHA512_0-9" --assert expected = checksum data 'sha512
===end-group===
===start-group=== "/with (HMAC) empty data and key tests"
--test-- "MD5"
data: copy ""
key: copy ""
expected: #{74E6F7298A9C2D168935F58C001BAD88}
--assert expected = checksum/with data 'md5 key
--test-- "SHA1"
data: copy ""
key: copy ""
expected: #{FBDB1D1B18AA6C08324B7D64B71FB76370690E1D}
--assert expected = checksum/with data 'sha1 key
--test-- "SHA256"
data: copy ""
key: copy ""
expected: #{B613679A0814D9EC772F95D778C35FC5FF1697C493715653C6C712144292C5AD}
--assert expected = checksum/with data 'sha256 key
--test-- "SHA384"
data: copy ""
key: copy ""
expected: #{
6C1F2EE938FAD2E24BD91298474382CA218C75DB3D83E114B3D4367776D14D35
51289E75E8209CD4B792302840234ADC
}
--assert expected = checksum/with data 'sha384 key
--test-- "SHA512"
data: copy ""
key: copy ""
expected: #{
B936CEE86C9F87AA5D3C6F2E84CB5A4239A5FE50480A6EC66B70AB5B1F4AC673
0C6C515421B327EC1D69402E53DFB49AD7381EB067B338FD7B0CB22247225D47
}
--assert expected = checksum/with data 'sha512 key
===end-group===
===start-group=== "/with (HMAC) standard test vectors"
--test-- "MD5"
data: copy "The quick brown fox jumps over the lazy dog"
key: copy "key"
expected: #{80070713463E7749B90C2DC24911E275}
--assert expected = checksum/with data 'md5 key
--test-- "SHA1"
data: copy "The quick brown fox jumps over the lazy dog"
key: copy "key"
expected: #{DE7C9B85B8B78AA6BC8A7A36F70A90701C9DB4D9}
--assert expected = checksum/with data 'sha1 key
--test-- "SHA256"
data: copy "The quick brown fox jumps over the lazy dog"
key: copy "key"
expected: #{F7BC83F430538424B13298E6AA6FB143EF4D59A14946175997479DBC2D1A3CD8}
--assert expected = checksum/with data 'sha256 key
--test-- "SHA384"
data: copy "The quick brown fox jumps over the lazy dog"
key: copy "key"
expected: #{
D7F4727E2C0B39AE0F1E40CC96F60242D5B7801841CEA6FC592C5D3E1AE50700
582A96CF35E1E554995FE4E03381C237
}
--assert expected = checksum/with data 'sha384 key
--test-- "SHA512"
data: copy "The quick brown fox jumps over the lazy dog"
key: copy "key"
expected: #{
B42AF09057BAC1E2D41708E48A902E09B5FF7F12AB428A4FE86653C73DD248FB
82F948A549F7B791A5B41915EE4D1EC3935357E4E2317250D0372AFA2EBEEB3A
}
--assert expected = checksum/with data 'sha512 key
;-------------------------------------------------------------------------------
; Test vectors from RFC 4231 (https://tools.ietf.org/html/rfc4231)
;-------------------------------------------------------------------------------
--test-- "PRF-1-HMAC-SHA-256"
data: copy #{4869205468657265} ; "Hi There"
key: copy #{0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B} ; 20 bytes
expected: #{B0344C61D8DB38535CA8AFCEAF0BF12B881DC200C9833DA726E9376C2E32CFF7}
--assert expected = checksum/with data 'sha256 key
--test-- "PRF-1-HMAC-SHA-384"
data: copy #{4869205468657265} ; "Hi There"
key: copy #{0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B} ; 20 bytes
expected: #{
AFD03944D84895626B0825F4AB46907F15F9DADBE4101EC682AA034C7CEBC59C
FAEA9EA9076EDE7F4AF152E8B2FA9CB6
}
--assert expected = checksum/with data 'sha384 key
--test-- "PRF-1-HMAC-SHA-512"
data: copy #{4869205468657265} ; "Hi There"
key: copy #{0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B} ; 20 bytes
expected: #{
87AA7CDEA5EF619D4FF0B4241A1D6CB02379F4E2CE4EC2787AD0B30545E17CDE
DAA833B7D6B8A702038B274EAEA3F4E4BE9D914EEB61F1702E696C203A126854
}
--assert expected = checksum/with data 'sha512 key
--test-- "PRF-2-HMAC-SHA-256"
data: copy "what do ya want for nothing?"
key: copy "Jefe"
expected: #{5BDCC146BF60754E6A042426089575C75A003F089D2739839DEC58B964EC3843}
--assert expected = checksum/with data 'sha256 key
--test-- "PRF-2-HMAC-SHA-384"
data: copy "what do ya want for nothing?"
key: copy "Jefe"
expected: #{
AF45D2E376484031617F78D2B58A6B1B9C7EF464F5A01B47E42EC3736322445E
8E2240CA5E69E2C78B3239ECFAB21649
}
--assert expected = checksum/with data 'sha384 key
--test-- "PRF-2-HMAC-SHA-512"
data: copy "what do ya want for nothing?"
key: copy "Jefe"
expected: #{
164B7A7BFCF819E2E395FBE73B56E0A387BD64222E831FD610270CD7EA250554
9758BF75C05A994A6D034F65F8F0E6FDCAEAB1A34D4A6B4B636E070A38BCE737
}
--assert expected = checksum/with data 'sha512 key
--test-- "PRF-3-HMAC-SHA-256"
data: copy #{ ; 50 bytes
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
}
key: copy #{AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA} ; 20 bytes
expected: #{773EA91E36800E46854DB8EBD09181A72959098B3EF8C122D9635514CED565FE}
--assert expected = checksum/with data 'sha256 key
--test-- "PRF-3-HMAC-SHA-384"
data: copy #{ ; 50 bytes
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
}
key: copy #{AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA} ; 20 bytes
expected: #{
88062608D3E6AD8A0AA2ACE014C8A86F0AA635D947AC9FEBE83EF4E55966144B
2A5AB39DC13814B94E3AB6E101A34F27
}
--assert expected = checksum/with data 'sha384 key
--test-- "PRF-3-HMAC-SHA-512"
data: copy #{ ; 50 bytes
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
}
key: copy #{AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA} ; 20 bytes
expected: #{
FA73B0089D56A284EFB0F0756C890BE9B1B5DBDD8EE81A3655F83E33B2279D39
BF3E848279A722C806B485A47E67C807B946A337BEE8942674278859E13292FB
}
--assert expected = checksum/with data 'sha512 key
--test-- "PRF-4-HMAC-SHA-256"
data: copy #{ ; 50 bytes
CDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCD
CDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCD
}
key: copy #{0102030405060708090A0B0C0D0E0F10111213141516171819} ; 25 bytes
expected: #{82558A389A443C0EA4CC819899F2083A85F0FAA3E578F8077A2E3FF46729665B}
--assert expected = checksum/with data 'sha256 key
--test-- "PRF-4-HMAC-SHA-384"
data: copy #{ ; 50 bytes
CDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCD
CDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCD
}
key: copy #{0102030405060708090A0B0C0D0E0F10111213141516171819} ; 25 bytes
expected: #{
3E8A69B7783C25851933AB6290AF6CA77A9981480850009CC5577C6E1F573B4E
6801DD23C4A7D679CCF8A386C674CFFB
}
--assert expected = checksum/with data 'sha384 key
--test-- "PRF-4-HMAC-SHA-512"
data: copy #{ ; 50 bytes
CDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCD
CDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCD
}
key: copy #{0102030405060708090A0B0C0D0E0F10111213141516171819} ; 25 bytes
expected: #{
B0BA465637458C6990E5A8C5F61D4AF7E576D97FF94B872DE76F8050361EE3DB
A91CA5C11AA25EB4D679275CC5788063A5F19741120C4F2DE2ADEBEB10A298DD
}
--assert expected = checksum/with data 'sha512 key
--test-- "PRF-5-HMAC-SHA-256"
data: copy #{546573742057697468205472756e636174696f6e} ; "Test With Truncation"
key: copy #{0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C} ; 20 bytes
expected: #{A3B6167473100EE06E0C796C2955552BFA6F7C0A6A8AEF8B93F860AAB0CD20C5}
--assert expected = checksum/with data 'sha256 key
--test-- "PRF-5-HMAC-SHA-384"
data: copy #{546573742057697468205472756e636174696f6e} ; "Test With Truncation"
key: copy #{0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C} ; 20 bytes
expected: #{
3ABF34C3503B2A23A46EFC619BAEF897F4C8E42C934CE55CCBAE9740FCBC1AF4
CA62269E2A37CD88BA926341EFE4AEEA
}
--assert expected = checksum/with data 'sha384 key
--test-- "PRF-5-HMAC-SHA-512"
data: copy #{546573742057697468205472756e636174696f6e} ; "Test With Truncation"
key: copy #{0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C} ; 20 bytes
expected: #{
415FAD6271580A531D4179BC891D87A650188707922A4FBB36663A1EB16DA008
711C5B50DDD0FC235084EB9D3364A1454FB2EF67CD1D29FE6773068EA266E96B
}
--assert expected = checksum/with data 'sha512 key
; "Test Using Larger Than Block-Size Key - Hash Key First"
data: copy #{
54657374205573696E67204C6172676572205468616E20426C6F636B2D53697A
65204B6579202D2048617368204B6579204669727374
}
key: #{ ; 131 bytes
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAA
}
--test-- "PRF-6-HMAC-SHA-256"
; "Test Using Larger Than Block-Size Key - Hash Key First"
data: copy #{
54657374205573696E67204C6172676572205468616E20426C6F636B2D53697A
65204B6579202D2048617368204B6579204669727374
}
key: #{ ; 131 bytes
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAA
}
expected: #{60E431591EE0B67F0D8A26AACBF5B77F8E0BC6213728C5140546040F0EE37F54}
--assert expected = checksum/with data 'sha256 key
--test-- "PRF-6-HMAC-SHA-384"
; "Test Using Larger Than Block-Size Key - Hash Key First"
data: copy #{
54657374205573696E67204C6172676572205468616E20426C6F636B2D53697A
65204B6579202D2048617368204B6579204669727374
}
key: #{ ; 131 bytes
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAA
}
expected: #{
4ECE084485813E9088D2C63A041BC5B44F9EF1012A2B588F3CD11F05033AC4C6
0C2EF6AB4030FE8296248DF163F44952
}
--assert expected = checksum/with data 'sha384 key
--test-- "PRF-6-HMAC-SHA-512"
; "Test Using Larger Than Block-Size Key - Hash Key First"
data: copy #{
54657374205573696E67204C6172676572205468616E20426C6F636B2D53697A
65204B6579202D2048617368204B6579204669727374
}
key: #{ ; 131 bytes
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAA
}
expected: #{
80B24263C7C1A3EBB71493C1DD7BE8B49B46D1F41B4AEEC1121B013783F8F352
6B56D037E05F2598BD0FD2215D6A1E5295E64F73F63F0AEC8B915A985D786598
}
--assert expected = checksum/with data 'sha512 key
--test-- "PRF-7-HMAC-SHA-256"
; data = "This is a test using a larger than block-size key
; and a larger than block-size data. The key needs to be
; hashed before being used by the HMAC algorithm."
data: #{
5468697320697320612074657374207573696E672061206C6172676572207468
616E20626C6F636B2D73697A65206B657920616E642061206C61726765722074
68616E20626C6F636B2D73697A6520646174612E20546865206B6579206E6565
647320746F20626520686173686564206265666F7265206265696E6720757365
642062792074686520484D414320616C676F726974686D2E
}
key: #{ ; 131 bytes
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAA
}
expected: #{9B09FFA71B942FCB27635FBCD5B0E944BFDC63644F0713938A7F51535C3A35E2}
--assert expected = checksum/with data 'sha256 key
--test-- "PRF-7-HMAC-SHA-384"
; data = "This is a test using a larger than block-size key
; and a larger than block-size data. The key needs to be
; hashed before being used by the HMAC algorithm."
data: #{
5468697320697320612074657374207573696E672061206C6172676572207468
616E20626C6F636B2D73697A65206B657920616E642061206C61726765722074
68616E20626C6F636B2D73697A6520646174612E20546865206B6579206E6565
647320746F20626520686173686564206265666F7265206265696E6720757365
642062792074686520484D414320616C676F726974686D2E
}
key: #{ ; 131 bytes
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAA
}
expected: #{
6617178E941F020D351E2F254E8FD32C602420FEB0B8FB9ADCCEBB82461E99C5
A678CC31E799176D3860E6110C46523E
}
--assert expected = checksum/with data 'sha384 key
--test-- "PRF-7-HMAC-SHA-512"
; data = "This is a test using a larger than block-size key
; and a larger than block-size data. The key needs to be
; hashed before being used by the HMAC algorithm."
data: #{
5468697320697320612074657374207573696E672061206C6172676572207468
616E20626C6F636B2D73697A65206B657920616E642061206C61726765722074
68616E20626C6F636B2D73697A6520646174612E20546865206B6579206E6565
647320746F20626520686173686564206265666F7265206265696E6720757365
642062792074686520484D414320616C676F726974686D2E
}
key: #{ ; 131 bytes
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAA
}
expected: #{
E37B6A775DC87DBAA4DFA9F96E5E3FFDDEBD71F8867289865DF5A32D20CDC944
B6022CAC3C4982B10D5EEB55C3E4DE15134676FB6DE0446065C97440FA8C6A58
}
--assert expected = checksum/with data 'sha512 key
===end-group===
~~~end-file~~~
| Red | 5 | GalenIvanov/red | tests/source/units/checksum-test.red | [
"BSL-1.0",
"BSD-3-Clause"
] |
.q-btn-toggle
position: relative
| Sass | 0 | ygyg70/quasar | ui/src/components/btn-toggle/QBtnToggle.sass | [
"MIT"
] |
/*
Copyright (c) 2021 by Contributors
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 ml.dmlc.xgboost4j.scala
import _root_.scala.collection.JavaConverters._
import ml.dmlc.xgboost4j.java.{Column, ColumnBatch, XGBoostError, DeviceQuantileDMatrix => JDeviceQuantileDMatrix}
class DeviceQuantileDMatrix private[scala](
private[scala] override val jDMatrix: JDeviceQuantileDMatrix) extends DMatrix(jDMatrix) {
/**
* Create DeviceQuantileDMatrix from iterator based on the cuda array interface
*
* @param iter the XGBoost ColumnBatch batch to provide the corresponding cuda array interface
* @param missing the missing value
* @param maxBin the max bin
* @param nthread the parallelism
* @throws XGBoostError
*/
def this(iter: Iterator[ColumnBatch], missing: Float, maxBin: Int, nthread: Int) {
this(new JDeviceQuantileDMatrix(iter.asJava, missing, maxBin, nthread))
}
/**
* set label of dmatrix
*
* @param labels labels
*/
@throws(classOf[XGBoostError])
override def setLabel(labels: Array[Float]): Unit =
throw new XGBoostError("DeviceQuantileDMatrix does not support setLabel.")
/**
* set weight of each instance
*
* @param weights weights
*/
@throws(classOf[XGBoostError])
override def setWeight(weights: Array[Float]): Unit =
throw new XGBoostError("DeviceQuantileDMatrix does not support setWeight.")
/**
* if specified, xgboost will start from this init margin
* can be used to specify initial prediction to boost from
*
* @param baseMargin base margin
*/
@throws(classOf[XGBoostError])
override def setBaseMargin(baseMargin: Array[Float]): Unit =
throw new XGBoostError("DeviceQuantileDMatrix does not support setBaseMargin.")
/**
* if specified, xgboost will start from this init margin
* can be used to specify initial prediction to boost from
*
* @param baseMargin base margin
*/
@throws(classOf[XGBoostError])
override def setBaseMargin(baseMargin: Array[Array[Float]]): Unit =
throw new XGBoostError("DeviceQuantileDMatrix does not support setBaseMargin.")
/**
* Set group sizes of DMatrix (used for ranking)
*
* @param group group size as array
*/
@throws(classOf[XGBoostError])
override def setGroup(group: Array[Int]): Unit =
throw new XGBoostError("DeviceQuantileDMatrix does not support setGroup.")
/**
* Set label of DMatrix from cuda array interface
*/
@throws(classOf[XGBoostError])
override def setLabel(column: Column): Unit =
throw new XGBoostError("DeviceQuantileDMatrix does not support setLabel.")
/**
* set weight of dmatrix from column array interface
*/
@throws(classOf[XGBoostError])
override def setWeight(column: Column): Unit =
throw new XGBoostError("DeviceQuantileDMatrix does not support setWeight.")
/**
* set base margin of dmatrix from column array interface
*/
@throws(classOf[XGBoostError])
override def setBaseMargin(column: Column): Unit =
throw new XGBoostError("DeviceQuantileDMatrix does not support setBaseMargin.")
}
| Scala | 4 | GinkoBalboa/xgboost | jvm-packages/xgboost4j/src/main/scala/ml/dmlc/xgboost4j/scala/DeviceQuantileDMatrix.scala | [
"Apache-2.0"
] |
$ORIGIN example.net.
@ IN SOA hostmaster.example.net. ns.example.net. (
2020011301
1H ; refresh
8H ; retry
4W ; expire
1H ; minimum ttl
) ;
@ IN NS ns.example.net.
@ IN MX 10 mail.example.net.
ns1 IN A 127.0.0.1
mail IN A 172.0.0.1
| DNS Zone | 3 | gearnode/nsd | tpkg/socket_partitioning.tdir/socket_partitioning.zone | [
"BSD-3-Clause"
] |
extends KinematicBody
export(bool) var _gravity_on_floor = true
export(bool) var _stop_on_slopes = false
export(bool) var _use_snap = false
var _gravity = 20.0
var _velocity = Vector3.ZERO
func _physics_process(delta):
var snap = Vector3.DOWN * 0.2
if is_on_floor() and _gravity_on_floor:
_velocity += Vector3.DOWN * _gravity * delta
else:
_velocity += Vector3.DOWN * _gravity * delta
snap = Vector3.ZERO
if _use_snap:
_velocity = move_and_slide_with_snap(_velocity, snap, Vector3.UP, _stop_on_slopes)
else:
_velocity = move_and_slide(_velocity, Vector3.UP, _stop_on_slopes)
| GDScript | 3 | jonbonazza/godot-demo-projects | 3d/physics_tests/utils/kinematicbody_physics.gd | [
"MIT"
] |
from django.contrib.admindocs import views
from django.urls import path, re_path
urlpatterns = [
path(
'',
views.BaseAdminDocsView.as_view(template_name='admin_doc/index.html'),
name='django-admindocs-docroot',
),
path(
'bookmarklets/',
views.BookmarkletsView.as_view(),
name='django-admindocs-bookmarklets',
),
path(
'tags/',
views.TemplateTagIndexView.as_view(),
name='django-admindocs-tags',
),
path(
'filters/',
views.TemplateFilterIndexView.as_view(),
name='django-admindocs-filters',
),
path(
'views/',
views.ViewIndexView.as_view(),
name='django-admindocs-views-index',
),
path(
'views/<view>/',
views.ViewDetailView.as_view(),
name='django-admindocs-views-detail',
),
path(
'models/',
views.ModelIndexView.as_view(),
name='django-admindocs-models-index',
),
re_path(
r'^models/(?P<app_label>[^\.]+)\.(?P<model_name>[^/]+)/$',
views.ModelDetailView.as_view(),
name='django-admindocs-models-detail',
),
path(
'templates/<path:template>/',
views.TemplateDetailView.as_view(),
name='django-admindocs-templates',
),
]
| Python | 3 | Lucas11200/LocaPy | Lib/site-packages/django/contrib/admindocs/urls.py | [
"bzip2-1.0.6"
] |
<div class="settings">
<a href="#" class="btn btn-icon btn-lg settings-btn" data-bs-toggle="offcanvas" data-bs-target="#offcanvasSettings">
{% include ui/icon.html icon="settings" %}
</a>
<form class="offcanvas offcanvas-end offcanvas-narrow" tabindex="-1" id="offcanvasSettings">
<div class="offcanvas-header">
<h2 class="offcanvas-title">Theme Builder</h2>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<div class="mb-4">
<label class="form-label">Color scheme</label>
<p class="form-hint">The perfect color mode for your app.</p>
<div class="row g-2">
{% assign schemes = 'light,mixed,colored,dark,transparent' | split: ',' %}
{% for scheme in schemes %}
<div class="col-6">
<label class="form-selectgroup-item">
<input type="radio" name="settings-theme" value="{{ scheme }}" class="form-selectgroup-input" />
<div class="form-selectgroup-label text-center">
<span class="form-selectgroup-check form-selectgroup-check-floated"></span>
<div class="settings-scheme settings-scheme-{{ scheme }}"></div>
<div>{{ scheme | capitalize }}</div>
</div>
</label>
</div>
{% endfor %}
</div>
</div>
<div class="mb-4">
<div class="form-label">Menu position</div>
<p class="form-hint">Toggle the position of the menu.</p>
<div>
{% assign positions = 'top,top-condensed,top-overlap,combo,left,right' | split: ',' %}
{% for position in positions %}
<label class="form-check">
<input class="form-check-input" name="settings-menu-position" value="{{ position }}" type="radio" />
<span class="form-check-label">{{ position | capitalize }}</span>
</label>
{% endfor %}
</div>
</div>
<div class="mb-4">
<div class="form-label">Menu behavior</div>
<p class="form-hint">Change the behavior of the menu.</p>
<div>
{% assign behaviors = 'sticky,fixed,compact' | split: ',' %}
{% for behavior in behaviors %}
<label class="form-check">
<input class="form-check-input" name="settings-menu-behavior" value="{{ behavior }}" type="radio" />
<span class="form-check-label">{{ behavior | capitalize }}</span>
</label>
{% endfor %}
</div>
</div>
<div class="mb-4">
<div class="form-label">Layout</div>
<p class="form-hint">Toggle container layout system.</p>
<div>
{% assign systems = 'boxed,fluid' | split: ',' %}
{% for system in systems %}
<label class="form-check">
<input class="form-check-input" name="settings-container-layout" value="{{ system }}" type="radio" />
<span class="form-check-label">{{ system | capitalize }}</span>
</label>
{% endfor %}
</div>
</div>
</div>
<div class="offcanvas-footer">
<button type="submit" class="btn btn-primary w-100">
{% include ui/icon.html icon="settings" %}
Save settings
</button>
</div>
</form>
</div> | HTML | 4 | wf-muhammadumar/tabler | src/pages/_includes/settings.html | [
"MIT"
] |
Make access log use local time with timezone
| Cucumber | 5 | ikrivosheev/aiohttp | CHANGES/3853.feature | [
"Apache-2.0"
] |
within ModelicaByExample.Subsystems;
package GearSubsystemModel "Build a subsystem model representing a gear with backlash"
end GearSubsystemModel;
| Modelica | 3 | JavascriptID/sourcerer-app | src/test/resources/samples/langs/Modelica/package3.mo | [
"MIT"
] |
<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24" viewBox="0 0 24 24" width="24"><g><rect fill="none" height="24" width="24"/></g><g><g><path d="M19.89,10.75C19.96,11.16,20,11.57,20,12c0,4.41-3.59,8-8,8s-8-3.59-8-8c0-0.05,0.01-0.1,0-0.14 c2.6-0.98,4.69-2.99,5.74-5.55c3.38,4.14,7.97,3.73,8.99,3.61l-0.89-1.93c-0.13,0.01-4.62,0.38-7.18-3.86 c1.01-0.16,1.71-0.15,2.59-0.01c2.52-1.15,1.93-0.89,2.76-1.26C14.78,2.3,13.43,2,12,2C6.48,2,2,6.48,2,12s4.48,10,10,10 s10-4.48,10-10c0-1.43-0.3-2.78-0.84-4.01L19.89,10.75z M8.08,5.03C7.45,6.92,6.13,8.5,4.42,9.47C5.05,7.58,6.37,6,8.08,5.03z"/><circle cx="15" cy="13" r="1.25"/><circle cx="9" cy="13" r="1.25"/><polygon points="23,4.5 20.6,3.4 19.5,1 18.4,3.4 16,4.5 18.4,5.6 19.5,8 20.6,5.6"/></g></g></svg> | SVG | 1 | good-gym/material-ui | packages/material-ui-icons/material-icons/face_retouching_natural_outlined_24px.svg | [
"MIT"
] |
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {getSystemPath, normalize, virtualFs} from '@angular-devkit/core';
import {TempScopedNodeJsSyncHost} from '@angular-devkit/core/node/testing';
import {HostTree} from '@angular-devkit/schematics';
import {SchematicTestRunner, UnitTestTree} from '@angular-devkit/schematics/testing';
import * as shx from 'shelljs';
describe('TestBed teardown migration', () => {
let runner: SchematicTestRunner;
let host: TempScopedNodeJsSyncHost;
let tree: UnitTestTree;
let tmpDirPath: string;
let previousWorkingDir: string;
beforeEach(() => {
runner = new SchematicTestRunner('test', require.resolve('../migrations.json'));
host = new TempScopedNodeJsSyncHost();
tree = new UnitTestTree(new HostTree(host));
writeFile('/tsconfig.json', JSON.stringify({
compilerOptions: {
lib: ['es2015'],
strictNullChecks: true,
},
}));
writeFile('/angular.json', JSON.stringify({
version: 1,
projects: {t: {architect: {build: {options: {tsConfig: './tsconfig.json'}}}}}
}));
// We need to declare the Angular symbols we're testing for, otherwise type checking won't work.
// Note that the declarations here are a little more convoluted than they need to be. It's
// because they've been copied over directly from `node_modules/@angular/core/testing.d.ts`,
// except for removing some methods that are irrelevant to these tests.
writeFile('/node_modules/@angular/core/testing.d.ts', `
export declare const getTestBed: () => TestBed;
export declare interface TestBed {
initTestEnvironment(ngModule: any, platform: any, options?: any): void;
configureTestingModule(moduleDef: any): void;
}
export declare const TestBed: TestBedStatic;
export declare interface TestBedStatic {
new (...args: any[]): TestBed;
initTestEnvironment(ngModule: any, platform: any, options?: any): TestBed;
configureTestingModule(moduleDef: any): TestBedStatic;
}
export declare function withModule(moduleDef: any, fn: Function): () => any;
`);
previousWorkingDir = shx.pwd();
tmpDirPath = getSystemPath(host.root);
// Switch into the temporary directory path. This allows us to run
// the schematic against our custom unit test tree.
shx.cd(tmpDirPath);
});
afterEach(() => {
shx.cd(previousWorkingDir);
shx.rm('-r', tmpDirPath);
});
it('should migrate calls to initTestEnvironment', async () => {
writeFile('/index.ts', `
import { TestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
`);
await runMigration();
expect(stripWhitespace(tree.readContent('/index.ts'))).toContain(stripWhitespace(`
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
teardown: { destroyAfterEach: false }
});
`));
});
it('should migrate calls to initTestEnvironment going through getTestBed()', async () => {
writeFile('/index.ts', `
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
`);
await runMigration();
expect(stripWhitespace(tree.readContent('/index.ts'))).toContain(stripWhitespace(`
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
teardown: { destroyAfterEach: false }
});
`));
});
it('should migrate calls to initTestEnvironment going through a variable', async () => {
writeFile('/index.ts', `
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
const tb = getTestBed();
tb.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
`);
await runMigration();
expect(stripWhitespace(tree.readContent('/index.ts'))).toContain(stripWhitespace(`
tb.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
teardown: { destroyAfterEach: false }
});
`));
});
it('should migrate not calls to initTestEnvironment that already specify a teardown behavior',
async () => {
writeFile('/index.ts', `
import { TestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
teardown: {destroyAfterEach: true}
});
`);
await runMigration();
expect(stripWhitespace(tree.readContent('/index.ts'))).toContain(stripWhitespace(`
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
teardown: {destroyAfterEach: true}
});
`));
});
it('should migrate calls to initTestEnvironment that pass in aotSummaries as an arrow function',
async () => {
writeFile('/index.ts', `
import { TestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
class Foo {}
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), () => [Foo]);
`);
await runMigration();
expect(stripWhitespace(tree.readContent('/index.ts'))).toContain(stripWhitespace(`
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
aotSummaries: () => [Foo],
teardown: { destroyAfterEach: false }
});
`));
});
it('should migrate calls to initTestEnvironment that pass in aotSummaries as an anonymous function',
async () => {
writeFile('/index.ts', `
import { TestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
class Foo {}
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), function() {
return [Foo];
});
`);
await runMigration();
expect(stripWhitespace(tree.readContent('/index.ts'))).toContain(stripWhitespace(`
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
aotSummaries: function() {
return [Foo];
},
teardown: { destroyAfterEach: false }
});
`));
});
it('should migrate calls to initTestEnvironment that pass in aotSummaries via an object literal',
async () => {
writeFile('/index.ts', `
import { TestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
class Foo {}
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
aotSummaries: () => [Foo]
});
`);
await runMigration();
expect(stripWhitespace(tree.readContent('/index.ts'))).toContain(stripWhitespace(`
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
aotSummaries: () => [Foo],
teardown: { destroyAfterEach: false }
});
`));
});
it('should migrate initTestEnvironment calls across multiple files', async () => {
writeFile('/test-init.ts', `
import { TestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
`);
writeFile('/other-test-init.ts', `
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
`);
await runMigration();
expect(stripWhitespace(tree.readContent('/test-init.ts'))).toContain(stripWhitespace(`
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
teardown: { destroyAfterEach: false }
});
`));
expect(stripWhitespace(tree.readContent('/other-test-init.ts'))).toContain(stripWhitespace(`
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
teardown: { destroyAfterEach: false }
});
`));
});
it('should not migrate calls to initTestEnvironment that pass in a variable', async () => {
writeFile('/index.ts', `
import { TestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
const config = {aotSummaries: () => []};
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), config);
`);
await runMigration();
const content = stripWhitespace(tree.readContent('/index.ts'));
expect(content).toContain(stripWhitespace(`const config = {aotSummaries: () => []};`));
expect(content).toContain(stripWhitespace(`
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), config);
`));
});
it('should not migrate invalid initTestEnvironment calls', async () => {
writeFile('/index.ts', `
import { TestBed } from '@angular/core/testing';
TestBed.initTestEnvironment();
`);
await runMigration();
expect(stripWhitespace(tree.readContent('/index.ts')))
.toContain(stripWhitespace(`TestBed.initTestEnvironment();`));
});
it('should not migrate calls to initTestEnvironment not coming from Angular', async () => {
writeFile('/index.ts', `
import { TestBed } from '@not-angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
`);
await runMigration();
expect(stripWhitespace(tree.readContent('/index.ts')))
.toContain(stripWhitespace(
`TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());`));
});
it('should migrate calls to initTestEnvironment when TestBed is aliased', async () => {
writeFile('/index.ts', `
import { TestBed as AliasOfTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
AliasOfTestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
`);
await runMigration();
expect(stripWhitespace(tree.readContent('/index.ts'))).toContain(stripWhitespace(`
AliasOfTestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
teardown: { destroyAfterEach: false }
});
`));
});
it('should migrate withModule calls', async () => {
writeFile('/index.spec.ts', `
import { Component } from '@angular/core';
import { withModule, TestBed } from '@angular/core/testing';
@Component({template: ''})
class Comp {}
it('should work', withModule({
declarations: [Comp],
}, () => {
TestBed.createComponent(Comp);
}));
`);
await runMigration();
expect(stripWhitespace(tree.readContent('/index.spec.ts'))).toContain(stripWhitespace(`
it('should work', withModule({
declarations: [Comp],
teardown: {destroyAfterEach: false}
}, () => {
TestBed.createComponent(Comp);
}));
`));
});
it('should not migrate withModule calls that already pass in the teardown flag', async () => {
writeFile('/index.spec.ts', `
import { Component } from '@angular/core';
import { withModule, TestBed } from '@angular/core/testing';
@Component({template: ''})
class Comp {}
it('should work', withModule({
teardown: {destroyAfterEach: true},
declarations: [Comp],
}, () => {
TestBed.createComponent(Comp);
}));
`);
await runMigration();
expect(stripWhitespace(tree.readContent('/index.spec.ts'))).toContain(stripWhitespace(`
it('should work', withModule({
teardown: {destroyAfterEach: true},
declarations: [Comp],
}, () => {
TestBed.createComponent(Comp);
}));
`));
});
it('should not migrate withModule calls that do not come from Angular', async () => {
writeFile('/index.spec.ts', `
import { Component } from '@angular/core';
import { TestBed } from '@angular/core/testing';
function withModule(...args: any[]) {}
@Component({template: ''})
class Comp {}
it('should work', withModule({
declarations: [Comp],
}, () => {
TestBed.createComponent(Comp);
}));
`);
await runMigration();
expect(stripWhitespace(tree.readContent('/index.spec.ts'))).toContain(stripWhitespace(`
it('should work', withModule({
declarations: [Comp],
}, () => {
TestBed.createComponent(Comp);
}));
`));
});
it('should migrate aliased withModule calls', async () => {
writeFile('/index.spec.ts', `
import { Component } from '@angular/core';
import { withModule as aliasOfWithModule, TestBed } from '@angular/core/testing';
@Component({template: ''})
class Comp {}
it('should work', aliasOfWithModule({
declarations: [Comp],
}, () => {
TestBed.createComponent(Comp);
}));
`);
await runMigration();
expect(stripWhitespace(tree.readContent('/index.spec.ts'))).toContain(stripWhitespace(`
it('should work', aliasOfWithModule({
declarations: [Comp],
teardown: {destroyAfterEach: false}
}, () => {
TestBed.createComponent(Comp);
}));
`));
});
it('should migrate configureTestingModule calls', async () => {
writeFile('/index.spec.ts', `
import { Component } from '@angular/core';
import { TestBed } from '@angular/core/testing';
@Component({template: ''})
class Comp {}
it('should work', () => {
TestBed.configureTestingModule({
declarations: [Comp]
});
const fixture = TestBed.createComponent(Comp);
fixture.detectChanges();
});
`);
await runMigration();
expect(stripWhitespace(tree.readContent('/index.spec.ts'))).toContain(stripWhitespace(`
TestBed.configureTestingModule({
declarations: [Comp],
teardown: {destroyAfterEach: false}
});
`));
});
it('should migrate multiple configureTestingModule calls within the same file', async () => {
writeFile('/index.spec.ts', `
import { Component } from '@angular/core';
import { TestBed } from '@angular/core/testing';
@Component({template: ''})
class Comp {}
@Component({template: ''})
class BetterComp {}
it('should work', () => {
TestBed.configureTestingModule({
declarations: [Comp]
});
const fixture = TestBed.createComponent(Comp);
fixture.detectChanges();
});
it('should work better', () => {
TestBed.configureTestingModule({
declarations: [BetterComp]
});
const fixture = TestBed.createComponent(BetterComp);
fixture.detectChanges();
});
`);
await runMigration();
const content = stripWhitespace(tree.readContent('/index.spec.ts'));
expect(content).toContain(stripWhitespace(`
TestBed.configureTestingModule({
declarations: [Comp],
teardown: {destroyAfterEach: false}
});
`));
expect(content).toContain(stripWhitespace(`
TestBed.configureTestingModule({
declarations: [BetterComp],
teardown: {destroyAfterEach: false}
});
`));
});
it('should migrate configureTestingModule calls through getTestBed()', async () => {
writeFile('/index.spec.ts', `
import { Component } from '@angular/core';
import { getTestBed } from '@angular/core/testing';
@Component({template: ''})
class Comp {}
it('should work', () => {
getTestBed().configureTestingModule({
declarations: [Comp]
});
const fixture = getTestBed().createComponent(Comp);
fixture.detectChanges();
});
`);
await runMigration();
expect(stripWhitespace(tree.readContent('/index.spec.ts'))).toContain(stripWhitespace(`
getTestBed().configureTestingModule({
declarations: [Comp],
teardown: {destroyAfterEach: false}
});
`));
});
it('should not migrate configureTestingModule calls that already pass in the teardown flag',
async () => {
writeFile('/index.spec.ts', `
import { Component } from '@angular/core';
import { TestBed } from '@angular/core/testing';
@Component({template: ''})
class Comp {}
it('should work', () => {
TestBed.configureTestingModule({
teardown: {destroyAfterEach: true},
declarations: [Comp]
});
const fixture = TestBed.createComponent(Comp);
fixture.detectChanges();
});
`);
await runMigration();
expect(stripWhitespace(tree.readContent('/index.spec.ts'))).toContain(stripWhitespace(`
TestBed.configureTestingModule({
teardown: {destroyAfterEach: true},
declarations: [Comp]
});
`));
});
it('should not migrate configureTestingModule or withModule calls if initTestEnvironment was migrated in another file',
async () => {
writeFile('/test-init.ts', `
import { TestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
`);
writeFile('/comp.spec.ts', `
import { Component } from '@angular/core';
import { TestBed, withModule } from '@angular/core/testing';
@Component({template: ''})
class Comp {}
it('should work', () => {
TestBed.configureTestingModule({
declarations: [Comp]
});
const fixture = TestBed.createComponent(Comp);
fixture.detectChanges();
});
it('should also work', withModule({
declarations: [Comp],
}, () => {
TestBed.createComponent(Comp);
}));
`);
await runMigration();
expect(stripWhitespace(tree.readContent('/test-init.ts'))).toContain(stripWhitespace(`
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
teardown: { destroyAfterEach: false }
});
`));
expect(stripWhitespace(tree.readContent('/comp.spec.ts'))).toContain(stripWhitespace(`
TestBed.configureTestingModule({
declarations: [Comp]
});
`));
expect(stripWhitespace(tree.readContent('/comp.spec.ts'))).toContain(stripWhitespace(`
it('should also work', withModule({
declarations: [Comp],
}, () => {
TestBed.createComponent(Comp);
}));
`));
});
it('should not duplicate comments on initTestEnvironment calls', async () => {
writeFile('/index.ts', `
import { TestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
// Hello
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
`);
await runMigration();
expect(stripWhitespace(tree.readContent('/index.ts'))).toContain(stripWhitespace(`
import { TestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
// Hello
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
teardown: { destroyAfterEach: false }
});
`));
});
function writeFile(filePath: string, contents: string) {
host.sync.write(normalize(filePath), virtualFs.stringToFileBuffer(contents));
}
function runMigration() {
return runner.runSchematicAsync('migration-v13-testbed-teardown', {}, tree).toPromise();
}
function stripWhitespace(contents: string) {
return contents.replace(/\s/g, '');
}
});
| TypeScript | 5 | OakMolecule/angular | packages/core/schematics/test/testbed_teardown_spec.ts | [
"MIT"
] |
// Copyright 2016 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.
//go:build plan9
// +build plan9
package os
import (
"internal/itoa"
"syscall"
)
func executable() (string, error) {
fn := "/proc/" + itoa.Itoa(Getpid()) + "/text"
f, err := Open(fn)
if err != nil {
return "", err
}
defer f.Close()
return syscall.Fd2path(int(f.Fd()))
}
| Go | 4 | PhilYue/go | src/os/executable_plan9.go | [
"BSD-3-Clause"
] |
/**
* @param {import('jscodeshift').FileInfo} file
* @param {import('jscodeshift').API} api
*/
export default function transformer(file, api, options) {
const j = api.jscodeshift;
const printOptions = options.printOptions;
return j(file.source)
.findJSXElements('IconButton')
.forEach((path) => {
const hasSizeAttribute = path.node.openingElement.attributes.some((node) => {
return node.type === 'JSXAttribute' && node.name.name === 'size';
});
if (!hasSizeAttribute) {
path.node.openingElement.attributes.push(
j.jsxAttribute(j.jsxIdentifier('size'), j.literal('large')),
);
}
})
.toSource(printOptions);
}
| JavaScript | 3 | dany-freeman/material-ui | packages/mui-codemod/src/v5.0.0/icon-button-size.js | [
"MIT"
] |
/*
* copyright (c) 2016 Ganesh Ajjanagadde <gajjanag@gmail.com>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* internal math functions header
*/
#ifndef AVUTIL_FFMATH_H
#define AVUTIL_FFMATH_H
#include "attributes.h"
#include "libm.h"
/**
* Compute 10^x for floating point values. Note: this function is by no means
* "correctly rounded", and is meant as a fast, reasonably accurate approximation.
* For instance, maximum relative error for the double precision variant is
* ~ 1e-13 for very small and very large values.
* This is ~2x faster than GNU libm's approach, which is still off by 2ulp on
* some inputs.
* @param x exponent
* @return 10^x
*/
static av_always_inline double ff_exp10(double x)
{
return exp2(M_LOG2_10 * x);
}
static av_always_inline float ff_exp10f(float x)
{
return exp2f(M_LOG2_10 * x);
}
/**
* Compute x^y for floating point x, y. Note: this function is faster than the
* libm variant due to mainly 2 reasons:
* 1. It does not handle any edge cases. In particular, this is only guaranteed
* to work correctly for x > 0.
* 2. It is not as accurate as a standard nearly "correctly rounded" libm variant.
* @param x base
* @param y exponent
* @return x^y
*/
static av_always_inline float ff_fast_powf(float x, float y)
{
return expf(logf(x) * y);
}
#endif /* AVUTIL_FFMATH_H */
| C | 5 | attenuation/srs | trunk/3rdparty/ffmpeg-4-fit/libavutil/ffmath.h | [
"MIT"
] |
CHANGED/* foo.css */
CHANGEDbody {
CHANGED margin: 0;
CHANGED}
CHANGEDh1, footer {
CHANGED padding: 2px auto;
CHANGED}
CHANGEDul.foo {
CHANGED list-style: none;
CHANGED}
CHANGED.bar {
CHANGED font-size: large;
CHANGED}
CHANGED | CSS | 3 | ravitejavalluri/brackets | test/spec/FindReplace-known-goods/regexp-zero-length/css/foo.css | [
"MIT"
] |
/*
* Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
#include "Format.h"
#include "Porting.h"
using namespace kotlin;
std_support::span<char> kotlin::FormatToSpan(std_support::span<char> buffer, const char* format, ...) noexcept {
std::va_list args;
va_start(args, format);
auto result = VFormatToSpan(buffer, format, args);
va_end(args);
return result;
}
std_support::span<char> kotlin::VFormatToSpan(std_support::span<char> buffer, const char* format, std::va_list args) noexcept {
if (buffer.empty()) return buffer;
if (buffer.size() == 1) {
buffer.front() = '\0';
return buffer;
}
int written = konan::vsnprintf(buffer.data(), buffer.size(), format, args);
// Consider this a failure, nothing has been written. TODO: Should this be an exception/RuntimeAssert?
if (written < 0) return buffer;
// If `written` is larger than the buffer size, just pretend we filled the entire buffer (ignoring the trailing \0).
size_t writtenSize = std::min(static_cast<size_t>(written), buffer.size() - 1);
return buffer.subspan(writtenSize);
}
| C++ | 4 | Mu-L/kotlin | kotlin-native/runtime/src/main/cpp/Format.cpp | [
"ECL-2.0",
"Apache-2.0"
] |
#
# @expect=org.quattor.pan.exceptions.EvaluationException ".*invalid format specification or mismatched types in format\(\):.*"
#
object template format5;
variable STR = format('%q');
| Pan | 2 | aka7/pan | panc/src/test/pan/Functionality/format/format5.pan | [
"Apache-2.0"
] |
// Copyright 2020 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.
#include "textflag.h"
// Values returned from an FCLASS instruction.
#define NegInf 0x001
#define PosInf 0x080
#define NaN 0x200
// func archMax(x, y float64) float64
TEXT ·archMax(SB),NOSPLIT,$0
MOVD x+0(FP), F0
MOVD y+8(FP), F1
FCLASSD F0, X5
FCLASSD F1, X6
// +Inf special cases
MOV $PosInf, X7
BEQ X7, X5, isMaxX
BEQ X7, X6, isMaxY
// NaN special cases
MOV $NaN, X7
BEQ X7, X5, isMaxX
BEQ X7, X6, isMaxY
// normal case
FMAXD F0, F1, F0
MOVD F0, ret+16(FP)
RET
isMaxX: // return x
MOVD F0, ret+16(FP)
RET
isMaxY: // return y
MOVD F1, ret+16(FP)
RET
// func archMin(x, y float64) float64
TEXT ·archMin(SB),NOSPLIT,$0
MOVD x+0(FP), F0
MOVD y+8(FP), F1
FCLASSD F0, X5
FCLASSD F1, X6
// -Inf special cases
MOV $NegInf, X7
BEQ X7, X5, isMinX
BEQ X7, X6, isMinY
// NaN special cases
MOV $NaN, X7
BEQ X7, X5, isMinX
BEQ X7, X6, isMinY
// normal case
FMIND F0, F1, F0
MOVD F0, ret+16(FP)
RET
isMinX: // return x
MOVD F0, ret+16(FP)
RET
isMinY: // return y
MOVD F1, ret+16(FP)
RET
| GAS | 3 | SSSDNSY/go | src/math/dim_riscv64.s | [
"BSD-3-Clause"
] |
{
"config": {
"step": {
"pick_implementation": {
"title": "[%key:common::config_flow::title::oauth2_pick_implementation%]"
},
"reauth_confirm": {
"title": "[%key:common::config_flow::title::reauth%]",
"description": "The Spotify integration needs to re-authenticate with Spotify for account: {account}"
}
},
"abort": {
"authorize_url_timeout": "Timeout generating authorize URL.",
"missing_configuration": "The Spotify integration is not configured. Please follow the documentation.",
"no_url_available": "[%key:common::config_flow::abort::oauth2_no_url_available%]",
"reauth_account_mismatch": "The Spotify account authenticated with, does not match the account needed re-authentication."
},
"create_entry": { "default": "Successfully authenticated with Spotify." }
},
"system_health": {
"info": {
"api_endpoint_reachable": "Spotify API endpoint reachable"
}
}
}
| JSON | 3 | MrDelik/core | homeassistant/components/spotify/strings.json | [
"Apache-2.0"
] |
--TEST--
Bug #80152 (odbc_execute() moves internal pointer of $params)
--EXTENSIONS--
odbc
--SKIPIF--
<?php include 'skipif.inc'; ?>
--FILE--
<?php
include 'config.inc';
$conn = odbc_connect($dsn, $user, $pass);
odbc_exec($conn,"CREATE TABLE bug80152 (id INT, name CHAR(24))");
$stmt = odbc_prepare($conn,"INSERT INTO bug80152 (id, name) VALUES (?, ?)");
$params = [1, "John", "Lim"];
var_dump(key($params));
odbc_execute($stmt, $params);
var_dump(key($params));
?>
--CLEAN--
<?php
include 'config.inc';
$conn = odbc_connect($dsn, $user, $pass);
odbc_exec($conn, "DROP TABLE bug80152");
?>
--EXPECT--
int(0)
int(0)
| PHP | 3 | NathanFreeman/php-src | ext/odbc/tests/bug80152.phpt | [
"PHP-3.01"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.