text
stringlengths 2
100k
| meta
dict |
---|---|
// Copyright 2020 The Bazel 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.
package com.google.devtools.build.lib.runtime.commands.info;
import com.google.common.base.Supplier;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.packages.semantics.BuildLanguageOptions;
import com.google.devtools.build.lib.runtime.CommandEnvironment;
import com.google.devtools.build.lib.runtime.InfoItem;
import com.google.devtools.build.lib.skyframe.SkyframeExecutor;
import com.google.devtools.common.options.OptionsParsingResult;
import net.starlark.java.eval.StarlarkSemantics;
/**
* Info item for the effective current set of Starlark semantics option values.
*
* <p>This is hidden because its output is verbose and may be multiline.
*/
public final class StarlarkSemanticsInfoItem extends InfoItem {
private final OptionsParsingResult commandOptions;
public StarlarkSemanticsInfoItem(OptionsParsingResult commandOptions) {
super(
/*name=*/ "starlark-semantics",
/*description=*/ "The effective set of Starlark semantics option values.",
/*hidden=*/ true);
this.commandOptions = commandOptions;
}
@Override
public byte[] get(Supplier<BuildConfiguration> configurationSupplier, CommandEnvironment env) {
BuildLanguageOptions starlarkSemanticsOptions =
commandOptions.getOptions(BuildLanguageOptions.class);
SkyframeExecutor skyframeExecutor = env.getBlazeWorkspace().getSkyframeExecutor();
StarlarkSemantics effectiveStarlarkSemantics =
skyframeExecutor.getEffectiveStarlarkSemantics(starlarkSemanticsOptions);
return print(effectiveStarlarkSemantics);
}
}
| {
"pile_set_name": "Github"
} |
///////////////////////////////////////////////////////////////////////////////
// Name: tests/textfile/textfile.cpp
// Purpose: wxTextFile unit test
// Author: Vadim Zeitlin
// Created: 2006-03-31
// Copyright: (c) 2006 Vadim Zeitlin
///////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_TEXTFILE
#ifndef WX_PRECOMP
#endif // WX_PRECOMP
#include "wx/ffile.h"
#include "wx/textfile.h"
#ifdef __VISUALC__
#define unlink _unlink
#endif
// ----------------------------------------------------------------------------
// test class
// ----------------------------------------------------------------------------
class TextFileTestCase : public CppUnit::TestCase
{
public:
TextFileTestCase()
{
srand((unsigned)time(NULL));
}
virtual void tearDown() { unlink(GetTestFileName()); }
private:
CPPUNIT_TEST_SUITE( TextFileTestCase );
CPPUNIT_TEST( ReadEmpty );
CPPUNIT_TEST( ReadDOS );
CPPUNIT_TEST( ReadDOSLast );
CPPUNIT_TEST( ReadUnix );
CPPUNIT_TEST( ReadUnixLast );
CPPUNIT_TEST( ReadMac );
CPPUNIT_TEST( ReadMacLast );
CPPUNIT_TEST( ReadMixed );
CPPUNIT_TEST( ReadMixedWithFuzzing );
CPPUNIT_TEST( ReadCRCRLF );
#if wxUSE_UNICODE
CPPUNIT_TEST( ReadUTF8 );
CPPUNIT_TEST( ReadUTF16 );
#endif // wxUSE_UNICODE
CPPUNIT_TEST( ReadBig );
CPPUNIT_TEST_SUITE_END();
void ReadEmpty();
void ReadDOS();
void ReadDOSLast();
void ReadUnix();
void ReadUnixLast();
void ReadMac();
void ReadMacLast();
void ReadMixed();
void ReadMixedWithFuzzing();
void ReadCRCRLF();
#if wxUSE_UNICODE
void ReadUTF8();
void ReadUTF16();
#endif // wxUSE_UNICODE
void ReadBig();
// return the name of the test file we use
static const char *GetTestFileName() { return "textfiletest.txt"; }
// create the test file with the given contents
static void CreateTestFile(const char *contents)
{
CreateTestFile(strlen(contents), contents);
}
// create the test file with the given contents (version must be used if
// contents contains NULs)
static void CreateTestFile(size_t len, const char *contents);
DECLARE_NO_COPY_CLASS(TextFileTestCase)
};
// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( TextFileTestCase );
// also include in its own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( TextFileTestCase, "TextFileTestCase" );
void TextFileTestCase::CreateTestFile(size_t len, const char *contents)
{
FILE *f = fopen(GetTestFileName(), "wb");
CPPUNIT_ASSERT( f );
CPPUNIT_ASSERT_EQUAL( len, fwrite(contents, 1, len, f) );
CPPUNIT_ASSERT_EQUAL( 0, fclose(f) );
}
void TextFileTestCase::ReadEmpty()
{
CreateTestFile("");
wxTextFile f;
CPPUNIT_ASSERT( f.Open(wxString::FromAscii(GetTestFileName())) );
CPPUNIT_ASSERT_EQUAL( (size_t)0, f.GetLineCount() );
}
void TextFileTestCase::ReadDOS()
{
CreateTestFile("foo\r\nbar\r\nbaz");
wxTextFile f;
CPPUNIT_ASSERT( f.Open(wxString::FromAscii(GetTestFileName())) );
CPPUNIT_ASSERT_EQUAL( (size_t)3, f.GetLineCount() );
CPPUNIT_ASSERT_EQUAL( wxTextFileType_Dos, f.GetLineType(0) );
CPPUNIT_ASSERT_EQUAL( wxTextFileType_None, f.GetLineType(2) );
CPPUNIT_ASSERT_EQUAL( wxString(wxT("bar")), f.GetLine(1) );
CPPUNIT_ASSERT_EQUAL( wxString(wxT("baz")), f.GetLastLine() );
}
void TextFileTestCase::ReadDOSLast()
{
CreateTestFile("foo\r\n");
wxTextFile f;
CPPUNIT_ASSERT( f.Open(GetTestFileName()) );
CPPUNIT_ASSERT_EQUAL( 1, f.GetLineCount() );
CPPUNIT_ASSERT_EQUAL( wxTextFileType_Dos, f.GetLineType(0) );
CPPUNIT_ASSERT_EQUAL( "foo", f.GetFirstLine() );
}
void TextFileTestCase::ReadUnix()
{
CreateTestFile("foo\nbar\nbaz");
wxTextFile f;
CPPUNIT_ASSERT( f.Open(wxString::FromAscii(GetTestFileName())) );
CPPUNIT_ASSERT_EQUAL( (size_t)3, f.GetLineCount() );
CPPUNIT_ASSERT_EQUAL( wxTextFileType_Unix, f.GetLineType(0) );
CPPUNIT_ASSERT_EQUAL( wxTextFileType_None, f.GetLineType(2) );
CPPUNIT_ASSERT_EQUAL( wxString(wxT("bar")), f.GetLine(1) );
CPPUNIT_ASSERT_EQUAL( wxString(wxT("baz")), f.GetLastLine() );
}
void TextFileTestCase::ReadUnixLast()
{
CreateTestFile("foo\n");
wxTextFile f;
CPPUNIT_ASSERT( f.Open(GetTestFileName()) );
CPPUNIT_ASSERT_EQUAL( 1, f.GetLineCount() );
CPPUNIT_ASSERT_EQUAL( wxTextFileType_Unix, f.GetLineType(0) );
CPPUNIT_ASSERT_EQUAL( "foo", f.GetFirstLine() );
}
void TextFileTestCase::ReadMac()
{
CreateTestFile("foo\rbar\r\rbaz");
wxTextFile f;
CPPUNIT_ASSERT( f.Open(wxString::FromAscii(GetTestFileName())) );
CPPUNIT_ASSERT_EQUAL( (size_t)4, f.GetLineCount() );
CPPUNIT_ASSERT_EQUAL( wxTextFileType_Mac, f.GetLineType(0) );
CPPUNIT_ASSERT_EQUAL( wxTextFileType_Mac, f.GetLineType(1) );
CPPUNIT_ASSERT_EQUAL( wxTextFileType_Mac, f.GetLineType(2) );
CPPUNIT_ASSERT_EQUAL( wxTextFileType_None, f.GetLineType(3) );
CPPUNIT_ASSERT_EQUAL( wxString(wxT("foo")), f.GetLine(0) );
CPPUNIT_ASSERT_EQUAL( wxString(wxT("bar")), f.GetLine(1) );
CPPUNIT_ASSERT_EQUAL( wxString(wxT("")), f.GetLine(2) );
CPPUNIT_ASSERT_EQUAL( wxString(wxT("baz")), f.GetLastLine() );
}
void TextFileTestCase::ReadMacLast()
{
CreateTestFile("foo\r");
wxTextFile f;
CPPUNIT_ASSERT( f.Open(GetTestFileName()) );
CPPUNIT_ASSERT_EQUAL( 1, f.GetLineCount() );
CPPUNIT_ASSERT_EQUAL( wxTextFileType_Mac, f.GetLineType(0) );
CPPUNIT_ASSERT_EQUAL( "foo", f.GetFirstLine() );
}
void TextFileTestCase::ReadMixed()
{
CreateTestFile("foo\rbar\r\nbaz\n");
wxTextFile f;
CPPUNIT_ASSERT( f.Open(wxString::FromAscii(GetTestFileName())) );
CPPUNIT_ASSERT_EQUAL( (size_t)3, f.GetLineCount() );
CPPUNIT_ASSERT_EQUAL( wxTextFileType_Mac, f.GetLineType(0) );
CPPUNIT_ASSERT_EQUAL( wxTextFileType_Dos, f.GetLineType(1) );
CPPUNIT_ASSERT_EQUAL( wxTextFileType_Unix, f.GetLineType(2) );
CPPUNIT_ASSERT_EQUAL( wxString(wxT("foo")), f.GetFirstLine() );
CPPUNIT_ASSERT_EQUAL( wxString(wxT("bar")), f.GetLine(1) );
CPPUNIT_ASSERT_EQUAL( wxString(wxT("baz")), f.GetLastLine() );
}
void TextFileTestCase::ReadMixedWithFuzzing()
{
for ( int iteration = 0; iteration < 100; iteration++)
{
// Create a random buffer with lots of newlines. This is intended to catch
// bad parsing in unexpected situations such as the one from ReadCRCRLF()
// (which is so common it deserves a test of its own).
static const char CHOICES[] = {'\r', '\n', 'X'};
const size_t BUF_LEN = 100;
char data[BUF_LEN + 1];
data[0] = 'X';
data[BUF_LEN] = '\0';
unsigned linesCnt = 0;
for ( size_t i = 1; i < BUF_LEN; i++ )
{
char ch = CHOICES[rand() % WXSIZEOF(CHOICES)];
data[i] = ch;
if ( ch == '\r' || (ch == '\n' && data[i-1] != '\r') )
linesCnt++;
}
if (data[BUF_LEN-1] != '\r' && data[BUF_LEN-1] != '\n')
linesCnt++; // last line was unterminated
CreateTestFile(data);
wxTextFile f;
CPPUNIT_ASSERT( f.Open(wxString::FromAscii(GetTestFileName())) );
CPPUNIT_ASSERT_EQUAL( (size_t)linesCnt, f.GetLineCount() );
}
}
void TextFileTestCase::ReadCRCRLF()
{
// Notepad may create files with CRCRLF line endings (see
// http://stackoverflow.com/questions/6998506/text-file-with-0d-0d-0a-line-breaks).
// Older versions of wx would loose all data when reading such files.
// Test that the data are read, but don't worry about empty lines in between or
// line endings. Also include a longer streak of CRs, because they can
// happen as well.
CreateTestFile("foo\r\r\nbar\r\r\r\nbaz\r\r\n");
wxTextFile f;
CPPUNIT_ASSERT( f.Open(wxString::FromAscii(GetTestFileName())) );
wxString all;
for ( wxString str = f.GetFirstLine(); !f.Eof(); str = f.GetNextLine() )
all += str;
CPPUNIT_ASSERT_EQUAL( "foobarbaz", all );
}
#if wxUSE_UNICODE
void TextFileTestCase::ReadUTF8()
{
CreateTestFile("\xd0\x9f\n"
"\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82");
wxTextFile f;
CPPUNIT_ASSERT( f.Open(wxString::FromAscii(GetTestFileName()), wxConvUTF8) );
CPPUNIT_ASSERT_EQUAL( (size_t)2, f.GetLineCount() );
CPPUNIT_ASSERT_EQUAL( wxTextFileType_Unix, f.GetLineType(0) );
CPPUNIT_ASSERT_EQUAL( wxTextFileType_None, f.GetLineType(1) );
#ifdef wxHAVE_U_ESCAPE
CPPUNIT_ASSERT_EQUAL( wxString(L"\u041f"), f.GetFirstLine() );
CPPUNIT_ASSERT_EQUAL( wxString(L"\u0440\u0438\u0432\u0435\u0442"),
f.GetLastLine() );
#endif // wxHAVE_U_ESCAPE
}
void TextFileTestCase::ReadUTF16()
{
CreateTestFile(16,
"\x1f\x04\x0d\x00\x0a\x00"
"\x40\x04\x38\x04\x32\x04\x35\x04\x42\x04");
wxTextFile f;
wxMBConvUTF16LE conv;
CPPUNIT_ASSERT( f.Open(wxString::FromAscii(GetTestFileName()), conv) );
CPPUNIT_ASSERT_EQUAL( (size_t)2, f.GetLineCount() );
CPPUNIT_ASSERT_EQUAL( wxTextFileType_Dos, f.GetLineType(0) );
CPPUNIT_ASSERT_EQUAL( wxTextFileType_None, f.GetLineType(1) );
#ifdef wxHAVE_U_ESCAPE
CPPUNIT_ASSERT_EQUAL( wxString(L"\u041f"), f.GetFirstLine() );
CPPUNIT_ASSERT_EQUAL( wxString(L"\u0440\u0438\u0432\u0435\u0442"),
f.GetLastLine() );
#endif // wxHAVE_U_ESCAPE
}
#endif // wxUSE_UNICODE
void TextFileTestCase::ReadBig()
{
static const size_t NUM_LINES = 10000;
{
wxFFile f(GetTestFileName(), "w");
for ( size_t n = 0; n < NUM_LINES; n++ )
{
fprintf(f.fp(), "Line %lu\n", (unsigned long)n + 1);
}
}
wxTextFile f;
CPPUNIT_ASSERT( f.Open(GetTestFileName()) );
CPPUNIT_ASSERT_EQUAL( NUM_LINES, f.GetLineCount() );
CPPUNIT_ASSERT_EQUAL( wxString("Line 1"), f[0] );
CPPUNIT_ASSERT_EQUAL( wxString("Line 999"), f[998] );
CPPUNIT_ASSERT_EQUAL( wxString("Line 1000"), f[999] );
CPPUNIT_ASSERT_EQUAL( wxString::Format("Line %lu", (unsigned long)NUM_LINES),
f[NUM_LINES - 1] );
}
#endif // wxUSE_TEXTFILE
| {
"pile_set_name": "Github"
} |
# Time-based query
Query data using a time extent.

## Use case
This workflow can be used to return records that are between a specified start and end date. For example, records of Canada goose sightings over time could be queried to only show sightings during the winter migration time period.
## How to use the sample
Run the sample, and a subset of records will be displayed on the map.
## How it works
1. An instance of `ServiceFeatureTable` is created by passing a URL to the REST endpoint of a time-enabled service. Time-enabled services will have TimeInfo defined in the service description. This information is specified in ArcMap or ArcGIS Pro prior to publishing the service.
2. The feature request mode of the `ServiceFeatureTable` is set to `ManualCache`, so that the developer can control how and when the feature table is populated with data.
3. A `FeatureLayer` is created by passing in the instance of the `ServiceFeatureTable`.
4. A `TimeExtent` object is created by specifying start and end date/time objects.
5. A `QueryParmaters` object is created with the `TimeExtent`.
6. `ServiceFeatureTable.PopulateFromService` is executed by passing in the `QueryParameters`.
7. The feature table is populated with data that matches the provided query.
## Relevant API
* QueryParameters
* ServiceFeatureTable.PopulateFromService
* TimeExtent
## About the data
This sample uses Atlantic hurricane data from the year 2000. The data is from the National Hurricane Center (NOAA / National Weather Service).
## Tags
query, time, time extent | {
"pile_set_name": "Github"
} |
%TITLE%
LMN 120415/0000
LEVEL HGHT TEMP DWPT WDIR WSPD
-------------------------------------------------------------------
%RAW%
1000.00, -5.00, -9999.00, -9999.00, -9999.00, -9999.00
964.00, 317.00, 23.00, 18.90, 160.00, 18.01
932.05, 610.00, 21.37, 17.76, 165.00, 36.00
925.00, 676.00, 21.00, 17.50, 170.00, 37.01
899.71, 914.00, 19.23, 16.52, 175.00, 42.00
868.31, 1219.00, 16.96, 15.26, 185.00, 46.00
850.00, 1402.00, 15.60, 14.50, 190.00, 50.99
837.82, 1524.00, 14.71, 13.82, 190.00, 50.99
808.11, 1829.00, 12.48, 12.12, 195.00, 52.00
789.00, 2031.24, 11.00, 11.00, -9999.00, -9999.00
779.33, 2134.00, 10.47, 10.27, 205.00, 50.99
751.40, 2438.00, 8.91, 8.09, 210.00, 47.01
739.00, 2576.66, 8.20, 7.10, -9999.00, -9999.00
724.26, 2743.00, 7.42, 3.45, 220.00, 39.01
709.00, 2918.70, 6.60, -0.40, -9999.00, -9999.00
700.00, 3024.00, 8.60, -14.40, 210.00, 48.00
698.00, 3047.64, 8.80, -15.20, -9999.00, -9999.00
672.55, 3353.00, 7.32, -28.09, 215.00, 54.00
654.00, 3583.01, 6.20, -37.80, -9999.00, -9999.00
647.84, 3658.00, 5.58, -37.74, 215.00, 50.00
599.94, 4267.00, 0.51, -37.24, 220.00, 54.00
555.51, 4877.00, -4.56, -36.74, 220.00, 63.00
503.00, 5664.12, -11.10, -36.10, -9999.00, -9999.00
500.00, 5710.00, -11.50, -34.50, 220.00, 65.00
474.88, 6096.00, -15.10, -32.19, 225.00, 66.01
421.00, 6997.65, -23.50, -26.80, -9999.00, -9999.00
413.00, 7137.67, -24.50, -27.60, -9999.00, -9999.00
400.00, 7370.00, -25.70, -42.70, 230.00, 73.00
396.00, 7442.91, -26.10, -45.10, -9999.00, -9999.00
386.31, 7620.00, -27.57, -47.63, 230.00, 75.00
370.16, 7925.00, -30.11, -51.97, 230.00, 81.00
352.00, 8284.48, -33.10, -57.10, -9999.00, -9999.00
310.86, 9144.00, -39.79, -61.45, 225.00, 73.00
300.00, 9390.00, -41.70, -62.70, 220.00, 73.00
275.00, 9973.05, -46.30, -62.30, -9999.00, -9999.00
270.00, 10094.45, -47.50, -58.50, -9999.00, -9999.00
268.00, 10143.47, -47.90, -53.90, -9999.00, -9999.00
265.00, 10217.65, -47.70, -48.80, -9999.00, -9999.00
259.21, 10363.00, -48.42, -51.11, 235.00, 91.01
257.00, 10419.31, -48.70, -52.00, -9999.00, -9999.00
250.00, 10600.00, -50.10, -52.90, 235.00, 89.01
247.39, 10668.00, -50.61, -53.31, 235.00, 90.00
240.00, 10864.65, -52.10, -54.50, -9999.00, -9999.00
214.31, 11582.00, -57.07, -59.65, 235.00, 77.99
200.00, 12020.00, -60.10, -62.80, 245.00, 89.01
174.00, 12877.75, -65.10, -68.30, 245.00, 96.00
169.00, 13055.37, -64.82, -67.94, 245.00, 102.00
167.00, 13127.89, -64.70, -67.80, -9999.00, -9999.00
162.00, 13312.89, -65.50, -69.70, -9999.00, -9999.00
159.44, 13411.00, -62.97, -72.15, 245.00, 102.00
156.00, 13545.45, -59.50, -75.50, -9999.00, -9999.00
150.00, 13790.00, -60.50, -73.50, 255.00, 75.00
147.00, 13915.70, -61.70, -75.70, -9999.00, -9999.00
146.00, 13958.33, -58.90, -73.90, -9999.00, -9999.00
144.56, 14021.00, -58.47, -77.76, 255.00, 75.99
142.00, 14133.46, -57.70, -84.70, -9999.00, -9999.00
137.71, 14326.00, -58.47, -85.47, 235.00, 52.99
131.20, 14630.00, -59.69, -86.69, 215.00, 58.99
125.00, 14933.58, -60.90, -87.90, 215.00, 49.01
118.98, 15240.00, -61.12, -88.12, 220.00, 47.01
113.28, 15545.00, -61.34, -88.34, 235.00, 39.01
107.86, 15850.00, -61.56, -88.56, 215.00, 35.00
100.00, 16320.00, -61.90, -88.90, 215.00, 46.00
97.77, 16459.00, -62.17, -89.17, 215.00, 46.00
93.06, 16764.00, -62.75, -89.75, 225.00, 49.01
88.57, 17069.00, -63.34, -90.34, 235.00, 31.99
85.90, 17258.29, -63.70, -90.70, -9999.00, -9999.00
80.29, 17678.00, -60.20, -88.72, 215.00, 31.99
78.60, 17810.22, -59.10, -88.10, -9999.00, -9999.00
76.44, 17983.00, -60.25, -88.77, 250.00, 23.00
70.00, 18530.00, -63.90, -90.90, 90.00, 4.99
69.28, 18593.00, -64.14, -90.98, 330.00, 10.00
61.40, 19327.95, -66.90, -91.90, -9999.00, -9999.00
59.62, 19507.00, -66.39, -91.67, 210.00, 22.01
56.71, 19812.00, -65.51, -91.28, 205.00, 15.00
51.31, 20422.00, -63.75, -90.50, 195.00, 17.00
50.00, 20580.00, -63.30, -90.30, 220.00, 10.99
48.82, 20726.00, -63.50, -90.83, 165.00, 13.00
46.50, 21024.64, -63.90, -91.90, -9999.00, -9999.00
46.45, 21031.00, -63.82, -91.86, 220.00, 10.99
44.22, 21336.00, -60.20, -89.88, 120.00, 6.00
43.80, 21394.48, -59.50, -89.50, -9999.00, -9999.00
37.90, 22293.22, -61.90, -91.90, -9999.00, -9999.00
34.63, 22860.00, -56.26, -87.97, 85.00, 10.00
34.10, 22956.01, -55.30, -87.30, -9999.00, -9999.00
33.00, 23165.00, -55.93, -87.93, 140.00, 18.01
31.70, 23419.39, -56.70, -88.70, -9999.00, -9999.00
31.45, 23470.00, -56.38, -88.53, 155.00, 15.00
30.00, 23770.00, -54.50, -87.50, 20.00, 10.00
29.98, 23774.00, -54.48, -87.49, 235.00, 10.99
28.60, 24079.00, -53.28, -86.50, 35.00, 10.00
26.03, 24689.00, -50.86, -84.54, 180.00, 2.00
24.83, 24994.00, -49.66, -83.55, 220.00, 10.00
24.30, 25134.34, -49.10, -83.10, -9999.00, -9999.00
23.70, 25298.00, -49.60, -83.46, 245.00, 14.01
22.61, 25603.00, -50.54, -84.12, 285.00, 25.99
20.59, 26213.00, -52.42, -85.44, 305.00, 31.99
20.50, 26240.34, -52.50, -85.50, -9999.00, -9999.00
20.00, 26400.00, -51.70, -84.70, 315.00, 25.99
19.64, 26518.00, -49.90, -83.68, 315.00, 31.00
19.10, 26701.57, -47.10, -82.10, -9999.00, -9999.00
%END%
----- Parcel Information-----
*** MU PARCEL IN LOWEST 400mb ***
LPL: P=964 T=73F Td=66F
CAPE: 2592 J/kg
CINH: -32 J/kg
LI: -6 C
LI(300mb): -9 C
3km Cape: 107 J/kg
NCAPE: 0.22 m/s2
LCL: 907mb 524m
LFC: 850mb 1085m
EL: 169mb 12738m
MPL: 106mb 15649m
All heights AGL
----- Moisture -----
Precip Water: 1.25 in
Mean W: 13.4 g/Kg
----- Lapse Rates -----
700-500mb 20 C 7.6 C/km
850-500mb 29 C 6.8 C/km
| {
"pile_set_name": "Github"
} |
DigiByte Core version 0.10.1 is now available from:
<https://digibyte.org/bin/digibyte-core-0.10.1/>
This is a new minor version release, bringing bug fixes and translation
updates. It is recommended to upgrade to this version.
Please report bugs using the issue tracker at github:
<https://github.com/digibyte/digibyte/issues>
Upgrading and downgrading
=========================
How to Upgrade
--------------
If you are running an older version, shut it down. Wait until it has completely
shut down (which might take a few minutes for older versions), then run the
installer (on Windows) or just copy over /Applications/DigiByte-Qt (on Mac) or
digibyted/digibyte-qt (on Linux).
Downgrade warning
------------------
Because release 0.10.0 and later makes use of headers-first synchronization and
parallel block download (see further), the block files and databases are not
backwards-compatible with pre-0.10 versions of DigiByte Core or other software:
* Blocks will be stored on disk out of order (in the order they are
received, really), which makes it incompatible with some tools or
other programs. Reindexing using earlier versions will also not work
anymore as a result of this.
* The block index database will now hold headers for which no block is
stored on disk, which earlier versions won't support.
If you want to be able to downgrade smoothly, make a backup of your entire data
directory. Without this your node will need start syncing (or importing from
bootstrap.dat) anew afterwards. It is possible that the data from a completely
synchronised 0.10 node may be usable in older versions as-is, but this is not
supported and may break as soon as the older version attempts to reindex.
This does not affect wallet forward or backward compatibility.
Notable changes
===============
This is a minor release and hence there are no notable changes.
For the notable changes in 0.10, refer to the release notes for the
0.10.0 release at https://github.com/digibyte/digibyte/blob/v0.10.0/doc/release-notes.md
0.10.1 Change log
=================
Detailed release notes follow. This overview includes changes that affect external
behavior, not code moves, refactors or string updates.
RPC:
- `7f502be` fix crash: createmultisig and addmultisigaddress
- `eae305f` Fix missing lock in submitblock
Block (database) and transaction handling:
- `1d2cdd2` Fix InvalidateBlock to add chainActive.Tip to setBlockIndexCandidates
- `c91c660` fix InvalidateBlock to repopulate setBlockIndexCandidates
- `002c8a2` fix possible block db breakage during re-index
- `a1f425b` Add (optional) consistency check for the block chain data structures
- `1c62e84` Keep mempool consistent during block-reorgs
- `57d1f46` Fix CheckBlockIndex for reindex
- `bac6fca` Set nSequenceId when a block is fully linked
P2P protocol and network code:
- `78f64ef` don't trickle for whitelisted nodes
- `ca301bf` Reduce fingerprinting through timestamps in 'addr' messages.
- `200f293` Ignore getaddr messages on Outbound connections.
- `d5d8998` Limit message sizes before transfer
- `aeb9279` Better fingerprinting protection for non-main-chain getdatas.
- `cf0218f` Make addrman's bucket placement deterministic (countermeasure 1 against eclipse attacks, see http://cs-people.bu.edu/heilman/eclipse/)
- `0c6f334` Always use a 50% chance to choose between tried and new entries (countermeasure 2 against eclipse attacks)
- `214154e` Do not bias outgoing connections towards fresh addresses (countermeasure 2 against eclipse attacks)
- `aa587d4` Scale up addrman (countermeasure 6 against eclipse attacks)
- `139cd81` Cap nAttempts penalty at 8 and switch to pow instead of a division loop
Validation:
- `d148f62` Acquire CCheckQueue's lock to avoid race condition
Build system:
- `8752b5c` 0.10 fix for crashes on OSX 10.6
Wallet:
- N/A
GUI:
- `2c08406` some mac specifiy cleanup (memory handling, unnecessary code)
- `81145a6` fix OSX dock icon window reopening
- `786cf72` fix a issue where "command line options"-action overwrite "Preference"-action (on OSX)
Tests:
- `1117378` add RPC test for InvalidateBlock
Miscellaneous:
- `c9e022b` Initialization: set Boost path locale in main thread
- `23126a0` Sanitize command strings before logging them.
- `323de27` Initialization: setup environment before starting Qt tests
- `7494e09` Initialization: setup environment before starting tests
- `df45564` Initialization: set fallback locale as environment variable
Credits
=======
Thanks to everyone who directly contributed to this release:
- Alex Morcos
- Cory Fields
- dexX7
- fsb4000
- Gavin Andresen
- Gregory Maxwell
- Ivan Pustogarov
- Jonas Schnelli
- Matt Corallo
- mrbandrews
- Pieter Wuille
- Ruben de Vries
- Suhas Daftuar
- Wladimir J. van der Laan
And all those who contributed additional code review and/or security research:
- 21E14
- Alison Kendler
- Aviv Zohar
- Ethan Heilman
- Evil-Knievel
- fanquake
- Jeff Garzik
- Jonas Nick
- Luke Dashjr
- Patrick Strateman
- Philip Kaufmann
- Sergio Demian Lerner
- Sharon Goldberg
As well as everyone that helped translating on [Transifex](https://www.transifex.com/projects/p/digibyte/).
| {
"pile_set_name": "Github"
} |
<?php
namespace Cron;
use DateTimeInterface;
use DateTimeZone;
/**
* Hours field. Allows: * , / -
*/
class HoursField extends AbstractField
{
/**
* @inheritDoc
*/
protected $rangeStart = 0;
/**
* @inheritDoc
*/
protected $rangeEnd = 23;
/**
* @inheritDoc
*/
public function isSatisfiedBy(DateTimeInterface $date, $value)
{
if ($value == '?') {
return true;
}
return $this->isSatisfied($date->format('H'), $value);
}
/**
* {@inheritDoc}
*
* @param \DateTime|\DateTimeImmutable &$date
* @param string|null $parts
*/
public function increment(DateTimeInterface &$date, $invert = false, $parts = null)
{
// Change timezone to UTC temporarily. This will
// allow us to go back or forwards and hour even
// if DST will be changed between the hours.
if (is_null($parts) || $parts == '*') {
$timezone = $date->getTimezone();
$date = $date->setTimezone(new DateTimeZone('UTC'));
$date = $date->modify(($invert ? '-' : '+') . '1 hour');
$date = $date->setTimezone($timezone);
$date = $date->setTime($date->format('H'), $invert ? 59 : 0);
return $this;
}
$parts = strpos($parts, ',') !== false ? explode(',', $parts) : array($parts);
$hours = array();
foreach ($parts as $part) {
$hours = array_merge($hours, $this->getRangeForExpression($part, 23));
}
$current_hour = $date->format('H');
$position = $invert ? count($hours) - 1 : 0;
if (count($hours) > 1) {
for ($i = 0; $i < count($hours) - 1; $i++) {
if ((!$invert && $current_hour >= $hours[$i] && $current_hour < $hours[$i + 1]) ||
($invert && $current_hour > $hours[$i] && $current_hour <= $hours[$i + 1])) {
$position = $invert ? $i : $i + 1;
break;
}
}
}
$hour = $hours[$position];
if ((!$invert && $date->format('H') >= $hour) || ($invert && $date->format('H') <= $hour)) {
$date = $date->modify(($invert ? '-' : '+') . '1 day');
$date = $date->setTime($invert ? 23 : 0, $invert ? 59 : 0);
}
else {
$date = $date->setTime($hour, $invert ? 59 : 0);
}
return $this;
}
}
| {
"pile_set_name": "Github"
} |
define([
'jquery',
'./base',
'../utils',
'../keys'
], function ($, BaseSelection, Utils, KEYS) {
function SingleSelection () {
SingleSelection.__super__.constructor.apply(this, arguments);
}
Utils.Extend(SingleSelection, BaseSelection);
SingleSelection.prototype.render = function () {
var $selection = SingleSelection.__super__.render.call(this);
$selection.addClass('select2-selection--single');
$selection.html(
'<span class="select2-selection__rendered"></span>' +
'<span class="select2-selection__arrow" role="presentation">' +
'<b role="presentation"></b>' +
'</span>'
);
return $selection;
};
SingleSelection.prototype.bind = function (container, $container) {
var self = this;
SingleSelection.__super__.bind.apply(this, arguments);
var id = container.id + '-container';
this.$selection.find('.select2-selection__rendered')
.attr('id', id)
.attr('role', 'textbox')
.attr('aria-readonly', 'true');
this.$selection.attr('aria-labelledby', id);
this.$selection.on('mousedown', function (evt) {
// Only respond to left clicks
if (evt.which !== 1) {
return;
}
self.trigger('toggle', {
originalEvent: evt
});
});
this.$selection.on('focus', function (evt) {
// User focuses on the container
});
this.$selection.on('blur', function (evt) {
// User exits the container
});
container.on('focus', function (evt) {
if (!container.isOpen()) {
self.$selection.focus();
}
});
};
SingleSelection.prototype.clear = function () {
var $rendered = this.$selection.find('.select2-selection__rendered');
$rendered.empty();
$rendered.removeAttr('title'); // clear tooltip on empty
};
SingleSelection.prototype.display = function (data, container) {
var template = this.options.get('templateSelection');
var escapeMarkup = this.options.get('escapeMarkup');
return escapeMarkup(template(data, container));
};
SingleSelection.prototype.selectionContainer = function () {
return $('<span></span>');
};
SingleSelection.prototype.update = function (data) {
if (data.length === 0) {
this.clear();
return;
}
var selection = data[0];
var $rendered = this.$selection.find('.select2-selection__rendered');
var formatted = this.display(selection, $rendered);
$rendered.empty().append(formatted);
$rendered.attr('title', selection.title || selection.text);
};
return SingleSelection;
});
| {
"pile_set_name": "Github"
} |
# /* **************************************************************************
# * *
# * (C) Copyright Paul Mensonides 2011.
# * (C) Copyright Edward Diener 2011,2014.
# * Distributed under the Boost Software License, Version 1.0. (See
# * accompanying file LICENSE_1_0.txt or copy at
# * http://www.boost.org/LICENSE_1_0.txt)
# * *
# ************************************************************************** */
#
# /* See http://www.boost.org for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_LIST_TO_ARRAY_HPP
# define BOOST_PREPROCESSOR_LIST_TO_ARRAY_HPP
#
# include <boost/preprocessor/arithmetic/dec.hpp>
# include <boost/preprocessor/arithmetic/inc.hpp>
# include <boost/preprocessor/config/config.hpp>
# include <boost/preprocessor/control/while.hpp>
# include <boost/preprocessor/list/adt.hpp>
# include <boost/preprocessor/tuple/elem.hpp>
# include <boost/preprocessor/tuple/rem.hpp>
# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && (_MSC_VER <= 1400)
# include <boost/preprocessor/control/iif.hpp>
# endif
#
# /* BOOST_PP_LIST_TO_ARRAY */
#
# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && (_MSC_VER <= 1400)
# define BOOST_PP_LIST_TO_ARRAY(list) \
BOOST_PP_IIF \
( \
BOOST_PP_LIST_IS_NIL(list), \
BOOST_PP_LIST_TO_ARRAY_VC8ORLESS_EMPTY, \
BOOST_PP_LIST_TO_ARRAY_VC8ORLESS_DO \
) \
(list) \
/**/
# define BOOST_PP_LIST_TO_ARRAY_VC8ORLESS_EMPTY(list) (0,())
# define BOOST_PP_LIST_TO_ARRAY_VC8ORLESS_DO(list) BOOST_PP_LIST_TO_ARRAY_I(BOOST_PP_WHILE, list)
# else
# define BOOST_PP_LIST_TO_ARRAY(list) BOOST_PP_LIST_TO_ARRAY_I(BOOST_PP_WHILE, list)
# endif
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
# define BOOST_PP_LIST_TO_ARRAY_I(w, list) \
BOOST_PP_LIST_TO_ARRAY_II(((BOOST_PP_TUPLE_REM_CTOR( \
3, \
w(BOOST_PP_LIST_TO_ARRAY_P, BOOST_PP_LIST_TO_ARRAY_O, (list, 1, (~))) \
)))) \
/**/
# define BOOST_PP_LIST_TO_ARRAY_II(p) BOOST_PP_LIST_TO_ARRAY_II_B(p)
# define BOOST_PP_LIST_TO_ARRAY_II_B(p) BOOST_PP_LIST_TO_ARRAY_II_C ## p
# define BOOST_PP_LIST_TO_ARRAY_II_C(p) BOOST_PP_LIST_TO_ARRAY_III p
# else
# define BOOST_PP_LIST_TO_ARRAY_I(w, list) \
BOOST_PP_LIST_TO_ARRAY_II(BOOST_PP_TUPLE_REM_CTOR( \
3, \
w(BOOST_PP_LIST_TO_ARRAY_P, BOOST_PP_LIST_TO_ARRAY_O, (list, 1, (~))) \
)) \
/**/
# define BOOST_PP_LIST_TO_ARRAY_II(im) BOOST_PP_LIST_TO_ARRAY_III(im)
# endif
# if BOOST_PP_VARIADICS
# define BOOST_PP_LIST_TO_ARRAY_III(list, size, tuple) (BOOST_PP_DEC(size), BOOST_PP_LIST_TO_ARRAY_IV tuple)
# define BOOST_PP_LIST_TO_ARRAY_IV(_, ...) (__VA_ARGS__)
# else
# define BOOST_PP_LIST_TO_ARRAY_III(list, size, tuple) (BOOST_PP_DEC(size), BOOST_PP_LIST_TO_ARRAY_IV_ ## size tuple)
# define BOOST_PP_LIST_TO_ARRAY_IV_2(_, e0) (e0)
# define BOOST_PP_LIST_TO_ARRAY_IV_3(_, e0, e1) (e0, e1)
# define BOOST_PP_LIST_TO_ARRAY_IV_4(_, e0, e1, e2) (e0, e1, e2)
# define BOOST_PP_LIST_TO_ARRAY_IV_5(_, e0, e1, e2, e3) (e0, e1, e2, e3)
# define BOOST_PP_LIST_TO_ARRAY_IV_6(_, e0, e1, e2, e3, e4) (e0, e1, e2, e3, e4)
# define BOOST_PP_LIST_TO_ARRAY_IV_7(_, e0, e1, e2, e3, e4, e5) (e0, e1, e2, e3, e4, e5)
# define BOOST_PP_LIST_TO_ARRAY_IV_8(_, e0, e1, e2, e3, e4, e5, e6) (e0, e1, e2, e3, e4, e5, e6)
# define BOOST_PP_LIST_TO_ARRAY_IV_9(_, e0, e1, e2, e3, e4, e5, e6, e7) (e0, e1, e2, e3, e4, e5, e6, e7)
# define BOOST_PP_LIST_TO_ARRAY_IV_10(_, e0, e1, e2, e3, e4, e5, e6, e7, e8) (e0, e1, e2, e3, e4, e5, e6, e7, e8)
# define BOOST_PP_LIST_TO_ARRAY_IV_11(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9)
# define BOOST_PP_LIST_TO_ARRAY_IV_12(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)
# define BOOST_PP_LIST_TO_ARRAY_IV_13(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11)
# define BOOST_PP_LIST_TO_ARRAY_IV_14(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12)
# define BOOST_PP_LIST_TO_ARRAY_IV_15(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13)
# define BOOST_PP_LIST_TO_ARRAY_IV_16(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14)
# define BOOST_PP_LIST_TO_ARRAY_IV_17(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15)
# define BOOST_PP_LIST_TO_ARRAY_IV_18(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16)
# define BOOST_PP_LIST_TO_ARRAY_IV_19(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17)
# define BOOST_PP_LIST_TO_ARRAY_IV_20(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18)
# define BOOST_PP_LIST_TO_ARRAY_IV_21(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19)
# define BOOST_PP_LIST_TO_ARRAY_IV_22(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20)
# define BOOST_PP_LIST_TO_ARRAY_IV_23(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21)
# define BOOST_PP_LIST_TO_ARRAY_IV_24(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22)
# define BOOST_PP_LIST_TO_ARRAY_IV_25(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23)
# define BOOST_PP_LIST_TO_ARRAY_IV_26(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24)
# define BOOST_PP_LIST_TO_ARRAY_IV_27(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25)
# define BOOST_PP_LIST_TO_ARRAY_IV_28(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26)
# define BOOST_PP_LIST_TO_ARRAY_IV_29(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27)
# define BOOST_PP_LIST_TO_ARRAY_IV_30(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28)
# define BOOST_PP_LIST_TO_ARRAY_IV_31(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29)
# define BOOST_PP_LIST_TO_ARRAY_IV_32(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30)
# define BOOST_PP_LIST_TO_ARRAY_IV_33(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31)
# define BOOST_PP_LIST_TO_ARRAY_IV_34(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32)
# define BOOST_PP_LIST_TO_ARRAY_IV_35(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33)
# define BOOST_PP_LIST_TO_ARRAY_IV_36(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34)
# define BOOST_PP_LIST_TO_ARRAY_IV_37(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35)
# define BOOST_PP_LIST_TO_ARRAY_IV_38(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36)
# define BOOST_PP_LIST_TO_ARRAY_IV_39(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37)
# define BOOST_PP_LIST_TO_ARRAY_IV_40(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38)
# define BOOST_PP_LIST_TO_ARRAY_IV_41(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39)
# define BOOST_PP_LIST_TO_ARRAY_IV_42(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40)
# define BOOST_PP_LIST_TO_ARRAY_IV_43(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41)
# define BOOST_PP_LIST_TO_ARRAY_IV_44(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42)
# define BOOST_PP_LIST_TO_ARRAY_IV_45(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43)
# define BOOST_PP_LIST_TO_ARRAY_IV_46(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44)
# define BOOST_PP_LIST_TO_ARRAY_IV_47(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45)
# define BOOST_PP_LIST_TO_ARRAY_IV_48(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46)
# define BOOST_PP_LIST_TO_ARRAY_IV_49(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47)
# define BOOST_PP_LIST_TO_ARRAY_IV_50(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48)
# define BOOST_PP_LIST_TO_ARRAY_IV_51(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49)
# define BOOST_PP_LIST_TO_ARRAY_IV_52(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50)
# define BOOST_PP_LIST_TO_ARRAY_IV_53(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51)
# define BOOST_PP_LIST_TO_ARRAY_IV_54(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52)
# define BOOST_PP_LIST_TO_ARRAY_IV_55(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53)
# define BOOST_PP_LIST_TO_ARRAY_IV_56(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54)
# define BOOST_PP_LIST_TO_ARRAY_IV_57(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55)
# define BOOST_PP_LIST_TO_ARRAY_IV_58(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56)
# define BOOST_PP_LIST_TO_ARRAY_IV_59(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57)
# define BOOST_PP_LIST_TO_ARRAY_IV_60(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58)
# define BOOST_PP_LIST_TO_ARRAY_IV_61(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59)
# define BOOST_PP_LIST_TO_ARRAY_IV_62(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60)
# define BOOST_PP_LIST_TO_ARRAY_IV_63(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61)
# define BOOST_PP_LIST_TO_ARRAY_IV_64(_, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62)
# endif
# define BOOST_PP_LIST_TO_ARRAY_P(d, state) BOOST_PP_LIST_IS_CONS(BOOST_PP_TUPLE_ELEM(3, 0, state))
# define BOOST_PP_LIST_TO_ARRAY_O(d, state) BOOST_PP_LIST_TO_ARRAY_O_I state
# define BOOST_PP_LIST_TO_ARRAY_O_I(list, size, tuple) (BOOST_PP_LIST_REST(list), BOOST_PP_INC(size), (BOOST_PP_TUPLE_REM(size) tuple, BOOST_PP_LIST_FIRST(list)))
#
# /* BOOST_PP_LIST_TO_ARRAY_D */
#
# if BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC && (_MSC_VER <= 1400)
# define BOOST_PP_LIST_TO_ARRAY_D(d, list) \
BOOST_PP_IIF \
( \
BOOST_PP_LIST_IS_NIL(list), \
BOOST_PP_LIST_TO_ARRAY_D_VC8ORLESS_EMPTY, \
BOOST_PP_LIST_TO_ARRAY_D_VC8ORLESS_DO \
) \
(d, list) \
/**/
# define BOOST_PP_LIST_TO_ARRAY_D_VC8ORLESS_EMPTY(d, list) (0,())
# define BOOST_PP_LIST_TO_ARRAY_D_VC8ORLESS_DO(d, list) BOOST_PP_LIST_TO_ARRAY_I(BOOST_PP_WHILE_ ## d, list)
# else
# define BOOST_PP_LIST_TO_ARRAY_D(d, list) BOOST_PP_LIST_TO_ARRAY_I(BOOST_PP_WHILE_ ## d, list)
# endif
#
# endif /* BOOST_PREPROCESSOR_LIST_TO_ARRAY_HPP */
| {
"pile_set_name": "Github"
} |
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
education, socio-economic status, nationality, personal appearance, race,
religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at `michael at snoyman dot com`. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
| {
"pile_set_name": "Github"
} |
abstract class A() {
val v : Int
}
| {
"pile_set_name": "Github"
} |
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) Microsoft Corporation. All rights reserved.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef _DRIVERS_H_
#define _DRIVERS_H_ 1
/////////////////////////////////////////////////////////////////////
//
// Chipset
//
// boot
#include <CPU_BOOT_decl.h>
// Cache driver
#include <CPU_MMU_decl.h>
// Cache driver
#include <CPU_CACHE_decl.h>
// Gp I/O driver
#include <CPU_INTC_decl.h>
// Gp I/O driver
#include <CPU_GPIO_decl.h>
// Watchdog driver
#include <CPU_WATCHDOG_decl.h>
// SPI driver
#include <CPU_SPI_decl.h>
// External bus interface driver
#include <CPU_EBIU_decl.h>
// Power control unit
#include <CPU_PCU_decl.h>
// Clock management unit driver
#include <CPU_CMU_decl.h>
// DMA driver
#include <CPU_DMA_decl.h>
#include <PerformanceCounters_decl.h>
// Virtual Key
#include <VirtualKey_decl.h>
// Power API
#include <Power_decl.h>
//
// Chipset
//
/////////////////////////////////////////////////////////////////////
#endif // _DRIVERS_H_
| {
"pile_set_name": "Github"
} |
'use strict';
// 26.1.5 Reflect.enumerate(target)
var $export = require('./_export');
var anObject = require('./_an-object');
var Enumerate = function (iterated) {
this._t = anObject(iterated); // target
this._i = 0; // next index
var keys = this._k = []; // keys
var key;
for (key in iterated) keys.push(key);
};
require('./_iter-create')(Enumerate, 'Object', function () {
var that = this;
var keys = that._k;
var key;
do {
if (that._i >= keys.length) return { value: undefined, done: true };
} while (!((key = keys[that._i++]) in that._t));
return { value: key, done: false };
});
$export($export.S, 'Reflect', {
enumerate: function enumerate(target) {
return new Enumerate(target);
}
});
| {
"pile_set_name": "Github"
} |
/*
Copyright The Kubernetes 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.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
v1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1"
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
)
type FakeStorageV1alpha1 struct {
*testing.Fake
}
func (c *FakeStorageV1alpha1) VolumeAttachments() v1alpha1.VolumeAttachmentInterface {
return &FakeVolumeAttachments{c}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeStorageV1alpha1) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret
}
| {
"pile_set_name": "Github"
} |
<?php
/*
* This file is part of PHPExifTool.
*
* (c) 2012 Romain Neutron <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPExiftool\Driver\Tag\Sony;
use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;
/**
* @ExclusionPolicy("all")
*/
class AFPointInFocus extends AbstractTag
{
protected $Id = 'mixed';
protected $Name = 'AFPointInFocus';
protected $FullName = 'Sony::AFInfo';
protected $GroupName = 'Sony';
protected $g0 = 'MakerNotes';
protected $g1 = 'Sony';
protected $g2 = 'Camera';
protected $Type = 'int8u';
protected $Writable = true;
protected $Description = 'AF Point In Focus';
protected $flag_Permanent = true;
protected $Values = array(
0 => array(
'Id' => 0,
'Label' => 'Upper-left',
),
1 => array(
'Id' => 1,
'Label' => 'Left',
),
2 => array(
'Id' => 2,
'Label' => 'Lower-left',
),
3 => array(
'Id' => 3,
'Label' => 'Far Left',
),
4 => array(
'Id' => 4,
'Label' => 'Top (horizontal)',
),
5 => array(
'Id' => 5,
'Label' => 'Near Right',
),
6 => array(
'Id' => 6,
'Label' => 'Center (horizontal)',
),
7 => array(
'Id' => 7,
'Label' => 'Near Left',
),
8 => array(
'Id' => 8,
'Label' => 'Bottom (horizontal)',
),
9 => array(
'Id' => 9,
'Label' => 'Top (vertical)',
),
10 => array(
'Id' => 10,
'Label' => 'Center (vertical)',
),
11 => array(
'Id' => 11,
'Label' => 'Bottom (vertical)',
),
12 => array(
'Id' => 12,
'Label' => 'Far Right',
),
13 => array(
'Id' => 13,
'Label' => 'Upper-right',
),
14 => array(
'Id' => 14,
'Label' => 'Right',
),
15 => array(
'Id' => 15,
'Label' => 'Lower-right',
),
16 => array(
'Id' => 16,
'Label' => 'Upper-middle',
),
17 => array(
'Id' => 17,
'Label' => 'Lower-middle',
),
18 => array(
'Id' => 255,
'Label' => '(none)',
),
19 => array(
'Id' => 0,
'Label' => 'Upper Far Left',
),
20 => array(
'Id' => 1,
'Label' => 'Upper-left (horizontal)',
),
21 => array(
'Id' => 2,
'Label' => 'Far Left (horizontal)',
),
22 => array(
'Id' => 3,
'Label' => 'Left (horizontal)',
),
23 => array(
'Id' => 4,
'Label' => 'Lower Far Left',
),
24 => array(
'Id' => 5,
'Label' => 'Lower-left (horizontal)',
),
25 => array(
'Id' => 6,
'Label' => 'Upper-left (vertical)',
),
26 => array(
'Id' => 7,
'Label' => 'Left (vertical)',
),
27 => array(
'Id' => 8,
'Label' => 'Lower-left (vertical)',
),
28 => array(
'Id' => 9,
'Label' => 'Far Left (vertical)',
),
29 => array(
'Id' => 10,
'Label' => 'Top (horizontal)',
),
30 => array(
'Id' => 11,
'Label' => 'Near Right',
),
31 => array(
'Id' => 12,
'Label' => 'Center (horizontal)',
),
32 => array(
'Id' => 13,
'Label' => 'Near Left',
),
33 => array(
'Id' => 14,
'Label' => 'Bottom (horizontal)',
),
34 => array(
'Id' => 15,
'Label' => 'Top (vertical)',
),
35 => array(
'Id' => 16,
'Label' => 'Upper-middle',
),
36 => array(
'Id' => 17,
'Label' => 'Center (vertical)',
),
37 => array(
'Id' => 18,
'Label' => 'Lower-middle',
),
38 => array(
'Id' => 19,
'Label' => 'Bottom (vertical)',
),
39 => array(
'Id' => 20,
'Label' => 'Upper Far Right',
),
40 => array(
'Id' => 21,
'Label' => 'Upper-right (horizontal)',
),
41 => array(
'Id' => 22,
'Label' => 'Far Right (horizontal)',
),
42 => array(
'Id' => 23,
'Label' => 'Right (horizontal)',
),
43 => array(
'Id' => 24,
'Label' => 'Lower Far Right',
),
44 => array(
'Id' => 25,
'Label' => 'Lower-right (horizontal)',
),
45 => array(
'Id' => 26,
'Label' => 'Far Right (vertical)',
),
46 => array(
'Id' => 27,
'Label' => 'Upper-right (vertical)',
),
47 => array(
'Id' => 28,
'Label' => 'Right (vertical)',
),
48 => array(
'Id' => 29,
'Label' => 'Lower-right (vertical)',
),
49 => array(
'Id' => 255,
'Label' => '(none)',
),
50 => array(
'Id' => 0,
'Label' => 'B4',
),
51 => array(
'Id' => 1,
'Label' => 'C4',
),
52 => array(
'Id' => 2,
'Label' => 'D4',
),
53 => array(
'Id' => 3,
'Label' => 'E4',
),
54 => array(
'Id' => 4,
'Label' => 'F4',
),
55 => array(
'Id' => 5,
'Label' => 'G4',
),
56 => array(
'Id' => 6,
'Label' => 'H4',
),
57 => array(
'Id' => 7,
'Label' => 'B3',
),
58 => array(
'Id' => 8,
'Label' => 'C3',
),
59 => array(
'Id' => 9,
'Label' => 'D3',
),
60 => array(
'Id' => 10,
'Label' => 'E3',
),
61 => array(
'Id' => 11,
'Label' => 'F3',
),
62 => array(
'Id' => 12,
'Label' => 'G3',
),
63 => array(
'Id' => 13,
'Label' => 'H3',
),
64 => array(
'Id' => 14,
'Label' => 'B2',
),
65 => array(
'Id' => 15,
'Label' => 'C2',
),
66 => array(
'Id' => 16,
'Label' => 'D2',
),
67 => array(
'Id' => 17,
'Label' => 'E2',
),
68 => array(
'Id' => 18,
'Label' => 'F2',
),
69 => array(
'Id' => 19,
'Label' => 'G2',
),
70 => array(
'Id' => 20,
'Label' => 'H2',
),
71 => array(
'Id' => 21,
'Label' => 'C1',
),
72 => array(
'Id' => 22,
'Label' => 'D1',
),
73 => array(
'Id' => 23,
'Label' => 'E1',
),
74 => array(
'Id' => 24,
'Label' => 'F1',
),
75 => array(
'Id' => 25,
'Label' => 'G1',
),
76 => array(
'Id' => 26,
'Label' => 'A7 Vertical',
),
77 => array(
'Id' => 27,
'Label' => 'A6 Vertical',
),
78 => array(
'Id' => 28,
'Label' => 'A5 Vertical',
),
79 => array(
'Id' => 29,
'Label' => 'C7 Vertical',
),
80 => array(
'Id' => 30,
'Label' => 'C6 Vertical',
),
81 => array(
'Id' => 31,
'Label' => 'C5 Vertical',
),
82 => array(
'Id' => 32,
'Label' => 'E7 Vertical',
),
83 => array(
'Id' => 33,
'Label' => 'E6 Center Vertical',
),
84 => array(
'Id' => 34,
'Label' => 'E5 Vertical',
),
85 => array(
'Id' => 35,
'Label' => 'G7 Vertical',
),
86 => array(
'Id' => 36,
'Label' => 'G6 Vertical',
),
87 => array(
'Id' => 37,
'Label' => 'G5 Vertical',
),
88 => array(
'Id' => 38,
'Label' => 'I7 Vertical',
),
89 => array(
'Id' => 39,
'Label' => 'I6 Vertical',
),
90 => array(
'Id' => 40,
'Label' => 'I5 Vertical',
),
91 => array(
'Id' => 41,
'Label' => 'A7',
),
92 => array(
'Id' => 42,
'Label' => 'B7',
),
93 => array(
'Id' => 43,
'Label' => 'C7',
),
94 => array(
'Id' => 44,
'Label' => 'D7',
),
95 => array(
'Id' => 45,
'Label' => 'E7',
),
96 => array(
'Id' => 46,
'Label' => 'F7',
),
97 => array(
'Id' => 47,
'Label' => 'G7',
),
98 => array(
'Id' => 48,
'Label' => 'H7',
),
99 => array(
'Id' => 49,
'Label' => 'I7',
),
100 => array(
'Id' => 50,
'Label' => 'A6',
),
101 => array(
'Id' => 51,
'Label' => 'B6',
),
102 => array(
'Id' => 52,
'Label' => 'C6',
),
103 => array(
'Id' => 53,
'Label' => 'D6',
),
104 => array(
'Id' => 54,
'Label' => 'E6 Center',
),
105 => array(
'Id' => 55,
'Label' => 'F6',
),
106 => array(
'Id' => 56,
'Label' => 'G6',
),
107 => array(
'Id' => 57,
'Label' => 'H6',
),
108 => array(
'Id' => 58,
'Label' => 'I6',
),
109 => array(
'Id' => 59,
'Label' => 'A5',
),
110 => array(
'Id' => 60,
'Label' => 'B5',
),
111 => array(
'Id' => 61,
'Label' => 'C5',
),
112 => array(
'Id' => 62,
'Label' => 'D5',
),
113 => array(
'Id' => 63,
'Label' => 'E5',
),
114 => array(
'Id' => 64,
'Label' => 'F5',
),
115 => array(
'Id' => 65,
'Label' => 'G5',
),
116 => array(
'Id' => 66,
'Label' => 'H5',
),
117 => array(
'Id' => 67,
'Label' => 'I5',
),
118 => array(
'Id' => 68,
'Label' => 'C11',
),
119 => array(
'Id' => 69,
'Label' => 'D11',
),
120 => array(
'Id' => 70,
'Label' => 'E11',
),
121 => array(
'Id' => 71,
'Label' => 'F11',
),
122 => array(
'Id' => 72,
'Label' => 'G11',
),
123 => array(
'Id' => 73,
'Label' => 'B10',
),
124 => array(
'Id' => 74,
'Label' => 'C10',
),
125 => array(
'Id' => 75,
'Label' => 'D10',
),
126 => array(
'Id' => 76,
'Label' => 'E10',
),
127 => array(
'Id' => 77,
'Label' => 'F10',
),
128 => array(
'Id' => 78,
'Label' => 'G10',
),
129 => array(
'Id' => 79,
'Label' => 'H10',
),
130 => array(
'Id' => 80,
'Label' => 'B9',
),
131 => array(
'Id' => 81,
'Label' => 'C9',
),
132 => array(
'Id' => 82,
'Label' => 'D9',
),
133 => array(
'Id' => 83,
'Label' => 'E9',
),
134 => array(
'Id' => 84,
'Label' => 'F9',
),
135 => array(
'Id' => 85,
'Label' => 'G9',
),
136 => array(
'Id' => 86,
'Label' => 'H9',
),
137 => array(
'Id' => 87,
'Label' => 'B8',
),
138 => array(
'Id' => 88,
'Label' => 'C8',
),
139 => array(
'Id' => 89,
'Label' => 'D8',
),
140 => array(
'Id' => 90,
'Label' => 'E8',
),
141 => array(
'Id' => 91,
'Label' => 'F8',
),
142 => array(
'Id' => 92,
'Label' => 'G8',
),
143 => array(
'Id' => 93,
'Label' => 'H8',
),
144 => array(
'Id' => 94,
'Label' => 'E6 Center F2.8',
),
145 => array(
'Id' => 255,
'Label' => '(none)',
),
);
protected $Index = 'mixed';
}
| {
"pile_set_name": "Github"
} |
# - Try to find Berkeley DB
# Once done this will define
#
# BERKELEY_DB_FOUND - system has Berkeley DB
# BERKELEY_DB_INCLUDE_DIR - the Berkeley DB include directory
# BERKELEY_DB_LIBRARIES - Link these to use Berkeley DB
# BERKELEY_DB_DEFINITIONS - Compiler switches required for using Berkeley DB
# Copyright (c) 2006, Alexander Dymo, <[email protected]>
# Copyright (c) 2011, Université Joseph Fourier
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
FIND_PATH(BERKELEY_DB_INCLUDE_DIR db_cxx.h
/usr/include/db4
/usr/local/include/db4
/usr/include/db5
/usr/local/include/db5
)
FIND_LIBRARY(BERKELEY_DB_LIBRARIES NAMES db_cxx )
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Berkeley "Could not find Berkeley DB >= 4.1" BERKELEY_DB_INCLUDE_DIR BERKELEY_DB_LIBRARIES)
# show the BERKELEY_DB_INCLUDE_DIR and BERKELEY_DB_LIBRARIES variables only in the advanced view
MARK_AS_ADVANCED(BERKELEY_DB_INCLUDE_DIR BERKELEY_DB_LIBRARIES )
| {
"pile_set_name": "Github"
} |
{
"frameGrid" : {
"size" : [48, 48],
"dimensions" : [11, 2],
"names" : [
[ null, "sleep.1", null, "fly.1", "fly.2", "fly.3", "fly.4", "fly.5", "fly.6", "fly.7", "fly.8" ],
[ null, "wakeup.1", "wakeup.2", "wakeup.3", "wakeup.4", "wakeup.5", null, "hurt.1", "hurt.2", null, null ]
]
},
"aliases" : {
"startsleep.1" : "wakeup.5",
"startsleep.2" : "wakeup.4",
"startsleep.3" : "wakeup.3",
"startsleep.4" : "wakeup.2",
"startsleep.5" : "wakeup.1"
}
} | {
"pile_set_name": "Github"
} |
<?php
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
];
| {
"pile_set_name": "Github"
} |
import React, { useState } from 'react'
import t from 'prop-types'
import styled from 'styled-components'
import { Redirect } from 'react-router-dom'
import {
Card as MaterialCard,
Grid,
Typography
} from '@material-ui/core'
import {
CardLink,
Content,
Divider,
Footer,
H4,
HeaderContent,
PizzasGrid
} from 'ui'
import { singularOrPlural, toMoney } from 'utils'
import { HOME, CHOOSE_PIZZA_QUANTITY } from 'routes'
import { useCollection } from 'hooks'
const ChoosePizzaFlavours = ({ location }) => {
const [checkboxes, setCheckboxes] = useState(() => ({}))
const pizzasFlavours = useCollection('pizzasFlavours')
if (!location.state) {
return <Redirect to={HOME} />
}
if (!pizzasFlavours) {
return 'Carregando sabores...'
}
if (pizzasFlavours.length === 0) {
return 'Não há dados.'
}
const { flavours, id } = location.state.pizzaSize
const handleChangeCheckbox = (pizzaId) => (e) => {
console.log('checkboxes', checkboxes)
if (
checkboxesChecked(checkboxes).length === flavours &&
e.target.checked === true
) {
return
}
setCheckboxes((checkboxes) => {
return {
...checkboxes,
[pizzaId]: e.target.checked
}
})
}
return (
<>
<Content>
<HeaderContent>
<H4>
Escolha até {flavours} {' '}
{singularOrPlural(flavours, 'sabor', 'sabores')}:
</H4>
</HeaderContent>
<PizzasGrid>
{pizzasFlavours.map((pizza) => (
<Grid item key={pizza.id} xs>
<Card checked={!!checkboxes[pizza.id]}>
<Label>
<Checkbox
checked={!!checkboxes[pizza.id]}
onChange={handleChangeCheckbox(pizza.id)}
/>
<Img src={pizza.image} alt={pizza.name} />
<Divider />
<Typography>{pizza.name}</Typography>
<Typography variant='h5'>
{toMoney(pizza.value[id])}
</Typography>
</Label>
</Card>
</Grid>
))}
</PizzasGrid>
</Content>
<Footer
buttons={{
back: {
children: 'Mudar tamanho'
},
action: {
to: {
pathname: CHOOSE_PIZZA_QUANTITY,
state: {
...location.state,
pizzaFlavours: getFlavoursNameAndId({
checkboxes,
pizzasFlavours
})
}
},
children: 'Quantas pizzas?',
disabled: checkboxesChecked(checkboxes).length === 0
}
}}
/>
</>
)
}
ChoosePizzaFlavours.propTypes = {
location: t.object.isRequired
}
function checkboxesChecked (checkboxes) {
return Object.values(checkboxes).filter(Boolean)
}
function getFlavoursNameAndId ({ checkboxes, pizzasFlavours }) {
return Object.entries(checkboxes)
.filter(([, value]) => !!value)
.map(([id]) => ({
id,
name: pizzasFlavours.find((flavour) => flavour.id === id).name
}))
}
const Card = styled(MaterialCard)`
&& {
border: 2px solid transparent;
border-color: ${({ theme, checked }) => checked ? theme.palette.secondary.light : ''};
}
`
const Label = styled(CardLink).attrs({
component: 'label'
})``
const Checkbox = styled.input.attrs({
type: 'checkbox'
})`
display: none;
`
const Img = styled.img`
width: 200px;
`
export default ChoosePizzaFlavours
| {
"pile_set_name": "Github"
} |
/* Copyright (C) 1992, 1995-2003, 2005-2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#if !_LIBC
# define _GL_USE_STDLIB_ALLOC 1
# include <config.h>
#endif
/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
optimizes away the name == NULL test below. */
#define _GL_ARG_NONNULL(params)
#include <alloca.h>
/* Specification. */
#include <stdlib.h>
#include <errno.h>
#ifndef __set_errno
# define __set_errno(ev) ((errno) = (ev))
#endif
#include <string.h>
#if _LIBC || HAVE_UNISTD_H
# include <unistd.h>
#endif
#if !_LIBC
# include "malloca.h"
#endif
#if _LIBC || !HAVE_SETENV
#if !_LIBC
# define __environ environ
#endif
#if _LIBC
/* This lock protects against simultaneous modifications of `environ'. */
# include <bits/libc-lock.h>
__libc_lock_define_initialized (static, envlock)
# define LOCK __libc_lock_lock (envlock)
# define UNLOCK __libc_lock_unlock (envlock)
#else
# define LOCK
# define UNLOCK
#endif
/* In the GNU C library we must keep the namespace clean. */
#ifdef _LIBC
# define setenv __setenv
# define clearenv __clearenv
# define tfind __tfind
# define tsearch __tsearch
#endif
/* In the GNU C library implementation we try to be more clever and
allow arbitrarily many changes of the environment given that the used
values are from a small set. Outside glibc this will eat up all
memory after a while. */
#if defined _LIBC || (defined HAVE_SEARCH_H && defined HAVE_TSEARCH \
&& defined __GNUC__)
# define USE_TSEARCH 1
# include <search.h>
typedef int (*compar_fn_t) (const void *, const void *);
/* This is a pointer to the root of the search tree with the known
values. */
static void *known_values;
# define KNOWN_VALUE(Str) \
({ \
void *value = tfind (Str, &known_values, (compar_fn_t) strcmp); \
value != NULL ? *(char **) value : NULL; \
})
# define STORE_VALUE(Str) \
tsearch (Str, &known_values, (compar_fn_t) strcmp)
#else
# undef USE_TSEARCH
# define KNOWN_VALUE(Str) NULL
# define STORE_VALUE(Str) do { } while (0)
#endif
/* If this variable is not a null pointer we allocated the current
environment. */
static char **last_environ;
/* This function is used by `setenv' and `putenv'. The difference between
the two functions is that for the former must create a new string which
is then placed in the environment, while the argument of `putenv'
must be used directly. This is all complicated by the fact that we try
to reuse values once generated for a `setenv' call since we can never
free the strings. */
int
__add_to_environ (const char *name, const char *value, const char *combined,
int replace)
{
char **ep;
size_t size;
const size_t namelen = strlen (name);
const size_t vallen = value != NULL ? strlen (value) + 1 : 0;
LOCK;
/* We have to get the pointer now that we have the lock and not earlier
since another thread might have created a new environment. */
ep = __environ;
size = 0;
if (ep != NULL)
{
for (; *ep != NULL; ++ep)
if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=')
break;
else
++size;
}
if (ep == NULL || *ep == NULL)
{
char **new_environ;
#ifdef USE_TSEARCH
char *new_value;
#endif
/* We allocated this space; we can extend it. */
new_environ =
(char **) (last_environ == NULL
? malloc ((size + 2) * sizeof (char *))
: realloc (last_environ, (size + 2) * sizeof (char *)));
if (new_environ == NULL)
{
/* It's easier to set errno to ENOMEM than to rely on the
'malloc-posix' and 'realloc-posix' gnulib modules. */
__set_errno (ENOMEM);
UNLOCK;
return -1;
}
/* If the whole entry is given add it. */
if (combined != NULL)
/* We must not add the string to the search tree since it belongs
to the user. */
new_environ[size] = (char *) combined;
else
{
/* See whether the value is already known. */
#ifdef USE_TSEARCH
# ifdef _LIBC
new_value = (char *) alloca (namelen + 1 + vallen);
__mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
value, vallen);
# else
new_value = (char *) malloca (namelen + 1 + vallen);
if (new_value == NULL)
{
__set_errno (ENOMEM);
UNLOCK;
return -1;
}
memcpy (new_value, name, namelen);
new_value[namelen] = '=';
memcpy (&new_value[namelen + 1], value, vallen);
# endif
new_environ[size] = KNOWN_VALUE (new_value);
if (new_environ[size] == NULL)
#endif
{
new_environ[size] = (char *) malloc (namelen + 1 + vallen);
if (new_environ[size] == NULL)
{
#if defined USE_TSEARCH && !defined _LIBC
freea (new_value);
#endif
__set_errno (ENOMEM);
UNLOCK;
return -1;
}
#ifdef USE_TSEARCH
memcpy (new_environ[size], new_value, namelen + 1 + vallen);
#else
memcpy (new_environ[size], name, namelen);
new_environ[size][namelen] = '=';
memcpy (&new_environ[size][namelen + 1], value, vallen);
#endif
/* And save the value now. We cannot do this when we remove
the string since then we cannot decide whether it is a
user string or not. */
STORE_VALUE (new_environ[size]);
}
#if defined USE_TSEARCH && !defined _LIBC
freea (new_value);
#endif
}
if (__environ != last_environ)
memcpy ((char *) new_environ, (char *) __environ,
size * sizeof (char *));
new_environ[size + 1] = NULL;
last_environ = __environ = new_environ;
}
else if (replace)
{
char *np;
/* Use the user string if given. */
if (combined != NULL)
np = (char *) combined;
else
{
#ifdef USE_TSEARCH
char *new_value;
# ifdef _LIBC
new_value = alloca (namelen + 1 + vallen);
__mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
value, vallen);
# else
new_value = malloca (namelen + 1 + vallen);
if (new_value == NULL)
{
__set_errno (ENOMEM);
UNLOCK;
return -1;
}
memcpy (new_value, name, namelen);
new_value[namelen] = '=';
memcpy (&new_value[namelen + 1], value, vallen);
# endif
np = KNOWN_VALUE (new_value);
if (np == NULL)
#endif
{
np = (char *) malloc (namelen + 1 + vallen);
if (np == NULL)
{
#if defined USE_TSEARCH && !defined _LIBC
freea (new_value);
#endif
__set_errno (ENOMEM);
UNLOCK;
return -1;
}
#ifdef USE_TSEARCH
memcpy (np, new_value, namelen + 1 + vallen);
#else
memcpy (np, name, namelen);
np[namelen] = '=';
memcpy (&np[namelen + 1], value, vallen);
#endif
/* And remember the value. */
STORE_VALUE (np);
}
#if defined USE_TSEARCH && !defined _LIBC
freea (new_value);
#endif
}
*ep = np;
}
UNLOCK;
return 0;
}
int
setenv (const char *name, const char *value, int replace)
{
if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
{
__set_errno (EINVAL);
return -1;
}
return __add_to_environ (name, value, NULL, replace);
}
/* The `clearenv' was planned to be added to POSIX.1 but probably
never made it. Nevertheless the POSIX.9 standard (POSIX bindings
for Fortran 77) requires this function. */
int
clearenv (void)
{
LOCK;
if (__environ == last_environ && __environ != NULL)
{
/* We allocated this environment so we can free it. */
free (__environ);
last_environ = NULL;
}
/* Clear the environment pointer removes the whole environment. */
__environ = NULL;
UNLOCK;
return 0;
}
#ifdef _LIBC
static void
free_mem (void)
{
/* Remove all traces. */
clearenv ();
/* Now remove the search tree. */
__tdestroy (known_values, free);
known_values = NULL;
}
text_set_element (__libc_subfreeres, free_mem);
# undef setenv
# undef clearenv
weak_alias (__setenv, setenv)
weak_alias (__clearenv, clearenv)
#endif
#endif /* _LIBC || !HAVE_SETENV */
/* The rest of this file is called into use when replacing an existing
but buggy setenv. Known bugs include failure to diagnose invalid
name, and consuming a leading '=' from value. */
#if HAVE_SETENV
# undef setenv
# if !HAVE_DECL_SETENV
extern int setenv (const char *, const char *, int);
# endif
# define STREQ(a, b) (strcmp (a, b) == 0)
int
rpl_setenv (const char *name, const char *value, int replace)
{
int result;
if (!name || !*name || strchr (name, '='))
{
errno = EINVAL;
return -1;
}
/* Call the real setenv even if replace is 0, in case implementation
has underlying data to update, such as when environ changes. */
result = setenv (name, value, replace);
if (result == 0 && replace && *value == '=')
{
char *tmp = getenv (name);
if (!STREQ (tmp, value))
{
int saved_errno;
size_t len = strlen (value);
tmp = malloca (len + 2);
/* Since leading '=' is eaten, double it up. */
*tmp = '=';
memcpy (tmp + 1, value, len + 1);
result = setenv (name, tmp, replace);
saved_errno = errno;
freea (tmp);
errno = saved_errno;
}
}
return result;
}
#endif /* HAVE_SETENV */
| {
"pile_set_name": "Github"
} |
/**
* **PostCSS Plugin Warning**
*
* Loader wrapper for postcss plugin warnings (`root.messages`)
*
* @class Warning
* @extends Error
*
* @param {Object} warning PostCSS Warning
*/
class Warning extends Error {
constructor(warning) {
super(warning);
const { text, line, column, plugin } = warning;
this.name = 'Warning';
this.message = `${this.name}\n\n`;
if (typeof line !== 'undefined') {
this.message += `(${line}:${column}) `;
}
this.message += plugin ? `${plugin}: ` : '';
this.message += `${text}`;
this.stack = false;
}
}
module.exports = Warning;
| {
"pile_set_name": "Github"
} |
compile:
cp mandelbrot.hipe-2.hipe mandelbrot.erl
erlc +native +"{hipe, [o3]}" mandelbrot.erl
measure:
sudo modprobe msr
sudo ../../RAPL/main "erl -smp enable -noshell -run mandelbrot main 16000" Erlang mandelbrot
run:
erl -smp enable -noshell -run mandelbrot main 16000
mem:
/usr/bin/time -v erl -smp enable -noshell -run mandelbrot main 16000
valgrind:
valgrind --tool=massif --stacks=yes erl -smp enable -noshell -run mandelbrot main 16000
| {
"pile_set_name": "Github"
} |
/*
* << Haru Free PDF Library >> -- hpdf_annotation.h
*
* URL: http://libharu.org
*
* Copyright (c) 1999-2006 Takeshi Kanno <[email protected]>
* Copyright (c) 2007-2009 Antony Dovgal <[email protected]>
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation.
* It is provided "as is" without express or implied warranty.
*
*/
#ifndef _HPDF_3DMEASURE_H
#define _HPDF_3DMEASURE_H
#include "hpdfobje.h"
#ifdef __cplusplus
extern "C" {
#endif
/*----------------------------------------------------------------------------*/
/*------ HPDF_3DMeasure -----------------------------------------------------*/
HPDF_3DMeasure
HPDF_3DC3DMeasure_New(HPDF_MMgr mmgr,
HPDF_Xref xref,
HPDF_Point3D firstanchorpoint,
HPDF_Point3D textanchorpoint
);
HPDF_3DMeasure
HPDF_PD33DMeasure_New(HPDF_MMgr mmgr,
HPDF_Xref xref,
HPDF_Point3D annotationPlaneNormal,
HPDF_Point3D firstAnchorPoint,
HPDF_Point3D secondAnchorPoint,
HPDF_Point3D leaderLinesDirection,
HPDF_Point3D measurementValuePoint,
HPDF_Point3D textYDirection,
HPDF_REAL value,
const char* unitsString
);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _HPDF_3DMEASURE_H */
| {
"pile_set_name": "Github"
} |
package edu.stanford.bmir.protege.web.client.auth;
import edu.stanford.bmir.protege.web.client.dispatch.DispatchErrorMessageDisplay;
import edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceCallback;
import edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceManager;
import edu.stanford.bmir.protege.web.shared.auth.*;
import edu.stanford.bmir.protege.web.shared.dispatch.Action;
import edu.stanford.bmir.protege.web.shared.user.UserId;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentMatcher;
import org.mockito.Matchers;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import java.util.Optional;
import static org.mockito.Mockito.*;
/**
* Matthew Horridge
* Stanford Center for Biomedical Informatics Research
* 19/02/15
*/
@RunWith(MockitoJUnitRunner.class)
public class AuthenticatedActionExecutor_TestCase<A extends AbstractAuthenticationAction<R>, R extends AbstractAuthenticationResult> {
@Mock
private DispatchServiceManager dispatchServiceManager;
@Mock
private PasswordDigestAlgorithm passwordDigestAlgorithm;
@Mock
private ChapResponseDigestAlgorithm chapResponseDigestAlgorithm;
private AuthenticatedActionExecutor protocol;
@Mock
private UserId userId;
@Mock
private AuthenticatedDispatchServiceCallback<R> callback;
private String clearTextPassword = "ThePassword";
@Mock
private GetChapSessionResult chapSessionResult;
@Mock
private ChapResponse chapResponse;
@Mock
private SaltedPasswordDigest saltedPassword;
@Mock
private ChapSession chapSession;
@Mock
private ChapSessionId chapSessionId;
@Mock
private Salt salt;
@Mock
private ChallengeMessage challengeMessage;
@Mock
private AuthenticationActionFactory<A, R> actionFactory;
@Mock
private A action;
@Mock
private R result;
@Mock
private DispatchErrorMessageDisplay errorDisplay;
@Before
public void setUp() throws Exception {
protocol = new AuthenticatedActionExecutor(dispatchServiceManager, passwordDigestAlgorithm, chapResponseDigestAlgorithm, errorDisplay);
when(passwordDigestAlgorithm
.getDigestOfSaltedPassword(anyString(), any(Salt.class)))
.thenReturn(saltedPassword);
when(chapResponseDigestAlgorithm
.getChapResponseDigest(any(ChallengeMessage.class), any(SaltedPasswordDigest.class)))
.thenReturn(chapResponse);
when(chapSessionResult.getChapSession()).thenReturn(Optional.of(chapSession));
when(chapSession.getId()).thenReturn(chapSessionId);
when(chapSession.getSalt()).thenReturn(salt);
when(chapSession.getChallengeMessage()).thenReturn(challengeMessage);
doAnswer(invocationOnMock -> {
Object[] args = invocationOnMock.getArguments();
if (args[0] instanceof GetChapSessionAction) {
DispatchServiceCallback<GetChapSessionResult> cb = (DispatchServiceCallback<GetChapSessionResult>) args[1];
cb.onSuccess(chapSessionResult);
}
else if(args[1] instanceof PerformLoginAction) {
DispatchServiceCallback<R> cb = (DispatchServiceCallback<R>) args[1];
cb.onSuccess(result);
}
return null;
}).when(dispatchServiceManager).execute(any(Action.class), any(DispatchServiceCallback.class));
when(actionFactory.createAction(chapSessionId, userId, chapResponse)).thenReturn(action);
}
@Test
public void shouldExecute_GetChapSession_ForUserId() {
protocol.execute(userId, clearTextPassword, actionFactory, callback);
verify(dispatchServiceManager, atLeastOnce())
.execute(argThat(isAGetChapSessionAction()), anyGetChapSessionResultCallback());
}
@Test
public void shouldExecute_AuthenticationAction_ForChapResponse() {
protocol.execute(userId, clearTextPassword, actionFactory, callback);
verify(dispatchServiceManager).execute(eq(action), Matchers.<DispatchServiceCallback<R>>any());
}
private ArgumentMatcher<GetChapSessionAction> isAGetChapSessionAction() {
return argument -> argument.getUserId().equals(userId);
}
private DispatchServiceCallback<GetChapSessionResult> anyGetChapSessionResultCallback() {
return Matchers.any();
}
}
| {
"pile_set_name": "Github"
} |
@import "~styles/mixins";
.bonus {
margin-right: 12px;
}
.name {
background: $tc-light-blue;
border-radius: 3px;
margin-right: $base-unit;
padding: 0 $base-unit;
font-size: 11px;
font-weight: 900;
line-height: 3 * $base-unit;
}
| {
"pile_set_name": "Github"
} |
//===----------------------------------------------------------------------===//
// C Language Family Front-end
//===----------------------------------------------------------------------===//
Chris Lattner
I. Introduction:
clang: noun
1. A loud, resonant, metallic sound.
2. The strident call of a crane or goose.
3. C-language family front-end toolkit.
The world needs better compiler tools, tools which are built as libraries. This
design point allows reuse of the tools in new and novel ways. However, building
the tools as libraries isn't enough: they must have clean APIs, be as
decoupled from each other as possible, and be easy to modify/extend. This
requires clean layering, decent design, and avoiding tying the libraries to a
specific use. Oh yeah, did I mention that we want the resultant libraries to
be as fast as possible? :)
This front-end is built as a component of the LLVM toolkit that can be used
with the LLVM backend or independently of it. In this spirit, the API has been
carefully designed as the following components:
libsupport - Basic support library, reused from LLVM.
libsystem - System abstraction library, reused from LLVM.
libbasic - Diagnostics, SourceLocations, SourceBuffer abstraction,
file system caching for input source files. This depends on
libsupport and libsystem.
libast - Provides classes to represent the C AST, the C type system,
builtin functions, and various helpers for analyzing and
manipulating the AST (visitors, pretty printers, etc). This
library depends on libbasic.
liblex - C/C++/ObjC lexing and preprocessing, identifier hash table,
pragma handling, tokens, and macros. This depends on libbasic.
libparse - C (for now) parsing and local semantic analysis. This library
invokes coarse-grained 'Actions' provided by the client to do
stuff (e.g. libsema builds ASTs). This depends on liblex.
libsema - Provides a set of parser actions to build a standardized AST
for programs. AST's are 'streamed' out a top-level declaration
at a time, allowing clients to use decl-at-a-time processing,
build up entire translation units, or even build 'whole
program' ASTs depending on how they use the APIs. This depends
on libast and libparse.
librewrite - Fast, scalable rewriting of source code. This operates on
the raw syntactic text of source code, allowing a client
to insert and delete text in very large source files using
the same source location information embedded in ASTs. This
is intended to be a low-level API that is useful for
higher-level clients and libraries such as code refactoring.
libanalysis - Source-level dataflow analysis useful for performing analyses
such as computing live variables. It also includes a
path-sensitive "graph-reachability" engine for writing
analyses that reason about different possible paths of
execution through source code. This is currently being
employed to write a set of checks for finding bugs in software.
libcodegen - Lower the AST to LLVM IR for optimization & codegen. Depends
on libast.
clang - An example driver, client of the libraries at various levels.
This depends on all these libraries, and on LLVM VMCore.
This front-end has been intentionally built as a DAG of libraries, making it
easy to reuse individual parts or replace pieces if desired. For example, to
build a preprocessor, you take the Basic and Lexer libraries. If you want an
indexer, you take those plus the Parser library and provide some actions for
indexing. If you want a refactoring, static analysis, or source-to-source
compiler tool, it makes sense to take those plus the AST building and semantic
analyzer library. Finally, if you want to use this with the LLVM backend,
you'd take these components plus the AST to LLVM lowering code.
In the future I hope this toolkit will grow to include new and interesting
components, including a C++ front-end, ObjC support, and a whole lot of other
things.
Finally, it should be pointed out that the goal here is to build something that
is high-quality and industrial-strength: all the obnoxious features of the C
family must be correctly supported (trigraphs, preprocessor arcana, K&R-style
prototypes, GCC/MS extensions, etc). It cannot be used if it is not 'real'.
II. Usage of clang driver:
* Basic Command-Line Options:
- Help: clang --help
- Standard GCC options accepted: -E, -I*, -i*, -pedantic, -std=c90, etc.
- To make diagnostics more gcc-like: -fno-caret-diagnostics -fno-show-column
- Enable metric printing: -stats
* -fsyntax-only is currently the default mode.
* -E mode works the same way as GCC.
* -Eonly mode does all preprocessing, but does not print the output,
useful for timing the preprocessor.
* -fsyntax-only is currently partially implemented, lacking some
semantic analysis (some errors and warnings are not produced).
* -parse-noop parses code without building an AST. This is useful
for timing the cost of the parser without including AST building
time.
* -parse-ast builds ASTs, but doesn't print them. This is most
useful for timing AST building vs -parse-noop.
* -parse-ast-print pretty prints most expression and statements nodes.
* -parse-ast-check checks that diagnostic messages that are expected
are reported and that those which are reported are expected.
* -dump-cfg builds ASTs and then CFGs. CFGs are then pretty-printed.
* -view-cfg builds ASTs and then CFGs. CFGs are then visualized by
invoking Graphviz.
For more information on getting Graphviz to work with clang/LLVM,
see: http://llvm.org/docs/ProgrammersManual.html#ViewGraph
III. Current advantages over GCC:
* Column numbers are fully tracked (no 256 col limit, no GCC-style pruning).
* All diagnostics have column numbers, includes 'caret diagnostics', and they
highlight regions of interesting code (e.g. the LHS and RHS of a binop).
* Full diagnostic customization by client (can format diagnostics however they
like, e.g. in an IDE or refactoring tool) through DiagnosticClient interface.
* Built as a framework, can be reused by multiple tools.
* All languages supported linked into same library (no cc1,cc1obj, ...).
* mmap's code in read-only, does not dirty the pages like GCC (mem footprint).
* LLVM License, can be linked into non-GPL projects.
* Full diagnostic control, per diagnostic. Diagnostics are identified by ID.
* Significantly faster than GCC at semantic analysis, parsing, preprocessing
and lexing.
* Defers exposing platform-specific stuff to as late as possible, tracks use of
platform-specific features (e.g. #ifdef PPC) to allow 'portable bytecodes'.
* The lexer doesn't rely on the "lexer hack": it has no notion of scope and
does not categorize identifiers as types or variables -- this is up to the
parser to decide.
Potential Future Features:
* Fine grained diag control within the source (#pragma enable/disable warning).
* Better token tracking within macros? (Token came from this line, which is
a macro argument instantiated here, recursively instantiated here).
* Fast #import with a module system.
* Dependency tracking: change to header file doesn't recompile every function
that texually depends on it: recompile only those functions that need it.
This is aka 'incremental parsing'.
IV. Missing Functionality / Improvements
Lexer:
* Source character mapping. GCC supports ASCII and UTF-8.
See GCC options: -ftarget-charset and -ftarget-wide-charset.
* Universal character support. Experimental in GCC, enabled with
-fextended-identifiers.
* -fpreprocessed mode.
Preprocessor:
* #assert/#unassert
* MSExtension: "L#param" stringizes to a wide string literal.
* Add support for -M*
Traditional Preprocessor:
* Currently, we have none. :)
| {
"pile_set_name": "Github"
} |
import Vec3 from "./Vec3.js";
class Quaternion extends Float32Array{
constructor(){
super(4);
this[0] = this[1] = this[2] = 0;
this[3] = 1;
this.isModified = false;
}
//http://in2gpu.com/2016/03/14/opengl-fps-camera-quaternion/
//----------------------------------------------
//region Setter/Getters
reset(){ this[0] = this[1] = this[2] = 0; this[3] = 1; this.isModified = false; return this; }
get x(){ return this[0]; } set x(val){ this[0] = val; this.isModified = true; }
get y(){ return this[1]; } set y(val){ this[1] = val; this.isModified = true; }
get z(){ return this[2]; } set z(val){ this[2] = val; this.isModified = true; }
get w(){ return this[3]; } set w(val){ this[3] = val; this.isModified = true; }
rx(rad){ Quaternion.rotateX(this,this,rad); this.isModified = true; return this; }
ry(rad){ Quaternion.rotateY(this,this,rad); this.isModified = true; return this; }
rz(rad){ Quaternion.rotateZ(this,this,rad); this.isModified = true; return this; }
setAxisAngle(axis, angle){ //AXIS MUST BE NORMALIZED.
var halfAngle = angle * .5;
var s = Math.sin(halfAngle);
this[0] = axis[0] * s;
this[1] = axis[1] * s;
this[2] = axis[2] * s;
this[3] = Math.cos(halfAngle);
this.isModified = true;
return this;
}
copy(q){
this[0] = q[0];
this[1] = q[1];
this[2] = q[2];
this[3] = q[3];
this.isModified = true;
return this;
}
//ex(deg){ Quaternion.rotateX(this,this,deg * DEG2RAD); this.isModified = true; return this; }
//ey(deg){ Quaternion.rotateY(this,this,deg * DEG2RAD); this.isModified = true; return this; }
//ez(deg){ Quaternion.rotateZ(this,this,deg * DEG2RAD); this.isModified = true; return this; }
//endregion
normalize(out){
var len = this[0]*this[0] + this[1]*this[1] + this[2]*this[2] + this[3]*this[3];
if(len > 0){
len = 1 / Math.sqrt(len);
out = out || this;
out[0] = this[0] * len;
out[1] = this[1] * len;
out[2] = this[2] * len;
out[3] = this[3] * len;
if(out === this) this.isModified = true;
}
return this;
}
//----------------------------------------------
//region Static Methods
static multi(out,a,b){
var ax = a[0], ay = a[1], az = a[2], aw = a[3],
bx = b[0], by = b[1], bz = b[2], bw = b[3];
out[0] = ax * bw + aw * bx + ay * bz - az * by;
out[1] = ay * bw + aw * by + az * bx - ax * bz;
out[2] = az * bw + aw * bz + ax * by - ay * bx;
out[3] = aw * bw - ax * bx - ay * by - az * bz;
return out;
}
static multiVec3(out,q,v){
var ax = q[0], ay = q[1], az = q[2], aw = q[3],
bx = v[0], by = v[1], bz = v[2];
out[0] = ax + aw * bx + ay * bz - az * by;
out[1] = ay + aw * by + az * bx - ax * bz;
out[2] = az + aw * bz + ax * by - ay * bx;
return out;
}
static rotateVec3(qa,va,out){
out = out || va;
//https://gamedev.stackexchange.com/questions/28395/rotating-vector3-by-a-quaternion
//vprime = 2.0f * dot(u, v) * u
// + (s*s - dot(u, u)) * v
// + 2.0f * s * cross(u, v);
var q = [qa[0],qa[1],qa[2]], //Save the vector part of the Quaternion
v = [va[0],va[1],va[2]], //Make a copy of the vector, going to chg its value
s = qa[3], //Save Quaternion Scalar (W)
d = Vec3.dot(q,v), // U DOT V
dq = Vec3.dot(q,q), // U DOT U
cqv = Vec3.cross(q,v,[0,0,0]); // Cross Product for Q,V
Vec3.scalarRev(q,2.0 * d,q);
Vec3.scalarRev(v,s*s - dq,v);
Vec3.scalarRev(cqv,2.0 * s,cqv);
out[0] = q[0] + v[0] + cqv[0];
out[1] = q[1] + v[1] + cqv[1];
out[2] = q[2] + v[2] + cqv[2];
return out;
}
//Ported to JS from C# example at https://pastebin.com/ubATCxJY
//Note, if Dir and Up are equal, a roll happends. Need to find a way to fix this.
static lookRotation(vDir, vUp, out){
var zAxis = new Vec3(vDir), //Forward
up = new Vec3(vUp),
xAxis = new Vec3(), //Right
yAxis = new Vec3();
zAxis.normalize();
Vec3.cross(up,zAxis,xAxis);
xAxis.normalize();
Vec3.cross(zAxis,xAxis,yAxis); //new up
//fromAxis - Mat3 to Quaternion
var m00 = xAxis.x, m01 = xAxis.y, m02 = xAxis.z,
m10 = yAxis.x, m11 = yAxis.y, m12 = yAxis.z,
m20 = zAxis.x, m21 = zAxis.y, m22 = zAxis.z,
t = m00 + m11 + m22,
x, y, z, w, s;
if(t > 0.0){
s = Math.sqrt(t + 1.0);
w = s * 0.5 ; // |w| >= 0.5
s = 0.5 / s;
x = (m12 - m21) * s;
y = (m20 - m02) * s;
z = (m01 - m10) * s;
}else if((m00 >= m11) && (m00 >= m22)){
s = Math.sqrt(1.0 + m00 - m11 - m22);
x = 0.5 * s;// |x| >= 0.5
s = 0.5 / s;
y = (m01 + m10) * s;
z = (m02 + m20) * s;
w = (m12 - m21) * s;
}else if(m11 > m22){
s = Math.sqrt(1.0 + m11 - m00 - m22);
y = 0.5 * s; // |y| >= 0.5
s = 0.5 / s;
x = (m10 + m01) * s;
z = (m21 + m12) * s;
w = (m20 - m02) * s;
}else{
s = Math.sqrt(1.0 + m22 - m00 - m11);
z = 0.5 * s; // |z| >= 0.5
s = 0.5 / s;
x = (m20 + m02) * s;
y = (m21 + m12) * s;
w = (m01 - m10) * s;
}
out[0] = x;
out[1] = y;
out[2] = z;
out[3] = w;
/*
var num8 = (m00 + m11) + m22;
if (num8 > 0.0){
var num = Math.sqrt(num8 + 1.0);
out.w = num * 0.5;
num = 0.5 / num;
out.x = (m12 - m21) * num;
out.y = (m20 - m02) * num;
out.z = (m01 - m10) * num;
return out;
}
if((m00 >= m11) && (m00 >= m22)){
var num7 = Math.sqrt(1.0 + m00 - m11 - m22);
var num4 = 0.5 / num7;
out.x = 0.5 * num7;
out.y = (m01 + m10) * num4;
out.z = (m02 + m20) * num4;
out.w = (m12 - m21) * num4;
return out;
}
if(m11 > m22){
var num6 = Math.sqrt(((1.0 + m11) - m00) - m22);
var num3 = 0.5 / num6;
out.x = (m10 + m01) * num3;
out.y = 0.5 * num6;
out.z = (m21 + m12) * num3;
out.w = (m20 - m02) * num3;
return out;
}
var num5 = Math.sqrt(((1.0 + m22) - m00) - m11);
var num2 = 0.5 / num5;
out.x = (m20 + m02) * num2;
out.y = (m21 + m12) * num2;
out.z = 0.5 * num5;
out.w = (m01 - m10) * num2;
return out;
*/
}
//https://github.com/toji/gl-matrix/blob/master/src/gl-matrix/quat.js
static rotateX(out, a, rad){
rad *= 0.5;
var ax = a[0], ay = a[1], az = a[2], aw = a[3],
bx = Math.sin(rad), bw = Math.cos(rad);
out[0] = ax * bw + aw * bx;
out[1] = ay * bw + az * bx;
out[2] = az * bw - ay * bx;
out[3] = aw * bw - ax * bx;
return out;
}
static rotateY(out, a, rad) {
rad *= 0.5;
var ax = a[0], ay = a[1], az = a[2], aw = a[3],
by = Math.sin(rad), bw = Math.cos(rad);
out[0] = ax * bw - az * by;
out[1] = ay * bw + aw * by;
out[2] = az * bw + ax * by;
out[3] = aw * bw - ay * by;
return out;
}
static rotateZ(out, a, rad){
rad *= 0.5;
var ax = a[0], ay = a[1], az = a[2], aw = a[3],
bz = Math.sin(rad), bw = Math.cos(rad);
out[0] = ax * bw + ay * bz;
out[1] = ay * bw - ax * bz;
out[2] = az * bw + aw * bz;
out[3] = aw * bw - az * bz;
return out;
}
//https://github.com/mrdoob/three.js/blob/dev/src/math/Quaternion.js
static setFromEuler(out,x,y,z,order){
var c1 = Math.cos(x/2),
c2 = Math.cos(y/2),
c3 = Math.cos(z/2),
s1 = Math.sin(x/2),
s2 = Math.sin(y/2),
s3 = Math.sin(z/2);
switch(order){
case 'XYZ':
out[0] = s1 * c2 * c3 + c1 * s2 * s3;
out[1] = c1 * s2 * c3 - s1 * c2 * s3;
out[2] = c1 * c2 * s3 + s1 * s2 * c3;
out[3] = c1 * c2 * c3 - s1 * s2 * s3;
break;
case 'YXZ':
out[0] = s1 * c2 * c3 + c1 * s2 * s3;
out[1] = c1 * s2 * c3 - s1 * c2 * s3;
out[2] = c1 * c2 * s3 - s1 * s2 * c3;
out[3] = c1 * c2 * c3 + s1 * s2 * s3;
break;
case 'ZXY':
out[0] = s1 * c2 * c3 - c1 * s2 * s3;
out[1] = c1 * s2 * c3 + s1 * c2 * s3;
out[2] = c1 * c2 * s3 + s1 * s2 * c3;
out[3] = c1 * c2 * c3 - s1 * s2 * s3;
break;
case 'ZYX':
out[0] = s1 * c2 * c3 - c1 * s2 * s3;
out[1] = c1 * s2 * c3 + s1 * c2 * s3;
out[2] = c1 * c2 * s3 - s1 * s2 * c3;
out[3] = c1 * c2 * c3 + s1 * s2 * s3;
break;
case 'YZX':
out[0] = s1 * c2 * c3 + c1 * s2 * s3;
out[1] = c1 * s2 * c3 + s1 * c2 * s3;
out[2] = c1 * c2 * s3 - s1 * s2 * c3;
out[3] = c1 * c2 * c3 - s1 * s2 * s3;
break;
case 'XZY':
out[0] = s1 * c2 * c3 - c1 * s2 * s3;
out[1] = c1 * s2 * c3 - s1 * c2 * s3;
out[2] = c1 * c2 * s3 + s1 * s2 * c3;
out[3] = c1 * c2 * c3 + s1 * s2 * s3;
break;
}
}
static lerp(out,a,b,t){
var ax = a[0],
ay = a[1],
az = a[2],
aw = a[3];
out[0] = ax + t * (b[0] - ax);
out[1] = ay + t * (b[1] - ay);
out[2] = az + t * (b[2] - az);
out[3] = aw + t * (b[3] - aw);
if(out.isModified !== undefined) out.isModified = true;
return out;
}
//https://github.com/toji/gl-matrix/blob/master/src/gl-matrix/quat.js
static invert(out, a) {
let a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3];
let dot = a0*a0 + a1*a1 + a2*a2 + a3*a3;
let invDot = dot ? 1.0/dot : 0;
// TODO: Would be faster to return [0,0,0,0] immediately if dot == 0
out[0] = -a0*invDot;
out[1] = -a1*invDot;
out[2] = -a2*invDot;
out[3] = a3*invDot;
return out;
}
//endregion
}
export default Quaternion | {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>{{ config('app.name') }}</title>
<link rel="stylesheet" href="{{ mix('css/new.css') }}">
@include('layouts.code.head')
</head>
<body class="border-t-2 border-brand bg-grey-lightest">
<div class="min-w-full min-h-screen flex items-center justify-center w-full px-2">
<div class="flex min-h-screen flex-col justify-center items-center text-center w-full">
<div class="flex-1 w-full mt-12 ">
<svg class="sm:w-104 sm:h-24 mb-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 344.5 83.2">
<path fill="#0FAEC9" d="M45.3 1.6c-2-2-5.5-2-7.6 0l-36 36c-2.2 2.2-2.2 5.6 0 7.7l36.2 36.3c2 2 5.4 2 7.5 0l36-36c2.2-2.2 2.2-5.6 0-7.7L45.4 1.5zm22.3 48.7L59 41.6l2-2.2-6.4-6.5-8.7 8.6 6.4 6.5 2.2-2 8.7 8.6-8.7 8.7-8.7-8.7 2-2.2-6.4-6.5-8.7 8.6 6.4 6.5 2.2-2 8.7 8.6-8.7 8.7-8.7-8.7 2-2.2-10.8-10.8 13-13-6.5-6.5-2.2 2.3-8.7-8.7 8.7-8.7 8.7 8.6-2.2 2.2 6.5 6.5 13-13L65.3 35l2.2-2 8.7 8.6-8.6 8.7z"/>
<path fill="#404040" d="M110.3 29.2c-6.8 0-11 4.8-11 12.7 0 8 4.2 12.6 11 12.6s11-4.7 11-12.7c0-8-4.2-12.8-11-12.8zm0 19.4c-3 0-5-2.5-5-6.7s2-7 5-7 5 2.7 5 7-2 6.6-5 6.6zM131.2 32v-2.2H125V54h6.2V40.5c0-4.2 2-5.2 4.2-5.2 2 0 3.3.6 4.4 1.4l1-5.6c-1.5-1-3-1.7-5-1.7-2.5 0-4 1-4.6 2.6zM155.8 31c-1.3-1.2-3-1.8-5.2-1.8-6 0-10 4.8-10 12.7 0 8.3 4 12.6 10 12.6 1.8 0 3.6-.4 5-1.8v.7c0 3.5-2 4.5-8.6 5l3.4 5c9.2-.6 11.4-4.3 11.4-12.7v-21h-6.2V31zm0 15.7c-1 1.3-2.2 2-4.2 2-3.3 0-4.8-3-4.8-7 0-4.3 1.8-6.6 4.8-6.6 2.3 0 3.5 1.2 4.2 2v9.7zM192.3 29.2c-3 0-5.7 1-7.4 3.4-1.2-2.2-3.2-3.4-6.3-3.4-2.6 0-4.4 1-5.7 2.8v-2.2h-6.2V54h6.2V40.7c0-4 1.4-5.6 4.2-5.6 2.8 0 3.8 1.8 3.8 5.7V54h6.2V40.7c0-4 1.3-5.6 4.2-5.6 2.8 0 3.8 1.8 3.8 5.7V54h6.2V38.8c0-7.3-4-9.6-9-9.6zM215.8 29.2c-4.2 0-7.6 1.3-10 2.8l2 5c2.3-1.6 4.6-2.4 7.5-2.4 2.8 0 4.4 1.2 4.4 3.8v1.2c-1.5-.7-3.2-1-5.5-1-4.8 0-9.6 2.3-9.6 8 0 5.2 4 8 9 8 3 0 5-1.3 6.2-2.4V54h6V38.5c0-8.2-5.6-9.3-10-9.3zm3.8 18c-1.2 1-2.8 2-5 2-2.8 0-4.2-1-4.2-2.6 0-2 2-2.8 4.6-2.8 1.7 0 3.2.3 4.5.8v2.6zM242.6 29.2c-2.8 0-5 1-6.5 2.8v-2.3h-6V54h6.2V40.6c0-3.8 1.6-5.5 4.6-5.5 2.8 0 4.2 1.8 4.2 5.7V54h6.2V38.7c0-7.2-4.4-9.5-8.6-9.5zM265.6 29.2c-4.2 0-7.6 1.3-10 2.8l2 5c2.3-1.6 4.6-2.4 7.5-2.4 3 0 4.5 1.2 4.5 3.8v1.2c-1.5-.7-3.2-1-5.5-1-4.8 0-9.6 2.3-9.6 8 0 5.2 4 8 9 8 3 0 5-1.3 6.2-2.4V54h6V38.5c0-8.2-5.7-9.3-10-9.3zm3.8 18c-1.2 1-2.8 2-5 2-2.8 0-4.2-1-4.2-2.6 0-2 2-2.8 4.6-2.8 1.7 0 3.2.3 4.5.8v2.6zM293.8 31c-1.3-1.2-3-1.8-5.2-1.8-6 0-10 4.8-10 12.7 0 8.3 4 12.6 10 12.6 1.8 0 3.6-.4 5-1.8v.7c0 3.5-2 4.5-8.6 5l3.4 5c9.2-.6 11.4-4.3 11.4-12.7v-21h-6.2V31zm0 15.7c-1 1.3-2.2 2-4.2 2-3.3 0-4.8-3-4.8-7 0-4.3 1.8-6.6 4.8-6.6 2.3 0 3.5 1.2 4.2 2v9.7zM314.8 29.2c-7 0-11.3 4.8-11.3 12.7 0 8 4.3 12.6 11.3 12.6 4 0 7-1.6 9-4l-3.8-4c-1.4 2-3 2.6-5.2 2.6-2.7 0-5-1.8-5.3-5h15.8c.2-1.2.2-2.6.2-3.6 0-7.8-4.7-11.4-10.7-11.4zm-5.2 10c.4-3 2.3-4.6 5.2-4.6 2.5 0 4.3 1.6 4.7 4.5h-10zM339.6 29.2c-2.4 0-3.8 1.2-4.5 2.7v-2.2h-6V54h6V40.5c0-4.2 2-5.2 4.3-5.2 2 0 3.3.6 4.4 1.4l1-5.6c-1.6-1-3-1.8-5-1.8z"/>
</svg>
<p class="text-black-light font-sans leading-loose text-xl mb-8">{{ config('app.name') }} allows Github Organizations to share invite links for free!</p>
<div class="flex items-center justify-around">
<a href="{{ route('login') }}" class="flex items-center text-center no-underline bg-brand border-2 border-brand hover:bg-white text-white hover:text-brand font-bold px-6 py-2 self-stretch rounded-full">
Try it out!
</a>
<a href="https://github.com/orgmanager/orgmanager" target="_blank" rel="noopener noreferrer" class="no-underline bg-black-light border-2 border-black-light hover:bg-white text-white hover:text-black-light font-bold py-2 px-6 self-stretch rounded-full">
<div class="flex items-center items-stretch">
<svg class="w-4 h-4 mr-3" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor">
<path d="M12 .3C5.4.3 0 5.7 0 12.3c0 5.3 3.4 9.8 8.2 11.4.6 0 .8-.3.8-.6v-2c-3.3.8-4-1.5-4-1.5-.6-1.4-1.4-1.8-1.4-1.8-1-.7 0-.7 0-.7 1.3 0 2 1.2 2 1.2 1 1.8 2.8 1.3 3.5 1 .2-.8.5-1.3.8-1.6-2.7-.3-5.5-1.3-5.5-6 0-1.2.5-2.3 1.3-3-.2-.5-.6-1.7 0-3.3 0 0 1-.3 3.4 1.2 1-.3 2-.4 3-.4s2 .2 3 .5c2.3-1.5 3.3-1.2 3.3-1.2.6 1.6.2 2.8 0 3.2 1 .8 1.3 2 1.3 3.2 0 4.6-2.8 5.6-5.5 6 .6.3 1 1 1 2v3.4c0 .4 0 .8.8.7 4.8-1.6 8.2-6 8.2-11.4 0-6.6-5.4-12-12-12"/>
</svg>
<p class="inline-flex items-center">GitHub</p>
</div>
</a>
</div>
<div class="mt-8 flex items-center justify-around">
<div class="w-32 border-b border-black-dark"></div>
<p class="text-black-darker text-base leading-loose">Lastest Release: v2.0 (Feb 19, 2017)</p>
<div class="w-32 border-b border-black-dark"></div>
</div>
<div class="mt-8 flex items-center justify-around text-center mb-8 md:mb-0">
<div>
<div class="rounded-full m-2">
<svg class="w-6 h-6 text-center text-grey-darker" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M7 8a4 4 0 1 1 0-8 4 4 0 0 1 0 8zm0 1c2.15 0 4.2.4 6.1 1.09L12 16h-1.25L10 20H4l-.75-4H2L.9 10.09A17.93 17.93 0 0 1 7 9zm8.31.17c1.32.18 2.59.48 3.8.92L18 16h-1.25L16 20h-3.96l.37-2h1.25l1.65-8.83zM13 0a4 4 0 1 1-1.33 7.76 5.96 5.96 0 0 0 0-7.52C12.1.1 12.53 0 13 0z"/></svg>
</div>
<p class="text-grey-dark">Multi-user support</p>
</div>
<div>
<div class="rounded-full m-2">
<svg class="w-6 h-6 text-center text-grey-darker" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.26 13a2 2 0 0 1 .01-2.01A3 3 0 0 0 9 5H5a3 3 0 0 0 0 6h.08a6.06 6.06 0 0 0 0 2H5A5 5 0 0 1 5 3h4a5 5 0 0 1 .26 10zm1.48-6a2 2 0 0 1-.01 2.01A3 3 0 0 0 11 15h4a3 3 0 0 0 0-6h-.08a6.06 6.06 0 0 0 0-2H15a5 5 0 0 1 0 10h-4a5 5 0 0 1-.26-10z"/></svg>
</div>
<p class="text-grey-dark">Share invite links</p>
</div>
<div>
<div class="rounded-full m-2">
<svg class="w-6 h-6 text-center text-grey-darker" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M3.94 6.5L2.22 3.64l1.42-1.42L6.5 3.94c.52-.3 1.1-.54 1.7-.7L9 0h2l.8 3.24c.6.16 1.18.4 1.7.7l2.86-1.72 1.42 1.42-1.72 2.86c.3.52.54 1.1.7 1.7L20 9v2l-3.24.8c-.16.6-.4 1.18-.7 1.7l1.72 2.86-1.42 1.42-2.86-1.72c-.52.3-1.1.54-1.7.7L11 20H9l-.8-3.24c-.6-.16-1.18-.4-1.7-.7l-2.86 1.72-1.42-1.42 1.72-2.86c-.3-.52-.54-1.1-.7-1.7L0 11V9l3.24-.8c.16-.6.4-1.18.7-1.7zM10 13a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"/></svg>
</div>
<p class="text-grey-dark">Control your team!</p>
</div>
</div>
</div>
<footer class="w-full bg-white border-t border-dark-light h-24 flex items-center justify-around">
<div>
<p class="text-black-darker">Used by <span class="text-grey-darkest">{{ \App\User::count() }} users & {{ \App\Org::count() }} orgs</span>, we have delivered <span class="text-grey-darkest">{{ \App\Org::sum('invitecount') }}</span> invites</p>
</div>
<div>
<a class="hidden sm:block text-black-light no-underline" href="https://github.com/orgmanager/orgmanager" target="_blank" rel="noopener noreferrer">
<svg class="w-6 h-6" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M12 .3C5.4.3 0 5.7 0 12.3c0 5.3 3.4 9.8 8.2 11.4.6 0 .8-.3.8-.6v-2c-3.3.8-4-1.5-4-1.5-.6-1.4-1.4-1.8-1.4-1.8-1-.7 0-.7 0-.7 1.3 0 2 1.2 2 1.2 1 1.8 2.8 1.3 3.5 1 .2-.8.5-1.3.8-1.6-2.7-.3-5.5-1.3-5.5-6 0-1.2.5-2.3 1.3-3-.2-.5-.6-1.7 0-3.3 0 0 1-.3 3.4 1.2 1-.3 2-.4 3-.4s2 .2 3 .5c2.3-1.5 3.3-1.2 3.3-1.2.6 1.6.2 2.8 0 3.2 1 .8 1.3 2 1.3 3.2 0 4.6-2.8 5.6-5.5 6 .6.3 1 1 1 2v3.4c0 .4 0 .8.8.7 4.8-1.6 8.2-6 8.2-11.4 0-6.6-5.4-12-12-12"/>
</svg>
</a>
</div>
</footer>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@8"></script>
@include('layouts.code.footer')
@if (count($errors) > 0)
<script>swal("Oops...", "{{ $errors->first() }}", "error")</script>
@endif
@if (session('success'))
<script>swal("Good job!", "{{ session('success') }}", "success")</script>
@endif
</body>
</html>
| {
"pile_set_name": "Github"
} |
/*
***************************************************************************************
*
* csi_cci_reg_i.h
*
* Hawkview ISP - csi_cci_reg_i.h module
*
* Copyright (c) 2014 by Allwinnertech Co., Ltd. http://www.allwinnertech.com
*
* Version Author Date Description
*
* 2.0 Yang Feng 2014/07/15 Second Version
*
****************************************************************************************
*/
#ifndef _CSI_CCI_REG_I_H_
#define _CSI_CCI_REG_I_H_
//
// Detail information of registers
//
#define CCI_CTRL_OFF 0x0000
#define CCI_CTRL_CCI_EN 0
#define CCI_CTRL_SOFT_RESET 1
#define CCI_CTRL_CCI_STA 16
#define CCI_CTRL_TRAN_RESULT 24
#define CCI_CTRL_READ_TRAN_MODE 28
#define CCI_CTRL_RESTART_MODE 29
#define CCI_CTRL_REPEAT_TRAN 30
#define CCI_CTRL_SINGLE_TRAN 31
#define CCI_CFG_OFF 0x0004
#define CCI_CFG_CSI_TRIG 0
#define CCI_CFG_CSI_TRIG_MASK (0xf << CCI_CFG_CSI_TRIG)
#define CCI_CFG_TRIG_MODE 4
#define CCI_CFG_TRIG_MODE_MASK (0x7 << CCI_CFG_TRIG_MODE)
#define CCI_CFG_SRC_SEL 7
#define CCI_CFG_SRC_SEL_MASK (0x1 << CCI_CFG_SRC_SEL)
#define CCI_CFG_PACKET_MODE 15
#define CCI_CFG_PACKET_MODE_MASK (0x1 << CCI_CFG_PACKET_MODE)
#define CCI_CFG_INTERVAL 16
#define CCI_CFG_INTERVAL_MASK (0xff << CCI_CFG_INTERVAL)
#define CCI_CFG_TIMEOUT_N 24
#define CCI_CFG_TIMEOUT_N_MASK (0xff << CCI_CFG_TIMEOUT_N)
#define CCI_FMT_OFF 0x0008
#define CCI_FMT_PACKET_CNT 0
#define CCI_FMT_PACKET_CNT_MASK (0xffff << CCI_FMT_PACKET_CNT)
#define CCI_FMT_DATA_BYTE 16
#define CCI_FMT_DATA_BYTE_MASK ( 0xf<< CCI_FMT_DATA_BYTE)
#define CCI_FMT_ADDR_BYTE 20
#define CCI_FMT_ADDR_BYTE_MASK ( 0xf<< CCI_FMT_ADDR_BYTE)
#define CCI_FMT_CMD 24
#define CCI_FMT_CMD_MASK ( 0x1<< CCI_FMT_CMD)
#define CCI_FMT_SLV_ID 25
#define CCI_FMT_SLV_ID_MASK ( 0x7f<< CCI_FMT_SLV_ID)
#define CCI_BUS_CTRL_OFF 0x000C
#define CCI_BUS_CTRL_SDA_MOE 0
#define CCI_BUS_CTRL_SCL_MOE 1
#define CCI_BUS_CTRL_SDA_MOV 2
#define CCI_BUS_CTRL_SCL_MOV 3
#define CCI_BUS_CTRL_SDA_PEN 4
#define CCI_BUS_CTRL_SCL_PEN 5
#define CCI_BUS_CTRL_SDA_STA 6
#define CCI_BUS_CTRL_SCL_STA 7
#define CCI_BUS_CTRL_CLK_M 8
#define CCI_BUS_CTRL_CLK_M_MASK (0xF << CCI_BUS_CTRL_CLK_M)
#define CCI_BUS_CTRL_CLK_N 12
#define CCI_BUS_CTRL_CLK_N_MASK (0x7 << CCI_BUS_CTRL_CLK_N)
#define CCI_BUS_CTRL_DLY_TRIG 15
#define CCI_BUS_CTRL_DLY_CYC 16
#define CCI_BUS_CTRL_DLY_CYC_MASK (0xffff << CCI_BUS_CTRL_DLY_CYC)
#define CCI_INT_CTRL_OFF 0x0014
#define CCI_INT_CTRL_S_TRAN_COM_PD 0
#define CCI_INT_CTRL_S_TRAN_ERR_PD 1
#define CCI_INT_CTRL_RES0 2
#define CCI_INT_CTRL_S_TRAN_COM_INT_EN 16
#define CCI_INT_CTRL_S_TRAN_ERR_INT_EN 17
#define CCI_INT_CTRL_RES1 18
#define CCI_LC_TRIG_OFF 0x0018
#define CCI_LC_TRIG_LN_CNT 0
#define CCI_LC_TRIG_LN_CNT_MASK (0x1fff << CCI_LC_TRIG_LN_CNT)
#define CCI_LC_TRIG_RES0 13
#define CCI_FIFO_ACC_OFF 0x0100
#define CCI_FIFO_ACC_DATA_FIFO 0
#define CCI_RSV_REG_OFF 0x0200
//------------------------------------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------------------------------------
#endif /*_CSI_CCI_REG_I_H_*/
| {
"pile_set_name": "Github"
} |
// Copyright © 2006-2010 Travis Robinson. All rights reserved.
//
// website: http://sourceforge.net/projects/libusbdotnet
// e-mail: [email protected]
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. or
// visit www.gnu.org.
//
//
using System;
using System.Globalization;
using System.Text.RegularExpressions;
using LibUsbDotNet.Internal.UsbRegex;
namespace LibUsbDotNet.Main
{
/// <summary> USB device symbolic names are persistent accrossed boots and uniquely identify each device.
/// </summary>
/// <remarks> As well as uniquely identify connected devices, the UsbSymbolicName class parses the symbolic name key into usable fields.
/// </remarks>
public class UsbSymbolicName
{
private static RegHardwareID _regHardwareId;
private static RegSymbolicName _regSymbolicName;
private readonly string mSymbolicName;
private Guid mClassGuid = Guid.Empty;
private bool mIsParsed;
private int mProductID;
private int mRevisionCode;
private string mSerialNumber = String.Empty;
private int mVendorID;
internal UsbSymbolicName(string symbolicName) { mSymbolicName = symbolicName; }
private static RegSymbolicName RegSymbolicName
{
get
{
if (ReferenceEquals(_regSymbolicName, null))
{
_regSymbolicName = new RegSymbolicName();
}
return _regSymbolicName;
}
}
private static RegHardwareID RegHardwareId
{
get
{
if (ReferenceEquals(_regHardwareId, null))
{
_regHardwareId = new RegHardwareID();
}
return _regHardwareId;
}
}
/// <summary>
/// The full symbolic name of the device.
/// </summary>
public string FullName
{
get
{
if (mSymbolicName != null) return mSymbolicName.TrimStart(new char[] {'\\', '?'});
return String.Empty;
}
}
/// <summary>
/// VendorId parsed out of the <see cref="UsbSymbolicName.FullName"/>
/// </summary>
public int Vid
{
get
{
Parse();
return mVendorID;
}
}
/// <summary>
/// ProductId parsed out of the <see cref="UsbSymbolicName.FullName"/>
/// </summary>
public int Pid
{
get
{
Parse();
return mProductID;
}
}
/// <summary>
/// SerialNumber parsed out of the <see cref="UsbSymbolicName.FullName"/>
/// </summary>
public string SerialNumber
{
get
{
Parse();
return mSerialNumber;
}
}
/// <summary>
/// Device class parsed out of the <see cref="UsbSymbolicName.FullName"/>
/// </summary>
public Guid ClassGuid
{
get
{
Parse();
return mClassGuid;
}
}
/// <summary>
/// Usb device revision number.
/// </summary>
public int Rev
{
get
{
Parse();
return mRevisionCode;
}
}
/// <summary>
/// Parses registry strings containing USB information. This function can Parse symbolic names as well as hardware ids, compatible ids, etc.
/// </summary>
/// <param name="identifiers"></param>
/// <returns>A <see cref="UsbSymbolicName"/> class with all the available information from the <paramref name="identifiers"/> string.</returns>
/// <remarks>
/// <code>
/// List<UsbRegistryDeviceInfo> regDeviceList = UsbGlobals.RegFindDevices();
/// foreach (UsbRegistryDeviceInfo regDevice in mDevList)
/// {
/// string[] hardwareIds = (string[])regDevice.Properties[DevicePropertyType.HardwareID];
/// UsbSymbolicName usbHardwareID = UsbSymbolicName.Parse(hardwareIds[0]);
/// Debug.Print(string.Format("Vid:0x{0:X4} Pid:0x{1:X4}", usbHardwareID.Vid, usbHardwareID.Pid));
/// }
/// </code>
/// </remarks>
public static UsbSymbolicName Parse(string identifiers) { return new UsbSymbolicName(identifiers); }
///<summary>
///Returns a <see cref="T:System.String"/> that represents the current <see cref="UsbSymbolicName"/>.
///</summary>
///
///<returns>
///A <see cref="System.String"/> that represents the current <see cref="UsbSymbolicName"/>.
///</returns>
public override string ToString()
{
object[] o = new object[] {FullName, Vid.ToString("X4"), Pid.ToString("X4"), SerialNumber, ClassGuid};
return string.Format("FullName:{0}\r\nVid:0x{1}\r\nPid:0x{2}\r\nSerialNumber:{3}\r\nClassGuid:{4}\r\n", o);
}
private void Parse()
{
if (!mIsParsed)
{
mIsParsed = true;
if (mSymbolicName != null)
{
MatchCollection matches = RegSymbolicName.Matches(mSymbolicName);
foreach (Match match in matches)
{
Group gVid = match.Groups[(int) NamedGroupType.Vid];
Group gPid = match.Groups[(int) NamedGroupType.Pid];
Group gRev = match.Groups[(int) NamedGroupType.Rev];
Group gString = match.Groups[(int) NamedGroupType.String];
Group gClass = match.Groups[(int) NamedGroupType.ClassGuid];
if (gVid.Success && mVendorID == 0)
{
int.TryParse(gVid.Captures[0].Value, NumberStyles.HexNumber, null, out mVendorID);
}
if (gPid.Success && mProductID == 0)
{
int.TryParse(gPid.Captures[0].Value, NumberStyles.HexNumber, null, out mProductID);
}
if (gRev.Success && mRevisionCode == 0)
{
int.TryParse(gRev.Captures[0].Value, out mRevisionCode);
}
if ((gString.Success) && mSerialNumber == String.Empty)
{
mSerialNumber = gString.Captures[0].Value;
}
if ((gClass.Success) && mClassGuid == Guid.Empty)
{
try
{
mClassGuid = new Guid(gClass.Captures[0].Value);
}
catch (Exception)
{
mClassGuid = Guid.Empty;
}
}
}
}
}
}
}
} | {
"pile_set_name": "Github"
} |
{
"type": "bundle",
"id": "bundle--5195c43f-46bd-472d-a6a6-40a92cd9e40d",
"spec_version": "2.0",
"objects": [
{
"type": "relationship",
"id": "relationship--7d639463-ea08-4233-a922-f74423845236",
"created_by_ref": "identity--e50ab59c-5c4f-4d40-bf6a-d58418d89bcd",
"created": "2014-06-23T00:00:00.000Z",
"modified": "2020-07-30T00:00:00.000Z",
"relationship_type": "mitigates",
"source_ref": "course-of-action--cab581d6-2ed4-47e6-85b3-5d84bd943c50",
"target_ref": "attack-pattern--f51fd46e-a327-4c2d-a047-12fe2be6eb0b",
"object_marking_refs": [
"marking-definition--17d82bb2-eeeb-4898-bda5-3ddbcd2b799d"
],
"x_capec_version": "3.3"
}
]
} | {
"pile_set_name": "Github"
} |
defmodule AcceptedSpec do
use ESpec
import ESpec.TestHelpers
defmodule SomeModule do
def f, do: :f
def m, do: :m
end
|> write_beam
describe "expect(module).to accepted(func, args)" do
before do
allow(SomeModule) |> to(accept(:func, fn a, b -> a + b end))
SomeModule.func(1, 2)
end
context "Success" do
it "checks success with `to`" do
message = expect(SomeModule) |> to(accepted(:func, [1, 2]))
expect(message)
|> to(
eq "`AcceptedSpec.SomeModule` accepted `:func` with `[1, 2]` in process `:any` at least once."
)
end
it "checks success with `not_to`" do
message = expect(SomeModule) |> to_not(accepted(:another_function, []))
expect(message)
|> to(
eq "`AcceptedSpec.SomeModule` didn't accept `:another_function` with `[]` in process `:any` at least once."
)
end
end
context "Error" do
context "with `to`" do
before do
{:shared,
expectation: fn -> expect(SomeModule) |> to(accepted(:another_function, [])) end,
message:
"Expected `AcceptedSpec.SomeModule` to accept `:another_function` with `[]` in process `:any` at least once, but it accepted the function `0` times. The function was called with arguments []"}
end
it_behaves_like(CheckErrorSharedSpec)
end
context "with `not_to`" do
before do
{:shared,
expectation: fn -> expect(SomeModule) |> to_not(accepted(:func, [1, 2])) end,
message:
"Expected `AcceptedSpec.SomeModule` not to accept `:func` with `[1, 2]` in process `:any` at least once, but it accepted the function `1` times. The function was called with arguments [1, 2]"}
end
it_behaves_like(CheckErrorSharedSpec)
end
end
end
describe "any args" do
before do
allow(SomeModule) |> to(accept(:func, fn a, b -> a + b end))
SomeModule.func(1, 2)
SomeModule.func(1, 2)
end
it do: expect(SomeModule) |> to(accepted(:func))
it do: expect(SomeModule) |> to(accepted(:func, :any))
it do: expect(SomeModule) |> to_not(accepted(:func, [2, 3]))
end
describe "count option" do
before do
allow(SomeModule) |> to(accept(:func, fn a, b -> a + b end))
SomeModule.func(1, 2)
SomeModule.func(1, 2)
end
it do: expect(SomeModule) |> to(accepted(:func, [1, 2], count: 2))
it do: expect(SomeModule) |> to_not(accepted(:func, [1, 2], count: 1))
end
describe "pid option" do
defmodule Server do
def call(a, b) do
SomeModule.func(a, b)
end
end
before do
allow(SomeModule) |> to(accept(:func, fn a, b -> a + b end))
pid = spawn(Server, :call, [10, 20])
:timer.sleep(100)
{:ok, pid: pid}
end
it "accepted with pid" do
expect(SomeModule) |> to(accepted(:func, [10, 20], pid: shared.pid))
end
it "not accepted with another pid" do
expect(SomeModule) |> to_not(accepted(:func, [10, 20], pid: self()))
end
it "accepted with :any" do
expect(SomeModule) |> to(accepted(:func, [10, 20], pid: :any))
end
context "with count" do
before do
allow(SomeModule) |> to(accept(:func, fn a, b -> a + b end))
SomeModule.func(10, 20)
end
it do: expect(SomeModule) |> to(accepted(:func, [10, 20], pid: :any, count: 2))
end
end
describe "messages" do
import ESpec.Assertions.Accepted, only: [assert: 3]
before do
allow(SomeModule) |> to(accept(:func, fn a, b -> a + b end))
end
it "for positive assertions" do
SomeModule.func(1, 2)
expect(assert(SomeModule, [:func, :any, []], true))
|> to(
eq(
"`AcceptedSpec.SomeModule` accepted `:func` with `:any` in process `:any` at least once."
)
)
expect(assert(SomeModule, [:func, [1, 2], [count: 1]], true))
|> to(
eq(
"`AcceptedSpec.SomeModule` accepted `:func` with `[1, 2]` in process `:any` `1` times."
)
)
end
it "for negative assertions" do
expect(assert(SomeModule, [:func, :any, []], false))
|> to(
eq(
"`AcceptedSpec.SomeModule` didn't accept `:func` with `:any` in process `:any` at least once."
)
)
expect(assert(SomeModule, [:func, [1, 2], [count: 1]], false))
|> to(
eq(
"`AcceptedSpec.SomeModule` didn't accept `:func` with `[1, 2]` in process `:any` `1` times."
)
)
end
it "for failed positive assertions" do
expect(fn -> assert(SomeModule, [:func, :any, []], true) end)
|> to(
raise_exception(
Elixir.ESpec.AssertionError,
"Expected `AcceptedSpec.SomeModule` to accept `:func` with `:any` in process `:any` at least once, but it accepted the function `0` times. The function was called with arguments :any"
)
)
end
it "for failed negative assertions" do
SomeModule.func(1, 2)
expect(fn -> assert(SomeModule, [:func, :any, []], false) end)
|> to(
raise_exception(
Elixir.ESpec.AssertionError,
"Expected `AcceptedSpec.SomeModule` not to accept `:func` with `:any` in process `:any` at least once, but it accepted the function `1` times. The function was called with arguments :any"
)
)
end
end
end
| {
"pile_set_name": "Github"
} |
/**
* Styles for Multi-Screen.js
* @author Ian de Vries <[email protected]>
* @license MIT License <http://opensource.org/licenses/MIT>
*/
.ms-container {
position: fixed;
z-index: 1;
display: none;
}
.ms-default {
position: absolute;
z-index: 2;
display: block;
} | {
"pile_set_name": "Github"
} |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
func main() {
if ; false {} // compiles; should be an error (should be simplevardecl before ;)
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>784</width>
<height>565</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="topMargin">
<number>10</number>
</property>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Archive:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="archiveNameLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>nyx2.local-2018-11-16T09:49:58 from November 16, 2018</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QTreeView" name="treeView"/>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Note: If you select a top-level folder and deselect its children, they will still be restored.</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="topMargin">
<number>10</number>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item alignment="Qt::AlignRight">
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="extractButton">
<property name="text">
<string>Extract</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
| {
"pile_set_name": "Github"
} |
/*
* Software License Agreement (BSD License)
*
* Copyright (c) 2010, Willow Garage, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of the copyright holder(s) nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*
*/
#include <pcl/common/distances.h>
void
pcl::lineToLineSegment (const Eigen::VectorXf &line_a, const Eigen::VectorXf &line_b,
Eigen::Vector4f &pt1_seg, Eigen::Vector4f &pt2_seg)
{
// point + direction = 2nd point
Eigen::Vector4f p1 = Eigen::Vector4f::Zero ();
Eigen::Vector4f p2 = Eigen::Vector4f::Zero ();
Eigen::Vector4f dir1 = Eigen::Vector4f::Zero ();
p1.head<3> () = line_a.head<3> ();
dir1.head<3> () = line_a.segment<3> (3);
p2 = p1 + dir1;
// point + direction = 2nd point
Eigen::Vector4f q1 = Eigen::Vector4f::Zero ();
Eigen::Vector4f q2 = Eigen::Vector4f::Zero ();
Eigen::Vector4f dir2 = Eigen::Vector4f::Zero ();
q1.head<3> () = line_b.head<3> ();
dir2.head<3> () = line_b.segment<3> (3);
q2 = q1 + dir2;
// a = x2 - x1 = line_a[1] - line_a[0]
Eigen::Vector4f u = dir1;
// b = x4 - x3 = line_b[1] - line_b[0]
Eigen::Vector4f v = dir2;
// c = x2 - x3 = line_a[1] - line_b[0]
Eigen::Vector4f w = p2 - q1;
float a = u.dot (u);
float b = u.dot (v);
float c = v.dot (v);
float d = u.dot (w);
float e = v.dot (w);
float denominator = a*c - b*b;
float sc, tc;
// Compute the line parameters of the two closest points
if (denominator < 1e-5) // The lines are almost parallel
{
sc = 0.0;
tc = (b > c ? d / b : e / c); // Use the largest denominator
}
else
{
sc = (b*e - c*d) / denominator;
tc = (a*e - b*d) / denominator;
}
// Get the closest points
pt1_seg = Eigen::Vector4f::Zero ();
pt1_seg = p2 + sc * u;
pt2_seg = Eigen::Vector4f::Zero ();
pt2_seg = q1 + tc * v;
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2016, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of the Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL CORPORATION OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Voltage Regulator
*
* This example demonstrates voltage regulator states.
*/
#include "qm_common.h"
#include "vreg.h"
int main(void)
{
QM_PUTS("Starting: VREG");
QM_PUTS("Put PLAT1P8 in LINEAR mode.");
vreg_plat1p8_set_mode(VREG_MODE_LINEAR);
QM_PUTS("Put PLAT1P8 in SHUTDOWN mode.");
vreg_plat1p8_set_mode(VREG_MODE_SHUTDOWN);
QM_PUTS("Put PLAT1P8 in SWITCHING mode.");
vreg_plat1p8_set_mode(VREG_MODE_SWITCHING);
QM_PUTS("Finished: VREG");
return 0;
}
| {
"pile_set_name": "Github"
} |
/*
* cjpeg.c
*
* Copyright (C) 1991-1998, Thomas G. Lane.
* Modified 2003-2010 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
* This file contains a command-line user interface for the JPEG compressor.
* It should work on any system with Unix- or MS-DOS-style command lines.
*
* Two different command line styles are permitted, depending on the
* compile-time switch TWO_FILE_COMMANDLINE:
* cjpeg [options] inputfile outputfile
* cjpeg [options] [inputfile]
* In the second style, output is always to standard output, which you'd
* normally redirect to a file or pipe to some other program. Input is
* either from a named file or from standard input (typically redirected).
* The second style is convenient on Unix but is unhelpful on systems that
* don't support pipes. Also, you MUST use the first style if your system
* doesn't do binary I/O to stdin/stdout.
* To simplify script writing, the "-outfile" switch is provided. The syntax
* cjpeg [options] -outfile outputfile inputfile
* works regardless of which command line style is used.
*/
#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
#include "jversion.h" /* for version message */
#ifdef USE_CCOMMAND /* command-line reader for Macintosh */
#ifdef __MWERKS__
#include <SIOUX.h> /* Metrowerks needs this */
#include <console.h> /* ... and this */
#endif
#ifdef THINK_C
#include <console.h> /* Think declares it here */
#endif
#endif
/* Create the add-on message string table. */
#define JMESSAGE(code,string) string ,
static const char * const cdjpeg_message_table[] = {
#include "cderror.h"
NULL
};
/*
* This routine determines what format the input file is,
* and selects the appropriate input-reading module.
*
* To determine which family of input formats the file belongs to,
* we may look only at the first byte of the file, since C does not
* guarantee that more than one character can be pushed back with ungetc.
* Looking at additional bytes would require one of these approaches:
* 1) assume we can fseek() the input file (fails for piped input);
* 2) assume we can push back more than one character (works in
* some C implementations, but unportable);
* 3) provide our own buffering (breaks input readers that want to use
* stdio directly, such as the RLE library);
* or 4) don't put back the data, and modify the input_init methods to assume
* they start reading after the start of file (also breaks RLE library).
* #1 is attractive for MS-DOS but is untenable on Unix.
*
* The most portable solution for file types that can't be identified by their
* first byte is to make the user tell us what they are. This is also the
* only approach for "raw" file types that contain only arbitrary values.
* We presently apply this method for Targa files. Most of the time Targa
* files start with 0x00, so we recognize that case. Potentially, however,
* a Targa file could start with any byte value (byte 0 is the length of the
* seldom-used ID field), so we provide a switch to force Targa input mode.
*/
static boolean is_targa; /* records user -targa switch */
LOCAL(cjpeg_source_ptr)
select_file_type (j_compress_ptr cinfo, FILE * infile)
{
int c;
if (is_targa) {
#ifdef TARGA_SUPPORTED
return jinit_read_targa(cinfo);
#else
ERREXIT(cinfo, JERR_TGA_NOTCOMP);
#endif
}
if ((c = getc(infile)) == EOF)
ERREXIT(cinfo, JERR_INPUT_EMPTY);
if (ungetc(c, infile) == EOF)
ERREXIT(cinfo, JERR_UNGETC_FAILED);
switch (c) {
#ifdef BMP_SUPPORTED
case 'B':
return jinit_read_bmp(cinfo);
#endif
#ifdef GIF_SUPPORTED
case 'G':
return jinit_read_gif(cinfo);
#endif
#ifdef PPM_SUPPORTED
case 'P':
return jinit_read_ppm(cinfo);
#endif
#ifdef RLE_SUPPORTED
case 'R':
return jinit_read_rle(cinfo);
#endif
#ifdef TARGA_SUPPORTED
case 0x00:
return jinit_read_targa(cinfo);
#endif
default:
ERREXIT(cinfo, JERR_UNKNOWN_FORMAT);
break;
}
return NULL; /* suppress compiler warnings */
}
/*
* Argument-parsing code.
* The switch parser is designed to be useful with DOS-style command line
* syntax, ie, intermixed switches and file names, where only the switches
* to the left of a given file name affect processing of that file.
* The main program in this file doesn't actually use this capability...
*/
static const char * progname; /* program name for error messages */
static char * outfilename; /* for -outfile switch */
LOCAL(void)
usage (void)
/* complain about bad command line */
{
fprintf(stderr, "usage: %s [switches] ", progname);
#ifdef TWO_FILE_COMMANDLINE
fprintf(stderr, "inputfile outputfile\n");
#else
fprintf(stderr, "[inputfile]\n");
#endif
fprintf(stderr, "Switches (names may be abbreviated):\n");
fprintf(stderr, " -quality N[,...] Compression quality (0..100; 5-95 is useful range)\n");
fprintf(stderr, " -grayscale Create monochrome JPEG file\n");
#ifdef ENTROPY_OPT_SUPPORTED
fprintf(stderr, " -optimize Optimize Huffman table (smaller file, but slow compression)\n");
#endif
#ifdef C_PROGRESSIVE_SUPPORTED
fprintf(stderr, " -progressive Create progressive JPEG file\n");
#endif
#ifdef DCT_SCALING_SUPPORTED
fprintf(stderr, " -scale M/N Scale image by fraction M/N, eg, 1/2\n");
#endif
#ifdef TARGA_SUPPORTED
fprintf(stderr, " -targa Input file is Targa format (usually not needed)\n");
#endif
fprintf(stderr, "Switches for advanced users:\n");
#ifdef DCT_SCALING_SUPPORTED
fprintf(stderr, " -block N DCT block size (1..16; default is 8)\n");
#endif
#ifdef DCT_ISLOW_SUPPORTED
fprintf(stderr, " -dct int Use integer DCT method%s\n",
(JDCT_DEFAULT == JDCT_ISLOW ? " (default)" : ""));
#endif
#ifdef DCT_IFAST_SUPPORTED
fprintf(stderr, " -dct fast Use fast integer DCT (less accurate)%s\n",
(JDCT_DEFAULT == JDCT_IFAST ? " (default)" : ""));
#endif
#ifdef DCT_FLOAT_SUPPORTED
fprintf(stderr, " -dct float Use floating-point DCT method%s\n",
(JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : ""));
#endif
fprintf(stderr, " -nosmooth Don't use high-quality downsampling\n");
fprintf(stderr, " -restart N Set restart interval in rows, or in blocks with B\n");
#ifdef INPUT_SMOOTHING_SUPPORTED
fprintf(stderr, " -smooth N Smooth dithered input (N=1..100 is strength)\n");
#endif
fprintf(stderr, " -maxmemory N Maximum memory to use (in kbytes)\n");
fprintf(stderr, " -outfile name Specify name for output file\n");
fprintf(stderr, " -verbose or -debug Emit debug output\n");
fprintf(stderr, "Switches for wizards:\n");
#ifdef C_ARITH_CODING_SUPPORTED
fprintf(stderr, " -arithmetic Use arithmetic coding\n");
#endif
fprintf(stderr, " -baseline Force baseline quantization tables\n");
fprintf(stderr, " -qtables file Use quantization tables given in file\n");
fprintf(stderr, " -qslots N[,...] Set component quantization tables\n");
fprintf(stderr, " -sample HxV[,...] Set component sampling factors\n");
#ifdef C_MULTISCAN_FILES_SUPPORTED
fprintf(stderr, " -scans file Create multi-scan JPEG per script file\n");
#endif
exit(EXIT_FAILURE);
}
LOCAL(int)
parse_switches (j_compress_ptr cinfo, int argc, char **argv,
int last_file_arg_seen, boolean for_real)
/* Parse optional switches.
* Returns argv[] index of first file-name argument (== argc if none).
* Any file names with indexes <= last_file_arg_seen are ignored;
* they have presumably been processed in a previous iteration.
* (Pass 0 for last_file_arg_seen on the first or only iteration.)
* for_real is FALSE on the first (dummy) pass; we may skip any expensive
* processing.
*/
{
int argn;
char * arg;
boolean force_baseline;
boolean simple_progressive;
char * qualityarg = NULL; /* saves -quality parm if any */
char * qtablefile = NULL; /* saves -qtables filename if any */
char * qslotsarg = NULL; /* saves -qslots parm if any */
char * samplearg = NULL; /* saves -sample parm if any */
char * scansarg = NULL; /* saves -scans parm if any */
/* Set up default JPEG parameters. */
force_baseline = FALSE; /* by default, allow 16-bit quantizers */
simple_progressive = FALSE;
is_targa = FALSE;
outfilename = NULL;
cinfo->err->trace_level = 0;
/* Scan command line options, adjust parameters */
for (argn = 1; argn < argc; argn++) {
arg = argv[argn];
if (*arg != '-') {
/* Not a switch, must be a file name argument */
if (argn <= last_file_arg_seen) {
outfilename = NULL; /* -outfile applies to just one input file */
continue; /* ignore this name if previously processed */
}
break; /* else done parsing switches */
}
arg++; /* advance past switch marker character */
if (keymatch(arg, "arithmetic", 1)) {
/* Use arithmetic coding. */
#ifdef C_ARITH_CODING_SUPPORTED
cinfo->arith_code = TRUE;
#else
fprintf(stderr, "%s: sorry, arithmetic coding not supported\n",
progname);
exit(EXIT_FAILURE);
#endif
} else if (keymatch(arg, "baseline", 2)) {
/* Force baseline-compatible output (8-bit quantizer values). */
force_baseline = TRUE;
} else if (keymatch(arg, "block", 2)) {
/* Set DCT block size. */
#if defined(DCT_SCALING_SUPPORTED) && defined(JPEG_LIB_VERSION_MAJOR) && \
(JPEG_LIB_VERSION_MAJOR > 8 || (JPEG_LIB_VERSION_MAJOR == 8 && \
defined(JPEG_LIB_VERSION_MINOR) && JPEG_LIB_VERSION_MINOR >= 3))
int val;
if (++argn >= argc) /* advance to next argument */
usage();
if (sscanf(argv[argn], "%d", &val) != 1)
usage();
if (val < 1 || val > 16)
usage();
cinfo->block_size = val;
#else
fprintf(stderr, "%s: sorry, block size setting not supported\n",
progname);
exit(EXIT_FAILURE);
#endif
} else if (keymatch(arg, "dct", 2)) {
/* Select DCT algorithm. */
if (++argn >= argc) /* advance to next argument */
usage();
if (keymatch(argv[argn], "int", 1)) {
cinfo->dct_method = JDCT_ISLOW;
} else if (keymatch(argv[argn], "fast", 2)) {
cinfo->dct_method = JDCT_IFAST;
} else if (keymatch(argv[argn], "float", 2)) {
cinfo->dct_method = JDCT_FLOAT;
} else
usage();
} else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) {
/* Enable debug printouts. */
/* On first -d, print version identification */
static boolean printed_version = FALSE;
if (! printed_version) {
fprintf(stderr, "Independent JPEG Group's CJPEG, version %s\n%s\n",
JVERSION, JCOPYRIGHT);
printed_version = TRUE;
}
cinfo->err->trace_level++;
} else if (keymatch(arg, "grayscale", 2) || keymatch(arg, "greyscale",2)) {
/* Force a monochrome JPEG file to be generated. */
jpeg_set_colorspace(cinfo, JCS_GRAYSCALE);
} else if (keymatch(arg, "maxmemory", 3)) {
/* Maximum memory in Kb (or Mb with 'm'). */
long lval;
char ch = 'x';
if (++argn >= argc) /* advance to next argument */
usage();
if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1)
usage();
if (ch == 'm' || ch == 'M')
lval *= 1000L;
cinfo->mem->max_memory_to_use = lval * 1000L;
} else if (keymatch(arg, "nosmooth", 3)) {
/* Suppress fancy downsampling */
cinfo->do_fancy_downsampling = FALSE;
} else if (keymatch(arg, "optimize", 1) || keymatch(arg, "optimise", 1)) {
/* Enable entropy parm optimization. */
#ifdef ENTROPY_OPT_SUPPORTED
cinfo->optimize_coding = TRUE;
#else
fprintf(stderr, "%s: sorry, entropy optimization was not compiled\n",
progname);
exit(EXIT_FAILURE);
#endif
} else if (keymatch(arg, "outfile", 4)) {
/* Set output file name. */
if (++argn >= argc) /* advance to next argument */
usage();
outfilename = argv[argn]; /* save it away for later use */
} else if (keymatch(arg, "progressive", 1)) {
/* Select simple progressive mode. */
#ifdef C_PROGRESSIVE_SUPPORTED
simple_progressive = TRUE;
/* We must postpone execution until num_components is known. */
#else
fprintf(stderr, "%s: sorry, progressive output was not compiled\n",
progname);
exit(EXIT_FAILURE);
#endif
} else if (keymatch(arg, "quality", 1)) {
/* Quality ratings (quantization table scaling factors). */
if (++argn >= argc) /* advance to next argument */
usage();
qualityarg = argv[argn];
} else if (keymatch(arg, "qslots", 2)) {
/* Quantization table slot numbers. */
if (++argn >= argc) /* advance to next argument */
usage();
qslotsarg = argv[argn];
/* Must delay setting qslots until after we have processed any
* colorspace-determining switches, since jpeg_set_colorspace sets
* default quant table numbers.
*/
} else if (keymatch(arg, "qtables", 2)) {
/* Quantization tables fetched from file. */
if (++argn >= argc) /* advance to next argument */
usage();
qtablefile = argv[argn];
/* We postpone actually reading the file in case -quality comes later. */
} else if (keymatch(arg, "restart", 1)) {
/* Restart interval in MCU rows (or in MCUs with 'b'). */
long lval;
char ch = 'x';
if (++argn >= argc) /* advance to next argument */
usage();
if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1)
usage();
if (lval < 0 || lval > 65535L)
usage();
if (ch == 'b' || ch == 'B') {
cinfo->restart_interval = (unsigned int) lval;
cinfo->restart_in_rows = 0; /* else prior '-restart n' overrides me */
} else {
cinfo->restart_in_rows = (int) lval;
/* restart_interval will be computed during startup */
}
} else if (keymatch(arg, "sample", 2)) {
/* Set sampling factors. */
if (++argn >= argc) /* advance to next argument */
usage();
samplearg = argv[argn];
/* Must delay setting sample factors until after we have processed any
* colorspace-determining switches, since jpeg_set_colorspace sets
* default sampling factors.
*/
} else if (keymatch(arg, "scale", 4)) {
/* Scale the image by a fraction M/N. */
if (++argn >= argc) /* advance to next argument */
usage();
if (sscanf(argv[argn], "%d/%d",
&cinfo->scale_num, &cinfo->scale_denom) != 2)
usage();
} else if (keymatch(arg, "scans", 4)) {
/* Set scan script. */
#ifdef C_MULTISCAN_FILES_SUPPORTED
if (++argn >= argc) /* advance to next argument */
usage();
scansarg = argv[argn];
/* We must postpone reading the file in case -progressive appears. */
#else
fprintf(stderr, "%s: sorry, multi-scan output was not compiled\n",
progname);
exit(EXIT_FAILURE);
#endif
} else if (keymatch(arg, "smooth", 2)) {
/* Set input smoothing factor. */
int val;
if (++argn >= argc) /* advance to next argument */
usage();
if (sscanf(argv[argn], "%d", &val) != 1)
usage();
if (val < 0 || val > 100)
usage();
cinfo->smoothing_factor = val;
} else if (keymatch(arg, "targa", 1)) {
/* Input file is Targa format. */
is_targa = TRUE;
} else {
usage(); /* bogus switch */
}
}
/* Post-switch-scanning cleanup */
if (for_real) {
/* Set quantization tables for selected quality. */
/* Some or all may be overridden if -qtables is present. */
if (qualityarg != NULL) /* process -quality if it was present */
if (! set_quality_ratings(cinfo, qualityarg, force_baseline))
usage();
if (qtablefile != NULL) /* process -qtables if it was present */
if (! read_quant_tables(cinfo, qtablefile, force_baseline))
usage();
if (qslotsarg != NULL) /* process -qslots if it was present */
if (! set_quant_slots(cinfo, qslotsarg))
usage();
if (samplearg != NULL) /* process -sample if it was present */
if (! set_sample_factors(cinfo, samplearg))
usage();
#ifdef C_PROGRESSIVE_SUPPORTED
if (simple_progressive) /* process -progressive; -scans can override */
jpeg_simple_progression(cinfo);
#endif
#ifdef C_MULTISCAN_FILES_SUPPORTED
if (scansarg != NULL) /* process -scans if it was present */
if (! read_scan_script(cinfo, scansarg))
usage();
#endif
}
return argn; /* return index of next arg (file name) */
}
/*
* The main program.
*/
int
main (int argc, char **argv)
{
struct jpeg_compress_struct cinfo;
struct jpeg_error_mgr jerr;
#ifdef PROGRESS_REPORT
struct cdjpeg_progress_mgr progress;
#endif
int file_index;
cjpeg_source_ptr src_mgr;
FILE * input_file;
FILE * output_file;
JDIMENSION num_scanlines;
/* On Mac, fetch a command line. */
#ifdef USE_CCOMMAND
argc = ccommand(&argv);
#endif
progname = argv[0];
if (progname == NULL || progname[0] == 0)
progname = "cjpeg"; /* in case C library doesn't provide it */
/* Initialize the JPEG compression object with default error handling. */
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_compress(&cinfo);
/* Add some application-specific error messages (from cderror.h) */
jerr.addon_message_table = cdjpeg_message_table;
jerr.first_addon_message = JMSG_FIRSTADDONCODE;
jerr.last_addon_message = JMSG_LASTADDONCODE;
/* Now safe to enable signal catcher. */
#ifdef NEED_SIGNAL_CATCHER
enable_signal_catcher((j_common_ptr) &cinfo);
#endif
/* Initialize JPEG parameters.
* Much of this may be overridden later.
* In particular, we don't yet know the input file's color space,
* but we need to provide some value for jpeg_set_defaults() to work.
*/
cinfo.in_color_space = JCS_RGB; /* arbitrary guess */
jpeg_set_defaults(&cinfo);
/* Scan command line to find file names.
* It is convenient to use just one switch-parsing routine, but the switch
* values read here are ignored; we will rescan the switches after opening
* the input file.
*/
file_index = parse_switches(&cinfo, argc, argv, 0, FALSE);
#ifdef TWO_FILE_COMMANDLINE
/* Must have either -outfile switch or explicit output file name */
if (outfilename == NULL) {
if (file_index != argc-2) {
fprintf(stderr, "%s: must name one input and one output file\n",
progname);
usage();
}
outfilename = argv[file_index+1];
} else {
if (file_index != argc-1) {
fprintf(stderr, "%s: must name one input and one output file\n",
progname);
usage();
}
}
#else
/* Unix style: expect zero or one file name */
if (file_index < argc-1) {
fprintf(stderr, "%s: only one input file\n", progname);
usage();
}
#endif /* TWO_FILE_COMMANDLINE */
/* Open the input file. */
if (file_index < argc) {
if ((input_file = fopen(argv[file_index], READ_BINARY)) == NULL) {
fprintf(stderr, "%s: can't open %s\n", progname, argv[file_index]);
exit(EXIT_FAILURE);
}
} else {
/* default input file is stdin */
input_file = read_stdin();
}
/* Open the output file. */
if (outfilename != NULL) {
if ((output_file = fopen(outfilename, WRITE_BINARY)) == NULL) {
fprintf(stderr, "%s: can't open %s\n", progname, outfilename);
exit(EXIT_FAILURE);
}
} else {
/* default output file is stdout */
output_file = write_stdout();
}
#ifdef PROGRESS_REPORT
start_progress_monitor((j_common_ptr) &cinfo, &progress);
#endif
/* Figure out the input file format, and set up to read it. */
src_mgr = select_file_type(&cinfo, input_file);
src_mgr->input_file = input_file;
/* Read the input file header to obtain file size & colorspace. */
(*src_mgr->start_input) (&cinfo, src_mgr);
/* Now that we know input colorspace, fix colorspace-dependent defaults */
jpeg_default_colorspace(&cinfo);
/* Adjust default compression parameters by re-parsing the options */
file_index = parse_switches(&cinfo, argc, argv, 0, TRUE);
/* Specify data destination for compression */
jpeg_stdio_dest(&cinfo, output_file);
/* Start compressor */
jpeg_start_compress(&cinfo, TRUE);
/* Process data */
while (cinfo.next_scanline < cinfo.image_height) {
num_scanlines = (*src_mgr->get_pixel_rows) (&cinfo, src_mgr);
(void) jpeg_write_scanlines(&cinfo, src_mgr->buffer, num_scanlines);
}
/* Finish compression and release memory */
(*src_mgr->finish_input) (&cinfo, src_mgr);
jpeg_finish_compress(&cinfo);
jpeg_destroy_compress(&cinfo);
/* Close files, if we opened them */
if (input_file != stdin)
fclose(input_file);
if (output_file != stdout)
fclose(output_file);
#ifdef PROGRESS_REPORT
end_progress_monitor((j_common_ptr) &cinfo);
#endif
/* All done. */
exit(jerr.num_warnings ? EXIT_WARNING : EXIT_SUCCESS);
return 0; /* suppress no-return-value warnings */
}
| {
"pile_set_name": "Github"
} |
var baseIteratee = require('./_baseIteratee'),
isArrayLike = require('./isArrayLike'),
keys = require('./keys');
/**
* Creates a `_.find` or `_.findLast` function.
*
* @private
* @param {Function} findIndexFunc The function to find the collection index.
* @returns {Function} Returns the new find function.
*/
function createFind(findIndexFunc) {
return function(collection, predicate, fromIndex) {
var iterable = Object(collection);
if (!isArrayLike(collection)) {
var iteratee = baseIteratee(predicate, 3);
collection = keys(collection);
predicate = function(key) { return iteratee(iterable[key], key, iterable); };
}
var index = findIndexFunc(collection, predicate, fromIndex);
return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
};
}
module.exports = createFind;
| {
"pile_set_name": "Github"
} |
// SPDX-License-Identifier: GPL-2.0
#define _GNU_SOURCE
#include <sched.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/mount.h>
#include <sys/wait.h>
#include <sys/vfs.h>
#include <sys/statvfs.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <grp.h>
#include <stdbool.h>
#include <stdarg.h>
#ifndef CLONE_NEWNS
# define CLONE_NEWNS 0x00020000
#endif
#ifndef CLONE_NEWUTS
# define CLONE_NEWUTS 0x04000000
#endif
#ifndef CLONE_NEWIPC
# define CLONE_NEWIPC 0x08000000
#endif
#ifndef CLONE_NEWNET
# define CLONE_NEWNET 0x40000000
#endif
#ifndef CLONE_NEWUSER
# define CLONE_NEWUSER 0x10000000
#endif
#ifndef CLONE_NEWPID
# define CLONE_NEWPID 0x20000000
#endif
#ifndef MS_REC
# define MS_REC 16384
#endif
#ifndef MS_RELATIME
# define MS_RELATIME (1 << 21)
#endif
#ifndef MS_STRICTATIME
# define MS_STRICTATIME (1 << 24)
#endif
static void die(char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
exit(EXIT_FAILURE);
}
static void vmaybe_write_file(bool enoent_ok, char *filename, char *fmt, va_list ap)
{
char buf[4096];
int fd;
ssize_t written;
int buf_len;
buf_len = vsnprintf(buf, sizeof(buf), fmt, ap);
if (buf_len < 0) {
die("vsnprintf failed: %s\n",
strerror(errno));
}
if (buf_len >= sizeof(buf)) {
die("vsnprintf output truncated\n");
}
fd = open(filename, O_WRONLY);
if (fd < 0) {
if ((errno == ENOENT) && enoent_ok)
return;
die("open of %s failed: %s\n",
filename, strerror(errno));
}
written = write(fd, buf, buf_len);
if (written != buf_len) {
if (written >= 0) {
die("short write to %s\n", filename);
} else {
die("write to %s failed: %s\n",
filename, strerror(errno));
}
}
if (close(fd) != 0) {
die("close of %s failed: %s\n",
filename, strerror(errno));
}
}
static void maybe_write_file(char *filename, char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vmaybe_write_file(true, filename, fmt, ap);
va_end(ap);
}
static void write_file(char *filename, char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vmaybe_write_file(false, filename, fmt, ap);
va_end(ap);
}
static int read_mnt_flags(const char *path)
{
int ret;
struct statvfs stat;
int mnt_flags;
ret = statvfs(path, &stat);
if (ret != 0) {
die("statvfs of %s failed: %s\n",
path, strerror(errno));
}
if (stat.f_flag & ~(ST_RDONLY | ST_NOSUID | ST_NODEV | \
ST_NOEXEC | ST_NOATIME | ST_NODIRATIME | ST_RELATIME | \
ST_SYNCHRONOUS | ST_MANDLOCK)) {
die("Unrecognized mount flags\n");
}
mnt_flags = 0;
if (stat.f_flag & ST_RDONLY)
mnt_flags |= MS_RDONLY;
if (stat.f_flag & ST_NOSUID)
mnt_flags |= MS_NOSUID;
if (stat.f_flag & ST_NODEV)
mnt_flags |= MS_NODEV;
if (stat.f_flag & ST_NOEXEC)
mnt_flags |= MS_NOEXEC;
if (stat.f_flag & ST_NOATIME)
mnt_flags |= MS_NOATIME;
if (stat.f_flag & ST_NODIRATIME)
mnt_flags |= MS_NODIRATIME;
if (stat.f_flag & ST_RELATIME)
mnt_flags |= MS_RELATIME;
if (stat.f_flag & ST_SYNCHRONOUS)
mnt_flags |= MS_SYNCHRONOUS;
if (stat.f_flag & ST_MANDLOCK)
mnt_flags |= ST_MANDLOCK;
return mnt_flags;
}
static void create_and_enter_userns(void)
{
uid_t uid;
gid_t gid;
uid = getuid();
gid = getgid();
if (unshare(CLONE_NEWUSER) !=0) {
die("unshare(CLONE_NEWUSER) failed: %s\n",
strerror(errno));
}
maybe_write_file("/proc/self/setgroups", "deny");
write_file("/proc/self/uid_map", "0 %d 1", uid);
write_file("/proc/self/gid_map", "0 %d 1", gid);
if (setgid(0) != 0) {
die ("setgid(0) failed %s\n",
strerror(errno));
}
if (setuid(0) != 0) {
die("setuid(0) failed %s\n",
strerror(errno));
}
}
static
bool test_unpriv_remount(const char *fstype, const char *mount_options,
int mount_flags, int remount_flags, int invalid_flags)
{
pid_t child;
child = fork();
if (child == -1) {
die("fork failed: %s\n",
strerror(errno));
}
if (child != 0) { /* parent */
pid_t pid;
int status;
pid = waitpid(child, &status, 0);
if (pid == -1) {
die("waitpid failed: %s\n",
strerror(errno));
}
if (pid != child) {
die("waited for %d got %d\n",
child, pid);
}
if (!WIFEXITED(status)) {
die("child did not terminate cleanly\n");
}
return WEXITSTATUS(status) == EXIT_SUCCESS ? true : false;
}
create_and_enter_userns();
if (unshare(CLONE_NEWNS) != 0) {
die("unshare(CLONE_NEWNS) failed: %s\n",
strerror(errno));
}
if (mount("testing", "/tmp", fstype, mount_flags, mount_options) != 0) {
die("mount of %s with options '%s' on /tmp failed: %s\n",
fstype,
mount_options? mount_options : "",
strerror(errno));
}
create_and_enter_userns();
if (unshare(CLONE_NEWNS) != 0) {
die("unshare(CLONE_NEWNS) failed: %s\n",
strerror(errno));
}
if (mount("/tmp", "/tmp", "none",
MS_REMOUNT | MS_BIND | remount_flags, NULL) != 0) {
/* system("cat /proc/self/mounts"); */
die("remount of /tmp failed: %s\n",
strerror(errno));
}
if (mount("/tmp", "/tmp", "none",
MS_REMOUNT | MS_BIND | invalid_flags, NULL) == 0) {
/* system("cat /proc/self/mounts"); */
die("remount of /tmp with invalid flags "
"succeeded unexpectedly\n");
}
exit(EXIT_SUCCESS);
}
static bool test_unpriv_remount_simple(int mount_flags)
{
return test_unpriv_remount("ramfs", NULL, mount_flags, mount_flags, 0);
}
static bool test_unpriv_remount_atime(int mount_flags, int invalid_flags)
{
return test_unpriv_remount("ramfs", NULL, mount_flags, mount_flags,
invalid_flags);
}
static bool test_priv_mount_unpriv_remount(void)
{
pid_t child;
int ret;
const char *orig_path = "/dev";
const char *dest_path = "/tmp";
int orig_mnt_flags, remount_mnt_flags;
child = fork();
if (child == -1) {
die("fork failed: %s\n",
strerror(errno));
}
if (child != 0) { /* parent */
pid_t pid;
int status;
pid = waitpid(child, &status, 0);
if (pid == -1) {
die("waitpid failed: %s\n",
strerror(errno));
}
if (pid != child) {
die("waited for %d got %d\n",
child, pid);
}
if (!WIFEXITED(status)) {
die("child did not terminate cleanly\n");
}
return WEXITSTATUS(status) == EXIT_SUCCESS ? true : false;
}
orig_mnt_flags = read_mnt_flags(orig_path);
create_and_enter_userns();
ret = unshare(CLONE_NEWNS);
if (ret != 0) {
die("unshare(CLONE_NEWNS) failed: %s\n",
strerror(errno));
}
ret = mount(orig_path, dest_path, "bind", MS_BIND | MS_REC, NULL);
if (ret != 0) {
die("recursive bind mount of %s onto %s failed: %s\n",
orig_path, dest_path, strerror(errno));
}
ret = mount(dest_path, dest_path, "none",
MS_REMOUNT | MS_BIND | orig_mnt_flags , NULL);
if (ret != 0) {
/* system("cat /proc/self/mounts"); */
die("remount of /tmp failed: %s\n",
strerror(errno));
}
remount_mnt_flags = read_mnt_flags(dest_path);
if (orig_mnt_flags != remount_mnt_flags) {
die("Mount flags unexpectedly changed during remount of %s originally mounted on %s\n",
dest_path, orig_path);
}
exit(EXIT_SUCCESS);
}
int main(int argc, char **argv)
{
if (!test_unpriv_remount_simple(MS_RDONLY)) {
die("MS_RDONLY malfunctions\n");
}
if (!test_unpriv_remount("devpts", "newinstance", MS_NODEV, MS_NODEV, 0)) {
die("MS_NODEV malfunctions\n");
}
if (!test_unpriv_remount_simple(MS_NOSUID)) {
die("MS_NOSUID malfunctions\n");
}
if (!test_unpriv_remount_simple(MS_NOEXEC)) {
die("MS_NOEXEC malfunctions\n");
}
if (!test_unpriv_remount_atime(MS_RELATIME,
MS_NOATIME))
{
die("MS_RELATIME malfunctions\n");
}
if (!test_unpriv_remount_atime(MS_STRICTATIME,
MS_NOATIME))
{
die("MS_STRICTATIME malfunctions\n");
}
if (!test_unpriv_remount_atime(MS_NOATIME,
MS_STRICTATIME))
{
die("MS_NOATIME malfunctions\n");
}
if (!test_unpriv_remount_atime(MS_RELATIME|MS_NODIRATIME,
MS_NOATIME))
{
die("MS_RELATIME|MS_NODIRATIME malfunctions\n");
}
if (!test_unpriv_remount_atime(MS_STRICTATIME|MS_NODIRATIME,
MS_NOATIME))
{
die("MS_STRICTATIME|MS_NODIRATIME malfunctions\n");
}
if (!test_unpriv_remount_atime(MS_NOATIME|MS_NODIRATIME,
MS_STRICTATIME))
{
die("MS_NOATIME|MS_DIRATIME malfunctions\n");
}
if (!test_unpriv_remount("ramfs", NULL, MS_STRICTATIME, 0, MS_NOATIME))
{
die("Default atime malfunctions\n");
}
if (!test_priv_mount_unpriv_remount()) {
die("Mount flags unexpectedly changed after remount\n");
}
return EXIT_SUCCESS;
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<object-views xmlns="http://axelor.com/xml/ns/object-views"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://axelor.com/xml/ns/object-views http://axelor.com/xml/ns/object-views/object-views_5.3.xsd">
<form name="supplychain-stock-details-by-product-form" title="Stock details by product" model="com.axelor.apps.base.db.Wizard" canSave="false" width="large" canNew="false" canCopy="false" onNew="action-group-stock-details-by-product-on-new">
<panel name="MainFilters" itemSpan="4" colSpan="12">
<field name="$product" title="Product" canEdit="false" target="com.axelor.apps.base.db.Product" type="many-to-one" form-view="product-form" grid-view="product-grid" onChange="action-group-supplychain-update-indicators" domain="self.stockManaged = true AND dtype = 'Product' AND self.productTypeSelect = 'storable'"/>
<field name="$company" title="Company" showIf="$product" canEdit="false" target="com.axelor.apps.base.db.Company" type="many-to-one" form-view="company-form" grid-view="company-grid" onChange="action-record-empty-company-and-stock-location, action-group-supplychain-update-indicators"/>
<field name="$stockLocation" title="Stock location" showIf="$product && $company" domain="self.typeSelect != 3 and self.company = :company" canEdit="false" target="com.axelor.apps.stock.db.StockLocation" type="many-to-one" form-view="stock-location-form" grid-view="stock-location-grid" onChange="action-group-supplychain-update-indicators" />
</panel>
<panel name="mainPanelIndicators" showIf="$product">
<panel name="indicators" title="Indicators" colSpan="12">
<panel name="stockIndicators" colSpan="12" itemSpan="3">
<button name="$realQty" title="Real quantity" icon="fa-building-o" widget="info-button" onClick="action-supplychain-stock-move-line-product-real-quantity"/>
<button name="$futureQty" title="Future quantity" icon="fa-building-o" widget="info-button" onClick="action-supplychain-stock-move-line-product-future-quantity"/>
<button name="$reservedQty" title="Reserved quantity" icon="fa-building-o" widget="info-button" onClick="action-supplychain-stock-move-line-product-reserved"/>
<button name="$requestedReservedQty" title="Requested reserved quantity" icon="fa-building-o" widget="info-button" if="__config__.app.isApp('supplychain') && __config__.app.getApp('supplychain').getManageStockReservation()" onClick="action-method-suppplychain-stock-location-line-view-requested-reserved"/>
</panel>
<panel name="supplychainIndicators" colSpan="12" itemSpan="3">
<button name="$saleOrderQty" title="Sale order quantity" icon="fa-shopping-cart" widget="info-button" onClick="action-method-supplychain-sale-order-product-planned"/>
<button name="$purchaseOrderQty" title="Purchase order quantity" icon="fa-shopping-cart" widget="info-button" onClick="action-method-supplychain-purchase-order-product-planned"/>
<button name="$availableQty" title="Available stock" icon="fa-building-o" widget="info-button" onClick="action-method-supplychain-stock-available-product"/>
</panel>
<panel name="productionIndicators" colSpan="12" itemSpan="3" if-module="axelor-production">
<button name="$buildingQty" title="Building quantity" icon="fa-cogs" widget="info-button" onClick="action-method-production-building-quantity-product"/>
<button name="$consumeManufOrderQty" title="Consume manuf order quantity" icon="fa-cogs" widget="info-button" onClick="action-method-production-consume-product" />
<button name="$missingManufOrderQty" title="Missing manuf order quantity" icon="fa-cogs" widget="info-button" onClick="action-method-production-missing-product" />
</panel>
<panel name="buttonPanel" colSpan="12" itemSpan="4" >
<button name="projectedStockButton" title="See projected stock" onClick="action-supplychain-method-projected-stock" showIf="$product"/>
<button name="stockHistoryButton" title="See stock history" showIf="$product && $company && $stockLocation" onClick="action-supplychain-view-projected-stock"/>
</panel>
</panel>
<panel-dashlet name="dashlet-views-stock-location-line-view-by-product" colSpan="12" action="action-stock-location-line-view-by-product" height="150" showIf="$product" readonly="true" />
</panel>
</form>
<action-group name="action-group-supplychain-update-indicators">
<action name="action-method-find-all-sublocation" if="product"/>
<action name="action-method-update-indicators" if="product"/>
<action name="action-attrs-reload-panel-dashlet"/>
</action-group>
<action-group name="action-group-stock-details-by-product-on-new">
<action name="action-record-stock-details-by-product-init-product"/>
<action name="action-method-find-all-sublocation"/>
<action name="action-method-update-indicators" />
<action name="action-attrs-reload-panel-dashlet"/>
<action name="action-stock-details-record-set-user-s-company"/>
</action-group>
<action-record name="action-stock-details-record-set-user-s-company" model="com.axelor.apps.base.db.Product">
<field name="$company" expr="eval: __user__.getActiveCompany()" if="eval: _isFromMenu"/>
</action-record>
<action-record name="action-record-empty-company-and-stock-location" model="com.axelor.apps.base.db.Product">
<field name="$stockLocation" expr="eval: null" if="!$company"/>
</action-record>
<action-record name="action-record-stock-details-by-product-init-product" model="com.axelor.apps.base.db.Product">
<field name="$product" expr="eval: _product"/>
<field name="$company" expr="eval: _company"/>
<field name="$stockLocation" expr="eval: _stockLocation"/>
</action-record>
<action-attrs name="action-attrs-reload-panel-dashlet">
<attribute name="refresh" for="dashlet-views-stock-location-line-view-by-product" expr="eval: true"/>
</action-attrs>
<action-method name="action-method-update-indicators" >
<call class="com.axelor.apps.supplychain.web.ProductController" method="setIndicatorsOfProduct"/>
</action-method>
<action-method name="action-method-find-all-sublocation" >
<call class="com.axelor.apps.supplychain.web.ProductController" method="findAllSubLocation"/>
</action-method>
<action-view name="action-stock-location-line-view-for-a-product-from-product-view" title="Stock location lines by product" model="com.axelor.apps.base.db.Wizard">
<view type="form" name="supplychain-stock-details-by-product-form"/>
<view-param name="popup" value="true"/>
<view-param name="popup-save" value="false"/>
<view-param name="popup.maximized" value="true"/>
<context name="_product" expr="eval:__self__"/>
</action-view>
<action-view name="action-stock-location-line-view-for-a-product-from-saleorderline-view" title="Stock location lines by product" model="com.axelor.apps.base.db.Wizard">
<view type="form" name="supplychain-stock-details-by-product-form"/>
<view-param name="popup" value="true"/>
<view-param name="popup-save" value="false"/>
<view-param name="popup.maximized" value="true"/>
<context name="_product" expr="eval:product"/>
<context name="_stockLocation" expr="eval:saleOrder?.stockLocation"/>
<context name="_company" expr="eval:saleOrder?.company"/>
</action-view>
<action-method name="action-method-suppplychain-stock-location-line-view-requested-reserved">
<call class="com.axelor.apps.supplychain.web.ProjectedStockController" method="showStockRequestedReservedQuantityOfProduct"/>
</action-method>
<action-view name="action-supplychain-stock-move-line-product-reserved" title="${product.fullName} reserved"
model="com.axelor.apps.stock.db.StockMoveLine">
<view type="grid" name="stock-move-line-all-grid-planned"/>
<view type="form" name="stock-move-line-all-form"/>
<view-param name="popup" value="true"/>
<view-param name="popup-save" value="false"/>
<view-param name="popup.maximized" value="true"/>
<domain>self.reservedQty > 0 and self.stockMove.statusSelect = :statusSelectList
AND self.product.id = :productId
AND (self.stockMove.toStockLocation.id IN :location OR 0 IN :location)
AND (self.stockMove.company.id = :companyId OR :companyId IS NULL)</domain>
<context name="productId" expr="eval:product?.id"/>
<context name="location" expr="eval: __stockLocationIdList"/>
<context name="companyId" expr="eval: company?.id "/>
<context name="statusSelectList" expr="eval: __repo__(StockMove).STATUS_PLANNED" />
</action-view>
<action-view name="action-supplychain-stock-move-line-product-future-quantity" title="${product.fullName} plan. st. move"
model="com.axelor.apps.stock.db.StockMoveLine" >
<view type="grid" name="stock-move-line-all-grid-planned"/>
<view type="form" name="stock-move-line-all-form"/>
<view-param name="popup" value="true"/>
<view-param name="popup-save" value="false"/>
<view-param name="popup.maximized" value="true"/>
<domain>self.stockMove.statusSelect = :statusSelectList
AND self.product.id = :productId
AND (self.stockMove.toStockLocation.id IN :location OR 0 IN :location)
AND (self.stockMove.company.id = :companyId OR :companyId IS NULL)</domain>
<context name="productId" expr="eval:product?.id"/>
<context name="location" expr="eval: __stockLocationIdList"/>
<context name="companyId" expr="eval: company?.id "/>
<context name="statusSelectList" expr="eval: __repo__(StockMove).STATUS_PLANNED" />
</action-view>
<action-view name="action-supplychain-stock-move-line-product-real-quantity" title="${product.fullName} real st. move"
model="com.axelor.apps.stock.db.StockMoveLine" >
<view type="grid" name="stock-move-line-all-grid"/>
<view type="form" name="stock-move-line-all-form"/>
<view-param name="popup" value="true"/>
<view-param name="popup-save" value="false"/>
<view-param name="popup.maximized" value="true"/>
<domain>self.stockMove.statusSelect = :statusSelect
AND self.product.id = :productId
AND (self.stockMove.toStockLocation.id IN :location OR 0 IN :location)
AND (self.stockMove.company.id = :companyId OR :companyId IS NULL)</domain>
<context name="productId" expr="eval:product?.id"/>
<context name="location" expr="eval: __stockLocationIdList"/>
<context name="companyId" expr="eval: company?.id "/>
<context name="statusSelect" expr="eval: __repo__(StockMove).STATUS_REALIZED" />
</action-view>
<action-view name="action-supplychain-view-projected-stock" title="Stock history" model="com.axelor.apps.base.db.Wizard">
<view type="form" name="stock-history-form"/>
<view-param name="popup" value="true"/>
<view-param name="show-toolbar" value="false"/>
<view-param name="show-confirm" value="false" />
<view-param name="popup-save" value="false"/>
<view-param name="popup.maximized" value="true"/>
<context name="_product" expr="eval: product"/>
<context name="_company" expr="eval: company"/>
<context name="_stockLocation" expr="eval: stockLocation"/>
</action-view>
<action-method name="action-method-supplychain-purchase-order-product-planned">
<call class="com.axelor.apps.supplychain.web.ProjectedStockController" method="showPurchaseOrderOfProduct"/>
</action-method>
<action-method name="action-method-supplychain-sale-order-product-planned">
<call class="com.axelor.apps.supplychain.web.ProjectedStockController" method="showSaleOrderOfProduct"/>
</action-method>
<action-method name="action-method-supplychain-stock-available-product">
<call class="com.axelor.apps.supplychain.web.ProjectedStockController" method="showStockAvailableProduct"/>
</action-method>
<action-method name="action-supplychain-method-projected-stock">
<call class="com.axelor.apps.supplychain.web.ProjectedStockController" method="showProjectedStock"/>
</action-method>
</object-views> | {
"pile_set_name": "Github"
} |
@machine1:HiMom:abcdeACXX:1:1101:1138:2141 :N:0:AACAATGG
AACAATGG
+
CCCFFFFF
@machine1:HiMom:abcdeACXX:1:1101:1206:2126 :N:0:AACAATGG
AACAATGG
+
CCCFFFFF
@machine1:HiMom:abcdeACXX:1:2101:1077:2139 :N:0:AACAATGG
AACAATGG
+
CCCFFFFF
@machine1:HiMom:abcdeACXX:1:2101:1112:2245 :N:0:AACAATGG
AACAATGG
+
@@?BBDDD
| {
"pile_set_name": "Github"
} |
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/greengrass/model/ListBulkDeploymentsResult.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/UnreferencedParam.h>
#include <utility>
using namespace Aws::Greengrass::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
using namespace Aws;
ListBulkDeploymentsResult::ListBulkDeploymentsResult()
{
}
ListBulkDeploymentsResult::ListBulkDeploymentsResult(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
*this = result;
}
ListBulkDeploymentsResult& ListBulkDeploymentsResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
JsonView jsonValue = result.GetPayload().View();
if(jsonValue.ValueExists("BulkDeployments"))
{
Array<JsonView> bulkDeploymentsJsonList = jsonValue.GetArray("BulkDeployments");
for(unsigned bulkDeploymentsIndex = 0; bulkDeploymentsIndex < bulkDeploymentsJsonList.GetLength(); ++bulkDeploymentsIndex)
{
m_bulkDeployments.push_back(bulkDeploymentsJsonList[bulkDeploymentsIndex].AsObject());
}
}
if(jsonValue.ValueExists("NextToken"))
{
m_nextToken = jsonValue.GetString("NextToken");
}
return *this;
}
| {
"pile_set_name": "Github"
} |
#ifndef DataFormats_GEMSegmentCollection_H
#define DataFormats_GEMSegmentCollection_H
/** \class GEMSegmentCollection
*
* The collection of GEMSegment's. See \ref CSCSegmentCollection.h for details from which is derived.
*
* \author Piet Verwilligen
*/
#include "DataFormats/MuonDetId/interface/GEMDetId.h"
#include "DataFormats/GEMRecHit/interface/GEMSegment.h"
#include "DataFormats/Common/interface/RangeMap.h"
#include "DataFormats/Common/interface/ClonePolicy.h"
#include "DataFormats/Common/interface/OwnVector.h"
typedef edm::RangeMap<GEMDetId, edm::OwnVector<GEMSegment> > GEMSegmentCollection;
#include "DataFormats/Common/interface/Ref.h"
typedef edm::Ref<GEMSegmentCollection> GEMSegmentRef;
#endif
| {
"pile_set_name": "Github"
} |
//b_spawn.cpp
//added by MCG
// leave this line at the top for all NPC_xxxx.cpp files...
#include "g_headers.h"
#include "b_local.h"
#include "anims.h"
#include "g_functions.h"
#include "g_icarus.h"
#include "wp_saber.h"
extern cvar_t *g_sex;
extern qboolean G_CheckInSolid (gentity_t *self, qboolean fix);
extern void ClientUserinfoChanged( int clientNum );
extern qboolean SpotWouldTelefrag2( gentity_t *mover, vec3_t dest );
extern void Jedi_Cloak( gentity_t *self );
//extern void FX_BorgTeleport( vec3_t org );
extern void G_MatchPlayerWeapon( gentity_t *ent );
extern void Q3_SetParm (int entID, int parmNum, const char *parmValue);
extern team_t TranslateTeamName( const char *name );
extern char *TeamNames[TEAM_NUM_TEAMS];
//extern void CG_ShimmeryThing_Spawner( vec3_t start, vec3_t end, float radius, qboolean taper, int duration );
extern void Q3_DebugPrint( int level, const char *format, ... );
//extern void NPC_StasisSpawnEffect( gentity_t *ent );
extern void PM_SetTorsoAnimTimer( gentity_t *ent, int *torsoAnimTimer, int time );
extern void PM_SetLegsAnimTimer( gentity_t *ent, int *legsAnimTimer, int time );
extern void WP_SaberInitBladeData( gentity_t *ent );
extern void ST_ClearTimers( gentity_t *ent );
extern void Jedi_ClearTimers( gentity_t *ent );
extern void NPC_ShadowTrooper_Precache( void );
extern void NPC_Gonk_Precache( void );
extern void NPC_Mouse_Precache( void );
extern void NPC_Seeker_Precache( void );
extern void NPC_Remote_Precache( void );
extern void NPC_R2D2_Precache(void);
extern void NPC_R5D2_Precache(void);
extern void NPC_Probe_Precache(void);
extern void NPC_Interrogator_Precache(gentity_t *self);
extern void NPC_MineMonster_Precache( void );
extern void NPC_Howler_Precache( void );
extern void NPC_ATST_Precache(void);
extern void NPC_Sentry_Precache(void);
extern void NPC_Mark1_Precache(void);
extern void NPC_Mark2_Precache(void);
extern void NPC_GalakMech_Precache( void );
extern void NPC_GalakMech_Init( gentity_t *ent );
extern void NPC_Protocol_Precache( void );
extern int WP_SetSaberModel( gclient_t *client, class_t npcClass );
#define NSF_DROP_TO_FLOOR 16
//void HirogenAlpha_Precache( void );
/*
-------------------------
NPC_PainFunc
-------------------------
*/
painFunc_t NPC_PainFunc( gentity_t *ent )
{
painFunc_t func;
if ( ent->client->ps.weapon == WP_SABER )
{
func = painF_NPC_Jedi_Pain;
}
else
{
// team no longer indicates race/species, use NPC_class to determine different npc types
/*
switch ( ent->client->playerTeam )
{
default:
func = painF_NPC_Pain;
break;
}
*/
switch( ent->client->NPC_class )
{
// troopers get special pain
case CLASS_STORMTROOPER:
case CLASS_SWAMPTROOPER:
func = painF_NPC_ST_Pain;
break;
case CLASS_SEEKER:
func = painF_NPC_Seeker_Pain;
break;
case CLASS_REMOTE:
func = painF_NPC_Remote_Pain;
break;
case CLASS_MINEMONSTER:
func = painF_NPC_MineMonster_Pain;
break;
case CLASS_HOWLER:
func = painF_NPC_Howler_Pain;
break;
// all other droids, did I miss any?
case CLASS_GONK:
case CLASS_R2D2:
case CLASS_R5D2:
case CLASS_MOUSE:
case CLASS_PROTOCOL:
case CLASS_INTERROGATOR:
func = painF_NPC_Droid_Pain;
break;
case CLASS_PROBE:
func = painF_NPC_Probe_Pain;
break;
case CLASS_SENTRY:
func = painF_NPC_Sentry_Pain;
break;
case CLASS_MARK1:
func = painF_NPC_Mark1_Pain;
break;
case CLASS_MARK2:
func = painF_NPC_Mark2_Pain;
break;
case CLASS_ATST:
func = painF_NPC_ATST_Pain;
break;
case CLASS_GALAKMECH:
func = painF_NPC_GM_Pain;
break;
// everyone else gets the normal pain func
default:
func = painF_NPC_Pain;
break;
}
}
return func;
}
/*
-------------------------
NPC_TouchFunc
-------------------------
*/
touchFunc_t NPC_TouchFunc( gentity_t *ent )
{
return touchF_NPC_Touch;
}
/*
-------------------------
NPC_SetMiscDefaultData
-------------------------
*/
extern void G_CreateG2AttachedWeaponModel( gentity_t *ent, const char *weaponModel );
void NPC_SetMiscDefaultData( gentity_t *ent )
{
if ( ent->spawnflags & SFB_CINEMATIC )
{//if a cinematic guy, default us to wait bState
ent->NPC->behaviorState = BS_CINEMATIC;
}
//***I'm not sure whether I should leave this as a TEAM_ switch, I think NPC_class may be more appropriate - dmv
switch(ent->client->playerTeam)
{
case TEAM_PLAYER:
//ent->flags |= FL_NO_KNOCKBACK;
if ( ent->client->NPC_class == CLASS_SEEKER )
{
ent->NPC->defaultBehavior = BS_DEFAULT;
ent->client->ps.gravity = 0;
ent->svFlags |= SVF_CUSTOM_GRAVITY;
ent->NPC->stats.moveType = MT_FLYSWIM;
ent->count = 30; // SEEKER shot ammo count
return;
}
else if ( ent->client->NPC_class == CLASS_JEDI || ent->client->NPC_class == CLASS_LUKE )
{//good jedi
ent->client->ps.saberActive = qfalse;
ent->client->ps.saberLength = 0;
WP_SaberInitBladeData( ent );
G_CreateG2AttachedWeaponModel( ent, ent->client->ps.saberModel );
ent->client->enemyTeam = TEAM_ENEMY;
WP_InitForcePowers( ent );
Jedi_ClearTimers( ent );
if ( ent->spawnflags & JSF_AMBUSH )
{//ambusher
ent->NPC->scriptFlags |= SCF_IGNORE_ALERTS;
ent->client->noclip = qtrue;//hang
}
}
else
{
if (ent->client->ps.weapon != WP_NONE)
{
G_CreateG2AttachedWeaponModel( ent, weaponData[ent->client->ps.weapon].weaponMdl );
}
switch ( ent->client->ps.weapon )
{
case WP_BRYAR_PISTOL://FIXME: new weapon: imp blaster pistol
case WP_BLASTER_PISTOL:
case WP_DISRUPTOR:
case WP_BOWCASTER:
case WP_REPEATER:
case WP_DEMP2:
case WP_FLECHETTE:
case WP_ROCKET_LAUNCHER:
default:
break;
case WP_THERMAL:
case WP_BLASTER:
//FIXME: health in NPCs.cfg, and not all blaster users are stormtroopers
//ent->health = 25;
//FIXME: not necc. a ST
ST_ClearTimers( ent );
if ( ent->NPC->rank >= RANK_LT || ent->client->ps.weapon == WP_THERMAL )
{//officers, grenade-throwers use alt-fire
//ent->health = 50;
ent->NPC->scriptFlags |= SCF_ALT_FIRE;
}
break;
}
}
if ( ent->client->NPC_class == CLASS_KYLE || (ent->spawnflags & SFB_CINEMATIC) )
{
ent->NPC->defaultBehavior = BS_CINEMATIC;
}
else
{
ent->NPC->defaultBehavior = BS_FOLLOW_LEADER;
ent->client->leader = &g_entities[0];
}
break;
case TEAM_NEUTRAL:
if ( Q_stricmp( ent->NPC_type, "gonk" ) == 0 )
{
// I guess we generically make them player usable
ent->svFlags |= SVF_PLAYER_USABLE;
// Not even sure if we want to give different levels of batteries? ...Or even that these are the values we'd want to use.
switch ( g_spskill->integer )
{
case 0: // EASY
ent->client->ps.batteryCharge = MAX_BATTERIES * 0.8f;
break;
case 1: // MEDIUM
ent->client->ps.batteryCharge = MAX_BATTERIES * 0.75f;
break;
default :
case 2: // HARD
ent->client->ps.batteryCharge = MAX_BATTERIES * 0.5f;
break;
}
}
break;
case TEAM_ENEMY:
{
ent->NPC->defaultBehavior = BS_DEFAULT;
if ( ent->client->NPC_class == CLASS_SHADOWTROOPER )
{//FIXME: a spawnflag?
Jedi_Cloak( ent );
}
if( ent->client->NPC_class == CLASS_TAVION ||
ent->client->NPC_class == CLASS_REBORN ||
ent->client->NPC_class == CLASS_DESANN ||
ent->client->NPC_class == CLASS_SHADOWTROOPER )
{
ent->client->ps.saberActive = qfalse;
ent->client->ps.saberLength = 0;
WP_SaberInitBladeData( ent );
G_CreateG2AttachedWeaponModel( ent, ent->client->ps.saberModel );
WP_InitForcePowers( ent );
ent->client->enemyTeam = TEAM_PLAYER;
Jedi_ClearTimers( ent );
if ( ent->spawnflags & JSF_AMBUSH )
{//ambusher
ent->NPC->scriptFlags |= SCF_IGNORE_ALERTS;
ent->client->noclip = qtrue;//hang
}
}
else if( ent->client->NPC_class == CLASS_PROBE || ent->client->NPC_class == CLASS_REMOTE ||
ent->client->NPC_class == CLASS_INTERROGATOR || ent->client->NPC_class == CLASS_SENTRY)
{
ent->NPC->defaultBehavior = BS_DEFAULT;
ent->client->ps.gravity = 0;
ent->svFlags |= SVF_CUSTOM_GRAVITY;
ent->NPC->stats.moveType = MT_FLYSWIM;
}
else
{
G_CreateG2AttachedWeaponModel( ent, weaponData[ent->client->ps.weapon].weaponMdl );
switch ( ent->client->ps.weapon )
{
case WP_BRYAR_PISTOL:
break;
case WP_BLASTER_PISTOL:
break;
case WP_DISRUPTOR:
//Sniper
ent->NPC->scriptFlags |= SCF_ALT_FIRE;//FIXME: use primary fire sometimes? Up close? Different class of NPC?
break;
case WP_BOWCASTER:
break;
case WP_REPEATER:
//machine-gunner
break;
case WP_DEMP2:
break;
case WP_FLECHETTE:
//shotgunner
if ( !Q_stricmp( "stofficeralt", ent->NPC_type ) )
{
ent->NPC->scriptFlags |= SCF_ALT_FIRE;
}
break;
case WP_ROCKET_LAUNCHER:
break;
case WP_THERMAL:
//Gran, use main, bouncy fire
// ent->NPC->scriptFlags |= SCF_ALT_FIRE;
break;
case WP_MELEE:
break;
default:
case WP_BLASTER:
//FIXME: health in NPCs.cfg, and not all blaster users are stormtroopers
//FIXME: not necc. a ST
ST_ClearTimers( ent );
if ( ent->NPC->rank >= RANK_COMMANDER )
{//commanders use alt-fire
ent->NPC->scriptFlags |= SCF_ALT_FIRE;
}
if ( !Q_stricmp( "rodian2", ent->NPC_type ) )
{
ent->NPC->scriptFlags |= SCF_ALT_FIRE;
}
break;
}
if ( !Q_stricmp( "galak_mech", ent->NPC_type ) )
{//starts with armor
NPC_GalakMech_Init( ent );
}
}
}
break;
default:
break;
}
if ( ent->client->NPC_class == CLASS_ATST || ent->client->NPC_class == CLASS_MARK1 ) // chris/steve/kevin requested that the mark1 be shielded also
{
ent->flags |= (FL_SHIELDED|FL_NO_KNOCKBACK);
}
}
/*
-------------------------
NPC_WeaponsForTeam
-------------------------
*/
int NPC_WeaponsForTeam( team_t team, int spawnflags, const char *NPC_type )
{
//*** not sure how to handle this, should I pass in class instead of team and go from there? - dmv
switch(team)
{
// no longer exists
// case TEAM_BORG:
// break;
// case TEAM_HIROGEN:
// if( Q_stricmp( "hirogenalpha", NPC_type ) == 0 )
// return ( 1 << WP_BLASTER);
//Falls through
// case TEAM_KLINGON:
//NOTENOTE: Falls through
// case TEAM_IMPERIAL:
case TEAM_ENEMY:
if ( Q_stricmp( "tavion", NPC_type ) == 0 ||
Q_strncmp( "reborn", NPC_type, 6 ) == 0 ||
Q_stricmp( "desann", NPC_type ) == 0 ||
Q_strncmp( "shadowtrooper", NPC_type, 13 ) == 0 )
return ( 1 << WP_SABER);
// return ( 1 << WP_IMPERIAL_BLADE);
//NOTENOTE: Falls through if not a knife user
// case TEAM_SCAVENGERS:
// case TEAM_MALON:
//FIXME: default weapon in npc config?
if ( Q_strncmp( "stofficer", NPC_type, 9 ) == 0 )
{
return ( 1 << WP_FLECHETTE);
}
if ( Q_stricmp( "stcommander", NPC_type ) == 0 )
{
return ( 1 << WP_REPEATER);
}
if ( Q_stricmp( "swamptrooper", NPC_type ) == 0 )
{
return ( 1 << WP_FLECHETTE);
}
if ( Q_stricmp( "swamptrooper2", NPC_type ) == 0 )
{
return ( 1 << WP_REPEATER);
}
if ( Q_stricmp( "rockettrooper", NPC_type ) == 0 )
{
return ( 1 << WP_ROCKET_LAUNCHER);
}
if ( Q_strncmp( "shadowtrooper", NPC_type, 13 ) == 0 )
{
return ( 1 << WP_SABER);//|( 1 << WP_RAPID_CONCUSSION)?
}
if ( Q_stricmp( "imperial", NPC_type ) == 0 )
{
return ( 1 << WP_BLASTER_PISTOL);
}
if ( Q_strncmp( "impworker", NPC_type, 9 ) == 0 )
{
return ( 1 << WP_BLASTER_PISTOL);
}
if ( Q_stricmp( "stormpilot", NPC_type ) == 0 )
{
return ( 1 << WP_BLASTER_PISTOL);
}
if ( Q_stricmp( "galak", NPC_type ) == 0 )
{
return ( 1 << WP_BLASTER);
}
if ( Q_stricmp( "galak_mech", NPC_type ) == 0 )
{
return ( 1 << WP_REPEATER);
}
if ( Q_strncmp( "ugnaught", NPC_type, 8 ) == 0 )
{
return WP_NONE;
}
if ( Q_stricmp( "granshooter", NPC_type ) == 0 )
{
return ( 1 << WP_BLASTER);
}
if ( Q_stricmp( "granboxer", NPC_type ) == 0 )
{
return ( 1 << WP_MELEE);
}
if ( Q_strncmp( "gran", NPC_type, 4 ) == 0 )
{
return (( 1 << WP_THERMAL)|( 1 << WP_MELEE));
}
if ( Q_stricmp( "rodian", NPC_type ) == 0 )
{
return ( 1 << WP_DISRUPTOR);
}
if ( Q_stricmp( "rodian2", NPC_type ) == 0 )
{
return ( 1 << WP_BLASTER);
}
if (( Q_stricmp( "interrogator",NPC_type) == 0) || ( Q_stricmp( "sentry",NPC_type) == 0) || (Q_strncmp( "protocol",NPC_type,8) == 0) )
{
return WP_NONE;
}
if ( Q_strncmp( "weequay", NPC_type, 7 ) == 0 )
{
return ( 1 << WP_BOWCASTER);//|( 1 << WP_STAFF )(FIXME: new weap?)
}
if ( Q_stricmp( "impofficer", NPC_type ) == 0 )
{
return ( 1 << WP_BLASTER);
}
if ( Q_stricmp( "impcommander", NPC_type ) == 0 )
{
return ( 1 << WP_BLASTER);
}
if (( Q_stricmp( "probe", NPC_type ) == 0 ) || ( Q_stricmp( "seeker", NPC_type ) == 0 ))
{
return ( 1 << WP_BOT_LASER);
}
if ( Q_stricmp( "remote", NPC_type ) == 0 )
{
return ( 1 << WP_BOT_LASER );
}
if ( Q_stricmp( "trandoshan", NPC_type ) == 0 )
{
return (1<<WP_REPEATER);
}
if ( Q_stricmp( "atst", NPC_type ) == 0 )
{
return (( 1 << WP_ATST_MAIN)|( 1 << WP_ATST_SIDE));
}
if ( Q_stricmp( "mark1", NPC_type ) == 0 )
{
return ( 1 << WP_BOT_LASER);
}
if ( Q_stricmp( "mark2", NPC_type ) == 0 )
{
return ( 1 << WP_BOT_LASER);
}
if ( Q_stricmp( "minemonster", NPC_type ) == 0 )
{
return (( 1 << WP_MELEE));
}
if ( Q_stricmp( "howler", NPC_type ) == 0 )
{
return (( 1 << WP_MELEE));
}
//Stormtroopers, etc.
return ( 1 << WP_BLASTER);
break;
case TEAM_PLAYER:
// if(spawnflags & SFB_TRICORDER)
// return ( 1 << WP_TRICORDER);
if(spawnflags & SFB_RIFLEMAN)
return ( 1 << WP_REPEATER);
if(spawnflags & SFB_PHASER)
return ( 1 << WP_BLASTER_PISTOL);
if ( Q_strncmp( "jedi", NPC_type, 4 ) == 0 || Q_stricmp( "luke", NPC_type ) == 0 )
return ( 1 << WP_SABER);
if ( Q_strncmp( "prisoner", NPC_type, 8 ) == 0 )
{
return WP_NONE;
}
if ( Q_strncmp( "bespincop", NPC_type, 9 ) == 0 )
{
return ( 1 << WP_BLASTER_PISTOL);
}
if ( Q_stricmp( "MonMothma", NPC_type ) == 0 )
{
return WP_NONE;
}
//rebel
return ( 1 << WP_BLASTER);
break;
case TEAM_NEUTRAL:
if ( Q_stricmp( "mark1", NPC_type ) == 0 )
{
return WP_NONE;
}
if ( Q_stricmp( "mark2", NPC_type ) == 0 )
{
return WP_NONE;
}
if ( Q_strncmp( "ugnaught", NPC_type, 8 ) == 0 )
{
return WP_NONE;
}
if ( Q_stricmp( "bartender", NPC_type ) == 0 )
{
return WP_NONE;
}
if ( Q_stricmp( "morgankatarn", NPC_type ) == 0 )
{
return WP_NONE;
}
break;
// these no longer exist
// case TEAM_FORGE:
// return ( 1 << WP_MELEE);
// break;
// case TEAM_STASIS:
// return ( 1 << WP_MELEE);
// break;
// case TEAM_PARASITE:
// break;
// case TEAM_8472:
// break;
default:
break;
}
return WP_NONE;
}
extern void ChangeWeapon( gentity_t *ent, int newWeapon );
/*
-------------------------
NPC_SetWeapons
-------------------------
*/
void NPC_SetWeapons( gentity_t *ent )
{
int bestWeap = WP_NONE;
int weapons = NPC_WeaponsForTeam( ent->client->playerTeam, ent->spawnflags, ent->NPC_type );
// these teams are gone now anyway, plus all team stuff should be read in from the config file
/*
switch ( ent->client->playerTeam )
{
case TEAM_KLINGON:
case TEAM_MALON:
case TEAM_HIROGEN:
case TEAM_IMPERIAL:
ent->client->playerTeam = TEAM_SCAVENGERS;
break;
}
*/
ent->client->ps.stats[STAT_WEAPONS] = 0;
for ( int curWeap = WP_SABER; curWeap < WP_NUM_WEAPONS; curWeap++ )
{
if ( (weapons & ( 1 << curWeap )) )
{
ent->client->ps.stats[STAT_WEAPONS] |= ( 1 << curWeap );
RegisterItem( FindItemForWeapon( (weapon_t)(curWeap) ) ); //precache the weapon
ent->NPC->currentAmmo = ent->client->ps.ammo[weaponData[curWeap].ammoIndex] = 100;//FIXME: max ammo
if ( bestWeap == WP_SABER )
{
// still want to register other weapons -- force saber to be best weap
continue;
}
if ( curWeap == WP_MELEE )
{
if ( bestWeap == WP_NONE )
{// We'll only consider giving Melee since we haven't found anything better yet.
bestWeap = curWeap;
}
}
else if ( curWeap > bestWeap || bestWeap == WP_MELEE )
{
// This will never override saber as best weap. Also will override WP_MELEE if something better comes later in the list
bestWeap = curWeap;
}
}
}
ent->client->ps.weapon = bestWeap;
ent->client->ps.weaponstate = WEAPON_IDLE;
ChangeWeapon( ent, bestWeap );
}
/*
-------------------------
NPC_SpawnEffect
NOTE: Make sure any effects called here have their models, tga's and sounds precached in
CG_RegisterNPCEffects in cg_player.cpp
-------------------------
*/
void NPC_SpawnEffect (gentity_t *ent)
{
/*
gentity_t *tent;
// NOTE: Make sure any effects called here have their models, tga's and sounds precached in
// CG_RegisterNPCEffects in cg_player.cpp
switch( ent->client->playerTeam )
{
case TEAM_BORG:
// FX_BorgTeleport( ent->client->ps.origin );
break;
case TEAM_PARASITE:
case TEAM_BOTS:
default:
break;
}
*/
}
//--------------------------------------------------------------
// NPC_SetFX_SpawnStates
//
// Set up any special parms for spawn effects
//--------------------------------------------------------------
void NPC_SetFX_SpawnStates( gentity_t *ent )
{
// stasis, 8472, etc no longer exist. However if certain NPC's need customized spawn effects, use
// NPC_class instead of TEAM_
/*
// -Etherians -------
if ( ent->client->playerTeam == TEAM_STASIS )
{
ent->svFlags |= SVF_CUSTOM_GRAVITY;
ent->client->ps.gravity = 300;
// The spawn effect can happen, so it's ok to do this extra setup stuff for the effect.
ent->fx_time = level.time;
ent->s.eFlags |= EF_SCALE_UP;
ent->client->ps.eFlags |= EF_SCALE_UP;
// Make it really small to start with
VectorSet( ent->->s.modelScale, 0.001,0.001,0.001 );
}
else
*/
{
ent->client->ps.gravity = g_gravity->value;
}
/*
// -Hunterseeker -------
if ( !stricmp( ent->NPC_type, "hunterseeker" ) )
{
// Set the custom banking flag
ent->s.eFlags |= EF_BANK_STRAFE;
ent->client->ps.eFlags |= EF_BANK_STRAFE;
}
// -8472 -------
if ( ent->client->playerTeam == TEAM_8472 )
{
// The spawn effect can happen, so it's ok to do this extra setup stuff for the effect.
ent->fx_time = level.time;
ent->s.eFlags |= EF_SCALE_UP;
ent->client->ps.eFlags |= EF_SCALE_UP;
// Make it really small to start with
VectorSet( ent->s.modelScale, 0.001,0.001,1 );
}
// -Forge -----
if ( ent->client->playerTeam == TEAM_FORGE )
{
// The spawn effect can happen, so it's ok to do this extra setup stuff for the effect.
ent->fx_time = level.time;
ent->s.eFlags |= EF_SCALE_UP;
ent->client->ps.eFlags |= EF_SCALE_UP;
// Make it really small to start with
VectorSet( ent->s.modelScale, 0.001,0.001,1 );
}
*/
}
//--------------------------------------------------------------
extern qboolean stop_icarus;
void NPC_Begin (gentity_t *ent)
{
vec3_t spawn_origin, spawn_angles;
gclient_t *client;
usercmd_t ucmd;
gentity_t *spawnPoint = NULL;
memset( &ucmd, 0, sizeof( ucmd ) );
if ( !(ent->spawnflags & SFB_NOTSOLID) )
{//No NPCs should telefrag
if( SpotWouldTelefrag( ent, TEAM_FREE ) )//(team_t)(ent->client->playerTeam)
{
if ( ent->wait < 0 )
{//remove yourself
Q3_DebugPrint( WL_DEBUG, "NPC %s could not spawn, firing target3 (%s) and removing self\n", ent->targetname, ent->target3 );
//Fire off our target3
G_UseTargets2( ent, ent, ent->target3 );
//Kill us
ent->e_ThinkFunc = thinkF_G_FreeEntity;
ent->nextthink = level.time + 100;
}
else
{
Q3_DebugPrint( WL_DEBUG, "NPC %s could not spawn, waiting %4.2 secs to try again\n", ent->targetname, ent->wait/1000.0f );
ent->e_ThinkFunc = thinkF_NPC_Begin;
ent->nextthink = level.time + ent->wait;//try again in half a second
}
return;
}
}
//Spawn effect
NPC_SpawnEffect( ent );
VectorCopy( ent->client->ps.origin, spawn_origin);
VectorCopy( ent->s.angles, spawn_angles);
spawn_angles[YAW] = ent->NPC->desiredYaw;
client = ent->client;
// increment the spawncount so the client will detect the respawn
client->ps.persistant[PERS_SPAWN_COUNT]++;
client->airOutTime = level.time + 12000;
client->ps.clientNum = ent->s.number;
// clear entity values
if ( ent->health ) // Was health supplied in map
{
ent->max_health = client->pers.maxHealth = client->ps.stats[STAT_MAX_HEALTH] = ent->health;
}
else if ( ent->NPC->stats.health ) // Was health supplied in NPC.cfg?
{
if ( ent->client->NPC_class != CLASS_REBORN
&& ent->client->NPC_class != CLASS_SHADOWTROOPER
//&& ent->client->NPC_class != CLASS_TAVION
//&& ent->client->NPC_class != CLASS_DESANN
&& ent->client->NPC_class != CLASS_JEDI )
{// up everyone except jedi
ent->NPC->stats.health += ent->NPC->stats.health/4 * g_spskill->integer; // 100% on easy, 125% on medium, 150% on hard
}
ent->max_health = client->pers.maxHealth = client->ps.stats[STAT_MAX_HEALTH] = ent->NPC->stats.health;
}
else
{
ent->max_health = client->pers.maxHealth = client->ps.stats[STAT_MAX_HEALTH] = 100;
}
if ( !Q_stricmp( "rodian", ent->NPC_type ) )
{//sniper
//NOTE: this will get overridden by any aim settings in their spawnscripts
switch ( g_spskill->integer )
{
case 0:
ent->NPC->stats.aim = 1;
break;
case 1:
ent->NPC->stats.aim = Q_irand( 2, 3 );
break;
case 2:
ent->NPC->stats.aim = Q_irand( 3, 4 );
break;
}
}
else if ( ent->client->NPC_class == CLASS_STORMTROOPER
|| ent->client->NPC_class == CLASS_SWAMPTROOPER
|| ent->client->NPC_class == CLASS_IMPWORKER
|| !Q_stricmp( "rodian2", ent->NPC_type ) )
{//tweak yawspeed for these NPCs based on difficulty
switch ( g_spskill->integer )
{
case 0:
ent->NPC->stats.yawSpeed *= 0.75f;
if ( ent->client->NPC_class == CLASS_IMPWORKER )
{
ent->NPC->stats.aim -= Q_irand( 3, 6 );
}
break;
case 1:
if ( ent->client->NPC_class == CLASS_IMPWORKER )
{
ent->NPC->stats.aim -= Q_irand( 2, 4 );
}
break;
case 2:
ent->NPC->stats.yawSpeed *= 1.5f;
if ( ent->client->NPC_class == CLASS_IMPWORKER )
{
ent->NPC->stats.aim -= Q_irand( 0, 2 );
}
break;
}
}
else if ( ent->client->NPC_class == CLASS_REBORN
|| ent->client->NPC_class == CLASS_SHADOWTROOPER )
{
switch ( g_spskill->integer )
{
case 1:
ent->NPC->stats.yawSpeed *= 1.25f;
break;
case 2:
ent->NPC->stats.yawSpeed *= 1.5f;
break;
}
}
ent->s.groundEntityNum = ENTITYNUM_NONE;
ent->mass = 10;
ent->takedamage = qtrue;
ent->inuse = qtrue;
SetInUse(ent);
ent->classname = "NPC";
// if ( ent->client->race == RACE_HOLOGRAM )
// {//can shoot through holograms, but not walk through them
// ent->contents = CONTENTS_PLAYERCLIP|CONTENTS_MONSTERCLIP|CONTENTS_ITEM;//contents_corspe to make them show up in ID and use traces
// ent->clipmask = MASK_NPCSOLID;
// } else
if(!(ent->spawnflags & SFB_NOTSOLID))
{
ent->contents = CONTENTS_BODY;
ent->clipmask = MASK_NPCSOLID;
}
else
{
ent->contents = 0;
ent->clipmask = MASK_NPCSOLID&~CONTENTS_BODY;
}
if(!ent->NPC->stats.moveType)//Static?
{
ent->NPC->stats.moveType = MT_RUNJUMP;
}
ent->e_DieFunc = dieF_player_die;
ent->waterlevel = 0;
ent->watertype = 0;
//visible to player and NPCs
if ( ent->client->NPC_class != CLASS_R2D2 &&
ent->client->NPC_class != CLASS_R5D2 &&
ent->client->NPC_class != CLASS_MOUSE &&
ent->client->NPC_class != CLASS_GONK &&
ent->client->NPC_class != CLASS_PROTOCOL )
{
ent->flags &= ~FL_NOTARGET;
}
ent->s.eFlags &= ~EF_NODRAW;
NPC_SetFX_SpawnStates( ent );
client->ps.friction = 6;
NPC_SetWeapons(ent);
VectorCopy( spawn_origin, client->ps.origin );
// the respawned flag will be cleared after the attack and jump keys come up
client->ps.pm_flags |= PMF_RESPAWNED;
// clear entity state values
ent->s.eType = ET_PLAYER;
ent->s.eFlags |= EF_NPC;
// ent->s.skinNum = ent - g_entities - 1; // used as index to get custom models
VectorCopy (spawn_origin, ent->s.origin);
// ent->s.origin[2] += 1; // make sure off ground
SetClientViewAngle( ent, spawn_angles );
client->renderInfo.lookTarget = ENTITYNUM_NONE;
if(!(ent->spawnflags & 64))
{
G_KillBox( ent );
gi.linkentity (ent);
}
// don't allow full run speed for a bit
client->ps.pm_flags |= PMF_TIME_KNOCKBACK;
client->ps.pm_time = 100;
client->respawnTime = level.time;
client->inactivityTime = level.time + g_inactivity->value * 1000;
client->latched_buttons = 0;
// set default animations
NPC_SetAnim( ent, SETANIM_BOTH, BOTH_STAND1, SETANIM_FLAG_NORMAL );
if( spawnPoint )
{
// fire the targets of the spawn point
G_UseTargets( spawnPoint, ent );
}
//ICARUS include
ICARUS_InitEnt( ent );
//==NPC initialization
SetNPCGlobals( ent );
ent->enemy = NULL;
NPCInfo->timeOfDeath = 0;
NPCInfo->shotTime = 0;
NPC_ClearGoal();
NPC_ChangeWeapon( ent->client->ps.weapon );
//==Final NPC initialization
ent->e_PainFunc = NPC_PainFunc( ent ); //painF_NPC_Pain;
ent->e_TouchFunc = NPC_TouchFunc( ent ); //touchF_NPC_Touch;
// ent->NPC->side = 1;
ent->client->ps.ping = ent->NPC->stats.reactions * 50;
//MCG - Begin: NPC hacks
//FIXME: Set the team correctly
ent->client->ps.persistant[PERS_TEAM] = ent->client->playerTeam;
ent->client->ps.eFlags |= EF_NPC;
ent->e_UseFunc = useF_NPC_Use;
ent->e_ThinkFunc = thinkF_NPC_Think;
ent->nextthink = level.time + FRAMETIME + Q_irand(0, 100);
NPC_SetMiscDefaultData( ent );
if ( ent->health <= 0 )
{
//ORIGINAL ID: health will count down towards max_health
ent->health = client->ps.stats[STAT_HEALTH] = ent->max_health;
}
else
{
client->ps.stats[STAT_HEALTH] = ent->max_health = ent->health;
}
ChangeWeapon( ent, ent->client->ps.weapon );//yes, again... sigh
if ( !(ent->spawnflags & SFB_STARTINSOLID) )
{//Not okay to start in solid
G_CheckInSolid( ent, qtrue );
}
VectorClear( ent->NPC->lastClearOrigin );
//Run a script if you have one assigned to you
if ( G_ActivateBehavior( ent, BSET_SPAWN ) )
{
if( ent->taskManager && !stop_icarus )
{
ent->taskManager->Update();
}
}
VectorCopy( ent->currentOrigin, ent->client->renderInfo.eyePoint );
// run a client frame to drop exactly to the floor,
// initialize animations and other things
memset( &ucmd, 0, sizeof( ucmd ) );
_VectorCopy( client->pers.cmd_angles, ucmd.angles );
ent->client->ps.groundEntityNum = ENTITYNUM_NONE;
if ( ent->NPC->aiFlags & NPCAI_MATCHPLAYERWEAPON )
{
G_MatchPlayerWeapon( ent );
}
ClientThink( ent->s.number, &ucmd );
gi.linkentity( ent );
if ( ent->client->playerTeam == TEAM_ENEMY )
{//valid enemy spawned
if ( !(ent->spawnflags&SFB_CINEMATIC) && ent->NPC->behaviorState != BS_CINEMATIC )
{//not a cinematic enemy
if ( g_entities[0].client )
{
g_entities[0].client->sess.missionStats.enemiesSpawned++;
}
}
}
}
gNPC_t *New_NPC_t()
{
gNPC_t *ptr = (gNPC_t *)G_Alloc (sizeof(gNPC_t));
if (ptr)
{
// clear it...
//
memset(ptr, 0, sizeof( *ptr ) );
}
return ptr;
}
/*
-------------------------
NPC_StasisSpawn_Go
-------------------------
*/
/*
qboolean NPC_StasisSpawn_Go( gentity_t *ent )
{
//Setup an owner pointer if we need it
if VALIDSTRING( ent->ownername )
{
ent->owner = G_Find( NULL, FOFS( targetname ), ent->ownername );
if ( ( ent->owner ) && ( ent->owner->health <= 0 ) )
{//our spawner thing is broken
if ( ent->target2 && ent->target2[0] )
{
//Fire off our target2
G_UseTargets2( ent, ent, ent->target2 );
//Kill us
ent->e_ThinkFunc = thinkF_G_FreeEntity;
ent->nextthink = level.time + 100;
}
else
{
//Try to spawn again in one second
ent->e_ThinkFunc = thinkF_NPC_Spawn_Go;
ent->nextthink = level.time + 1000;
}
return qfalse;
}
}
//Test for an entity blocking the spawn
trace_t tr;
gi.trace( &tr, ent->currentOrigin, ent->mins, ent->maxs, ent->currentOrigin, ent->s.number, MASK_NPCSOLID );
//Can't have anything in the way
if ( tr.allsolid || tr.startsolid )
{
ent->nextthink = level.time + 1000;
return qfalse;
}
return qtrue;
}
*/
void NPC_DefaultScriptFlags( gentity_t *ent )
{
if ( !ent || !ent->NPC )
{
return;
}
//Set up default script flags
ent->NPC->scriptFlags = (SCF_CHASE_ENEMIES|SCF_LOOK_FOR_ENEMIES);
}
/*
-------------------------
NPC_Spawn_Go
-------------------------
*/
void NPC_Spawn_Go( gentity_t *ent )
{
gentity_t *newent;
int index;
vec3_t saveOrg;
/* //Do extra code for stasis spawners
if ( Q_stricmp( ent->classname, "NPC_Stasis" ) == 0 )
{
if ( NPC_StasisSpawn_Go( ent ) == qfalse )
return;
}
*/
//Test for drop to floor
if ( ent->spawnflags & NSF_DROP_TO_FLOOR )
{
trace_t tr;
vec3_t bottom;
VectorCopy( ent->currentOrigin, saveOrg );
VectorCopy( ent->currentOrigin, bottom );
bottom[2] = MIN_WORLD_COORD;
gi.trace( &tr, ent->currentOrigin, ent->mins, ent->maxs, bottom, ent->s.number, MASK_NPCSOLID, (EG2_Collision)0, 0 );
if ( !tr.allsolid && !tr.startsolid && tr.fraction < 1.0 )
{
G_SetOrigin( ent, tr.endpos );
}
}
//Check the spawner's count
if( ent->count != -1 )
{
ent->count--;
if( ent->count <= 0 )
{
ent->e_UseFunc = useF_NULL;//never again
//FIXME: why not remove me...? Because of all the string pointers? Just do G_NewStrings?
}
}
newent = G_Spawn();
if ( newent == NULL )
{
gi.Printf ( S_COLOR_RED"ERROR: NPC G_Spawn failed\n" );
goto finish;
return;
}
newent->svFlags |= SVF_NPC;
newent->fullName = ent->fullName;
newent->NPC = New_NPC_t();
if ( newent->NPC == NULL )
{
gi.Printf ( S_COLOR_RED"ERROR: NPC G_Alloc NPC failed\n" );
goto finish;
return;
}
newent->NPC->tempGoal = G_Spawn();
if ( newent->NPC->tempGoal == NULL )
{
newent->NPC = NULL;
goto finish;
return;
}
newent->NPC->tempGoal->classname = "NPC_goal";
newent->NPC->tempGoal->owner = newent;
newent->NPC->tempGoal->svFlags |= SVF_NOCLIENT;
newent->client = (gclient_s *)G_Alloc (sizeof(gclient_s));
if ( newent->client == NULL )
{
gi.Printf ( S_COLOR_RED"ERROR: NPC G_Alloc client failed\n" );
goto finish;
return;
}
memset ( newent->client, 0, sizeof(*newent->client) );
//==NPC_Connect( newent, net_name );===================================
if ( ent->NPC_type == NULL )
{
ent->NPC_type = "random";
}
else
{
ent->NPC_type = strlwr( G_NewString( ent->NPC_type ) );
}
if ( ent->svFlags & SVF_NO_BASIC_SOUNDS )
{
newent->svFlags |= SVF_NO_BASIC_SOUNDS;
}
if ( ent->svFlags & SVF_NO_COMBAT_SOUNDS )
{
newent->svFlags |= SVF_NO_COMBAT_SOUNDS;
}
if ( ent->svFlags & SVF_NO_EXTRA_SOUNDS )
{
newent->svFlags |= SVF_NO_EXTRA_SOUNDS;
}
if ( ent->message )
{//has a key
newent->message = ent->message;//transfer the key name
newent->flags |= FL_NO_KNOCKBACK;//don't fall off ledges
}
if ( !NPC_ParseParms( ent->NPC_type, newent ) )
{
gi.Printf ( S_COLOR_RED "ERROR: Couldn't spawn NPC %s\n", ent->NPC_type );
G_FreeEntity( newent );
goto finish;
return;
}
if ( ent->NPC_type )
{
if ( !Q_stricmp( ent->NPC_type, "kyle" ) )
{
newent->NPC->aiFlags |= NPCAI_MATCHPLAYERWEAPON;
}
else if ( !Q_stricmp( ent->NPC_type, "test" ) )
{
int n;
for ( n = 0; n < 1 ; n++)
{
if ( !(g_entities[n].svFlags & SVF_NPC) && g_entities[n].client)
{
VectorCopy(g_entities[n].s.origin, newent->s.origin);
newent->client->playerTeam = g_entities[n].client->playerTeam;
break;
}
}
newent->NPC->defaultBehavior = newent->NPC->behaviorState = BS_WAIT;
newent->classname = "NPC";
// newent->svFlags |= SVF_NOPUSH;
}
}
//=====================================================================
//set the info we want
newent->health = ent->health;
newent->script_targetname = ent->NPC_targetname;
newent->targetname = ent->NPC_targetname;
newent->target = ent->NPC_target;//death
newent->target2 = ent->target2;//knocked out death
newent->target3 = ent->target3;//???
newent->target4 = ent->target4;//ffire death
newent->wait = ent->wait;
for( index = BSET_FIRST; index < NUM_BSETS; index++)
{
if ( ent->behaviorSet[index] )
{
newent->behaviorSet[index] = ent->behaviorSet[index];
}
}
newent->classname = "NPC";
newent->NPC_type = ent->NPC_type;
gi.unlinkentity(newent);
VectorCopy(ent->s.origin, newent->s.origin);
VectorCopy(ent->s.origin, newent->client->ps.origin);
VectorCopy(ent->s.origin, newent->currentOrigin);
G_SetOrigin(newent, ent->s.origin);//just to be sure!
VectorCopy(ent->s.angles, newent->s.angles);
VectorCopy(ent->s.angles, newent->currentAngles);
VectorCopy(ent->s.angles, newent->client->ps.viewangles);
newent->NPC->desiredYaw =ent->s.angles[YAW];
gi.linkentity(newent);
newent->spawnflags = ent->spawnflags;
if(ent->paintarget)
{ //safe to point at owner's string since memory is never freed during game
newent->paintarget = ent->paintarget;
}
if(ent->opentarget)
{
newent->opentarget = ent->opentarget;
}
//==New stuff=====================================================================
newent->s.eType = ET_PLAYER;
//FIXME: Call CopyParms
if ( ent->parms )
{
for ( int parmNum = 0; parmNum < MAX_PARMS; parmNum++ )
{
if ( ent->parms->parm[parmNum] && ent->parms->parm[parmNum][0] )
{
Q3_SetParm( newent->s.number, parmNum, ent->parms->parm[parmNum] );
}
}
}
//FIXME: copy cameraGroup, store mine in message or other string field
//set origin
newent->s.pos.trType = TR_INTERPOLATE;
newent->s.pos.trTime = level.time;
VectorCopy( newent->currentOrigin, newent->s.pos.trBase );
VectorClear( newent->s.pos.trDelta );
newent->s.pos.trDuration = 0;
//set angles
newent->s.apos.trType = TR_INTERPOLATE;
newent->s.apos.trTime = level.time;
VectorCopy( newent->currentOrigin, newent->s.apos.trBase );
VectorClear( newent->s.apos.trDelta );
newent->s.apos.trDuration = 0;
newent->NPC->combatPoint = -1;
newent->flags |= FL_NOTARGET;//So he's ignored until he's fully spawned
newent->s.eFlags |= EF_NODRAW;//So he's ignored until he's fully spawned
newent->e_ThinkFunc = thinkF_NPC_Begin;
newent->nextthink = level.time + FRAMETIME;
NPC_DefaultScriptFlags( newent );
gi.linkentity (newent);
if(ent->e_UseFunc == useF_NULL)
{
if( ent->target )
{//use any target we're pointed at
G_UseTargets ( ent, ent );
}
if(ent->closetarget)
{//last guy should fire this target when he dies
newent->target = ent->closetarget;
}
ent->targetname = NULL;
//why not remove me...? Because of all the string pointers? Just do G_NewStrings?
G_FreeEntity( ent );//bye!
}
finish:
if ( ent->spawnflags & NSF_DROP_TO_FLOOR )
{
G_SetOrigin( ent, saveOrg );
}
}
/*
-------------------------
NPC_StasisSpawnEffect
-------------------------
*/
/*
void NPC_StasisSpawnEffect( gentity_t *ent )
{
vec3_t start, end, forward;
qboolean taper;
//Floor or wall?
if ( ent->spawnflags & 1 )
{
AngleVectors( ent->s.angles, forward, NULL, NULL );
VectorMA( ent->currentOrigin, 24, forward, end );
VectorMA( ent->currentOrigin, -20, forward, start );
start[2] += 64;
taper = qtrue;
}
else
{
VectorCopy( ent->currentOrigin, start );
VectorCopy( start, end );
end[2] += 48;
taper = qfalse;
}
//Add the effect
// CG_ShimmeryThing_Spawner( start, end, 32, qtrue, 1000 );
}
*/
/*
-------------------------
NPC_ShySpawn
-------------------------
*/
#define SHY_THINK_TIME 1000
#define SHY_SPAWN_DISTANCE 128
#define SHY_SPAWN_DISTANCE_SQR ( SHY_SPAWN_DISTANCE * SHY_SPAWN_DISTANCE )
void NPC_ShySpawn( gentity_t *ent )
{
ent->nextthink = level.time + SHY_THINK_TIME;
ent->e_ThinkFunc = thinkF_NPC_ShySpawn;
if ( DistanceSquared( g_entities[0].currentOrigin, ent->currentOrigin ) <= SHY_SPAWN_DISTANCE_SQR )
return;
if ( (InFOV( ent, &g_entities[0], 80, 64 )) ) // FIXME: hardcoded fov
if ( (NPC_ClearLOS( &g_entities[0], ent->currentOrigin )) )
return;
ent->e_ThinkFunc = thinkF_NULL;
ent->nextthink = 0;
NPC_Spawn_Go( ent );
}
/*
-------------------------
NPC_Spawn
-------------------------
*/
void NPC_Spawn ( gentity_t *ent, gentity_t *other, gentity_t *activator )
{
//delay before spawning NPC
if( ent->delay )
{
/* //Stasis does an extra step
if ( Q_stricmp( ent->classname, "NPC_Stasis" ) == 0 )
{
if ( NPC_StasisSpawn_Go( ent ) == qfalse )
return;
}
*/
if ( ent->spawnflags & 2048 ) // SHY
ent->e_ThinkFunc = thinkF_NPC_ShySpawn;
else
ent->e_ThinkFunc = thinkF_NPC_Spawn_Go;
ent->nextthink = level.time + ent->delay;
}
else
{
if ( ent->spawnflags & 2048 ) // SHY
NPC_ShySpawn( ent );
else
NPC_Spawn_Go( ent );
}
}
/*QUAK-ED NPC_spawner (1 0 0) (-16 -16 -24) (16 16 32) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
targetname - name this NPC goes by for targetting
target - NPC will fire this when it spawns it's last NPC (should this be when the last NPC it spawned dies?)
target2 - Fired by stasis spawners when they try to spawn while their spawner model is broken
target3 - Fired by spawner if they try to spawn and are blocked and have a wait < 0 (removes them)
If targeted, will only spawn a NPC when triggered
count - how many NPCs to spawn (only if targetted) default = 1
delay - how long to wait to spawn after used
wait - if trying to spawn and blocked, how many seconds to wait before trying again (default = 0.5, < 0 = never try again and fire target2)
NPC_targetname - NPC's targetname AND script_targetname
NPC_target - NPC's target to fire when killed
NPC_target2 - NPC's target to fire when knocked out
NPC_target4 - NPC's target to fire when killed by friendly fire
NPC_type - type of NPC ("Borg" (default), "Xian", etc)
health - starting health (default = 100)
spawnscript - default script to run once spawned (none by default)
usescript - default script to run when used (none by default)
awakescript - default script to run once awoken (none by default)
angerscript - default script to run once angered (none by default)
painscript - default script to run when hit (none by default)
fleescript - default script to run when hit and below 50% health (none by default)
deathscript - default script to run when killed (none by default)
These strings can be used to activate behaviors instead of scripts - these are checked
first and so no scripts should be names with these names:
default - 0: whatever
idle - 1: Stand around, do abolutely nothing
roam - 2: Roam around, collect stuff
walk - 3: Crouch-Walk toward their goals
run - 4: Run toward their goals
standshoot - 5: Stay in one spot and shoot- duck when neccesary
standguard - 6: Wait around for an enemy
patrol - 7: Follow a path, looking for enemies
huntkill - 8: Track down enemies and kill them
evade - 9: Run from enemies
evadeshoot - 10: Run from enemies, shoot them if they hit you
runshoot - 11: Run to your goal and shoot enemy when possible
defend - 12: Defend an entity or spot?
snipe - 13: Stay hidden, shoot enemy only when have perfect shot and back turned
combat - 14: Attack, evade, use cover, move about, etc. Full combat AI - id NPC code
medic - 15: Go for lowest health buddy, hide and heal him.
takecover - 16: Find nearest cover from enemies
getammo - 17: Go get some ammo
advancefight - 18: Go somewhere and fight along the way
face - 19: turn until facing desired angles
wait - 20: do nothing
formation - 21: Maintain a formation
crouch - 22: Crouch-walk toward their goals
delay - after spawned or triggered, how many seconds to wait to spawn the NPC
*/
//void NPC_PrecacheModels ( char *NPCName );
extern qboolean spawning; // the G_Spawn*() functions are valid (only turned on during one function)
void SP_NPC_spawner( gentity_t *self)
{
extern void NPC_PrecacheAnimationCFG( const char *NPC_type );
if ( !self->fullName || !self->fullName[0] )
{
//FIXME: make an index into an external string table for localization
self->fullName = "Humanoid Lifeform";
}
//register/precache the models needed for this NPC, not anymore
//self->classname = "NPC_spawner";
if(!self->count)
{
self->count = 1;
}
{//Stop loading of certain extra sounds
static int garbage;
if ( G_SpawnInt( "noBasicSounds", "0", &garbage ) )
{
self->svFlags |= SVF_NO_BASIC_SOUNDS;
}
if ( G_SpawnInt( "noCombatSounds", "0", &garbage ) )
{
self->svFlags |= SVF_NO_COMBAT_SOUNDS;
}
if ( G_SpawnInt( "noExtraSounds", "0", &garbage ) )
{
self->svFlags |= SVF_NO_EXTRA_SOUNDS;
}
}
if ( !self->wait )
{
self->wait = 500;
}
else
{
self->wait *= 1000;//1 = 1 msec, 1000 = 1 sec
}
self->delay *= 1000;//1 = 1 msec, 1000 = 1 sec
if ( self->delay > 0 )
{
self->svFlags |= SVF_NPC_PRECACHE;
}
//We have to load the animation.cfg now because spawnscripts are going to want to set anims and we need to know their length and if they're valid
NPC_PrecacheAnimationCFG( self->NPC_type );
if ( self->targetname )
{//Wait for triggering
self->e_UseFunc = useF_NPC_Spawn;
self->svFlags |= SVF_NPC_PRECACHE;//FIXME: precache my weapons somehow?
//NPC_PrecacheModels( self->NPC_type );
}
else
{
//NOTE: auto-spawners never check for shy spawning
if ( spawning )
{//in entity spawn stage - map starting up
self->e_ThinkFunc = thinkF_NPC_Spawn_Go;
self->nextthink = level.time + START_TIME_REMOVE_ENTS + 50;
}
else
{//else spawn right now
NPC_Spawn( self, self, self );
}
}
//FIXME: store cameraGroup somewhere else and apply to spawned NPCs' cameraGroup
//Or just don't include NPC_spawners in cameraGroupings
}
//Characters
//STAR WARS NPCs============================================================================
/*QUAKED NPC_***** (1 0 0) (-16 -16 -24) (16 16 32) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
targetname - name this NPC goes by for targetting
target - NPC will fire this when it spawns it's last NPC (should this be when the last NPC it spawned dies?)
If targeted, will only spawn a NPC when triggered
count - how many NPCs to spawn (only if targetted) default = 1
NPC_targetname - NPC's targetname AND script_targetname
NPC_target - NPC's target to fire when killed
health - starting health (default = 100)
playerTeam - Who not to shoot! (default is TEAM_STARFLEET)
TEAM_FREE (none) = 0
TEAM_RED = 1
TEAM_BLUE = 2
TEAM_GOLD = 3
TEAM_GREEN = 4
TEAM_STARFLEET = 5
TEAM_BORG = 6
TEAM_SCAVENGERS = 7
TEAM_STASIS = 8
TEAM_NPCS = 9
TEAM_HARVESTER, = 10
TEAM_FORGE = 11
enemyTeam - Who to shoot (all but own if not set)
spawnscript - default script to run once spawned (none by default)
usescript - default script to run when used (none by default)
awakescript - default script to run once awoken (none by default)
angerscript - default script to run once angered (none by default)
painscript - default script to run when hit (none by default)
fleescript - default script to run when hit and below 50% health (none by default)
deathscript - default script to run when killed (none by default)
These strings can be used to activate behaviors instead of scripts - these are checked
first and so no scripts should be names with these names:
default - 0: whatever
idle - 1: Stand around, do abolutely nothing
roam - 2: Roam around, collect stuff
walk - 3: Crouch-Walk toward their goals
run - 4: Run toward their goals
standshoot - 5: Stay in one spot and shoot- duck when neccesary
standguard - 6: Wait around for an enemy
patrol - 7: Follow a path, looking for enemies
huntkill - 8: Track down enemies and kill them
evade - 9: Run from enemies
evadeshoot - 10: Run from enemies, shoot them if they hit you
runshoot - 11: Run to your goal and shoot enemy when possible
defend - 12: Defend an entity or spot?
snipe - 13: Stay hidden, shoot enemy only when have perfect shot and back turned
combat - 14: Attack, evade, use cover, move about, etc. Full combat AI - id NPC code
medic - 15: Go for lowest health buddy, hide and heal him.
takecover - 16: Find nearest cover from enemies
getammo - 17: Go get some ammo
advancefight - 18: Go somewhere and fight along the way
face - 19: turn until facing desired angles
wait - 20: do nothing
formation - 21: Maintain a formation
crouch - 22: Crouch-walk toward their goals
delay - after spawned or triggered, how many seconds to wait to spawn the NPC
*/
//=============================================================================================
//CHARACTERS
//=============================================================================================
/*QUAKED NPC_Kyle (1 0 0) (-16 -16 -24) (16 16 32) x RIFLEMAN PHASER TRICORDER DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Kyle( gentity_t *self)
{
self->NPC_type = "Kyle";
WP_SetSaberModel( NULL, CLASS_KYLE );
SP_NPC_spawner( self );
}
/*QUAKED NPC_Lando(1 0 0) (-16 -16 -24) (16 16 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Lando( gentity_t *self)
{
self->NPC_type = "Lando";
SP_NPC_spawner( self );
}
/*QUAKED NPC_Jan(1 0 0) (-16 -16 -24) (16 16 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Jan( gentity_t *self)
{
self->NPC_type = "Jan";
SP_NPC_spawner( self );
}
/*QUAKED NPC_Luke(1 0 0) (-16 -16 -24) (16 16 40) x x x x CEILING CINEMATIC NOTSOLID STARTINSOLID SHY
CEILING - Sticks to the ceiling until he sees an enemy or takes pain
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Luke( gentity_t *self)
{
self->NPC_type = "Luke";
WP_SetSaberModel( NULL, CLASS_LUKE );
SP_NPC_spawner( self );
}
/*QUAKED NPC_MonMothma(1 0 0) (-16 -16 -24) (16 16 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_MonMothma( gentity_t *self)
{
self->NPC_type = "MonMothma";
SP_NPC_spawner( self );
}
/*QUAKED NPC_Tavion (1 0 0) (-16 -16 -24) (16 16 32) x x x x CEILING CINEMATIC NOTSOLID STARTINSOLID SHY
CEILING - Sticks to the ceiling until he sees an enemy or takes pain
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Tavion( gentity_t *self)
{
self->NPC_type = "Tavion";
WP_SetSaberModel( NULL, CLASS_TAVION );
SP_NPC_spawner( self );
}
/*QUAKED NPC_Reelo(1 0 0) (-16 -16 -24) (16 16 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Reelo( gentity_t *self)
{
self->NPC_type = "Reelo";
SP_NPC_spawner( self );
}
/*QUAKED NPC_Galak(1 0 0) (-16 -16 -24) (16 16 40) MECH x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
MECH - will be the armored Galak
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Galak( gentity_t *self)
{
if ( self->spawnflags & 1 )
{
self->NPC_type = "Galak_Mech";
NPC_GalakMech_Precache();
}
else
{
self->NPC_type = "Galak";
}
SP_NPC_spawner( self );
}
/*QUAKED NPC_Desann(1 0 0) (-16 -16 -24) (16 16 40) x x x x CEILING CINEMATIC NOTSOLID STARTINSOLID SHY
CEILING - Sticks to the ceiling until he sees an enemy or takes pain
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Desann( gentity_t *self)
{
self->NPC_type = "Desann";
WP_SetSaberModel( NULL, CLASS_DESANN );
SP_NPC_spawner( self );
}
/*QUAKED NPC_Bartender(1 0 0) (-16 -16 -24) (16 16 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Bartender( gentity_t *self)
{
self->NPC_type = "Bartender";
SP_NPC_spawner( self );
}
/*QUAKED NPC_MorganKatarn(1 0 0) (-16 -16 -24) (16 16 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_MorganKatarn( gentity_t *self)
{
self->NPC_type = "MorganKatarn";
SP_NPC_spawner( self );
}
//=============================================================================================
//ALLIES
//=============================================================================================
/*QUAKED NPC_Jedi(1 0 0) (-16 -16 -24) (16 16 40) TRAINER x x x CEILING CINEMATIC NOTSOLID STARTINSOLID SHY
TRAINER - Special Jedi- instructor
CEILING - Sticks to the ceiling until he sees an enemy or takes pain
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
Ally Jedi NPC Buddy - tags along with player
*/
void SP_NPC_Jedi( gentity_t *self)
{
if(!self->NPC_type)
{
if ( self->spawnflags & 1 )
{
self->NPC_type = "jeditrainer";
}
else
{
/*
if ( !Q_irand( 0, 2 ) )
{
self->NPC_type = "JediF";
}
else
*/if ( Q_irand( 0, 1 ) )
{
self->NPC_type = "Jedi";
}
else
{
self->NPC_type = "Jedi2";
}
}
}
WP_SetSaberModel( NULL, CLASS_JEDI );
SP_NPC_spawner( self );
}
/*QUAKED NPC_Prisoner(1 0 0) (-16 -16 -24) (16 16 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Prisoner( gentity_t *self)
{
if(!self->NPC_type)
{
if ( Q_irand( 0, 1 ) )
{
self->NPC_type = "Prisoner";
}
else
{
self->NPC_type = "Prisoner2";
}
}
SP_NPC_spawner( self );
}
/*QUAKED NPC_Rebel(1 0 0) (-16 -16 -24) (16 16 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Rebel( gentity_t *self)
{
if(!self->NPC_type)
{
if ( Q_irand( 0, 1 ) )
{
self->NPC_type = "Rebel";
}
else
{
self->NPC_type = "Rebel2";
}
}
SP_NPC_spawner( self );
}
//=============================================================================================
//ENEMIES
//=============================================================================================
/*QUAKED NPC_Stormtrooper(1 0 0) (-16 -16 -24) (16 16 40) OFFICER COMMANDER ALTOFFICER ROCKET DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
30 health, blaster
OFFICER - 60 health, flechette
COMMANDER - 60 health, heavy repeater
ALTOFFICER - 60 health, alt-fire flechette (grenades)
ROCKET - 60 health, rocket launcher
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Stormtrooper( gentity_t *self)
{
if ( self->spawnflags & 8 )
{//rocketer
self->NPC_type = "rockettrooper";
}
else if ( self->spawnflags & 4 )
{//alt-officer
self->NPC_type = "stofficeralt";
}
else if ( self->spawnflags & 2 )
{//commander
self->NPC_type = "stcommander";
}
else if ( self->spawnflags & 1 )
{//officer
self->NPC_type = "stofficer";
}
else
{//regular trooper
if ( Q_irand( 0, 1 ) )
{
self->NPC_type = "StormTrooper";
}
else
{
self->NPC_type = "StormTrooper2";
}
}
SP_NPC_spawner( self );
}
void SP_NPC_StormtrooperOfficer( gentity_t *self)
{
self->spawnflags |= 1;
SP_NPC_Stormtrooper( self );
}
/*QUAKED NPC_Tie_Pilot(1 0 0) (-16 -16 -24) (16 16 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
30 health, blaster
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Tie_Pilot( gentity_t *self)
{
self->NPC_type = "stormpilot";
SP_NPC_spawner( self );
}
/*QUAKED NPC_Ugnaught(1 0 0) (-16 -16 -24) (16 16 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Ugnaught( gentity_t *self)
{
if ( !self->NPC_type )
{
if ( Q_irand( 0, 1 ) )
{
self->NPC_type = "Ugnaught";
}
else
{
self->NPC_type = "Ugnaught2";
}
}
SP_NPC_spawner( self );
}
/*QUAKED NPC_Gran(1 0 0) (-16 -16 -24) (16 16 40) SHOOTER BOXER x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
Uses grenade
SHOOTER - uses blaster instead of
BOXER - uses fists only
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Gran( gentity_t *self)
{
if ( !self->NPC_type )
{
if ( self->spawnflags & 1 )
{
self->NPC_type = "granshooter";
}
else if ( self->spawnflags & 2 )
{
self->NPC_type = "granboxer";
}
else
{
if ( Q_irand( 0, 1 ) )
{
self->NPC_type = "gran";
}
else
{
self->NPC_type = "gran2";
}
}
}
SP_NPC_spawner( self );
}
/*QUAKED NPC_Rodian(1 0 0) (-16 -16 -24) (16 16 40) BLASTER NO_HIDE x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
BLASTER uses a blaster instead of sniper rifle, different skin
NO_HIDE (only applicable with snipers) does not duck and hide between shots
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Rodian( gentity_t *self)
{
if ( !self->NPC_type )
{
if ( self->spawnflags&1 )
{
self->NPC_type = "rodian2";
}
else
{
self->NPC_type = "rodian";
}
}
SP_NPC_spawner( self );
}
/*QUAKED NPC_Weequay(1 0 0) (-16 -16 -24) (16 16 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Weequay( gentity_t *self)
{
if ( !self->NPC_type )
{
switch ( Q_irand( 0, 3 ) )
{
case 0:
self->NPC_type = "Weequay";
break;
case 1:
self->NPC_type = "Weequay2";
break;
case 2:
self->NPC_type = "Weequay3";
break;
case 3:
self->NPC_type = "Weequay4";
break;
}
}
SP_NPC_spawner( self );
}
/*QUAKED NPC_Trandoshan(1 0 0) (-16 -16 -24) (16 16 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Trandoshan( gentity_t *self)
{
if ( !self->NPC_type )
{
self->NPC_type = "Trandoshan";
}
SP_NPC_spawner( self );
}
/*QUAKED NPC_SwampTrooper(1 0 0) (-16 -16 -24) (16 16 40) REPEATER x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
REPEATER - Swaptrooper who uses the repeater
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_SwampTrooper( gentity_t *self)
{
if ( !self->NPC_type )
{
if ( self->spawnflags & 1 )
{
self->NPC_type = "SwampTrooper2";
}
else
{
self->NPC_type = "SwampTrooper";
}
}
SP_NPC_spawner( self );
}
/*QUAKED NPC_Imperial(1 0 0) (-16 -16 -24) (16 16 40) OFFICER COMMANDER x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
Greyshirt grunt, uses blaster pistol, 20 health.
OFFICER - Brownshirt Officer, uses blaster rifle, 40 health
COMMANDER - Blackshirt Commander, uses rapid-fire blaster rifle, 80 healt
"message" - if a COMMANDER, turns on his key surface. This is the name of the key you get when you walk over his body. This must match the "message" field of the func_security_panel you want this key to open. Set to "goodie" to have him carrying a goodie key that player can use to operate doors with "GOODIE" spawnflag.
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Imperial( gentity_t *self)
{
if ( !self->NPC_type )
{
if ( self->spawnflags & 1 )
{
self->NPC_type = "ImpOfficer";
}
else if ( self->spawnflags & 2 )
{
self->NPC_type = "ImpCommander";
}
else
{
self->NPC_type = "Imperial";
}
}
if ( self->message )
{//may drop a key, precache the key model and pickup sound
G_SoundIndex( "sound/weapons/key_pkup.wav" );
if ( !Q_stricmp( "goodie", self->message ) )
{
RegisterItem( FindItemForInventory( INV_GOODIE_KEY ) );
}
else
{
RegisterItem( FindItemForInventory( INV_SECURITY_KEY ) );
}
}
SP_NPC_spawner( self );
}
/*QUAKED NPC_ImpWorker(1 0 0) (-16 -16 -24) (16 16 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_ImpWorker( gentity_t *self)
{
if ( !self->NPC_type )
{
if ( !Q_irand( 0, 2 ) )
{
self->NPC_type = "ImpWorker";
}
else if ( Q_irand( 0, 1 ) )
{
self->NPC_type = "ImpWorker2";
}
else
{
self->NPC_type = "ImpWorker3";
}
}
SP_NPC_spawner( self );
}
/*QUAKED NPC_BespinCop(1 0 0) (-16 -16 -24) (16 16 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_BespinCop( gentity_t *self)
{
if ( !self->NPC_type )
{
if ( !Q_irand( 0, 1 ) )
{
self->NPC_type = "BespinCop";
}
else
{
self->NPC_type = "BespinCop2";
}
}
SP_NPC_spawner( self );
}
/*QUAKED NPC_Reborn(1 0 0) (-16 -16 -24) (16 16 40) FORCE FENCER ACROBAT BOSS CEILING CINEMATIC NOTSOLID STARTINSOLID SHY
Default Reborn is A poor lightsaber fighter, acrobatic and uses no force powers. Yellow saber, 40 health.
FORCE - Uses force powers but is not the best lightsaber fighter and not acrobatic. Purple saber, 75 health.
FENCER - A good lightsaber fighter, but not acrobatic and uses no force powers. Yellow saber, 100 health.
ACROBAT - quite acrobatic, but not the best lightsaber fighter and uses no force powers. Red saber, 100 health.
BOSS - quite acrobatic, good lightsaber fighter and uses force powers. Orange saber, 150 health.
NOTE: Saber colors are temporary until they have different by skins to tell them apart
CEILING - Sticks to the ceiling until he sees an enemy or takes pain
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Reborn( gentity_t *self)
{
if ( !self->NPC_type )
{
if ( self->spawnflags & 1 )
{
self->NPC_type = "rebornforceuser";
}
else if ( self->spawnflags & 2 )
{
self->NPC_type = "rebornfencer";
}
else if ( self->spawnflags & 4 )
{
self->NPC_type = "rebornacrobat";
}
else if ( self->spawnflags & 8 )
{
self->NPC_type = "rebornboss";
}
else
{
self->NPC_type = "reborn";
}
}
WP_SetSaberModel( NULL, CLASS_REBORN );
SP_NPC_spawner( self );
}
/*QUAKED NPC_ShadowTrooper(1 0 0) (-16 -16 -24) (16 16 40) x x x x CEILING CINEMATIC NOTSOLID STARTINSOLID SHY
CEILING - Sticks to the ceiling until he sees an enemy or takes pain
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_ShadowTrooper( gentity_t *self)
{
if(!self->NPC_type)
{
if ( !Q_irand( 0, 1 ) )
{
self->NPC_type = "ShadowTrooper";
}
else
{
self->NPC_type = "ShadowTrooper2";
}
}
NPC_ShadowTrooper_Precache();
WP_SetSaberModel( NULL, CLASS_SHADOWTROOPER );
SP_NPC_spawner( self );
}
//=============================================================================================
//MONSTERS
//=============================================================================================
/*QUAKED NPC_Monster_Murjj (1 0 0) (-12 -12 -24) (12 12 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Monster_Murjj( gentity_t *self)
{
self->NPC_type = "Murjj";
SP_NPC_spawner( self );
}
/*QUAKED NPC_Monster_Swamp (1 0 0) (-12 -12 -24) (12 12 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Monster_Swamp( gentity_t *self)
{
self->NPC_type = "Swamp";
SP_NPC_spawner( self );
}
/*QUAKED NPC_Monster_Howler (1 0 0) (-12 -12 -24) (12 12 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Monster_Howler( gentity_t *self)
{
self->NPC_type = "howler";
SP_NPC_spawner( self );
}
/*QUAKED NPC_MineMonster (1 0 0) (-12 -12 -24) (12 12 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_MineMonster( gentity_t *self)
{
self->NPC_type = "minemonster";
SP_NPC_spawner( self );
NPC_MineMonster_Precache();
}
/*QUAKED NPC_Monster_Claw (1 0 0) (-12 -12 -24) (12 12 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Monster_Claw( gentity_t *self)
{
self->NPC_type = "Claw";
SP_NPC_spawner( self );
}
/*QUAKED NPC_Monster_Glider (1 0 0) (-12 -12 -24) (12 12 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Monster_Glider( gentity_t *self)
{
self->NPC_type = "Glider";
SP_NPC_spawner( self );
}
/*QUAKED NPC_Monster_Flier2 (1 0 0) (-12 -12 -24) (12 12 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Monster_Flier2( gentity_t *self)
{
self->NPC_type = "Flier2";
SP_NPC_spawner( self );
}
/*QUAKED NPC_Monster_Lizard (1 0 0) (-12 -12 -24) (12 12 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Monster_Lizard( gentity_t *self)
{
self->NPC_type = "Lizard";
SP_NPC_spawner( self );
}
/*QUAKED NPC_Monster_Fish (1 0 0) (-12 -12 -24) (12 12 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Monster_Fish( gentity_t *self)
{
self->NPC_type = "Fish";
SP_NPC_spawner( self );
}
//=============================================================================================
//DROIDS
//=============================================================================================
/*QUAKED NPC_Droid_Interrogator (1 0 0) (-12 -12 -24) (12 12 0) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Droid_Interrogator( gentity_t *self)
{
self->NPC_type = "interrogator";
SP_NPC_spawner( self );
NPC_Interrogator_Precache(self);
}
/*QUAKED NPC_Droid_Probe (1 0 0) (-12 -12 -24) (12 12 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
Imperial Probe Droid - the multilegged floating droid that Han and Chewie shot on the ice planet Hoth
*/
void SP_NPC_Droid_Probe( gentity_t *self)
{
self->NPC_type = "probe";
SP_NPC_spawner( self );
NPC_Probe_Precache();
}
/*QUAKED NPC_Droid_Mark1 (1 0 0) (-36 -36 -24) (36 36 80) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
Big walking droid
*/
void SP_NPC_Droid_Mark1( gentity_t *self)
{
self->NPC_type = "mark1";
SP_NPC_spawner( self );
NPC_Mark1_Precache();
}
/*QUAKED NPC_Droid_Mark2 (1 0 0) (-12 -12 -24) (12 12 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
Small rolling droid with one gun.
*/
void SP_NPC_Droid_Mark2( gentity_t *self)
{
self->NPC_type = "mark2";
SP_NPC_spawner( self );
NPC_Mark2_Precache();
}
/*QUAKED NPC_Droid_ATST (1 0 0) (-40 -40 -24) (40 40 248) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
*/
void SP_NPC_Droid_ATST( gentity_t *self)
{
self->NPC_type = "atst";
SP_NPC_spawner( self );
NPC_ATST_Precache();
}
/*QUAKED NPC_Droid_Remote (1 0 0) (-12 -12 -24) (12 12 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
Remote Droid - the floating round droid used by Obi Wan to train Luke about the force while on the Millenium Falcon.
*/
void SP_NPC_Droid_Remote( gentity_t *self)
{
self->NPC_type = "remote";
SP_NPC_spawner( self );
NPC_Remote_Precache();
}
/*QUAKED NPC_Droid_Seeker (1 0 0) (-12 -12 -24) (12 12 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
Seeker Droid - floating round droids that shadow troopers spawn
*/
void SP_NPC_Droid_Seeker( gentity_t *self)
{
self->NPC_type = "seeker";
SP_NPC_spawner( self );
NPC_Seeker_Precache();
}
/*QUAKED NPC_Droid_Sentry (1 0 0) (-24 -24 -24) (24 24 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
Sentry Droid - Large, armored floating Imperial droids with 3 forward-facing gun turrets
*/
void SP_NPC_Droid_Sentry( gentity_t *self)
{
self->NPC_type = "sentry";
SP_NPC_spawner( self );
NPC_Sentry_Precache();
}
/*QUAKED NPC_Droid_Gonk (1 0 0) (-12 -12 -24) (12 12 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
Gonk Droid - the droid that looks like a walking ice machine. Was in the Jawa land crawler, walking around talking to itself.
NOTARGET by default
*/
void SP_NPC_Droid_Gonk( gentity_t *self)
{
self->NPC_type = "gonk";
SP_NPC_spawner( self );
//precache the Gonk sounds
NPC_Gonk_Precache();
}
/*QUAKED NPC_Droid_Mouse (1 0 0) (-12 -12 -24) (12 12 40) x x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
Mouse Droid - small, box shaped droid, first seen on the Death Star. Chewie yelled at it and it backed up and ran away.
NOTARGET by default
*/
void SP_NPC_Droid_Mouse( gentity_t *self)
{
self->NPC_type = "mouse";
SP_NPC_spawner( self );
//precache the Mouse sounds
NPC_Mouse_Precache();
}
/*QUAKED NPC_Droid_R2D2 (1 0 0) (-12 -12 -24) (12 12 40) IMPERIAL x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
R2D2 Droid - you probably know this one already.
NOTARGET by default
*/
void SP_NPC_Droid_R2D2( gentity_t *self)
{
if ( self->spawnflags&1 )
{//imperial skin
self->NPC_type = "r2d2_imp";
}
else
{
self->NPC_type = "r2d2";
}
SP_NPC_spawner( self );
NPC_R2D2_Precache();
}
/*QUAKED NPC_Droid_R5D2 (1 0 0) (-12 -12 -24) (12 12 40) IMPERIAL ALWAYSDIE x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
ALWAYSDIE - won't go into spinning zombie AI when at low health.
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
R5D2 Droid - the droid originally chosen by Uncle Owen until it blew a bad motivator, and they took R2D2 instead.
NOTARGET by default
*/
void SP_NPC_Droid_R5D2( gentity_t *self)
{
if ( self->spawnflags&1 )
{//imperial skin
self->NPC_type = "r5d2_imp";
}
else
{
self->NPC_type = "r5d2";
}
SP_NPC_spawner( self );
NPC_R5D2_Precache();
}
/*QUAKED NPC_Droid_Protocol (1 0 0) (-12 -12 -24) (12 12 40) IMPERIAL x x x DROPTOFLOOR CINEMATIC NOTSOLID STARTINSOLID SHY
DROPTOFLOOR - NPC can be in air, but will spawn on the closest floor surface below it
CINEMATIC - Will spawn with no default AI (BS_CINEMATIC)
NOTSOLID - Starts not solid
STARTINSOLID - Don't try to fix if spawn in solid
SHY - Spawner is shy
NOTARGET by default
*/
void SP_NPC_Droid_Protocol( gentity_t *self)
{
if ( self->spawnflags&1 )
{//imperial skin
self->NPC_type = "protocol_imp";
}
else
{
self->NPC_type = "protocol";
}
SP_NPC_spawner( self );
NPC_Protocol_Precache();
}
//NPC console commands
/*
NPC_Spawn_f
*/
static void NPC_Spawn_f(void)
{
gentity_t *NPCspawner = G_Spawn();
vec3_t forward, end;
trace_t trace;
if(!NPCspawner)
{
gi.Printf( S_COLOR_RED"NPC_Spawn Error: Out of entities!\n" );
return;
}
NPCspawner->e_ThinkFunc = thinkF_G_FreeEntity;
NPCspawner->nextthink = level.time + FRAMETIME;
const char *npc_type = gi.argv( 2 );
if (!*npc_type )
{
gi.Printf( S_COLOR_RED"Error, expected:\n NPC spawn [NPC type (from NCPCs.cfg)]\n" );
return;
}
//Spawn it at spot of first player
//FIXME: will gib them!
AngleVectors(g_entities[0].client->ps.viewangles, forward, NULL, NULL);
VectorNormalize(forward);
VectorMA(g_entities[0].currentOrigin, 64, forward, end);
gi.trace(&trace, g_entities[0].currentOrigin, NULL, NULL, end, 0, MASK_SOLID, (EG2_Collision)0, 0);
VectorCopy(trace.endpos, end);
end[2] -= 24;
gi.trace(&trace, trace.endpos, NULL, NULL, end, 0, MASK_SOLID, (EG2_Collision)0, 0);
VectorCopy(trace.endpos, end);
end[2] += 24;
G_SetOrigin(NPCspawner, end);
VectorCopy(NPCspawner->currentOrigin, NPCspawner->s.origin);
//set the yaw so that they face away from player
NPCspawner->s.angles[1] = g_entities[0].client->ps.viewangles[1];
gi.linkentity(NPCspawner);
NPCspawner->NPC_type = G_NewString( npc_type );
NPCspawner->NPC_targetname = G_NewString(gi.argv( 3 ));
NPCspawner->count = 1;
NPCspawner->delay = 0;
//NPCspawner->spawnflags |= SFB_NOTSOLID;
//NPCspawner->playerTeam = TEAM_FREE;
//NPCspawner->behaviorSet[BSET_SPAWN] = "common/guard";
//call precache funcs for James' builds
if ( !Q_stricmp( "gonk", NPCspawner->NPC_type))
{
NPC_Gonk_Precache();
}
else if ( !Q_stricmp( "mouse", NPCspawner->NPC_type))
{
NPC_Mouse_Precache();
}
else if ( !Q_strncmp( "r2d2", NPCspawner->NPC_type, 4))
{
NPC_R2D2_Precache();
}
else if ( !Q_stricmp( "atst", NPCspawner->NPC_type))
{
NPC_ATST_Precache();
}
else if ( !Q_strncmp( "r5d2", NPCspawner->NPC_type, 4))
{
NPC_R5D2_Precache();
}
else if ( !Q_stricmp( "mark1", NPCspawner->NPC_type))
{
NPC_Mark1_Precache();
}
else if ( !Q_stricmp( "mark2", NPCspawner->NPC_type))
{
NPC_Mark2_Precache();
}
else if ( !Q_stricmp( "interrogator", NPCspawner->NPC_type))
{
NPC_Interrogator_Precache(NULL);
}
else if ( !Q_stricmp( "probe", NPCspawner->NPC_type))
{
NPC_Probe_Precache();
}
else if ( !Q_stricmp( "seeker", NPCspawner->NPC_type))
{
NPC_Seeker_Precache();
}
else if ( !Q_stricmp( "remote", NPCspawner->NPC_type))
{
NPC_Remote_Precache();
}
else if ( !Q_strncmp( "shadowtrooper", NPCspawner->NPC_type, 13 ) )
{
NPC_ShadowTrooper_Precache();
}
else if ( !Q_stricmp( "minemonster", NPCspawner->NPC_type ))
{
NPC_MineMonster_Precache();
}
else if ( !Q_stricmp( "howler", NPCspawner->NPC_type ))
{
NPC_Howler_Precache();
}
else if ( !Q_stricmp( "sentry", NPCspawner->NPC_type ))
{
NPC_Sentry_Precache();
}
else if ( !Q_stricmp( "protocol", NPCspawner->NPC_type ))
{
NPC_Protocol_Precache();
}
else if ( !Q_stricmp( "galak_mech", NPCspawner->NPC_type ))
{
NPC_GalakMech_Precache();
}
NPC_Spawn( NPCspawner, NPCspawner, NPCspawner );
}
/*
NPC_Kill_f
*/
void NPC_Kill_f( void )
{
int n;
gentity_t *player;
char *name;
team_t killTeam = TEAM_FREE;
qboolean killNonSF = qfalse;
name = gi.argv( 2 );
if ( !*name || !name[0] )
{
gi.Printf( S_COLOR_RED"Error, Expected:\n");
gi.Printf( S_COLOR_RED"NPC kill '[NPC targetname]' - kills NPCs with certain targetname\n" );
gi.Printf( S_COLOR_RED"or\n" );
gi.Printf( S_COLOR_RED"NPC kill 'all' - kills all NPCs\n" );
gi.Printf( S_COLOR_RED"or\n" );
gi.Printf( S_COLOR_RED"NPC team '[teamname]' - kills all NPCs of a certain team ('nonally' is all but your allies)\n" );
return;
}
if ( Q_stricmp( "team", name ) == 0 )
{
name = gi.argv( 3 );
if ( !*name || !name[0] )
{
gi.Printf( S_COLOR_RED"NPC_Kill Error: 'npc kill team' requires a team name!\n" );
gi.Printf( S_COLOR_RED"Valid team names are:\n");
for ( n = (TEAM_FREE + 1); n < TEAM_NUM_TEAMS; n++ )
{
gi.Printf( S_COLOR_RED"%s\n", TeamNames[n] );
}
gi.Printf( S_COLOR_RED"nonally - kills all but your teammates\n" );
return;
}
if ( Q_stricmp( "nonally", name ) == 0 )
{
killNonSF = qtrue;
}
else
{
killTeam = TranslateTeamName( name );
if ( killTeam == TEAM_FREE )
{
gi.Printf( S_COLOR_RED"NPC_Kill Error: team '%s' not recognized\n", name );
gi.Printf( S_COLOR_RED"Valid team names are:\n");
for ( n = (TEAM_FREE + 1); n < TEAM_NUM_TEAMS; n++ )
{
gi.Printf( S_COLOR_RED"%s\n", TeamNames[n] );
}
gi.Printf( S_COLOR_RED"nonally - kills all but your teammates\n" );
return;
}
}
}
for ( n = 1; n < ENTITYNUM_MAX_NORMAL; n++)
{
player = &g_entities[n];
if (!player->inuse) {
continue;
}
if ( killNonSF )
{
if ( player )
{
if ( player->client )
{
if ( player->client->playerTeam != TEAM_PLAYER )
{
gi.Printf( S_COLOR_GREEN"Killing NPC %s named %s\n", player->NPC_type, player->targetname );
player->health = 0;
GEntity_DieFunc(player, player, player, player->max_health, MOD_UNKNOWN);
}
}
else if ( player->NPC_type && player->classname && player->classname[0] && Q_stricmp( "NPC_starfleet", player->classname ) != 0 )
{//A spawner, remove it
gi.Printf( S_COLOR_GREEN"Removing NPC spawner %s with NPC named %s\n", player->NPC_type, player->NPC_targetname );
G_FreeEntity( player );
//FIXME: G_UseTargets2(player, player, player->NPC_target & player->target);?
}
}
}
else if ( player && player->NPC && player->client )
{
if ( killTeam != TEAM_FREE )
{
if ( player->client->playerTeam == killTeam )
{
gi.Printf( S_COLOR_GREEN"Killing NPC %s named %s\n", player->NPC_type, player->targetname );
player->health = 0;
GEntity_DieFunc(player, player, player, player->max_health, MOD_UNKNOWN);
}
}
else if( (player->targetname && Q_stricmp( name, player->targetname ) == 0)
|| Q_stricmp( name, "all" ) == 0 )
{
gi.Printf( S_COLOR_GREEN"Killing NPC %s named %s\n", player->NPC_type, player->targetname );
player->health = 0;
player->client->ps.stats[STAT_HEALTH] = 0;
GEntity_DieFunc(player, player, player, 100, MOD_UNKNOWN);
}
}
else if ( player && (player->svFlags&SVF_NPC_PRECACHE) )
{//a spawner
gi.Printf( S_COLOR_GREEN"Removing NPC spawner %s named %s\n", player->NPC_type, player->targetname );
G_FreeEntity( player );
}
}
}
void NPC_PrintScore( gentity_t *ent )
{
gi.Printf( "%s: %d\n", ent->targetname, ent->client->ps.persistant[PERS_SCORE] );
}
/*
Svcmd_NPC_f
parse and dispatch bot commands
*/
qboolean showBBoxes = qfalse;
void Svcmd_NPC_f( void )
{
char *cmd;
cmd = gi.argv( 1 );
if ( !*cmd )
{
gi.Printf( "Valid NPC commands are:\n" );
gi.Printf( " spawn [NPC type (from NCPCs.cfg)]\n" );
gi.Printf( " kill [NPC targetname] or [all(kills all NPCs)] or 'team [teamname]'\n" );
gi.Printf( " showbounds (draws exact bounding boxes of NPCs)\n" );
gi.Printf( " score [NPC targetname] (prints number of kills per NPC)\n" );
}
else if ( Q_stricmp( cmd, "spawn" ) == 0 )
{
NPC_Spawn_f();
}
else if ( Q_stricmp( cmd, "kill" ) == 0 )
{
NPC_Kill_f();
}
else if ( Q_stricmp( cmd, "showbounds" ) == 0 )
{//Toggle on and off
showBBoxes = showBBoxes ? qfalse : qtrue;
}
else if ( Q_stricmp ( cmd, "score" ) == 0 )
{
char *cmd2 = gi.argv(2);
gentity_t *ent = NULL;
if ( !cmd2 || !cmd2[0] )
{//Show the score for all NPCs
gi.Printf( "SCORE LIST:\n" );
for ( int i = 0; i < ENTITYNUM_WORLD; i++ )
{
ent = &g_entities[i];
if ( !ent || !ent->client )
{
continue;
}
NPC_PrintScore( ent );
}
}
else
{
if ( (ent = G_Find( NULL, FOFS(targetname), cmd2 )) != NULL && ent->client )
{
NPC_PrintScore( ent );
}
else
{
gi.Printf( "ERROR: NPC score - no such NPC %s\n", cmd2 );
}
}
}
}
| {
"pile_set_name": "Github"
} |
/*
Feathers
Copyright 2012-2013 Joshua Tynjala. All Rights Reserved.
This program is free software. You can redistribute and/or modify it in
accordance with the terms of the accompanying license agreement.
*/
package feathers.controls
{
import feathers.core.FeathersControl;
import feathers.core.IFocusDisplayObject;
import feathers.core.ITextEditor;
import feathers.core.ITextRenderer;
import feathers.events.FeathersEventType;
import loom2d.math.Point;
//import flash.ui.Mouse;
//import flash.ui.MouseCursor;
import loom2d.Loom2D;
import loom2d.display.DisplayObject;
import loom2d.events.Event;
import loom2d.events.Touch;
import loom2d.events.TouchEvent;
import loom2d.events.TouchPhase;
import loom.platform.LoomKeyboardType;
/**
* Dispatched when the text input's `text` property changes.
*
* @eventType loom2d.events.Event.CHANGE
*/
[Event(name="change",type="loom2d.events.Event")]
/**
* Dispatched when the user presses the Enter key while the text input
* has focus. This event may not be dispatched at all times. Certain text
* editors will not dispatch an event for the enter key on some platforms,
* depending on the values of certain properties. This may include the
* default values for some platforms! If you've encountered this issue,
* please see the specific text editor's API documentation for complete
* details of this event's limitations and requirements.
*
* @eventType feathers.events.FeathersEventType.ENTER
*/
[Event(name="enter",type="loom2d.events.Event")]
/**
* Dispatched when the text input receives focus.
*
* @eventType feathers.events.FeathersEventType.FOCUS_IN
*/
[Event(name="focusIn",type="loom2d.events.Event")]
/**
* Dispatched when the text input loses focus.
*
* @eventType feathers.events.FeathersEventType.FOCUS_OUT
*/
[Event(name="focusOut",type="loom2d.events.Event")]
/**
* A text entry control that allows users to enter and edit a single line of
* uniformly-formatted text.
*
* To set things like font properties, the ability to display as
* password, and character restrictions, use the `textEditorProperties` to pass
* values to the `ITextEditor` instance.
*
* @see http://wiki.starling-framework.org/feathers/text-input
* @see http://wiki.starling-framework.org/feathers/text-editors
* @see feathers.core.ITextEditor
*/
public class TextInput extends FeathersControl implements IFocusDisplayObject
{
/**
* @private
*/
private static const HELPER_POINT:Point = new Point();
/**
* @private
*/
private static const HELPER_TOUCHES_VECTOR:Vector.<Touch> = new <Touch>[];
/**
* @private
*/
protected static const INVALIDATION_FLAG_PROMPT_FACTORY:String = "promptFactory";
/**
* Constructor.
*/
public function TextInput()
{
this.isQuickHitAreaEnabled = true;
this.addEventListener(Event.ADDED_TO_STAGE, textInput_addedToStageHandler);
this.addEventListener(Event.REMOVED_FROM_STAGE, textInput_removedFromStageHandler);
}
/**
* The text editor sub-component.
*/
protected var textEditor:ITextEditor;
/**
* The prompt text renderer sub-component.
*/
protected var promptTextRenderer:ITextRenderer;
/**
* The currently selected background, based on state.
*/
protected var currentBackground:DisplayObject;
/**
* @private
*/
protected var _textEditorHasFocus:Boolean = false;
/**
* @private
*/
protected var _ignoreTextChanges:Boolean = false;
/**
* @private
*/
protected var _touchPointID:int = -1;
/**
* @private
*/
protected var _text:String = "";
/**
* @private
* Par of a Workaround fix that specially prevents editing when not in focus
*/
private var _localIsEditable:Boolean = false;
/**
* The text displayed by the text input. The text input dispatches
* `Event.CHANGE` when the value of the `text`
* property changes for any reason.
*
* @see loom2d.events.Event#!CHANGE
*/
public function get text():String
{
return this._text;
}
/**
* @private
*/
public function set text(value:String):void
{
if(!value)
{
//don't allow null or undefined
value = "";
}
if(this._text == value)
{
return;
}
this._text = value;
this.invalidate(INVALIDATION_FLAG_DATA);
this.dispatchEventWith(Event.CHANGE);
}
/**
* @private
*/
protected var _prompt:String;
/**
* The prompt, hint, or description text displayed by the input when the
* value of its text is empty.
*/
public function get prompt():String
{
return this._prompt;
}
/**
* @private
*/
public function set prompt(value:String):void
{
if(this._prompt == value)
{
return;
}
this._prompt = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _typicalText:String;
/**
* The text used to measure the input when the dimensions are not set
* explicitly (in addition to using the background skin for measurement).
*/
public function get typicalText():String
{
return this._typicalText;
}
/**
* @private
*/
public function set typicalText(value:String):void
{
if(this._typicalText == value)
{
return;
}
this._typicalText = value;
this.invalidate(INVALIDATION_FLAG_DATA);
}
/**
* @private
*/
protected var _maxChars:int = 0;
/**
* The maximum number of characters that may be entered.
*/
public function get maxChars():int
{
return this._maxChars;
}
/**
* @private
*/
public function set maxChars(value:int):void
{
if(this._maxChars == value)
{
return;
}
this._maxChars = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _restrict:String;
/**
* Limits the set of characters that may be entered.
*/
public function get restrict():String
{
return this._restrict;
}
/**
* @private
*/
public function set restrict(value:String):void
{
if(this._restrict == value)
{
return;
}
this._restrict = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _displayAsPassword:Boolean = false;
/**
* Determines if the entered text will be masked so that it cannot be
* seen, such as for a password input.
*/
public function get displayAsPassword():Boolean
{
return this._displayAsPassword;
}
/**
* @private
*/
public function set displayAsPassword(value:Boolean):void
{
if(this._displayAsPassword == value)
{
return;
}
this._displayAsPassword = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _isEditable:Boolean = true;
/**
* Determines if the text input is editable. If the text input is not
* editable, it will still appear enabled.
*/
public function get isEditable():Boolean
{
return this._isEditable;
}
/**
* @private
*/
public function set isEditable(value:Boolean):void
{
if(this._isEditable == value)
{
return;
}
this._isEditable = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _keyboardType:LoomKeyboardType = 0;
/**
* Determines the type of keyboard to open when control gains focus.
*/
public function get keyboardType():LoomKeyboardType
{
return this._keyboardType;
}
/**
* @private
*/
public function set keyboardType(value:LoomKeyboardType):void
{
if(this._keyboardType == value)
{
return;
}
this._keyboardType = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _textEditorFactory:Function;
/**
* A function used to instantiate the text editor. If null,
* `FeathersControl.defaultTextEditorFactory` is used
* instead. The text editor must be an instance of
* `ITextEditor`. This factory can be used to change
* properties on the text editor when it is first created. For instance,
* if you are skinning Feathers components without a theme, you might
* use this factory to set styles on the text editor.
*
* The factory should have the following function signature:
* `function():ITextEditor`
*
* @see feathers.core.ITextEditor
* @see feathers.core.FeathersControl#defaultTextEditorFactory
*/
public function get textEditorFactory():Function
{
return this._textEditorFactory;
}
/**
* @private
*/
public function set textEditorFactory(value:Function):void
{
if(this._textEditorFactory == value)
{
return;
}
this._textEditorFactory = value;
this.invalidate(INVALIDATION_FLAG_TEXT_EDITOR);
}
/**
* @private
*/
protected var _promptFactory:Function;
/**
* A function used to instantiate the prompt text renderer. If null,
* `FeathersControl.defaultTextRendererFactory` is used
* instead. The prompt text renderer must be an instance of
* `ITextRenderer`. This factory can be used to change
* properties on the prompt when it is first created. For instance, if
* you are skinning Feathers components without a theme, you might use
* this factory to set styles on the prompt.
*
* The factory should have the following function signature:
* `function():ITextRenderer`
*
* @see feathers.core.ITextRenderer
* @see feathers.core.FeathersControl#defaultTextRendererFactory
* @see feathers.controls.text.BitmapFontTextRenderer
* @see feathers.controls.text.TextFieldTextRenderer
*/
public function get promptFactory():Function
{
return this._promptFactory;
}
/**
* @private
*/
public function set promptFactory(value:Function):void
{
if(this._promptFactory == value)
{
return;
}
this._promptFactory = value;
this.invalidate(INVALIDATION_FLAG_PROMPT_FACTORY);
}
/**
* @private
*/
protected var _promptProperties:Dictionary.<String, Object>;
/**
* A set of key/value pairs to be passed down to the text input's prompt
* text renderer. The prompt text renderer is an `ITextRenderer`
* instance that is created by `promptFactory`. The available
* properties depend on which `ITextRenderer` implementation
* is returned by `promptFactory`. The most common
* implementations are `BitmapFontTextRenderer` and
* `TextFieldTextRenderer`.
*
* If the subcomponent has its own subcomponents, their properties
* can be set too, using attribute `@` notation. For example,
* to set the skin on the thumb of a `SimpleScrollBar`
* which is in a `Scroller` which is in a `List`,
* you can use the following syntax:
* `list.scrollerProperties.@verticalScrollBarProperties.@thumbProperties.defaultSkin = new Image(texture);`
*
* Setting properties in a `promptFactory` function
* instead of using `promptProperties` will result in
* better performance.
*
* @see #promptFactory
* @see feathers.core.ITextRenderer
* @see feathers.controls.text.BitmapFontTextRenderer
* @see feathers.controls.text.TextFieldTextRenderer
*/
public function get promptProperties():Dictionary.<String, Object>
{
if(!this._promptProperties)
{
this._promptProperties = new Dictionary.<String, Object>;
}
return this._promptProperties;
}
/**
* @private
*/
public function set promptProperties(value:Dictionary.<String, Object>):void
{
if(this._promptProperties == value)
{
return;
}
this._promptProperties = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
* The width of the first skin that was displayed.
*/
protected var _originalSkinWidth:Number = NaN;
/**
* @private
* The height of the first skin that was displayed.
*/
protected var _originalSkinHeight:Number = NaN;
/**
* @private
*/
protected var _backgroundSkin:DisplayObject;
/**
* A display object displayed behind the header's content.
*/
public function get backgroundSkin():DisplayObject
{
return this._backgroundSkin;
}
/**
* @private
*/
public function set backgroundSkin(value:DisplayObject):void
{
if(this._backgroundSkin == value)
{
return;
}
if(this._backgroundSkin && this._backgroundSkin != this._backgroundDisabledSkin &&
this._backgroundSkin != this._backgroundFocusedSkin)
{
this.removeChild(this._backgroundSkin);
}
this._backgroundSkin = value;
if(this._backgroundSkin && this._backgroundSkin.parent != this)
{
this._backgroundSkin.visible = false;
this._backgroundSkin.touchable = false;
this.addChildAt(this._backgroundSkin, 0);
}
this.invalidate(INVALIDATION_FLAG_SKIN);
}
/**
* @private
*/
protected var _backgroundFocusedSkin:DisplayObject;
/**
* A display object displayed behind the header's content when the
* TextInput has focus.
*/
public function get backgroundFocusedSkin():DisplayObject
{
return this._backgroundFocusedSkin;
}
/**
* @private
*/
public function set backgroundFocusedSkin(value:DisplayObject):void
{
if(this._backgroundFocusedSkin == value)
{
return;
}
if(this._backgroundFocusedSkin && this._backgroundFocusedSkin != this._backgroundSkin &&
this._backgroundFocusedSkin != this._backgroundDisabledSkin)
{
this.removeChild(this._backgroundFocusedSkin);
}
this._backgroundFocusedSkin = value;
if(this._backgroundFocusedSkin && this._backgroundFocusedSkin.parent != this)
{
this._backgroundFocusedSkin.visible = false;
this._backgroundFocusedSkin.touchable = false;
this.addChildAt(this._backgroundFocusedSkin, 0);
}
this.invalidate(INVALIDATION_FLAG_SKIN);
}
/**
* @private
*/
protected var _backgroundDisabledSkin:DisplayObject;
/**
* A background to display when the header is disabled.
*/
public function get backgroundDisabledSkin():DisplayObject
{
return this._backgroundDisabledSkin;
}
/**
* @private
*/
public function set backgroundDisabledSkin(value:DisplayObject):void
{
if(this._backgroundDisabledSkin == value)
{
return;
}
if(this._backgroundDisabledSkin && this._backgroundDisabledSkin != this._backgroundSkin &&
this._backgroundDisabledSkin != this._backgroundFocusedSkin)
{
this.removeChild(this._backgroundDisabledSkin);
}
this._backgroundDisabledSkin = value;
if(this._backgroundDisabledSkin && this._backgroundDisabledSkin.parent != this)
{
this._backgroundDisabledSkin.visible = false;
this._backgroundDisabledSkin.touchable = false;
this.addChildAt(this._backgroundDisabledSkin, 0);
}
this.invalidate(INVALIDATION_FLAG_SKIN);
}
/**
* Quickly sets all padding properties to the same value. The
* `padding` getter always returns the value of
* `paddingTop`, but the other padding values may be
* different.
*/
public function get padding():Number
{
return this._paddingTop;
}
/**
* @private
*/
public function set padding(value:Number):void
{
this.paddingTop = value;
this.paddingRight = value;
this.paddingBottom = value;
this.paddingLeft = value;
}
/**
* @private
*/
protected var _paddingTop:Number = 0;
/**
* The minimum space, in pixels, between the input's top edge and the
* input's content.
*/
public function get paddingTop():Number
{
return this._paddingTop;
}
/**
* @private
*/
public function set paddingTop(value:Number):void
{
if(this._paddingTop == value)
{
return;
}
this._paddingTop = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _paddingRight:Number = 0;
/**
* The minimum space, in pixels, between the input's right edge and the
* input's content.
*/
public function get paddingRight():Number
{
return this._paddingRight;
}
/**
* @private
*/
public function set paddingRight(value:Number):void
{
if(this._paddingRight == value)
{
return;
}
this._paddingRight = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _paddingBottom:Number = 0;
/**
* The minimum space, in pixels, between the input's bottom edge and
* the input's content.
*/
public function get paddingBottom():Number
{
return this._paddingBottom;
}
/**
* @private
*/
public function set paddingBottom(value:Number):void
{
if(this._paddingBottom == value)
{
return;
}
this._paddingBottom = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
*/
protected var _paddingLeft:Number = 0;
/**
* The minimum space, in pixels, between the input's left edge and the
* input's content.
*/
public function get paddingLeft():Number
{
return this._paddingLeft;
}
/**
* @private
*/
public function set paddingLeft(value:Number):void
{
if(this._paddingLeft == value)
{
return;
}
this._paddingLeft = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @private
* Flag indicating that the text editor should get focus after it is
* created.
*/
protected var _isWaitingToSetFocus:Boolean = false;
/**
* @private
*/
protected var _pendingSelectionStartIndex:int = -1;
/**
* @private
*/
protected var _pendingSelectionEndIndex:int = -1;
/**
* @private
*/
protected var _oldMouseCursor:String = null;
/**
* @private
*/
protected var _textEditorProperties:Dictionary.<String, Object>;
/**
* A set of key/value pairs to be passed down to the text input's
* text editor. The text editor is an `ITextEditor` instance
* that is created by `textEditorFactory`.
*
* If the subcomponent has its own subcomponents, their properties
* can be set too, using attribute `@` notation. For example,
* to set the skin on the thumb of a `SimpleScrollBar`
* which is in a `Scroller` which is in a `List`,
* you can use the following syntax:
* `list.scrollerProperties.@verticalScrollBarProperties.@thumbProperties.defaultSkin = new Image(texture);`
*
* Setting properties in a `textEditorFactory` function
* instead of using `textEditorProperties` will result in
* better performance.
*
* @see #textEditorFactory
* @see feathers.core.ITextEditor
*/
public function get textEditorProperties():Dictionary.<String, Object>
{
if(!this._textEditorProperties)
{
this._textEditorProperties = new Dictionary.<String, Object>;
}
return this._textEditorProperties;
}
/**
* @private
*/
public function set textEditorProperties(value:Dictionary.<String, Object>):void
{
if(this._textEditorProperties == value)
{
return;
}
this._textEditorProperties = value;
this.invalidate(INVALIDATION_FLAG_STYLES);
}
/**
* @inheritDoc
*/
override public function showFocus():void
{
this.selectRange(0, this._text.length);
super.showFocus();
}
/**
* Focuses the text input control so that it may be edited.
*/
public function setFocus():void
{
if(this._textEditorHasFocus)
{
return;
}
if(this.textEditor)
{
this._isWaitingToSetFocus = false;
this.textEditor.setFocus();
}
else
{
this._isWaitingToSetFocus = true;
this.invalidate(INVALIDATION_FLAG_SELECTED);
}
}
/**
* Sets the range of selected characters. If both values are the same,
* or the end index is `-1`, the text insertion position is
* changed and nothing is selected.
*/
public function selectRange(startIndex:int, endIndex:int = -1):void
{
if(endIndex < 0)
{
endIndex = startIndex;
}
if(startIndex < 0)
{
Debug.assert("Expected start index >= 0. Received " + startIndex + ".");
}
if(endIndex > this._text.length)
{
Debug.assert("Expected start index > " + this._text.length + ". Received " + endIndex + ".");
}
if(this.textEditor)
{
this._pendingSelectionStartIndex = -1;
this._pendingSelectionEndIndex = -1;
this.textEditor.selectRange(startIndex, endIndex);
}
else
{
this._pendingSelectionStartIndex = startIndex;
this._pendingSelectionEndIndex = endIndex;
this.invalidate(INVALIDATION_FLAG_SELECTED);
}
}
/**
* @private
*/
override protected function draw():void
{
const stateInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_STATE);
const stylesInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_STYLES);
const dataInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_DATA);
const skinInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_SKIN);
var sizeInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_SIZE);
const textEditorInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_TEXT_EDITOR);
const promptFactoryInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_PROMPT_FACTORY);
const focusInvalid:Boolean = this.isInvalid(INVALIDATION_FLAG_FOCUS);
if(textEditorInvalid)
{
this.createTextEditor();
}
if(promptFactoryInvalid)
{
this.createPrompt();
}
if(textEditorInvalid || stylesInvalid)
{
this.refreshTextEditorProperties();
}
if(promptFactoryInvalid || stylesInvalid)
{
this.refreshPromptProperties();
}
if(textEditorInvalid || dataInvalid)
{
const oldIgnoreTextChanges:Boolean = this._ignoreTextChanges;
this._ignoreTextChanges = true;
this.textEditor.text = this._text;
this._ignoreTextChanges = oldIgnoreTextChanges;
}
if(promptFactoryInvalid || dataInvalid)
{
this.promptTextRenderer.visible = this._prompt && !this._text;
}
if(textEditorInvalid || stateInvalid)
{
this.textEditor.isEnabled = this._isEnabled;
/*if(!this._isEnabled && Mouse.supportsNativeCursor && this._oldMouseCursor)
{
Mouse.cursor = this._oldMouseCursor;
this._oldMouseCursor = null;
}*/
}
if(textEditorInvalid || stateInvalid || skinInvalid)
{
this.refreshBackground();
}
sizeInvalid = this.autoSizeIfNeeded() || sizeInvalid;
if(textEditorInvalid || promptFactoryInvalid || sizeInvalid || stylesInvalid || skinInvalid || stateInvalid)
{
this.layout();
}
if(sizeInvalid || focusInvalid)
{
this.refreshFocusIndicator();
}
this.doPendingActions();
if(text && text.length > 0 || _textEditorHasFocus)
{
if(promptTextRenderer) promptTextRenderer.visible = false;
if(textEditor) textEditor.visible = true;
layout();
}
else
{
if(promptTextRenderer) promptTextRenderer.visible = true;
if(textEditor) textEditor.visible = false;
layout();
}
}
/**
* @private
*/
protected function autoSizeIfNeeded():Boolean
{
const needsWidth:Boolean = isNaN(this.explicitWidth);
const needsHeight:Boolean = isNaN(this.explicitHeight);
if(!needsWidth && !needsHeight)
{
return false;
}
var typicalTextWidth:Number = 0;
var typicalTextHeight:Number = 0;
if(this._typicalText)
{
const oldIgnoreTextChanges:Boolean = this._ignoreTextChanges;
this._ignoreTextChanges = true;
this.textEditor.setSize(NaN, NaN);
this.textEditor.text = this._typicalText;
HELPER_POINT = this.textEditor.measureText();
this.textEditor.text = this._text;
this._ignoreTextChanges = oldIgnoreTextChanges;
typicalTextWidth = HELPER_POINT.x;
typicalTextHeight = HELPER_POINT.y;
}
if(this._prompt)
{
this.promptTextRenderer.setSize(NaN, NaN);
HELPER_POINT = this.promptTextRenderer.measureText();
typicalTextWidth = Math.max(typicalTextWidth, HELPER_POINT.x);
typicalTextHeight = Math.max(typicalTextHeight, HELPER_POINT.y);
}
var newWidth:Number = this.explicitWidth;
var newHeight:Number = this.explicitHeight;
if(needsWidth)
{
newWidth = Math.max(this._originalSkinWidth, typicalTextWidth + this._paddingLeft + this._paddingRight);
}
if(needsHeight)
{
newHeight = Math.max(this._originalSkinHeight, typicalTextHeight + this._paddingTop + this._paddingBottom);
}
if(this._typicalText)
{
this.textEditor.width = this.actualWidth - this._paddingLeft - this._paddingRight;
this.textEditor.height = this.actualHeight - this._paddingTop - this._paddingBottom;
}
return this.setSizeInternal(newWidth, newHeight, false);
}
/**
* @private
*/
protected function createTextEditor():void
{
if(this.textEditor)
{
this.removeChild(DisplayObject(this.textEditor), true);
this.textEditor.removeEventListener(Event.CHANGE, textEditor_changeHandler);
this.textEditor.removeEventListener(FeathersEventType.ENTER, textEditor_enterHandler);
this.textEditor.removeEventListener(FeathersEventType.FOCUS_IN, textEditor_focusInHandler);
this.textEditor.removeEventListener(FeathersEventType.FOCUS_OUT, textEditor_focusOutHandler);
this.textEditor = null;
}
const factory:Function = this._textEditorFactory != null ? this._textEditorFactory : FeathersControl.defaultTextEditorFactory;
this.textEditor = ITextEditor(factory.call());
this.textEditor.addEventListener(Event.CHANGE, textEditor_changeHandler);
this.textEditor.addEventListener(FeathersEventType.ENTER, textEditor_enterHandler);
this.textEditor.addEventListener(FeathersEventType.FOCUS_IN, textEditor_focusInHandler);
this.textEditor.addEventListener(FeathersEventType.FOCUS_OUT, textEditor_focusOutHandler);
this.addChild(DisplayObject(this.textEditor));
}
/**
* @private
*/
protected function createPrompt():void
{
if(this.promptTextRenderer)
{
this.removeChild(DisplayObject(this.promptTextRenderer), true);
this.promptTextRenderer = null;
}
const factory:Function = this._promptFactory != null ? this._promptFactory : FeathersControl.defaultTextRendererFactory;
this.promptTextRenderer = ITextRenderer(factory.call());
this.addChild(DisplayObject(this.promptTextRenderer));
}
/**
* @private
*/
protected function doPendingActions():void
{
if(this._isWaitingToSetFocus)
{
this._isWaitingToSetFocus = false;
if(!this._textEditorHasFocus)
{
this.textEditor.setFocus();
}
}
if(this._pendingSelectionStartIndex >= 0)
{
const startIndex:int = this._pendingSelectionStartIndex;
const endIndex:int = this._pendingSelectionEndIndex;
this._pendingSelectionStartIndex = -1;
this._pendingSelectionEndIndex = -1;
this.selectRange(startIndex, endIndex);
}
}
/**
* @private
*/
protected function refreshTextEditorProperties():void
{
this.textEditor.displayAsPassword = this._displayAsPassword;
this.textEditor.maxChars = this._maxChars;
this.textEditor.restrict = this._restrict;
this.textEditor.isEditable = (this._isEditable && this._localIsEditable);
this.textEditor.keyboardType = this._keyboardType;
const displayTextEditor:DisplayObject = DisplayObject(this.textEditor);
Dictionary.mapToObject(this._textEditorProperties, displayTextEditor);
}
/**
* @private
*/
protected function refreshPromptProperties():void
{
this.promptTextRenderer.text = this._prompt;
const displayPrompt:DisplayObject = DisplayObject(this.promptTextRenderer);
Dictionary.mapToObject(this._promptProperties, displayPrompt);
}
/**
* @private
*/
protected function refreshBackground():void
{
const useDisabledBackground:Boolean = !this._isEnabled && this._backgroundDisabledSkin;
const useFocusBackground:Boolean = this._textEditorHasFocus && this._backgroundFocusedSkin;
this.currentBackground = this._backgroundSkin;
if(useDisabledBackground)
{
this.currentBackground = this._backgroundDisabledSkin;
}
else if(useFocusBackground)
{
this.currentBackground = this._backgroundFocusedSkin;
}
else
{
if(this._backgroundFocusedSkin)
{
this._backgroundFocusedSkin.visible = false;
this._backgroundFocusedSkin.touchable = false;
}
if(this._backgroundDisabledSkin)
{
this._backgroundDisabledSkin.visible = false;
this._backgroundDisabledSkin.touchable = false;
}
}
if(useDisabledBackground || useFocusBackground)
{
if(this._backgroundSkin)
{
this._backgroundSkin.visible = false;
this._backgroundSkin.touchable = false;
}
}
if(this.currentBackground)
{
if(isNaN(this._originalSkinWidth))
{
this._originalSkinWidth = this.currentBackground.width;
}
if(isNaN(this._originalSkinHeight))
{
this._originalSkinHeight = this.currentBackground.height;
}
}
}
/**
* @private
*/
protected function layout():void
{
if(this.currentBackground)
{
this.currentBackground.visible = true;
this.currentBackground.touchable = true;
this.currentBackground.width = this.actualWidth;
this.currentBackground.height = this.actualHeight;
}
this.textEditor.x = this._paddingLeft;
this.textEditor.y = this._paddingTop;
this.textEditor.width = this.actualWidth - this._paddingLeft - this._paddingRight;
this.textEditor.height = this.actualHeight - this._paddingTop - this._paddingBottom;
this.promptTextRenderer.x = this._paddingLeft;
this.promptTextRenderer.y = this._paddingTop;
this.promptTextRenderer.width = this.actualWidth - this._paddingLeft - this._paddingRight;
this.promptTextRenderer.height = this.actualHeight - this._paddingTop - this._paddingBottom;
}
/**
* @private
*/
protected function setFocusOnTextEditorWithTouch(touch:Touch):void
{
HELPER_POINT = touch.getLocation(this.stage);
const isInBounds:Boolean = this.contains(this.stage.hitTest(HELPER_POINT, true));
if(!this._textEditorHasFocus && isInBounds)
{
HELPER_POINT = this.globalToLocal(HELPER_POINT);
HELPER_POINT.x -= this._paddingLeft;
HELPER_POINT.y -= this._paddingTop;
this._isWaitingToSetFocus = false;
this.textEditor.setFocus();
}
}
/**
* @private
*/
protected function textInput_addedToStageHandler(event:Event):void
{
// We need to validate when put on stage because touch events expect a validated control
validate();
stage.addEventListener(TouchEvent.TOUCH, textInput_touchHandler);
}
/**
* @private
*/
protected function textInput_removedFromStageHandler(event:Event):void
{
stage.removeEventListener(TouchEvent.TOUCH, textInput_touchHandler);
this._textEditorHasFocus = false;
this._isWaitingToSetFocus = false;
this._touchPointID = -1;
/*if(Mouse.supportsNativeCursor && this._oldMouseCursor)
{
Mouse.cursor = this._oldMouseCursor;
this._oldMouseCursor = null;
}*/
}
/**
* @private
*/
protected function textInput_touchHandler(event:TouchEvent):void
{
if(!this._isEnabled)
{
this._touchPointID = -1;
return;
}
var touch:Touch = null;
const touches:Vector.<Touch> = event.getTouches(stage, null, HELPER_TOUCHES_VECTOR);
if (_textEditorHasFocus) {
var clearFocus:Boolean = false;
for each(touch in touches) {
if (!touch.isTouching(this) && touch.phase == TouchPhase.ENDED) {
clearFocus = true;
break;
}
//end hover
/*if(Mouse.supportsNativeCursor && this._oldMouseCursor)
{
Mouse.cursor = this._oldMouseCursor;
this._oldMouseCursor = null;
}*/
}
if (clearFocus) {
this.textEditor.clearFocus();
return;
}
}
if(this._touchPointID >= 0)
{
touch = null;
for each(var currentTouch:Touch in touches)
{
if (!currentTouch.isTouching(this)) continue;
if(currentTouch.id == this._touchPointID)
{
touch = currentTouch;
break;
}
}
if(!touch)
{
HELPER_TOUCHES_VECTOR.length = 0;
return;
}
if(touch.phase == TouchPhase.ENDED)
{
this._touchPointID = -1;
if(this.textEditor.setTouchFocusOnEndedPhase)
{
this.setFocusOnTextEditorWithTouch(touch);
}
}
}
else
{
for each(touch in touches)
{
if (!touch.isTouching(this)) continue;
if(touch.phase == TouchPhase.BEGAN)
{
this._touchPointID = touch.id;
if(!this.textEditor.setTouchFocusOnEndedPhase)
{
this.setFocusOnTextEditorWithTouch(touch);
}
break;
}
else if(touch.phase == TouchPhase.HOVER)
{
/*if(Mouse.supportsNativeCursor && !this._oldMouseCursor)
{
this._oldMouseCursor = Mouse.cursor;
Mouse.cursor = MouseCursor.IBEAM;
}*/
break;
}
}
}
HELPER_TOUCHES_VECTOR.length = 0;
}
/**
* @private
*/
override protected function focusInHandler(event:Event):void
{
super.focusInHandler(event);
this.setFocus();
}
/**
* @private
*/
override protected function focusOutHandler(event:Event):void
{
super.focusOutHandler(event);
this.textEditor.clearFocus();
}
/**
* @private
*/
protected function textEditor_changeHandler(event:Event):void
{
if(this._ignoreTextChanges)
{
return;
}
this.text = this.textEditor.text;
}
/**
* @private
*/
protected function textEditor_enterHandler(event:Event):void
{
this.dispatchEventWith(FeathersEventType.ENTER);
}
/**
* @private
*/
protected function textEditor_focusInHandler(event:Event):void
{
this._textEditorHasFocus = true;
this._localIsEditable = true; // Workaround Hack
this.refreshTextEditorProperties(); // Workaround Hack
this._touchPointID = -1;
this.invalidate(INVALIDATION_FLAG_STATE);
if(this._focusManager)
{
this._focusManager.focus = this;
}
else
{
this.dispatchEventWith(FeathersEventType.FOCUS_IN);
}
}
/**
* @private
*/
protected function textEditor_focusOutHandler(event:Event):void
{
this._textEditorHasFocus = false;
this._localIsEditable = false; // Workaround Hack
this.refreshTextEditorProperties(); // Workaround Hack
this.invalidate(INVALIDATION_FLAG_STATE);
if(this._focusManager)
{
if(this._focusManager.focus == this)
{
this._focusManager.focus = null;
}
}
else
{
this.dispatchEventWith(FeathersEventType.FOCUS_OUT);
}
}
}
}
| {
"pile_set_name": "Github"
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class BoolList : List<bool>
{
public BoolList() { }
public BoolList(int capacity) : base(capacity) { }
public BoolList(IEnumerable<bool> coll) : base(coll) { }
}
public class CharList : List<char>
{
public CharList() { }
public CharList(int capacity) : base(capacity) { }
public CharList(IEnumerable<char> coll) : base(coll) { }
}
public class ByteList : List<byte>
{
public ByteList() { }
public ByteList(int capacity) : base(capacity) { }
public ByteList(IEnumerable<byte> coll) : base(coll) { }
}
public class SbyteList : List<sbyte>
{
public SbyteList() { }
public SbyteList(int capacity) : base(capacity) { }
public SbyteList(IEnumerable<sbyte> coll) : base(coll) { }
}
public class ShortList : List<short>
{
public ShortList() { }
public ShortList(int capacity) : base(capacity) { }
public ShortList(IEnumerable<short> coll) : base(coll) { }
}
public class UshortList : List<ushort>
{
public UshortList() { }
public UshortList(int capacity) : base(capacity) { }
public UshortList(IEnumerable<ushort> coll) : base(coll) { }
}
public class UintList : List<uint>
{
public UintList() { }
public UintList(int capacity) : base(capacity) { }
public UintList(IEnumerable<uint> coll) : base(coll) { }
}
public class LongList : List<long>
{
public LongList() { }
public LongList(int capacity) : base(capacity) { }
public LongList(IEnumerable<long> coll) : base(coll) { }
}
public class UlongList : List<ulong>
{
public UlongList() { }
public UlongList(int capacity) : base(capacity) { }
public UlongList(IEnumerable<ulong> coll) : base(coll) { }
}
public class DoubleList : List<double>
{
public DoubleList() { }
public DoubleList(int capacity) : base(capacity) { }
public DoubleList(IEnumerable<double> coll) : base(coll) { }
}
public class IntList : List<int>
{
public IntList() { }
public IntList(int capacity) : base(capacity) { }
public IntList(IEnumerable<int> coll) : base(coll) { }
}
public class FloatList : List<float>
{
public FloatList() { }
public FloatList(int capacity) : base(capacity) { }
public FloatList(IEnumerable<float> coll) : base(coll) { }
}
public class StrList : List<string>
{
public StrList() { }
public StrList(int capacity) : base(capacity) { }
public StrList(IEnumerable<string> coll) : base(coll) { }
}
public class ObjList : List<object>
{
public ObjList() { }
public ObjList(int capacity) : base(capacity) { }
public ObjList(IEnumerable<object> coll) : base(coll) { }
}
public class IntIntDict : Dictionary<int, int>
{
public IntIntDict() { }
public IntIntDict(int capacity) : base(capacity) { }
public IntIntDict(IDictionary<int, int> dict) : base(dict) { }
}
public class IntFloatDict : Dictionary<int, float>
{
public IntFloatDict() { }
public IntFloatDict(int capacity) : base(capacity) { }
public IntFloatDict(IDictionary<int, float> dict) : base(dict) { }
}
public class IntStrDict : Dictionary<int, string>
{
public IntStrDict() { }
public IntStrDict(int capacity) : base(capacity) { }
public IntStrDict(IDictionary<int, string> dict) : base(dict) { }
}
public class IntObjDict : Dictionary<int, object>
{
public IntObjDict() { }
public IntObjDict(int capacity) : base(capacity) { }
public IntObjDict(IDictionary<int, object> dict) : base(dict) { }
}
public class StrIntDict : Dictionary<string, int>
{
public StrIntDict() { }
public StrIntDict(int capacity) : base(capacity) { }
public StrIntDict(IDictionary<string, int> dict) : base(dict) { }
}
public class StrFloatDict : Dictionary<string, float>
{
public StrFloatDict() { }
public StrFloatDict(int capacity) : base(capacity) { }
public StrFloatDict(IDictionary<string, float> dict) : base(dict) { }
}
public class StrStrDict : Dictionary<string, string>
{
public StrStrDict() { }
public StrStrDict(int capacity) : base(capacity) { }
public StrStrDict(IDictionary<string, string> dict) : base(dict) { }
}
public class StrObjDict : Dictionary<string, object>
{
public StrObjDict() { }
public StrObjDict(int capacity) : base(capacity) { }
public StrObjDict(IDictionary<string, object> dict) : base(dict) { }
}
public class ObjIntDict : Dictionary<object, int>
{
public ObjIntDict() { }
public ObjIntDict(int capacity) : base(capacity) { }
public ObjIntDict(IDictionary<object, int> dict) : base(dict) { }
}
public class ObjFloatDict : Dictionary<object, float>
{
public ObjFloatDict() { }
public ObjFloatDict(int capacity) : base(capacity) { }
public ObjFloatDict(IDictionary<object, float> dict) : base(dict) { }
}
public class ObjStrDict : Dictionary<object, string>
{
public ObjStrDict() { }
public ObjStrDict(int capacity) : base(capacity) { }
public ObjStrDict(IDictionary<object, string> dict) : base(dict) { }
}
public class ObjObjDict : Dictionary<object, object>
{
public ObjObjDict() { }
public ObjObjDict(int capacity) : base(capacity) { }
public ObjObjDict(IDictionary<object, object> dict) : base(dict) { }
}
public class IntHashSet : HashSet<int>
{
public IntHashSet() { }
public IntHashSet(IEnumerable<int> coll) : base(coll) { }
}
public class StrHashSet : HashSet<string>
{
public StrHashSet() { }
public StrHashSet(IEnumerable<string> coll) : base(coll) { }
}
public class ObjHashSet : HashSet<object>
{
public ObjHashSet() { }
public ObjHashSet(IEnumerable<object> coll) : base(coll) { }
}
public class IntQueue : Queue<int>
{
public IntQueue() { }
public IntQueue(int capacity) : base(capacity) { }
public IntQueue(IEnumerable<int> coll) : base(coll) { }
}
public class ObjQueue : Queue<object>
{
public ObjQueue() { }
public ObjQueue(int capacity) : base(capacity) { }
public ObjQueue(IEnumerable<object> coll) : base(coll) { }
}
public class StrQueue : Queue<string>
{
public StrQueue() { }
public StrQueue(int capacity) : base(capacity) { }
public StrQueue(IEnumerable<string> coll) : base(coll) { }
}
public class IntStack : Stack<int>
{
public IntStack() { }
public IntStack(int capacity) : base(capacity) { }
public IntStack(IEnumerable<int> coll) : base(coll) { }
}
public class ObjStack : Stack<object>
{
public ObjStack() { }
public ObjStack(int capacity) : base(capacity) { }
public ObjStack(IEnumerable<object> coll) : base(coll) { }
}
public class StrStack : Stack<string>
{
public StrStack() { }
public StrStack(int capacity) : base(capacity) { }
public StrStack(IEnumerable<string> coll) : base(coll) { }
}
public class IntObjSortedDict : SortedDictionary<int, object>
{
public IntObjSortedDict() { }
public IntObjSortedDict(IDictionary<int, object> dict) : base(dict) { }
}
public class Vector2List : List<ScriptRuntime.Vector2>
{
public Vector2List() { }
public Vector2List(int capacity) : base(capacity) { }
public Vector2List(ICollection<ScriptRuntime.Vector2> coll) : base(coll) { }
}
public class Vector3List : List<ScriptRuntime.Vector3>
{
public Vector3List() { }
public Vector3List(int capacity) : base(capacity) { }
public Vector3List(ICollection<ScriptRuntime.Vector3> coll) : base(coll) { }
}
| {
"pile_set_name": "Github"
} |
// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.firebase.firestore.model;
/**
* The result of a lookup for a given path may be an existing document or a marker that this
* document does not exist at a given version.
*/
public abstract class MaybeDocument {
private final DocumentKey key;
private final SnapshotVersion version;
MaybeDocument(DocumentKey key, SnapshotVersion version) {
this.key = key;
this.version = version;
}
/** The key for this document */
public DocumentKey getKey() {
return key;
}
/**
* Returns the version of this document if it exists or a version at which this document was
* guaranteed to not exist.
*/
public SnapshotVersion getVersion() {
return version;
}
/**
* Whether this document has a local mutation applied that has not yet been acknowledged by Watch.
*/
public abstract boolean hasPendingWrites();
}
| {
"pile_set_name": "Github"
} |
/* EXTRAS
* -------------------------- */
/* Stacked and layered icon */
/* Animated rotating icon */
.#{$fa-css-prefix}-spin {
-webkit-animation: spin 2s infinite linear;
-moz-animation: spin 2s infinite linear;
-o-animation: spin 2s infinite linear;
animation: spin 2s infinite linear;
}
@-moz-keyframes spin {
0% { -moz-transform: rotate(0deg); }
100% { -moz-transform: rotate(359deg); }
}
@-webkit-keyframes spin {
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(359deg); }
}
@-o-keyframes spin {
0% { -o-transform: rotate(0deg); }
100% { -o-transform: rotate(359deg); }
}
@-ms-keyframes spin {
0% { -ms-transform: rotate(0deg); }
100% { -ms-transform: rotate(359deg); }
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(359deg); }
}
// Icon rotations & flipping
// -------------------------
.#{$fa-css-prefix}-rotate-90 { @include fa-icon-rotate(90deg, 1); }
.#{$fa-css-prefix}-rotate-180 { @include fa-icon-rotate(180deg, 2); }
.#{$fa-css-prefix}-rotate-270 { @include fa-icon-rotate(270deg, 3); }
.#{$fa-css-prefix}-flip-horizontal { @include fa-icon-flip(-1, 1, 0); }
.#{$fa-css-prefix}-flip-vertical { @include fa-icon-flip(1, -1, 2); }
| {
"pile_set_name": "Github"
} |
### [Overview](/api_docs/index.md)
### [Python API](/api_docs/python/index.md)
python/framework.md
python/constant_op.md
python/state_ops.md
python/array_ops.md
python/math_ops.md
python/control_flow_ops.md
python/image.md
python/sparse_ops.md
python/io_ops.md
python/python_io.md
python/nn.md
python/client.md
python/train.md
python/script_ops.md
python/test.md
python/contrib.layers.md
python/contrib.losses.md
python/contrib.metrics.md
python/contrib.learn.md
python/contrib.framework.md
python/contrib.util.md
>>> [C++ API](/api_docs/cc/index.md)
cc/ClassEnv.md
cc/ClassRandomAccessFile.md
cc/ClassWritableFile.md
cc/ClassEnvWrapper.md
cc/ClassSession.md
cc/StructSessionOptions.md
cc/ClassStatus.md
cc/StructState.md
cc/ClassTensor.md
cc/ClassTensorShape.md
cc/StructTensorShapeDim.md
cc/ClassTensorShapeUtils.md
cc/ClassPartialTensorShape.md
cc/ClassPartialTensorShapeUtils.md
cc/ClassThread.md
cc/StructThreadOptions.md
| {
"pile_set_name": "Github"
} |
<component name="ArtifactManager">
<artifact type="exploded-war" name="seckill:war exploded">
<output-path>$PROJECT_DIR$/target/seckill</output-path>
<root id="root">
<element id="directory" name="WEB-INF">
<element id="directory" name="classes">
<element id="module-output" name="seckill" />
</element>
<element id="directory" name="lib">
<element id="library" level="project" name="Maven: junit:junit:4.11" />
<element id="library" level="project" name="Maven: org.hamcrest:hamcrest-core:1.3" />
<element id="library" level="project" name="Maven: ch.qos.logback:logback-classic:1.1.1" />
<element id="library" level="project" name="Maven: ch.qos.logback:logback-core:1.1.1" />
<element id="library" level="project" name="Maven: org.slf4j:slf4j-api:1.7.6" />
<element id="library" level="project" name="Maven: mysql:mysql-connector-java:5.1.37" />
<element id="library" level="project" name="Maven: c3p0:c3p0:0.9.1.2" />
<element id="library" level="project" name="Maven: org.mybatis:mybatis:3.3.0" />
<element id="library" level="project" name="Maven: org.mybatis:mybatis-spring:1.2.3" />
<element id="library" level="project" name="Maven: taglibs:standard:1.1.2" />
<element id="library" level="project" name="Maven: jstl:jstl:1.2" />
<element id="library" level="project" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.5.4" />
<element id="library" level="project" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.5.0" />
<element id="library" level="project" name="Maven: com.fasterxml.jackson.core:jackson-core:2.5.4" />
<element id="library" level="project" name="Maven: javax.servlet:javax.servlet-api:3.1.0" />
<element id="library" level="project" name="Maven: org.springframework:spring-core:4.1.7.RELEASE" />
<element id="library" level="project" name="Maven: commons-logging:commons-logging:1.2" />
<element id="library" level="project" name="Maven: org.springframework:spring-beans:4.1.7.RELEASE" />
<element id="library" level="project" name="Maven: org.springframework:spring-context:4.1.7.RELEASE" />
<element id="library" level="project" name="Maven: org.springframework:spring-aop:4.1.7.RELEASE" />
<element id="library" level="project" name="Maven: org.springframework:spring-expression:4.1.7.RELEASE" />
<element id="library" level="project" name="Maven: org.springframework:spring-jdbc:4.1.7.RELEASE" />
<element id="library" level="project" name="Maven: org.springframework:spring-tx:4.1.7.RELEASE" />
<element id="library" level="project" name="Maven: org.springframework:spring-web:4.1.7.RELEASE" />
<element id="library" level="project" name="Maven: org.springframework:spring-webmvc:4.1.7.RELEASE" />
<element id="library" level="project" name="Maven: org.springframework:spring-test:4.1.7.RELEASE" />
<element id="library" level="project" name="Maven: aopalliance:aopalliance:1.0" />
<element id="library" level="project" name="Maven: org.springframework:spring-aspects:4.2.0.RELEASE" />
<element id="library" level="project" name="Maven: org.aspectj:aspectjweaver:1.8.6" />
<element id="library" level="project" name="Maven: redis.clients:jedis:2.7.3" />
<element id="library" level="project" name="Maven: org.apache.commons:commons-pool2:2.3" />
<element id="library" level="project" name="Maven: com.dyuproject.protostuff:protostuff-core:1.0.8" />
<element id="library" level="project" name="Maven: com.dyuproject.protostuff:protostuff-api:1.0.8" />
<element id="library" level="project" name="Maven: javax:javaee-api:7.0" />
<element id="library" level="project" name="Maven: com.sun.mail:javax.mail:1.5.0" />
<element id="library" level="project" name="Maven: javax.activation:activation:1.1" />
<element id="library" level="project" name="Maven: com.dyuproject.protostuff:protostuff-runtime:1.0.8" />
<element id="library" level="project" name="Maven: com.dyuproject.protostuff:protostuff-collectionschema:1.0.8" />
<element id="library" level="project" name="Maven: commons-collections:commons-collections:3.2" />
</element>
</element>
<element id="directory" name="META-INF">
<element id="file-copy" path="$PROJECT_DIR$/target/seckill/META-INF/MANIFEST.MF" />
</element>
<element id="javaee-facet-resources" facet="seckill/web/Web" />
</root>
</artifact>
</component> | {
"pile_set_name": "Github"
} |
package com.xzp.forum.async;
public enum EventType {
COMMENT(0),
USEFUL(1),
LOGIN(2);
private int value;
EventType(int value){
this.value=value;
}
public int getValue() {
return value;
}
}
| {
"pile_set_name": "Github"
} |
/*
Copyright (C) 2018-2019 [email protected]
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#if ENCODER && BLOCK_ENCODER && CODE_ASSEMBLER
using System;
namespace Iced.Intel {
/// <summary>
/// Assembler operand flags.
/// </summary>
[Flags]
enum AssemblerOperandFlags {
/// <summary>
/// No flags.
/// </summary>
None = 0,
/// <summary>
/// Broadcast.
/// </summary>
Broadcast = 1,
/// <summary>
/// Zeroing mask.
/// </summary>
Zeroing = 1 << 1,
/// <summary>
/// Suppress all exceptions (.sae).
/// </summary>
SuppressAllExceptions = 1 << 2,
/// <summary>
/// Round to nearest (.rn_sae).
/// </summary>
RoundToNearest = RoundingControl.RoundToNearest << 3,
/// <summary>
/// Round to down (.rd_sae).
/// </summary>
RoundDown = RoundingControl.RoundDown << 3,
/// <summary>
/// Round to up (.ru_sae).
/// </summary>
RoundUp = RoundingControl.RoundUp << 3,
/// <summary>
/// Round towards zero (.rz_sae).
/// </summary>
RoundTowardZero = RoundingControl.RoundTowardZero << 3,
/// <summary>
/// RoundControl mask.
/// </summary>
RoundControlMask = 0x7 << 3,
/// <summary>
/// Mask register K1.
/// </summary>
K1 = 1 << 6,
/// <summary>
/// Mask register K2.
/// </summary>
K2 = 2 << 6,
/// <summary>
/// Mask register K3.
/// </summary>
K3 = 3 << 6,
/// <summary>
/// Mask register K4.
/// </summary>
K4 = 4 << 6,
/// <summary>
/// Mask register K5.
/// </summary>
K5 = 5 << 6,
/// <summary>
/// Mask register K6.
/// </summary>
K6 = 6 << 6,
/// <summary>
/// Mask register K7.
/// </summary>
K7 = 7 << 6,
/// <summary>
/// Mask for K registers.
/// </summary>
RegisterMask = 0x7 << 6,
}
}
#endif
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) Lightbend Inc. <https://www.lightbend.com>
*/
package javaguide.di.guice.eager;
import javaguide.di.*;
// #eager-guice-module
import com.google.inject.AbstractModule;
public class StartModule extends AbstractModule {
protected void configure() {
bind(ApplicationStart.class).asEagerSingleton();
}
}
// #eager-guice-module
| {
"pile_set_name": "Github"
} |
import "mocha";
import { expect } from "chai";
import { TIP } from "../../src/lib/searcher";
describe("TIP", function () {
const subject = new TIP();
it("should support ip and domain", function () {
expect(subject.supportedTypes).to.deep.equal(["ip", "domain"]);
});
describe("#searchByIP", function () {
const ip = "1.1.1.1";
it("should return a URL", function () {
expect(subject.searchByIP(ip)).to.equal(
`https://threatintelligenceplatform.com/report/${ip}/`
);
});
});
describe("#searchByDomain", function () {
const domain = "github.com";
it("should return a URL", function () {
expect(subject.searchByDomain(domain)).to.equal(
`https://threatintelligenceplatform.com/report/${domain}/`
);
});
});
});
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html lang="en">
<head>
<title>AnyNodeDescriptionWithChildren Protocol Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Protocol/AnyNodeDescriptionWithChildren" class="dashAnchor"></a>
<a title="AnyNodeDescriptionWithChildren Protocol Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">Katana Docs</a> (99% documented)</p>
<p class="header-right"><a href="https://github.com/BendingSpoons/katana-swift"><img src="../img/gh.png"/>View on GitHub</a></p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html">Katana Reference</a>
<img id="carat" src="../img/carat.png" />
AnyNodeDescriptionWithChildren Protocol Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/EmptySideEffectDependencyContainer.html">EmptySideEffectDependencyContainer</a>
</li>
<li class="nav-group-task">
<a href="../Classes/Node.html">Node</a>
</li>
<li class="nav-group-task">
<a href="../Classes/PlasticNode.html">PlasticNode</a>
</li>
<li class="nav-group-task">
<a href="../Classes/PlasticView.html">PlasticView</a>
</li>
<li class="nav-group-task">
<a href="../Classes/Renderer.html">Renderer</a>
</li>
<li class="nav-group-task">
<a href="../Classes/StateMockProvider.html">StateMockProvider</a>
</li>
<li class="nav-group-task">
<a href="../Classes/Store.html">Store</a>
</li>
<li class="nav-group-task">
<a href="../Classes/ViewsContainer.html">ViewsContainer</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enums</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/AnimationType.html">AnimationType</a>
</li>
<li class="nav-group-task">
<a href="../Enums/AsyncActionState.html">AsyncActionState</a>
</li>
<li class="nav-group-task">
<a href="../Enums.html#/s:O6Katana9EmptyKeys">EmptyKeys</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/CGSize.html">CGSize</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UIView.html">UIView</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/Action.html">Action</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/ActionWithSideEffect.html">ActionWithSideEffect</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/AnyAsyncAction.html">AnyAsyncAction</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/AnyConnectedNodeDescription.html">AnyConnectedNodeDescription</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/AnyNode.html">AnyNode</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/AnyNodeDescription.html">AnyNodeDescription</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/AnyNodeDescriptionProps.html">AnyNodeDescriptionProps</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/AnyNodeDescriptionWithChildren.html">AnyNodeDescriptionWithChildren</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/AnyNodeDescriptionWithRefProps.html">AnyNodeDescriptionWithRefProps</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/AnyPlasticNodeDescription.html">AnyPlasticNodeDescription</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/AnyPlatformNativeViewWithRef.html">AnyPlatformNativeViewWithRef</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/AnyStore.html">AnyStore</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/AsyncAction.html">AsyncAction</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/Childrenable.html">Childrenable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/ConnectedNodeDescription.html">ConnectedNodeDescription</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/LinkeableAction.html">LinkeableAction</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/NativeViewRef.html">NativeViewRef</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/NativeViewWithRef.html">NativeViewWithRef</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/NodeDescription.html">NodeDescription</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/NodeDescriptionProps.html">NodeDescriptionProps</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/NodeDescriptionState.html">NodeDescriptionState</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/NodeDescriptionWithChildren.html">NodeDescriptionWithChildren</a>
</li>
<li class="nav-group-task">
<a href="../Protocols.html#/s:P6Katana22NodeDescriptionWithRef">NodeDescriptionWithRef</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/NodeDescriptionWithRefProps.html">NodeDescriptionWithRefProps</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/PlasticNodeDescription.html">PlasticNodeDescription</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/PlasticReferenceSizeable.html">PlasticReferenceSizeable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/PlatformNativeView.html">PlatformNativeView</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/SideEffectDependencyContainer.html">SideEffectDependencyContainer</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/State.html">State</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structs</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ActionLinker.html">ActionLinker</a>
</li>
<li class="nav-group-task">
<a href="../Structs/ActionLinks.html">ActionLinks</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Anchor.html">Anchor</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Anchor/Kind.html">– Kind</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Animation.html">Animation</a>
</li>
<li class="nav-group-task">
<a href="../Structs/AnimationContainer.html">AnimationContainer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/AnimationOptions.html">AnimationOptions</a>
</li>
<li class="nav-group-task">
<a href="../Structs/AnimationProps.html">AnimationProps</a>
</li>
<li class="nav-group-task">
<a href="../Structs/ChildrenAnimations.html">ChildrenAnimations</a>
</li>
<li class="nav-group-task">
<a href="../Structs/EdgeInsets.html">EdgeInsets</a>
</li>
<li class="nav-group-task">
<a href="../Structs/EmptyProps.html">EmptyProps</a>
</li>
<li class="nav-group-task">
<a href="../Structs/EmptyState.html">EmptyState</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Size.html">Size</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Value.html">Value</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Typealiases.html">Typealiases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Typealiases.html#/s:6Katana25AnimationPropsTransformer">AnimationPropsTransformer</a>
</li>
<li class="nav-group-task">
<a href="../Typealiases.html#/s:6Katana21AnyRefCallbackClosure">AnyRefCallbackClosure</a>
</li>
<li class="nav-group-task">
<a href="../Typealiases.html#/s:6Katana20NodeUpdateCompletion">NodeUpdateCompletion</a>
</li>
<li class="nav-group-task">
<a href="../Typealiases.html#/s:6Katana18RefCallbackClosure">RefCallbackClosure</a>
</li>
<li class="nav-group-task">
<a href="../Typealiases.html#/s:6Katana13StoreDispatch">StoreDispatch</a>
</li>
<li class="nav-group-task">
<a href="../Typealiases.html#/s:6Katana13StoreListener">StoreListener</a>
</li>
<li class="nav-group-task">
<a href="../Typealiases.html#/s:6Katana15StoreMiddleware">StoreMiddleware</a>
</li>
<li class="nav-group-task">
<a href="../Typealiases.html#/s:6Katana16StoreUnsubscribe">StoreUnsubscribe</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Associated Types.html">Associated Types</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Associated Types.html#/s:P6Katana27NodeDescriptionWithChildren9PropsType">PropsType</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>AnyNodeDescriptionWithChildren</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">AnyNodeDescriptionWithChildren</span><span class="p">:</span> <span class="kt"><a href="../Protocols/AnyNodeDescription.html">AnyNodeDescription</a></span></code></pre>
</div>
</div>
<p>Type Erasure for <code><a href="../Protocols/NodeDescriptionWithChildren.html">NodeDescriptionWithChildren</a></code></p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:vP6Katana30AnyNodeDescriptionWithChildren8childrenGSaPS_18AnyNodeDescription__"></a>
<a name="//apple_ref/swift/Property/children" class="dashAnchor"></a>
<a class="token" href="#/s:vP6Katana30AnyNodeDescriptionWithChildren8childrenGSaPS_18AnyNodeDescription__">children</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>children of the description</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">var</span> <span class="nv">children</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Protocols/AnyNodeDescription.html">AnyNodeDescription</a></span><span class="p">]</span></code></pre>
</div>
</div>
<div class="slightly-smaller">
<a href="https://github.com/BendingSpoons/katana-swift/tree/0.8.3/Katana/Core/NodeDescription/NodeDescriptionWithChildren.swift#L14">Show on GitHub</a>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>© 2017 <a class="link" href="http://bendingspoons.com" target="_blank" rel="external">Bending Spoons Team</a>. All rights reserved. (Last updated: 2017-05-11)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.4</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>
| {
"pile_set_name": "Github"
} |
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2007 Tobias Schwinger
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(FUSION_SEQUENCE_BASE_04182005_0737)
#define FUSION_SEQUENCE_BASE_04182005_0737
#include <boost/config.hpp>
#include <boost/fusion/support/config.hpp>
#include <boost/mpl/begin_end_fwd.hpp>
namespace boost { namespace fusion
{
namespace detail
{
struct from_sequence_convertible_type
{};
}
template <typename Sequence>
struct sequence_base
{
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
Sequence const&
derived() const BOOST_NOEXCEPT
{
return static_cast<Sequence const&>(*this);
}
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
Sequence&
derived() BOOST_NOEXCEPT
{
return static_cast<Sequence&>(*this);
}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
operator detail::from_sequence_convertible_type() const BOOST_NOEXCEPT
{
return detail::from_sequence_convertible_type();
}
};
struct fusion_sequence_tag;
}}
namespace boost { namespace mpl
{
// Deliberately break mpl::begin, so it doesn't lie that a Fusion sequence
// is not an MPL sequence by returning mpl::void_.
// In other words: Fusion Sequences are always MPL Sequences, but they can
// be incompletely defined.
template<> struct begin_impl< boost::fusion::fusion_sequence_tag >;
}}
#endif
| {
"pile_set_name": "Github"
} |
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 44;
objects = {
/* Begin PBXBuildFile section */
22CF11AE0EE9A8840054F513 /* sheep.c in Sources */ = {isa = PBXBuildFile; fileRef = 22CF11AD0EE9A8840054F513 /* sheep.c */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
22CF10220EE984600054F513 /* maxmspsdk.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = maxmspsdk.xcconfig; path = ../../maxmspsdk.xcconfig; sourceTree = SOURCE_ROOT; };
22CF11AD0EE9A8840054F513 /* sheep.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sheep.c; sourceTree = "<group>"; };
2FBBEAE508F335360078DB84 /* sheep.mxo */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = sheep.mxo; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
2FBBEADC08F335360078DB84 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
089C166AFE841209C02AAC07 /* iterator */ = {
isa = PBXGroup;
children = (
22CF10220EE984600054F513 /* maxmspsdk.xcconfig */,
22CF11AD0EE9A8840054F513 /* sheep.c */,
19C28FB4FE9D528D11CA2CBB /* Products */,
);
name = iterator;
sourceTree = "<group>";
};
19C28FB4FE9D528D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
2FBBEAE508F335360078DB84 /* sheep.mxo */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
2FBBEAD708F335360078DB84 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
2FBBEAD608F335360078DB84 /* max-external */ = {
isa = PBXNativeTarget;
buildConfigurationList = 2FBBEAE008F335360078DB84 /* Build configuration list for PBXNativeTarget "max-external" */;
buildPhases = (
2FBBEAD708F335360078DB84 /* Headers */,
2FBBEAD808F335360078DB84 /* Resources */,
2FBBEADA08F335360078DB84 /* Sources */,
2FBBEADC08F335360078DB84 /* Frameworks */,
2FBBEADF08F335360078DB84 /* Rez */,
);
buildRules = (
);
dependencies = (
);
name = "max-external";
productName = iterator;
productReference = 2FBBEAE508F335360078DB84 /* sheep.mxo */;
productType = "com.apple.product-type.bundle";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
089C1669FE841209C02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 2FBBEACF08F335010078DB84 /* Build configuration list for PBXProject "sheep" */;
compatibilityVersion = "Xcode 3.0";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Japanese,
French,
German,
);
mainGroup = 089C166AFE841209C02AAC07 /* iterator */;
projectDirPath = "";
projectRoot = "";
targets = (
2FBBEAD608F335360078DB84 /* max-external */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
2FBBEAD808F335360078DB84 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXRezBuildPhase section */
2FBBEADF08F335360078DB84 /* Rez */ = {
isa = PBXRezBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXRezBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
2FBBEADA08F335360078DB84 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
22CF11AE0EE9A8840054F513 /* sheep.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
2FBBEAD008F335010078DB84 /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
};
name = Development;
};
2FBBEAD108F335010078DB84 /* Deployment */ = {
isa = XCBuildConfiguration;
buildSettings = {
};
name = Deployment;
};
2FBBEAE108F335360078DB84 /* Development */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 22CF10220EE984600054F513 /* maxmspsdk.xcconfig */;
buildSettings = {
COPY_PHASE_STRIP = NO;
GCC_OPTIMIZATION_LEVEL = 0;
OTHER_LDFLAGS = "$(C74_SYM_LINKER_FLAGS)";
};
name = Development;
};
2FBBEAE208F335360078DB84 /* Deployment */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 22CF10220EE984600054F513 /* maxmspsdk.xcconfig */;
buildSettings = {
COPY_PHASE_STRIP = YES;
OTHER_LDFLAGS = "$(C74_SYM_LINKER_FLAGS)";
};
name = Deployment;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
2FBBEACF08F335010078DB84 /* Build configuration list for PBXProject "sheep" */ = {
isa = XCConfigurationList;
buildConfigurations = (
2FBBEAD008F335010078DB84 /* Development */,
2FBBEAD108F335010078DB84 /* Deployment */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Development;
};
2FBBEAE008F335360078DB84 /* Build configuration list for PBXNativeTarget "max-external" */ = {
isa = XCConfigurationList;
buildConfigurations = (
2FBBEAE108F335360078DB84 /* Development */,
2FBBEAE208F335360078DB84 /* Deployment */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Development;
};
/* End XCConfigurationList section */
};
rootObject = 089C1669FE841209C02AAC07 /* Project object */;
}
| {
"pile_set_name": "Github"
} |
好奇心原文链接:[WPP创始人兼CEO苏铭天辞职,4A广告业最后一个大佬的离场意味着什么?_商业_好奇心日报-朱凯麟](https://www.qdaily.com/articles/52259.html)
WebArchive归档链接:[WPP创始人兼CEO苏铭天辞职,4A广告业最后一个大佬的离场意味着什么?_商业_好奇心日报-朱凯麟](http://web.archive.org/web/20181022130759/http://www.qdaily.com:80/articles/52259.html)
 | {
"pile_set_name": "Github"
} |
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Observable_1 = require('../Observable');
var tryCatch_1 = require('../util/tryCatch');
var errorObject_1 = require('../util/errorObject');
var AsyncSubject_1 = require('../AsyncSubject');
/**
* We need this JSDoc comment for affecting ESDoc.
* @extends {Ignored}
* @hide true
*/
var BoundNodeCallbackObservable = (function (_super) {
__extends(BoundNodeCallbackObservable, _super);
function BoundNodeCallbackObservable(callbackFunc, selector, args, context, scheduler) {
_super.call(this);
this.callbackFunc = callbackFunc;
this.selector = selector;
this.args = args;
this.context = context;
this.scheduler = scheduler;
}
/* tslint:enable:max-line-length */
/**
* Converts a Node.js-style callback API to a function that returns an
* Observable.
*
* <span class="informal">It's just like {@link bindCallback}, but the
* callback is expected to be of type `callback(error, result)`.</span>
*
* `bindNodeCallback` is not an operator because its input and output are not
* Observables. The input is a function `func` with some parameters, but the
* last parameter must be a callback function that `func` calls when it is
* done. The callback function is expected to follow Node.js conventions,
* where the first argument to the callback is an error object, signaling
* whether call was successful. If that object is passed to callback, it means
* something went wrong.
*
* The output of `bindNodeCallback` is a function that takes the same
* parameters as `func`, except the last one (the callback). When the output
* function is called with arguments, it will return an Observable.
* If `func` calls its callback with error parameter present, Observable will
* error with that value as well. If error parameter is not passed, Observable will emit
* second parameter. If there are more parameters (third and so on),
* Observable will emit an array with all arguments, except first error argument.
*
* Optionally `bindNodeCallback` accepts selector function, which allows you to
* make resulting Observable emit value computed by selector, instead of regular
* callback arguments. It works similarly to {@link bindCallback} selector, but
* Node.js-style error argument will never be passed to that function.
*
* Note that `func` will not be called at the same time output function is,
* but rather whenever resulting Observable is subscribed. By default call to
* `func` will happen synchronously after subscription, but that can be changed
* with proper {@link Scheduler} provided as optional third parameter. Scheduler
* can also control when values from callback will be emitted by Observable.
* To find out more, check out documentation for {@link bindCallback}, where
* Scheduler works exactly the same.
*
* As in {@link bindCallback}, context (`this` property) of input function will be set to context
* of returned function, when it is called.
*
* After Observable emits value, it will complete immediately. This means
* even if `func` calls callback again, values from second and consecutive
* calls will never appear on the stream. If you need to handle functions
* that call callbacks multiple times, check out {@link fromEvent} or
* {@link fromEventPattern} instead.
*
* Note that `bindNodeCallback` can be used in non-Node.js environments as well.
* "Node.js-style" callbacks are just a convention, so if you write for
* browsers or any other environment and API you use implements that callback style,
* `bindNodeCallback` can be safely used on that API functions as well.
*
* Remember that Error object passed to callback does not have to be an instance
* of JavaScript built-in `Error` object. In fact, it does not even have to an object.
* Error parameter of callback function is interpreted as "present", when value
* of that parameter is truthy. It could be, for example, non-zero number, non-empty
* string or boolean `true`. In all of these cases resulting Observable would error
* with that value. This means usually regular style callbacks will fail very often when
* `bindNodeCallback` is used. If your Observable errors much more often then you
* would expect, check if callback really is called in Node.js-style and, if not,
* switch to {@link bindCallback} instead.
*
* Note that even if error parameter is technically present in callback, but its value
* is falsy, it still won't appear in array emitted by Observable or in selector function.
*
*
* @example <caption>Read a file from the filesystem and get the data as an Observable</caption>
* import * as fs from 'fs';
* var readFileAsObservable = Rx.Observable.bindNodeCallback(fs.readFile);
* var result = readFileAsObservable('./roadNames.txt', 'utf8');
* result.subscribe(x => console.log(x), e => console.error(e));
*
*
* @example <caption>Use on function calling callback with multiple arguments</caption>
* someFunction((err, a, b) => {
* console.log(err); // null
* console.log(a); // 5
* console.log(b); // "some string"
* });
* var boundSomeFunction = Rx.Observable.bindNodeCallback(someFunction);
* boundSomeFunction()
* .subscribe(value => {
* console.log(value); // [5, "some string"]
* });
*
*
* @example <caption>Use with selector function</caption>
* someFunction((err, a, b) => {
* console.log(err); // undefined
* console.log(a); // "abc"
* console.log(b); // "DEF"
* });
* var boundSomeFunction = Rx.Observable.bindNodeCallback(someFunction, (a, b) => a + b);
* boundSomeFunction()
* .subscribe(value => {
* console.log(value); // "abcDEF"
* });
*
*
* @example <caption>Use on function calling callback in regular style</caption>
* someFunction(a => {
* console.log(a); // 5
* });
* var boundSomeFunction = Rx.Observable.bindNodeCallback(someFunction);
* boundSomeFunction()
* .subscribe(
* value => {} // never gets called
* err => console.log(err) // 5
*);
*
*
* @see {@link bindCallback}
* @see {@link from}
* @see {@link fromPromise}
*
* @param {function} func Function with a Node.js-style callback as the last parameter.
* @param {function} [selector] A function which takes the arguments from the
* callback and maps those to a value to emit on the output Observable.
* @param {Scheduler} [scheduler] The scheduler on which to schedule the
* callbacks.
* @return {function(...params: *): Observable} A function which returns the
* Observable that delivers the same values the Node.js callback would
* deliver.
* @static true
* @name bindNodeCallback
* @owner Observable
*/
BoundNodeCallbackObservable.create = function (func, selector, scheduler) {
if (selector === void 0) { selector = undefined; }
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
return new BoundNodeCallbackObservable(func, selector, args, this, scheduler);
};
};
BoundNodeCallbackObservable.prototype._subscribe = function (subscriber) {
var callbackFunc = this.callbackFunc;
var args = this.args;
var scheduler = this.scheduler;
var subject = this.subject;
if (!scheduler) {
if (!subject) {
subject = this.subject = new AsyncSubject_1.AsyncSubject();
var handler = function handlerFn() {
var innerArgs = [];
for (var _i = 0; _i < arguments.length; _i++) {
innerArgs[_i - 0] = arguments[_i];
}
var source = handlerFn.source;
var selector = source.selector, subject = source.subject;
var err = innerArgs.shift();
if (err) {
subject.error(err);
}
else if (selector) {
var result_1 = tryCatch_1.tryCatch(selector).apply(this, innerArgs);
if (result_1 === errorObject_1.errorObject) {
subject.error(errorObject_1.errorObject.e);
}
else {
subject.next(result_1);
subject.complete();
}
}
else {
subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs);
subject.complete();
}
};
// use named function instance to avoid closure.
handler.source = this;
var result = tryCatch_1.tryCatch(callbackFunc).apply(this.context, args.concat(handler));
if (result === errorObject_1.errorObject) {
subject.error(errorObject_1.errorObject.e);
}
}
return subject.subscribe(subscriber);
}
else {
return scheduler.schedule(dispatch, 0, { source: this, subscriber: subscriber, context: this.context });
}
};
return BoundNodeCallbackObservable;
}(Observable_1.Observable));
exports.BoundNodeCallbackObservable = BoundNodeCallbackObservable;
function dispatch(state) {
var self = this;
var source = state.source, subscriber = state.subscriber, context = state.context;
// XXX: cast to `any` to access to the private field in `source`.
var _a = source, callbackFunc = _a.callbackFunc, args = _a.args, scheduler = _a.scheduler;
var subject = source.subject;
if (!subject) {
subject = source.subject = new AsyncSubject_1.AsyncSubject();
var handler = function handlerFn() {
var innerArgs = [];
for (var _i = 0; _i < arguments.length; _i++) {
innerArgs[_i - 0] = arguments[_i];
}
var source = handlerFn.source;
var selector = source.selector, subject = source.subject;
var err = innerArgs.shift();
if (err) {
self.add(scheduler.schedule(dispatchError, 0, { err: err, subject: subject }));
}
else if (selector) {
var result_2 = tryCatch_1.tryCatch(selector).apply(this, innerArgs);
if (result_2 === errorObject_1.errorObject) {
self.add(scheduler.schedule(dispatchError, 0, { err: errorObject_1.errorObject.e, subject: subject }));
}
else {
self.add(scheduler.schedule(dispatchNext, 0, { value: result_2, subject: subject }));
}
}
else {
var value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs;
self.add(scheduler.schedule(dispatchNext, 0, { value: value, subject: subject }));
}
};
// use named function to pass values in without closure
handler.source = source;
var result = tryCatch_1.tryCatch(callbackFunc).apply(context, args.concat(handler));
if (result === errorObject_1.errorObject) {
self.add(scheduler.schedule(dispatchError, 0, { err: errorObject_1.errorObject.e, subject: subject }));
}
}
self.add(subject.subscribe(subscriber));
}
function dispatchNext(arg) {
var value = arg.value, subject = arg.subject;
subject.next(value);
subject.complete();
}
function dispatchError(arg) {
var err = arg.err, subject = arg.subject;
subject.error(err);
}
//# sourceMappingURL=BoundNodeCallbackObservable.js.map | {
"pile_set_name": "Github"
} |
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtWidgets>
#include "droparea.h"
#include "dropsitewindow.h"
//! [constructor part1]
DropSiteWindow::DropSiteWindow()
{
abstractLabel = new QLabel(tr("This example accepts drags from other "
"applications and displays the MIME types "
"provided by the drag object."));
abstractLabel->setWordWrap(true);
abstractLabel->adjustSize();
//! [constructor part1]
//! [constructor part2]
dropArea = new DropArea;
connect(dropArea, &DropArea::changed,
this, &DropSiteWindow::updateFormatsTable);
//! [constructor part2]
//! [constructor part3]
QStringList labels;
labels << tr("Format") << tr("Content");
formatsTable = new QTableWidget;
formatsTable->setColumnCount(2);
formatsTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
formatsTable->setHorizontalHeaderLabels(labels);
formatsTable->horizontalHeader()->setStretchLastSection(true);
//! [constructor part3]
//! [constructor part4]
clearButton = new QPushButton(tr("Clear"));
copyButton = new QPushButton(tr("Copy"));
quitButton = new QPushButton(tr("Quit"));
buttonBox = new QDialogButtonBox;
buttonBox->addButton(clearButton, QDialogButtonBox::ActionRole);
buttonBox->addButton(copyButton, QDialogButtonBox::ActionRole);
#if !QT_CONFIG(clipboard)
copyButton->setVisible(false);
#endif
buttonBox->addButton(quitButton, QDialogButtonBox::RejectRole);
connect(quitButton, &QAbstractButton::clicked, this, &QWidget::close);
connect(clearButton, &QAbstractButton::clicked, dropArea, &DropArea::clear);
connect(copyButton, &QAbstractButton::clicked, this, &DropSiteWindow::copy);
//! [constructor part4]
//! [constructor part5]
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->addWidget(abstractLabel);
mainLayout->addWidget(dropArea);
mainLayout->addWidget(formatsTable);
mainLayout->addWidget(buttonBox);
setWindowTitle(tr("Drop Site"));
setMinimumSize(350, 500);
}
//! [constructor part5]
//! [updateFormatsTable() part1]
void DropSiteWindow::updateFormatsTable(const QMimeData *mimeData)
{
formatsTable->setRowCount(0);
copyButton->setEnabled(false);
if (!mimeData)
return;
//! [updateFormatsTable() part1]
//! [updateFormatsTable() part2]
const QStringList formats = mimeData->formats();
for (const QString &format : formats) {
QTableWidgetItem *formatItem = new QTableWidgetItem(format);
formatItem->setFlags(Qt::ItemIsEnabled);
formatItem->setTextAlignment(Qt::AlignTop | Qt::AlignLeft);
//! [updateFormatsTable() part2]
//! [updateFormatsTable() part3]
QString text;
if (format == QLatin1String("text/plain")) {
text = mimeData->text().simplified();
} else if (format == QLatin1String("text/html")) {
text = mimeData->html().simplified();
} else if (format == QLatin1String("text/uri-list")) {
QList<QUrl> urlList = mimeData->urls();
for (int i = 0; i < urlList.size() && i < 32; ++i)
text.append(urlList.at(i).toString() + QLatin1Char(' '));
} else {
QByteArray data = mimeData->data(format);
for (int i = 0; i < data.size() && i < 32; ++i)
text.append(QStringLiteral("%1 ").arg(uchar(data[i]), 2, 16, QLatin1Char('0')).toUpper());
}
//! [updateFormatsTable() part3]
//! [updateFormatsTable() part4]
int row = formatsTable->rowCount();
formatsTable->insertRow(row);
formatsTable->setItem(row, 0, new QTableWidgetItem(format));
formatsTable->setItem(row, 1, new QTableWidgetItem(text));
}
formatsTable->resizeColumnToContents(0);
#if QT_CONFIG(clipboard)
copyButton->setEnabled(formatsTable->rowCount() > 0);
#endif
}
//! [updateFormatsTable() part4]
void DropSiteWindow::copy()
{
#if QT_CONFIG(clipboard)
QString text;
for (int row = 0, rowCount = formatsTable->rowCount(); row < rowCount; ++row)
text += formatsTable->item(row, 0)->text() + ": " + formatsTable->item(row, 1)->text() + '\n';
QGuiApplication::clipboard()->setText(text);
#endif
}
| {
"pile_set_name": "Github"
} |
function ShapeXferHelper(canvas) {
this.canvas = canvas;
this.type = ShapeXferHelper.MIME_TYPE;
}
ShapeXferHelper.MIME_TYPE = "pencil/shape";
ShapeXferHelper.prototype.toString = function () {
return "ShapeXferHelper: " + ShapeXferHelper.MIME_TYPE;
};
ShapeXferHelper.prototype.handleData = function (dom) {
//validate
var shape = Dom.getSingle("/svg:g[@p:type='Shape' or @p:type='Group']", dom);
if (!shape) {
throw Util.getMessage("bad.data.in.the.clipboard");
}
shape = this.canvas.ownerDocument.importNode(shape, true);
Dom.renewId(shape);
if (Config.get("edit.cutAndPasteAtTheSamePlace") == null ){
Config.set("edit.cutAndPasteAtTheSamePlace", false);
}
if (dom.copySamePlace && dom.copySamePlace == true || Config.get("edit.cutAndPasteAtTheSamePlace")) {
dx = 0;
dy = 0;
} else if (!Config.get("edit.cutAndPasteAtTheSamePlace")) {
var grid = Pencil.getGridSize()
var dx = Math.round(Math.random() * 50);
dx = dx - (dx % grid.w);
var dy = Math.round(Math.random() * 50);
dy = dy - (dy % grid.h);
}
this.canvas.run(function() {
this.canvas.drawingLayer.appendChild(shape);
this.canvas.selectShape(shape);
if (this.canvas.currentController.renewTargetProperties) {
try {
var renewed = this.canvas.currentController.renewTargetProperties();
if (renewed) {
this.canvas.selectNone();
this.canvas.selectShape(shape);
}
} catch (e) {
console.error(e);
}
}
var rect = this.canvas.currentController.getBoundingRect();
var mx = dx;
var my = dy;
var padding = this.canvas.element.getBoundingClientRect().left - this.canvas._wrapper.getBoundingClientRect().left;
var x0 = this.canvas._scrollPane.scrollLeft - padding;
var y0 = this.canvas._scrollPane.scrollTop - padding;
console.log(this.canvas.getSize(), this.canvas._scrollPane.scrollWidth, this.canvas._scrollPane.scrollHeight);
var x1 = x0 + Math.min(this.canvas.getSize().width, this.canvas._scrollPane.clientWidth - padding);
var y1 = y0 + Math.min(this.canvas.getSize().height, this.canvas._scrollPane.clientHeight - padding);
console.log(x0, y0, x1, y1, padding);
if (rect.x + rect.width > x1 || rect.x < x0) {
mx = Math.round((x1 + x0) / 2 - (rect.x + rect.width / 2));
}
if (rect.y + rect.height > y1 || rect.y < y0) {
my = Math.round((y1 + y0) / 2 - (rect.y + rect.height / 2));
}
this.canvas.currentController.moveBy(mx, my);
this.canvas.ensureControllerInView();
this.canvas.snappingHelper.updateSnappingGuide(this.canvas.currentController);
}, this, Util.getMessage("action.create.shape", this.canvas.createControllerFor(shape).getName()));
this.canvas.invalidateEditors();
};
Pencil.registerXferHelper(ShapeXferHelper);
| {
"pile_set_name": "Github"
} |
// Copyright 2009 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.
// +build darwin dragonfly freebsd netbsd openbsd
// BSD system call wrappers shared by *BSD based systems
// including OS X (Darwin) and FreeBSD. Like the other
// syscall_*.go files it is compiled as Go code but also
// used as input to mksyscall which parses the //sys
// lines and generates system call stubs.
package unix
import (
"runtime"
"syscall"
"unsafe"
)
/*
* Wrapped
*/
//sysnb getgroups(ngid int, gid *_Gid_t) (n int, err error)
//sysnb setgroups(ngid int, gid *_Gid_t) (err error)
func Getgroups() (gids []int, err error) {
n, err := getgroups(0, nil)
if err != nil {
return nil, err
}
if n == 0 {
return nil, nil
}
// Sanity check group count. Max is 16 on BSD.
if n < 0 || n > 1000 {
return nil, EINVAL
}
a := make([]_Gid_t, n)
n, err = getgroups(n, &a[0])
if err != nil {
return nil, err
}
gids = make([]int, n)
for i, v := range a[0:n] {
gids[i] = int(v)
}
return
}
func Setgroups(gids []int) (err error) {
if len(gids) == 0 {
return setgroups(0, nil)
}
a := make([]_Gid_t, len(gids))
for i, v := range gids {
a[i] = _Gid_t(v)
}
return setgroups(len(a), &a[0])
}
func ReadDirent(fd int, buf []byte) (n int, err error) {
// Final argument is (basep *uintptr) and the syscall doesn't take nil.
// 64 bits should be enough. (32 bits isn't even on 386). Since the
// actual system call is getdirentries64, 64 is a good guess.
// TODO(rsc): Can we use a single global basep for all calls?
var base = (*uintptr)(unsafe.Pointer(new(uint64)))
return Getdirentries(fd, buf, base)
}
// Wait status is 7 bits at bottom, either 0 (exited),
// 0x7F (stopped), or a signal number that caused an exit.
// The 0x80 bit is whether there was a core dump.
// An extra number (exit code, signal causing a stop)
// is in the high bits.
type WaitStatus uint32
const (
mask = 0x7F
core = 0x80
shift = 8
exited = 0
stopped = 0x7F
)
func (w WaitStatus) Exited() bool { return w&mask == exited }
func (w WaitStatus) ExitStatus() int {
if w&mask != exited {
return -1
}
return int(w >> shift)
}
func (w WaitStatus) Signaled() bool { return w&mask != stopped && w&mask != 0 }
func (w WaitStatus) Signal() syscall.Signal {
sig := syscall.Signal(w & mask)
if sig == stopped || sig == 0 {
return -1
}
return sig
}
func (w WaitStatus) CoreDump() bool { return w.Signaled() && w&core != 0 }
func (w WaitStatus) Stopped() bool { return w&mask == stopped && syscall.Signal(w>>shift) != SIGSTOP }
func (w WaitStatus) Continued() bool { return w&mask == stopped && syscall.Signal(w>>shift) == SIGSTOP }
func (w WaitStatus) StopSignal() syscall.Signal {
if !w.Stopped() {
return -1
}
return syscall.Signal(w>>shift) & 0xFF
}
func (w WaitStatus) TrapCause() int { return -1 }
//sys wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error)
func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) {
var status _C_int
wpid, err = wait4(pid, &status, options, rusage)
if wstatus != nil {
*wstatus = WaitStatus(status)
}
return
}
//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
//sysnb socket(domain int, typ int, proto int) (fd int, err error)
//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
//sys Shutdown(s int, how int) (err error)
func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) {
if sa.Port < 0 || sa.Port > 0xFFFF {
return nil, 0, EINVAL
}
sa.raw.Len = SizeofSockaddrInet4
sa.raw.Family = AF_INET
p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
p[0] = byte(sa.Port >> 8)
p[1] = byte(sa.Port)
for i := 0; i < len(sa.Addr); i++ {
sa.raw.Addr[i] = sa.Addr[i]
}
return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil
}
func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, _Socklen, error) {
if sa.Port < 0 || sa.Port > 0xFFFF {
return nil, 0, EINVAL
}
sa.raw.Len = SizeofSockaddrInet6
sa.raw.Family = AF_INET6
p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
p[0] = byte(sa.Port >> 8)
p[1] = byte(sa.Port)
sa.raw.Scope_id = sa.ZoneId
for i := 0; i < len(sa.Addr); i++ {
sa.raw.Addr[i] = sa.Addr[i]
}
return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil
}
func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) {
name := sa.Name
n := len(name)
if n >= len(sa.raw.Path) || n == 0 {
return nil, 0, EINVAL
}
sa.raw.Len = byte(3 + n) // 2 for Family, Len; 1 for NUL
sa.raw.Family = AF_UNIX
for i := 0; i < n; i++ {
sa.raw.Path[i] = int8(name[i])
}
return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil
}
func (sa *SockaddrDatalink) sockaddr() (unsafe.Pointer, _Socklen, error) {
if sa.Index == 0 {
return nil, 0, EINVAL
}
sa.raw.Len = sa.Len
sa.raw.Family = AF_LINK
sa.raw.Index = sa.Index
sa.raw.Type = sa.Type
sa.raw.Nlen = sa.Nlen
sa.raw.Alen = sa.Alen
sa.raw.Slen = sa.Slen
for i := 0; i < len(sa.raw.Data); i++ {
sa.raw.Data[i] = sa.Data[i]
}
return unsafe.Pointer(&sa.raw), SizeofSockaddrDatalink, nil
}
func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
switch rsa.Addr.Family {
case AF_LINK:
pp := (*RawSockaddrDatalink)(unsafe.Pointer(rsa))
sa := new(SockaddrDatalink)
sa.Len = pp.Len
sa.Family = pp.Family
sa.Index = pp.Index
sa.Type = pp.Type
sa.Nlen = pp.Nlen
sa.Alen = pp.Alen
sa.Slen = pp.Slen
for i := 0; i < len(sa.Data); i++ {
sa.Data[i] = pp.Data[i]
}
return sa, nil
case AF_UNIX:
pp := (*RawSockaddrUnix)(unsafe.Pointer(rsa))
if pp.Len < 2 || pp.Len > SizeofSockaddrUnix {
return nil, EINVAL
}
sa := new(SockaddrUnix)
// Some BSDs include the trailing NUL in the length, whereas
// others do not. Work around this by subtracting the leading
// family and len. The path is then scanned to see if a NUL
// terminator still exists within the length.
n := int(pp.Len) - 2 // subtract leading Family, Len
for i := 0; i < n; i++ {
if pp.Path[i] == 0 {
// found early NUL; assume Len included the NUL
// or was overestimating.
n = i
break
}
}
bytes := (*[10000]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
sa.Name = string(bytes)
return sa, nil
case AF_INET:
pp := (*RawSockaddrInet4)(unsafe.Pointer(rsa))
sa := new(SockaddrInet4)
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
sa.Port = int(p[0])<<8 + int(p[1])
for i := 0; i < len(sa.Addr); i++ {
sa.Addr[i] = pp.Addr[i]
}
return sa, nil
case AF_INET6:
pp := (*RawSockaddrInet6)(unsafe.Pointer(rsa))
sa := new(SockaddrInet6)
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
sa.Port = int(p[0])<<8 + int(p[1])
sa.ZoneId = pp.Scope_id
for i := 0; i < len(sa.Addr); i++ {
sa.Addr[i] = pp.Addr[i]
}
return sa, nil
}
return nil, EAFNOSUPPORT
}
func Accept(fd int) (nfd int, sa Sockaddr, err error) {
var rsa RawSockaddrAny
var len _Socklen = SizeofSockaddrAny
nfd, err = accept(fd, &rsa, &len)
if err != nil {
return
}
if runtime.GOOS == "darwin" && len == 0 {
// Accepted socket has no address.
// This is likely due to a bug in xnu kernels,
// where instead of ECONNABORTED error socket
// is accepted, but has no address.
Close(nfd)
return 0, nil, ECONNABORTED
}
sa, err = anyToSockaddr(fd, &rsa)
if err != nil {
Close(nfd)
nfd = 0
}
return
}
func Getsockname(fd int) (sa Sockaddr, err error) {
var rsa RawSockaddrAny
var len _Socklen = SizeofSockaddrAny
if err = getsockname(fd, &rsa, &len); err != nil {
return
}
// TODO(jsing): DragonFly has a "bug" (see issue 3349), which should be
// reported upstream.
if runtime.GOOS == "dragonfly" && rsa.Addr.Family == AF_UNSPEC && rsa.Addr.Len == 0 {
rsa.Addr.Family = AF_UNIX
rsa.Addr.Len = SizeofSockaddrUnix
}
return anyToSockaddr(fd, &rsa)
}
//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
// GetsockoptString returns the string value of the socket option opt for the
// socket associated with fd at the given socket level.
func GetsockoptString(fd, level, opt int) (string, error) {
buf := make([]byte, 256)
vallen := _Socklen(len(buf))
err := getsockopt(fd, level, opt, unsafe.Pointer(&buf[0]), &vallen)
if err != nil {
return "", err
}
return string(buf[:vallen-1]), nil
}
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
var msg Msghdr
var rsa RawSockaddrAny
msg.Name = (*byte)(unsafe.Pointer(&rsa))
msg.Namelen = uint32(SizeofSockaddrAny)
var iov Iovec
if len(p) > 0 {
iov.Base = (*byte)(unsafe.Pointer(&p[0]))
iov.SetLen(len(p))
}
var dummy byte
if len(oob) > 0 {
// receive at least one normal byte
if len(p) == 0 {
iov.Base = &dummy
iov.SetLen(1)
}
msg.Control = (*byte)(unsafe.Pointer(&oob[0]))
msg.SetControllen(len(oob))
}
msg.Iov = &iov
msg.Iovlen = 1
if n, err = recvmsg(fd, &msg, flags); err != nil {
return
}
oobn = int(msg.Controllen)
recvflags = int(msg.Flags)
// source address is only specified if the socket is unconnected
if rsa.Addr.Family != AF_UNSPEC {
from, err = anyToSockaddr(fd, &rsa)
}
return
}
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (err error) {
_, err = SendmsgN(fd, p, oob, to, flags)
return
}
func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) {
var ptr unsafe.Pointer
var salen _Socklen
if to != nil {
ptr, salen, err = to.sockaddr()
if err != nil {
return 0, err
}
}
var msg Msghdr
msg.Name = (*byte)(unsafe.Pointer(ptr))
msg.Namelen = uint32(salen)
var iov Iovec
if len(p) > 0 {
iov.Base = (*byte)(unsafe.Pointer(&p[0]))
iov.SetLen(len(p))
}
var dummy byte
if len(oob) > 0 {
// send at least one normal byte
if len(p) == 0 {
iov.Base = &dummy
iov.SetLen(1)
}
msg.Control = (*byte)(unsafe.Pointer(&oob[0]))
msg.SetControllen(len(oob))
}
msg.Iov = &iov
msg.Iovlen = 1
if n, err = sendmsg(fd, &msg, flags); err != nil {
return 0, err
}
if len(oob) > 0 && len(p) == 0 {
n = 0
}
return n, nil
}
//sys kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error)
func Kevent(kq int, changes, events []Kevent_t, timeout *Timespec) (n int, err error) {
var change, event unsafe.Pointer
if len(changes) > 0 {
change = unsafe.Pointer(&changes[0])
}
if len(events) > 0 {
event = unsafe.Pointer(&events[0])
}
return kevent(kq, change, len(changes), event, len(events), timeout)
}
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
// sysctlmib translates name to mib number and appends any additional args.
func sysctlmib(name string, args ...int) ([]_C_int, error) {
// Translate name to mib number.
mib, err := nametomib(name)
if err != nil {
return nil, err
}
for _, a := range args {
mib = append(mib, _C_int(a))
}
return mib, nil
}
func Sysctl(name string) (string, error) {
return SysctlArgs(name)
}
func SysctlArgs(name string, args ...int) (string, error) {
buf, err := SysctlRaw(name, args...)
if err != nil {
return "", err
}
n := len(buf)
// Throw away terminating NUL.
if n > 0 && buf[n-1] == '\x00' {
n--
}
return string(buf[0:n]), nil
}
func SysctlUint32(name string) (uint32, error) {
return SysctlUint32Args(name)
}
func SysctlUint32Args(name string, args ...int) (uint32, error) {
mib, err := sysctlmib(name, args...)
if err != nil {
return 0, err
}
n := uintptr(4)
buf := make([]byte, 4)
if err := sysctl(mib, &buf[0], &n, nil, 0); err != nil {
return 0, err
}
if n != 4 {
return 0, EIO
}
return *(*uint32)(unsafe.Pointer(&buf[0])), nil
}
func SysctlUint64(name string, args ...int) (uint64, error) {
mib, err := sysctlmib(name, args...)
if err != nil {
return 0, err
}
n := uintptr(8)
buf := make([]byte, 8)
if err := sysctl(mib, &buf[0], &n, nil, 0); err != nil {
return 0, err
}
if n != 8 {
return 0, EIO
}
return *(*uint64)(unsafe.Pointer(&buf[0])), nil
}
func SysctlRaw(name string, args ...int) ([]byte, error) {
mib, err := sysctlmib(name, args...)
if err != nil {
return nil, err
}
// Find size.
n := uintptr(0)
if err := sysctl(mib, nil, &n, nil, 0); err != nil {
return nil, err
}
if n == 0 {
return nil, nil
}
// Read into buffer of that size.
buf := make([]byte, n)
if err := sysctl(mib, &buf[0], &n, nil, 0); err != nil {
return nil, err
}
// The actual call may return less than the original reported required
// size so ensure we deal with that.
return buf[:n], nil
}
//sys utimes(path string, timeval *[2]Timeval) (err error)
func Utimes(path string, tv []Timeval) error {
if tv == nil {
return utimes(path, nil)
}
if len(tv) != 2 {
return EINVAL
}
return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
}
func UtimesNano(path string, ts []Timespec) error {
if ts == nil {
err := utimensat(AT_FDCWD, path, nil, 0)
if err != ENOSYS {
return err
}
return utimes(path, nil)
}
if len(ts) != 2 {
return EINVAL
}
// Darwin setattrlist can set nanosecond timestamps
err := setattrlistTimes(path, ts, 0)
if err != ENOSYS {
return err
}
err = utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
if err != ENOSYS {
return err
}
// Not as efficient as it could be because Timespec and
// Timeval have different types in the different OSes
tv := [2]Timeval{
NsecToTimeval(TimespecToNsec(ts[0])),
NsecToTimeval(TimespecToNsec(ts[1])),
}
return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
}
func UtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) error {
if ts == nil {
return utimensat(dirfd, path, nil, flags)
}
if len(ts) != 2 {
return EINVAL
}
err := setattrlistTimes(path, ts, flags)
if err != ENOSYS {
return err
}
return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), flags)
}
//sys futimes(fd int, timeval *[2]Timeval) (err error)
func Futimes(fd int, tv []Timeval) error {
if tv == nil {
return futimes(fd, nil)
}
if len(tv) != 2 {
return EINVAL
}
return futimes(fd, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
}
//sys fcntl(fd int, cmd int, arg int) (val int, err error)
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
func Poll(fds []PollFd, timeout int) (n int, err error) {
if len(fds) == 0 {
return poll(nil, 0, timeout)
}
return poll(&fds[0], len(fds), timeout)
}
// TODO: wrap
// Acct(name nil-string) (err error)
// Gethostuuid(uuid *byte, timeout *Timespec) (err error)
// Ptrace(req int, pid int, addr uintptr, data int) (ret uintptr, err error)
var mapper = &mmapper{
active: make(map[*byte][]byte),
mmap: mmap,
munmap: munmap,
}
func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) {
return mapper.Mmap(fd, offset, length, prot, flags)
}
func Munmap(b []byte) (err error) {
return mapper.Munmap(b)
}
//sys Madvise(b []byte, behav int) (err error)
//sys Mlock(b []byte) (err error)
//sys Mlockall(flags int) (err error)
//sys Mprotect(b []byte, prot int) (err error)
//sys Msync(b []byte, flags int) (err error)
//sys Munlock(b []byte) (err error)
//sys Munlockall() (err error)
| {
"pile_set_name": "Github"
} |
/*
Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang("widget","cs",{move:"Klepněte a táhněte pro přesunutí"}); | {
"pile_set_name": "Github"
} |
/*
* SHA-384 internal definitions
* Copyright (c) 2015, Pali Rohár <[email protected]>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
*/
#ifndef SHA384_I_H
#define SHA384_I_H
#include "sha512_i.h"
#define SHA384_BLOCK_SIZE SHA512_BLOCK_SIZE
#define sha384_state sha512_state
void sha384_init(struct sha384_state *md);
int sha384_process(struct sha384_state *md, const unsigned char *in,
unsigned long inlen);
int sha384_done(struct sha384_state *md, unsigned char *out);
#endif /* SHA384_I_H */
| {
"pile_set_name": "Github"
} |
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2017, Daniel Stenberg, <[email protected]>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "curl_setup.h"
#include <curl/curl.h>
#include "curl_fnmatch.h"
#include "curl_memory.h"
/* The last #include file should be: */
#include "memdebug.h"
#define CURLFNM_CHARSET_LEN (sizeof(char) * 256)
#define CURLFNM_CHSET_SIZE (CURLFNM_CHARSET_LEN + 15)
#define CURLFNM_NEGATE CURLFNM_CHARSET_LEN
#define CURLFNM_ALNUM (CURLFNM_CHARSET_LEN + 1)
#define CURLFNM_DIGIT (CURLFNM_CHARSET_LEN + 2)
#define CURLFNM_XDIGIT (CURLFNM_CHARSET_LEN + 3)
#define CURLFNM_ALPHA (CURLFNM_CHARSET_LEN + 4)
#define CURLFNM_PRINT (CURLFNM_CHARSET_LEN + 5)
#define CURLFNM_BLANK (CURLFNM_CHARSET_LEN + 6)
#define CURLFNM_LOWER (CURLFNM_CHARSET_LEN + 7)
#define CURLFNM_GRAPH (CURLFNM_CHARSET_LEN + 8)
#define CURLFNM_SPACE (CURLFNM_CHARSET_LEN + 9)
#define CURLFNM_UPPER (CURLFNM_CHARSET_LEN + 10)
typedef enum {
CURLFNM_LOOP_DEFAULT = 0,
CURLFNM_LOOP_BACKSLASH
} loop_state;
typedef enum {
CURLFNM_SCHS_DEFAULT = 0,
CURLFNM_SCHS_MAYRANGE,
CURLFNM_SCHS_MAYRANGE2,
CURLFNM_SCHS_RIGHTBR,
CURLFNM_SCHS_RIGHTBRLEFTBR
} setcharset_state;
typedef enum {
CURLFNM_PKW_INIT = 0,
CURLFNM_PKW_DDOT
} parsekey_state;
#define SETCHARSET_OK 1
#define SETCHARSET_FAIL 0
static int parsekeyword(unsigned char **pattern, unsigned char *charset)
{
parsekey_state state = CURLFNM_PKW_INIT;
#define KEYLEN 10
char keyword[KEYLEN] = { 0 };
int found = FALSE;
int i;
unsigned char *p = *pattern;
for(i = 0; !found; i++) {
char c = *p++;
if(i >= KEYLEN)
return SETCHARSET_FAIL;
switch(state) {
case CURLFNM_PKW_INIT:
if(ISALPHA(c) && ISLOWER(c))
keyword[i] = c;
else if(c == ':')
state = CURLFNM_PKW_DDOT;
else
return 0;
break;
case CURLFNM_PKW_DDOT:
if(c == ']')
found = TRUE;
else
return SETCHARSET_FAIL;
}
}
#undef KEYLEN
*pattern = p; /* move caller's pattern pointer */
if(strcmp(keyword, "digit") == 0)
charset[CURLFNM_DIGIT] = 1;
else if(strcmp(keyword, "alnum") == 0)
charset[CURLFNM_ALNUM] = 1;
else if(strcmp(keyword, "alpha") == 0)
charset[CURLFNM_ALPHA] = 1;
else if(strcmp(keyword, "xdigit") == 0)
charset[CURLFNM_XDIGIT] = 1;
else if(strcmp(keyword, "print") == 0)
charset[CURLFNM_PRINT] = 1;
else if(strcmp(keyword, "graph") == 0)
charset[CURLFNM_GRAPH] = 1;
else if(strcmp(keyword, "space") == 0)
charset[CURLFNM_SPACE] = 1;
else if(strcmp(keyword, "blank") == 0)
charset[CURLFNM_BLANK] = 1;
else if(strcmp(keyword, "upper") == 0)
charset[CURLFNM_UPPER] = 1;
else if(strcmp(keyword, "lower") == 0)
charset[CURLFNM_LOWER] = 1;
else
return SETCHARSET_FAIL;
return SETCHARSET_OK;
}
/* returns 1 (true) if pattern is OK, 0 if is bad ("p" is pattern pointer) */
static int setcharset(unsigned char **p, unsigned char *charset)
{
setcharset_state state = CURLFNM_SCHS_DEFAULT;
unsigned char rangestart = 0;
unsigned char lastchar = 0;
bool something_found = FALSE;
unsigned char c;
for(;;) {
c = **p;
switch(state) {
case CURLFNM_SCHS_DEFAULT:
if(ISALNUM(c)) { /* ASCII value */
rangestart = c;
charset[c] = 1;
(*p)++;
state = CURLFNM_SCHS_MAYRANGE;
something_found = TRUE;
}
else if(c == ']') {
if(something_found)
return SETCHARSET_OK;
something_found = TRUE;
state = CURLFNM_SCHS_RIGHTBR;
charset[c] = 1;
(*p)++;
}
else if(c == '[') {
char c2 = *((*p) + 1);
if(c2 == ':') { /* there has to be a keyword */
(*p) += 2;
if(parsekeyword(p, charset)) {
state = CURLFNM_SCHS_DEFAULT;
}
else
return SETCHARSET_FAIL;
}
else {
charset[c] = 1;
(*p)++;
}
something_found = TRUE;
}
else if(c == '?' || c == '*') {
something_found = TRUE;
charset[c] = 1;
(*p)++;
}
else if(c == '^' || c == '!') {
if(!something_found) {
if(charset[CURLFNM_NEGATE]) {
charset[c] = 1;
something_found = TRUE;
}
else
charset[CURLFNM_NEGATE] = 1; /* negate charset */
}
else
charset[c] = 1;
(*p)++;
}
else if(c == '\\') {
c = *(++(*p));
if(ISPRINT((c))) {
something_found = TRUE;
state = CURLFNM_SCHS_MAYRANGE;
charset[c] = 1;
rangestart = c;
(*p)++;
}
else
return SETCHARSET_FAIL;
}
else if(c == '\0') {
return SETCHARSET_FAIL;
}
else {
charset[c] = 1;
(*p)++;
something_found = TRUE;
}
break;
case CURLFNM_SCHS_MAYRANGE:
if(c == '-') {
charset[c] = 1;
(*p)++;
lastchar = '-';
state = CURLFNM_SCHS_MAYRANGE2;
}
else if(c == '[') {
state = CURLFNM_SCHS_DEFAULT;
}
else if(ISALNUM(c)) {
charset[c] = 1;
(*p)++;
}
else if(c == '\\') {
c = *(++(*p));
if(ISPRINT(c)) {
charset[c] = 1;
(*p)++;
}
else
return SETCHARSET_FAIL;
}
else if(c == ']') {
return SETCHARSET_OK;
}
else
return SETCHARSET_FAIL;
break;
case CURLFNM_SCHS_MAYRANGE2:
if(c == '\\') {
c = *(++(*p));
if(!ISPRINT(c))
return SETCHARSET_FAIL;
}
if(c == ']') {
return SETCHARSET_OK;
}
if(c == '\\') {
c = *(++(*p));
if(ISPRINT(c)) {
charset[c] = 1;
state = CURLFNM_SCHS_DEFAULT;
(*p)++;
}
else
return SETCHARSET_FAIL;
}
if(c >= rangestart) {
if((ISLOWER(c) && ISLOWER(rangestart)) ||
(ISDIGIT(c) && ISDIGIT(rangestart)) ||
(ISUPPER(c) && ISUPPER(rangestart))) {
charset[lastchar] = 0;
rangestart++;
while(rangestart++ <= c)
charset[rangestart-1] = 1;
(*p)++;
state = CURLFNM_SCHS_DEFAULT;
}
else
return SETCHARSET_FAIL;
}
break;
case CURLFNM_SCHS_RIGHTBR:
if(c == '[') {
state = CURLFNM_SCHS_RIGHTBRLEFTBR;
charset[c] = 1;
(*p)++;
}
else if(c == ']') {
return SETCHARSET_OK;
}
else if(c == '\0') {
return SETCHARSET_FAIL;
}
else if(ISPRINT(c)) {
charset[c] = 1;
(*p)++;
state = CURLFNM_SCHS_DEFAULT;
}
else
/* used 'goto fail' instead of 'return SETCHARSET_FAIL' to avoid a
* nonsense warning 'statement not reached' at end of the fnc when
* compiling on Solaris */
goto fail;
break;
case CURLFNM_SCHS_RIGHTBRLEFTBR:
if(c == ']') {
return SETCHARSET_OK;
}
else {
state = CURLFNM_SCHS_DEFAULT;
charset[c] = 1;
(*p)++;
}
break;
}
}
fail:
return SETCHARSET_FAIL;
}
static int loop(const unsigned char *pattern, const unsigned char *string)
{
loop_state state = CURLFNM_LOOP_DEFAULT;
unsigned char *p = (unsigned char *)pattern;
unsigned char *s = (unsigned char *)string;
unsigned char charset[CURLFNM_CHSET_SIZE] = { 0 };
int rc = 0;
for(;;) {
switch(state) {
case CURLFNM_LOOP_DEFAULT:
if(*p == '*') {
while(*(p + 1) == '*') /* eliminate multiple stars */
p++;
if(*s == '\0' && *(p + 1) == '\0')
return CURL_FNMATCH_MATCH;
rc = loop(p + 1, s); /* *.txt matches .txt <=> .txt matches .txt */
if(rc == CURL_FNMATCH_MATCH)
return CURL_FNMATCH_MATCH;
if(*s) /* let the star eat up one character */
s++;
else
return CURL_FNMATCH_NOMATCH;
}
else if(*p == '?') {
if(ISPRINT(*s)) {
s++;
p++;
}
else if(*s == '\0')
return CURL_FNMATCH_NOMATCH;
else
return CURL_FNMATCH_FAIL; /* cannot deal with other character */
}
else if(*p == '\0') {
if(*s == '\0')
return CURL_FNMATCH_MATCH;
return CURL_FNMATCH_NOMATCH;
}
else if(*p == '\\') {
state = CURLFNM_LOOP_BACKSLASH;
p++;
}
else if(*p == '[') {
unsigned char *pp = p + 1; /* cannot handle with pointer to register */
if(setcharset(&pp, charset)) {
int found = FALSE;
if(charset[(unsigned int)*s])
found = TRUE;
else if(charset[CURLFNM_ALNUM])
found = ISALNUM(*s);
else if(charset[CURLFNM_ALPHA])
found = ISALPHA(*s);
else if(charset[CURLFNM_DIGIT])
found = ISDIGIT(*s);
else if(charset[CURLFNM_XDIGIT])
found = ISXDIGIT(*s);
else if(charset[CURLFNM_PRINT])
found = ISPRINT(*s);
else if(charset[CURLFNM_SPACE])
found = ISSPACE(*s);
else if(charset[CURLFNM_UPPER])
found = ISUPPER(*s);
else if(charset[CURLFNM_LOWER])
found = ISLOWER(*s);
else if(charset[CURLFNM_BLANK])
found = ISBLANK(*s);
else if(charset[CURLFNM_GRAPH])
found = ISGRAPH(*s);
if(charset[CURLFNM_NEGATE])
found = !found;
if(found) {
p = pp + 1;
s++;
memset(charset, 0, CURLFNM_CHSET_SIZE);
}
else
return CURL_FNMATCH_NOMATCH;
}
else
return CURL_FNMATCH_FAIL;
}
else {
if(*p++ != *s++)
return CURL_FNMATCH_NOMATCH;
}
break;
case CURLFNM_LOOP_BACKSLASH:
if(ISPRINT(*p)) {
if(*p++ == *s++)
state = CURLFNM_LOOP_DEFAULT;
else
return CURL_FNMATCH_NOMATCH;
}
else
return CURL_FNMATCH_FAIL;
break;
}
}
}
/*
* @unittest: 1307
*/
int Curl_fnmatch(void *ptr, const char *pattern, const char *string)
{
(void)ptr; /* the argument is specified by the curl_fnmatch_callback
prototype, but not used by Curl_fnmatch() */
if(!pattern || !string) {
return CURL_FNMATCH_FAIL;
}
return loop((unsigned char *)pattern, (unsigned char *)string);
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8" ?>
<dt-example table-class="display responsive nowrap" order="2">
<css lib="datatables responsive">
</css>
<js lib="jquery datatables responsive">
<![CDATA[
$(document).ready(function() {
$('#example').DataTable( {
"ajax": "../../../../examples/ajax/data/objects.txt",
"columns": [
{ "data": "name" },
{ "data": "position" },
{ "data": "office" },
{ "data": "start_date" },
{ "data": "salary" },
{ "data": "extn" }
]
} );
} );
]]>
</js>
<title lib="Responsive">Class control</title>
<info><![CDATA[
You can tell Responsive what columns to want to be visible on different devices through the use of class names on the columns. The breakpoints are horizontal screen resolutions and the defaults are set for common devices:
* `desktop` x >= 1024px
* `tablet-l` (landscape) 768 <= x < 1024
* `tablet-p` (portrait) 480 <= x < 768
* `mobile-l` (landscape) 320 <= x < 480
* `mobile-p` (portrait) x < 320
You may leave the `-[lp]` option from the end if you wish to just target all tablet or mobile devices. Additionally to may add `min-`, `max-` or `not-` as a prefix to the class name to perform logic operations. For example `not-mobile` would cause a column to appear as visible on desktop and tablet devices, while `min-tablet-l` would require at least a horizontal width of 768 for the browser window to be shown, and be shown at all sizes larger.
Additionally, there are three special class names:
* `all` - Always display
* `none` - Don't display as a column, but show in the child row
* `never` - Never display
* `control` - Used for the `column` `r-init responsive.details.type` option.
Please [refer to the Responsive manual](//datatables.net/extensions/responsive/) for further details of these options.
This example shows the `salary` column visible on a desktop only - `office` requires a tablet, while the `position` column requires a phone in landscape or larger. The `name` column is always visible and the `start date` is never visible.
This can be useful if you wish to change the format of the data shown on different devices, for example using a combination of `mobile` and `not-mobile` on two different columns would allow information to be formatted suitable for each device type.
]]></info>
<custom-table>
<div id="breakpoint"> </div>
<table id="example" class="display responsive" width="100%">
<thead>
<tr>
<th class="all">Name</th>
<th class="min-phone-l">Position</th>
<th class="min-tablet">Office</th>
<th class="never">Start date</th>
<th class="desktop">Salary</th>
<th class="none">Extn.</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Start date</th>
<th>Salary</th>
<th>Extn.</th>
</tr>
</tfoot>
</table>
</custom-table>
</dt-example>
| {
"pile_set_name": "Github"
} |
package tenants
import "github.com/gophercloud/gophercloud"
func listURL(client *gophercloud.ServiceClient) string {
return client.ServiceURL("tenants")
}
func getURL(client *gophercloud.ServiceClient, tenantID string) string {
return client.ServiceURL("tenants", tenantID)
}
func createURL(client *gophercloud.ServiceClient) string {
return client.ServiceURL("tenants")
}
func deleteURL(client *gophercloud.ServiceClient, tenantID string) string {
return client.ServiceURL("tenants", tenantID)
}
func updateURL(client *gophercloud.ServiceClient, tenantID string) string {
return client.ServiceURL("tenants", tenantID)
}
| {
"pile_set_name": "Github"
} |
package carpet.mixins;
import carpet.fakes.RecipeManagerInterface;
import com.google.common.collect.Lists;
import net.minecraft.recipe.Recipe;
import net.minecraft.recipe.RecipeManager;
import net.minecraft.recipe.RecipeType;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Mixin(RecipeManager.class)
public class RecipeManager_scarpetMixin implements RecipeManagerInterface
{
@Shadow private Map<RecipeType<?>, Map<Identifier, Recipe<?>>> recipes;
@Override
public List<Recipe<?>> getAllMatching(RecipeType type, Identifier output)
{
Map<Identifier, Recipe<?>> typeRecipes = recipes.get(type);
if (typeRecipes.containsKey(output)) return Collections.singletonList(typeRecipes.get(output));
return Lists.newArrayList(typeRecipes.values().stream().filter(
r -> Registry.ITEM.getId(r.getOutput().getItem()).equals(output)).collect(Collectors.toList()));
}
}
| {
"pile_set_name": "Github"
} |
server.port: 7003
server.error.include-message: always
logging:
level:
root: INFO
se.magnus: DEBUG
---
spring.profiles: docker
server.port: 8080
| {
"pile_set_name": "Github"
} |
<?php
namespace BikeShare\Console\Commands;
use BikeShare\Domain\User\User;
use BikeShare\Domain\User\UsersRepository;
use BikeShare\Http\Services\AppConfig;
use BikeShare\Http\Services\Rents\RentService;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
class CheckManyRents extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'bike-share:many-rents';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Check users to many rents in short time';
/**
* Create a new command instance.
*
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
*/
public function handle()
{
try {
RentService::checkManyRents();
} catch (Exception $e) {
$this->error($e->getMessage());
}
}
}
| {
"pile_set_name": "Github"
} |
---
layout: default
title: Examples - Select2
slug: examples
---
<script type="text/javascript" src="vendor/js/placeholders.jquery.min.js"></script>
<script type="text/javascript" src="dist/js/i18n/es.js"></script>
<style type="text/css">
.img-flag {
height: 15px;
width: 18px;
}
</style>
<section class="jumbotron">
<div class="container">
<h1>
Examples
</h1>
</div>
</section>
<div class="container s2-docs-container">
<div class="row">
<div class="col-md-9" role="main">
{% include examples/basics.html %}
{% include examples/placeholders.html %}
{% include examples/data.html %}
{% include examples/disabled-mode.html %}
{% include examples/disabled-results.html %}
{% include examples/multiple-max.html %}
{% include examples/hide-search.html %}
{% include examples/programmatic-control.html %}
{% include examples/tags.html %}
{% include examples/tokenizer.html %}
{% include examples/matcher.html %}
{% include examples/localization-rtl-diacritics.html %}
{% include examples/themes-templating-responsive-design.html %}
</div>
<div class="col-md-3" role="complementary">
{% include nav/examples.html %}
</div>
</div>
</div>
{% include js-source-states.html %}
<script type="text/javascript">
var $states = $(".js-source-states");
var statesOptions = $states.html();
$states.remove();
$(".js-states").append(statesOptions);
$("[data-fill-from]").each(function () {
var $this = $(this);
var codeContainer = $this.data("fill-from");
var $container = $(codeContainer);
var code = $.trim($container.html());
$this.text(code);
$this.addClass("prettyprint linenums");
});
prettyPrint();
$.fn.select2.amd.require([
"select2/core",
"select2/utils",
"select2/compat/matcher"
], function (Select2, Utils, oldMatcher) {
var $basicSingle = $(".js-example-basic-single");
var $basicMultiple = $(".js-example-basic-multiple");
var $limitMultiple = $(".js-example-basic-multiple-limit");
var $dataArray = $(".js-example-data-array");
var $dataArraySelected = $(".js-example-data-array-selected");
var data = [
{ id: 0, text: 'enhancement' },
{ id: 1, text: 'bug' },
{ id: 2, text: 'duplicate' },
{ id: 3, text: 'invalid' },
{ id: 4, text: 'wontfix' }
];
var $ajax = $(".js-example-data-ajax");
var $disabledResults = $(".js-example-disabled-results");
var $tags = $(".js-example-tags");
var $matcherStart = $('.js-example-matcher-start');
var $diacritics = $(".js-example-diacritics");
var $language = $(".js-example-language");
$.fn.select2.defaults.set("width", "100%");
$basicSingle.select2();
$basicMultiple.select2();
$limitMultiple.select2({
maximumSelectionLength: 2
});
function formatState (state) {
if (!state.id) {
return state.text;
}
var $state = $(
'<span>' +
'<img src="vendor/images/flags/' +
state.element.value.toLowerCase() +
'.png" class="img-flag" /> ' +
state.text +
'</span>'
);
return $state;
};
$(".js-example-templating").select2({
templateResult: formatState,
templateSelection: formatState
});
$dataArray.select2({
data: data
});
$dataArraySelected.select2({
data: data
});
function formatRepo (repo) {
if (repo.loading) return repo.text;
var markup = "<div class='select2-result-repository clearfix'>" +
"<div class='select2-result-repository__avatar'><img src='" + repo.owner.avatar_url + "' /></div>" +
"<div class='select2-result-repository__meta'>" +
"<div class='select2-result-repository__title'>" + repo.full_name + "</div>";
if (repo.description) {
markup += "<div class='select2-result-repository__description'>" + repo.description + "</div>";
}
markup += "<div class='select2-result-repository__statistics'>" +
"<div class='select2-result-repository__forks'><i class='fa fa-flash'></i> " + repo.forks_count + " Forks</div>" +
"<div class='select2-result-repository__stargazers'><i class='fa fa-star'></i> " + repo.stargazers_count + " Stars</div>" +
"<div class='select2-result-repository__watchers'><i class='fa fa-eye'></i> " + repo.watchers_count + " Watchers</div>" +
"</div>" +
"</div></div>";
return markup;
}
function formatRepoSelection (repo) {
return repo.full_name || repo.text;
}
$ajax.select2({
ajax: {
url: "https://api.github.com/search/repositories",
dataType: 'json',
delay: 250,
data: function (params) {
return {
q: params.term, // search term
page: params.page
};
},
processResults: function (data, params) {
// parse the results into the format expected by Select2
// since we are using custom formatting functions we do not need to
// alter the remote JSON data, except to indicate that infinite
// scrolling can be used
params.page = params.page || 1;
return {
results: data.items,
pagination: {
more: (params.page * 30) < data.total_count
}
};
},
cache: true
},
escapeMarkup: function (markup) { return markup; },
minimumInputLength: 1,
templateResult: formatRepo,
templateSelection: formatRepoSelection
});
$(".js-example-disabled").select2();
$(".js-example-disabled-multi").select2();
$(".js-example-responsive").select2({
width: 'resolve' // need to override the changed default
});
$disabledResults.select2();
$(".js-example-programmatic").select2();
$(".js-example-programmatic-multi").select2();
$eventSelect.select2();
$tags.select2({
tags: ['red', 'blue', 'green']
});
$(".js-example-tokenizer").select2({
tags: true,
tokenSeparators: [',', ' ']
});
function matchStart (term, text) {
if (text.toUpperCase().indexOf(term.toUpperCase()) == 0) {
return true;
}
return false;
}
$matcherStart.select2({
matcher: oldMatcher(matchStart)
});
$(".js-example-basic-hide-search").select2({
minimumResultsForSearch: Infinity
});
$diacritics.select2();
$language.select2({
language: "es"
});
$(".js-example-theme-single").select2({
theme: "classic"
});
$(".js-example-theme-multiple").select2({
theme: "classic"
});
$(".js-example-rtl").select2();
});
</script>
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="label12.Text" xml:space="preserve">
<value>Auto WP Rad</value>
</data>
<data name="label10.Text" xml:space="preserve">
<value>Closed Loop Nav</value>
</data>
<data name="label13.Text" xml:space="preserve">
<value>Sonar Trigger Dist</value>
</data>
<data name="label11.Text" xml:space="preserve">
<value>Booster</value>
</data>
<data name="label80.Text" xml:space="preserve">
<value>Gain (cm)</value>
</data>
<data name="label2.Text" xml:space="preserve">
<value>FBW max</value>
</data>
<data name="label3.Text" xml:space="preserve">
<value>FBW min</value>
</data>
<data name="label1.Text" xml:space="preserve">
<value>Ratio</value>
</data>
<data name="label6.Text" xml:space="preserve">
<value>Max</value>
</data>
<data name="label7.Text" xml:space="preserve">
<value>Min</value>
</data>
<data name="groupBox4.Text" xml:space="preserve">
<value>Rover</value>
</data>
<data name="label4.Text" xml:space="preserve">
<value>Cruise</value>
</data>
<data name="label5.Text" xml:space="preserve">
<value>FS Value</value>
</data>
<data name="groupBox2.Text" xml:space="preserve">
<value>Navigation Angles</value>
</data>
<data name="groupBox3.Text" xml:space="preserve">
<value>Throttle 0-100%</value>
</data>
<data name="label8.Text" xml:space="preserve">
<value>Cruise</value>
</data>
<data name="groupBox1.Text" xml:space="preserve">
<value>speed m/s</value>
</data>
<data name="label9.Text" xml:space="preserve">
<value>Turn Gain</value>
</data>
<data name="label64.Text" xml:space="preserve">
<value>P</value>
</data>
<data name="label61.Text" xml:space="preserve">
<value>INT_MAX</value>
</data>
<data name="label62.Text" xml:space="preserve">
<value>D</value>
</data>
<data name="label63.Text" xml:space="preserve">
<value>I</value>
</data>
<data name="groupBox14.Text" xml:space="preserve">
<value>Energy/Alt Pid</value>
</data>
<data name="groupBox15.Text" xml:space="preserve">
<value>Xtrack Pids</value>
</data>
<data name="groupBox11.Text" xml:space="preserve">
<value>Nav Roll Pid</value>
</data>
<data name="label38.Text" xml:space="preserve">
<value>Pitch Max</value>
</data>
<data name="label37.Text" xml:space="preserve">
<value>Bank Max</value>
</data>
<data name="label39.Text" xml:space="preserve">
<value>Pitch Min</value>
</data>
<data name="label74.Text" xml:space="preserve">
<value>D</value>
</data>
<data name="label76.Text" xml:space="preserve">
<value>P</value>
</data>
<data name="label75.Text" xml:space="preserve">
<value>I</value>
</data>
<data name="label73.Text" xml:space="preserve">
<value>INT_MAX</value>
</data>
<data name="BUT_writePIDS.Text" xml:space="preserve">
<value>Write Params</value>
</data>
<data name="label79.Text" xml:space="preserve">
<value>Entry Angle</value>
</data>
<data name="BUT_rerequestparams.Text" xml:space="preserve">
<value>Refresh Params</value>
</data>
</root> | {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="" />
</component>
</project>
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="PRRealtimeViewController">
<connections>
<outlet property="tableView" destination="j5F-gc-Is5" id="3cd-jg-7i0"/>
<outlet property="view" destination="iN0-l3-epB" id="aXZ-9b-fNR"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="80" sectionHeaderHeight="26" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="j5F-gc-Is5" customClass="PRTableView">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="sectionIndexBackgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<connections>
<outlet property="dataSource" destination="-1" id="JcV-rK-P3o"/>
<outlet property="delegate" destination="-1" id="UW0-cG-T8M"/>
</connections>
</tableView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="j5F-gc-Is5" secondAttribute="trailing" id="2NA-KD-vkn"/>
<constraint firstItem="j5F-gc-Is5" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="5Zc-m1-NnT"/>
<constraint firstAttribute="bottom" secondItem="j5F-gc-Is5" secondAttribute="bottom" id="IN7-WM-EAU"/>
<constraint firstItem="j5F-gc-Is5" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="pyx-ad-OVF"/>
</constraints>
<point key="canvasLocation" x="99" y="225"/>
</view>
</objects>
</document>
| {
"pile_set_name": "Github"
} |
<?php
/*
+-----------------------------------------------------------------------------+
| ILIAS open source |
+-----------------------------------------------------------------------------+
| Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
| |
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of the GNU General Public License |
| along with this program; if not, write to the Free Software |
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
+-----------------------------------------------------------------------------+
*/
/** @defgroup ServicesUtilities Services/Utilities
*/
/**
* util class
* various functions, usage as namespace
*
* @author Sascha Hofmann <[email protected]>
* @author Alex Killing <[email protected]>
* @version $Id: class.ilUtil.php 13126 2007-01-29 15:51:03 +0000 (Mo, 29 Jan 2007) smeyer $
*
* @ingroup ServicesUtilities
*/
class ilUpdateUtils
{
public function removeTrailingPathSeparators($path)
{
$path = preg_replace("/[\/\\\]+$/", "", $path);
return $path;
}
/**
* get webspace directory
*
* @param string $mode use "filesystem" for filesystem operations
* and "output" for output operations, e.g. images
*
*/
public function getWebspaceDir($mode = "filesystem")
{
global $ilias;
if ($mode == "filesystem") {
return "./" . ILIAS_WEB_DIR . "/" . $ilias->client_id;
} else {
if (defined("ILIAS_MODULE")) {
return "../" . ILIAS_WEB_DIR . "/" . $ilias->client_id;
} else {
return "./" . ILIAS_WEB_DIR . "/" . $ilias->client_id;
}
}
//return $ilias->ini->readVariable("server","webspace_dir");
}
/**
* get data directory (outside webspace)
*/
public function getDataDir()
{
return CLIENT_DATA_DIR;
//global $ilias;
//return $ilias->ini->readVariable("server", "data_dir");
}
/**
* creates a new directory and inherits all filesystem permissions of the parent directory
* You may pass only the name of your new directory or with the entire path or relative path information.
*
* examples:
* a_dir = /tmp/test/your_dir
* a_dir = ../test/your_dir
* a_dir = your_dir (--> creates your_dir in current directory)
*
* @access public
* @param string [path] + directory name
* @return boolean
*
*/
public function makeDir($a_dir)
{
$a_dir = trim($a_dir);
// remove trailing slash (bugfix for php 4.2.x)
if (substr($a_dir, -1) == "/") {
$a_dir = substr($a_dir, 0, -1);
}
// check if a_dir comes with a path
if (!($path = substr($a_dir, 0, strrpos($a_dir, "/") - strlen($a_dir)))) {
$path = ".";
}
// create directory with file permissions of parent directory
umask(0000);
return @mkdir($a_dir, fileperms($path));
}
/**
* Create a new directory and all parent directories
*
* Creates a new directory and inherits all filesystem permissions of the parent directory
* If the parent directories doesn't exist, they will be created recursively.
* The directory name NEEDS TO BE an absolute path, because it seems that relative paths
* are not working with PHP's file_exists function.
*
* @author Helmut Schottmüller <[email protected]>
* @param string $a_dir The directory name to be created
* @access public
*/
public function makeDirParents($a_dir)
{
$dirs = array($a_dir);
$a_dir = dirname($a_dir);
$last_dirname = '';
while ($last_dirname != $a_dir) {
array_unshift($dirs, $a_dir);
$last_dirname = $a_dir;
$a_dir = dirname($a_dir);
}
// find the first existing dir
$reverse_paths = array_reverse($dirs, true);
$found_index = -1;
foreach ($reverse_paths as $key => $value) {
if ($found_index == -1) {
if (is_dir($value)) {
$found_index = $key;
}
}
}
umask(0000);
foreach ($dirs as $dirindex => $dir) {
// starting with the longest existing path
if ($dirindex >= $found_index) {
if (!file_exists($dir)) {
if (strcmp(substr($dir, strlen($dir) - 1, 1), "/") == 0) {
// on some systems there is an error when there is a slash
// at the end of a directory in mkdir, see Mantis #2554
$dir = substr($dir, 0, strlen($dir) - 1);
}
if (!mkdir($dir, $umask)) {
error_log("Can't make directory: $dir");
return false;
}
} elseif (!is_dir($dir)) {
error_log("$dir is not a directory");
return false;
} else {
// get umask of the last existing parent directory
$umask = fileperms($dir);
}
}
}
return true;
}
/**
* removes a dir and all its content (subdirs and files) recursively
*
* @access public
* @param string dir to delete
* @author Unknown <[email protected]> (source: http://www.php.net/rmdir)
*/
public function delDir($a_dir)
{
if (!is_dir($a_dir) || is_int(strpos($a_dir, ".."))) {
return;
}
$current_dir = opendir($a_dir);
$files = array();
// this extra loop has been necessary because of a strange bug
// at least on MacOS X. A looped readdir() didn't work
// correctly with larger directories
// when an unlink happened inside the loop. Getting all files
// into the memory first solved the problem.
while ($entryname = readdir($current_dir)) {
$files[] = $entryname;
}
foreach ($files as $file) {
if (is_dir($a_dir . "/" . $file) and ($file != "." and $file != "..")) {
ilUtil::delDir(${a_dir} . "/" . ${file});
} elseif ($file != "." and $file != "..") {
unlink(${a_dir} . "/" . ${file});
}
}
closedir($current_dir);
rmdir(${a_dir});
}
/**
* get directory
*/
public function getDir($a_dir)
{
$current_dir = opendir($a_dir);
$dirs = array();
$files = array();
while ($entry = readdir($current_dir)) {
if (is_dir($a_dir . "/" . $entry)) {
$dirs[$entry] = array("type" => "dir", "entry" => $entry);
} else {
$size = filesize($a_dir . "/" . $entry);
$files[$entry] = array("type" => "file", "entry" => $entry,
"size" => $size);
}
}
ksort($dirs);
ksort($files);
return array_merge($dirs, $files);
}
} // END class.ilUtil
| {
"pile_set_name": "Github"
} |
// Copyright 2017 The Bazel 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 SRC_MAIN_TOOLS_PROCESS_WRAPPER_LEGACY_H_
#define SRC_MAIN_TOOLS_PROCESS_WRAPPER_LEGACY_H_
#include <signal.h>
#include <vector>
// The process-wrapper implementation that was used until and including Bazel
// 0.4.5. Waits for the wrapped process to exit and then kills its process
// group. Works on all POSIX operating systems (tested on Linux, macOS,
// FreeBSD, and OpenBSD).
//
// Caveats:
// - Killing just the process group of the spawned child means that daemons or
// other processes spawned by the child may not be killed if they change their
// process group.
// - Does not wait for grandchildren to exit, thus processes spawned by the
// child that could not be killed will linger around in the background.
// - Has a PID reuse race condition, because the kill() to the process group is
// sent after waitpid() was called on the main child.
class LegacyProcessWrapper {
public:
// Run the command specified in the `opt.args` array and kill it after
// `opt.timeout_secs` seconds.
static void RunCommand();
private:
static void SpawnChild();
static void SetupSignalHandlers();
static void WaitForChild();
static void OnAbruptSignal(int sig);
static void OnGracefulSignal(int sig);
static pid_t child_pid;
static volatile sig_atomic_t last_signal;
};
#endif
| {
"pile_set_name": "Github"
} |
import sysconfig
import distutils.sysconfig as du_sysconfig
import sys
import os
import itertools
def find_python_library():
"""
Get python library based on sysconfig
Based on https://github.com/scikit-build/scikit-build/blob/master/skbuild/cmaker.py#L335
:returns a location python library
"""
python_library = sysconfig.get_config_var('LIBRARY')
if (not python_library or os.path.splitext(python_library)[1][-2:] == '.a'):
candidate_lib_prefixes = ['', 'lib']
candidate_implementations = ['python']
if hasattr(sys, "pypy_version_info"):
candidate_implementations = ['pypy-c', 'pypy3-c']
candidate_extensions = ['.lib', '.so', '.a']
if sysconfig.get_config_var('WITH_DYLD'):
candidate_extensions.insert(0, '.dylib')
candidate_versions = []
candidate_versions.append('')
candidate_versions.insert(0, str(sys.version_info.major) +
"." + str(sys.version_info.minor))
abiflags = getattr(sys, 'abiflags', '')
candidate_abiflags = [abiflags]
if abiflags:
candidate_abiflags.append('')
# Ensure the value injected by virtualenv is
# returned on windows.
# Because calling `sysconfig.get_config_var('multiarchsubdir')`
# returns an empty string on Linux, `du_sysconfig` is only used to
# get the value of `LIBDIR`.
libdir = du_sysconfig.get_config_var('LIBDIR')
if sysconfig.get_config_var('MULTIARCH'):
masd = sysconfig.get_config_var('multiarchsubdir')
if masd:
if masd.startswith(os.sep):
masd = masd[len(os.sep):]
libdir = os.path.join(libdir, masd)
if libdir is None:
libdir = os.path.abspath(os.path.join(
sysconfig.get_config_var('LIBDEST'), "..", "libs"))
no_valid_candidate = True
for (pre, impl, ext, ver, abi) in itertools.product(candidate_lib_prefixes,
candidate_implementations,
candidate_extensions,
candidate_versions,
candidate_abiflags):
candidate = os.path.join(libdir, ''.join((pre, impl, ver, abi, ext)))
if os.path.exists(candidate):
python_library = candidate
no_valid_candidate = False
break
# If there is not valid candidate then set the python_library is empty
if no_valid_candidate:
python_library = ""
return python_library
| {
"pile_set_name": "Github"
} |
#!/bin/bash
docker build -t developmentseed/skynet-monitor -f docker/skynet-monitor/Dockerfile .
| {
"pile_set_name": "Github"
} |
import * as React from 'react';
import { View, Text, StyleSheet } from 'react-native';
import { TabBar } from 'react-native-tab-view';
import { Route, useTheme } from '@react-navigation/native';
import Color from 'color';
import { MaterialTopTabBarProps } from '../types';
export default function TabBarTop(props: MaterialTopTabBarProps) {
const { colors } = useTheme();
const {
state,
navigation,
descriptors,
activeTintColor = colors.text,
inactiveTintColor = Color(activeTintColor)
.alpha(0.5)
.rgb()
.string(),
allowFontScaling = true,
showIcon = false,
showLabel = true,
pressColor = Color(activeTintColor)
.alpha(0.08)
.rgb()
.string(),
iconStyle,
labelStyle,
indicatorStyle,
style,
...rest
} = props;
return (
<TabBar
{...rest}
navigationState={state}
activeColor={activeTintColor}
inactiveColor={inactiveTintColor}
indicatorStyle={[{ backgroundColor: colors.primary }, indicatorStyle]}
style={[{ backgroundColor: colors.card }, style]}
pressColor={pressColor}
getAccessibilityLabel={({ route }) =>
descriptors[route.key].options.tabBarAccessibilityLabel
}
getTestID={({ route }) => descriptors[route.key].options.tabBarTestID}
onTabPress={({ route, preventDefault }) => {
const event = navigation.emit({
type: 'tabPress',
target: route.key,
canPreventDefault: true,
});
if (event.defaultPrevented) {
preventDefault();
}
}}
onTabLongPress={({ route }) =>
navigation.emit({
type: 'tabLongPress',
target: route.key,
})
}
renderIcon={({ route, focused, color }) => {
if (showIcon === false) {
return null;
}
const { options } = descriptors[route.key];
if (options.tabBarIcon !== undefined) {
const icon = options.tabBarIcon({ focused, color });
return <View style={[styles.icon, iconStyle]}>{icon}</View>;
}
return null;
}}
renderLabel={({ route, focused, color }) => {
if (showLabel === false) {
return null;
}
const { options } = descriptors[route.key];
const label =
options.tabBarLabel !== undefined
? options.tabBarLabel
: options.title !== undefined
? options.title
: (route as Route<string>).name;
if (typeof label === 'string') {
return (
<Text
style={[styles.label, { color }, labelStyle]}
allowFontScaling={allowFontScaling}
>
{label}
</Text>
);
}
return label({ focused, color });
}}
/>
);
}
const styles = StyleSheet.create({
icon: {
height: 24,
width: 24,
},
label: {
textAlign: 'center',
textTransform: 'uppercase',
fontSize: 13,
margin: 4,
backgroundColor: 'transparent',
},
});
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
bootstrap="vendor/autoload.php"
>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">lib/</directory>
</whitelist>
</filter>
<testsuites>
<testsuite name="Unit Test Suite">
<directory>tests/unit</directory>
</testsuite>
<testsuite name="Integration Test Suite">
<directory>tests/integration</directory>
</testsuite>
</testsuites>
</phpunit>
| {
"pile_set_name": "Github"
} |
require 'colorize'
require 'international/version'
require 'csv'
require 'file_manager'
module International
class MainApp
def initialize(arguments)
# defaults
@path_to_output = 'output/'
@path_to_csv = nil
@dryrun = false
@platform = 'android'
# Parse Options
arguments.push "-h" if arguments.length == 0
create_options_parser(arguments)
manage_opts
end
def is_valid_platform
@platform.eql?'android' or @platform.eql?'ios'
end
### Options parser
def create_options_parser(args)
args.options do |opts|
opts.banner = "Usage: international [OPTIONS]"
opts.separator ''
opts.separator "Options"
opts.on('-c PATH_TO_CSV', '--csv PATH_TO_CSV', 'Path to the .csv file') do |csv_path|
@path_to_csv = csv_path
end
opts.on('-p PLATFORM', '--platform PLATFORM', 'Choose between "android" and "ios" (default: "android")') do |platform|
@platform = platform.downcase
end
opts.on('-o PATH_TO_OUTPUT', '--output PATH_TO_OUTPUT', 'Path to the desired output folder') do |path_to_output|
unless path_to_output[-1,1] == '/'
path_to_output = "#{path_to_output}/"
end
@path_to_output = path_to_output
end
opts.on('-d', '--dryrun', 'Only simulates the output and don\'t write files') do |aa|
@dryrun = true
end
opts.on('-h', '--help', 'Displays help') do
@require_analyses = false
puts opts.help
exit
end
opts.on('-v', '--version', 'Displays version') do
@require_analyses = false
puts International::VERSION
exit
end
opts.parse!
end
end
### Manage options
def manage_opts
unless @path_to_csv
puts "Please give me a path to a CSV".yellow
exit 1
end
unless is_valid_platform
puts "The platform you chose could not be found, pick 'android' or 'ios'".yellow
exit 1
end
hash = csv_to_hash(@path_to_csv)
separate_languages hash
end
### CSV TO HASH
def csv_to_hash(path_to_csv)
file = File.open(path_to_csv, "rb")
body = file.read
body = "key#{body}" if body[0,1] == ','
CSV::Converters[:blank_to_nil] = lambda do |field|
field && field.empty? ? nil : field
end
csv = CSV.new(body, :headers => true, :header_converters => :symbol, :converters => [:all, :blank_to_nil])
csv.to_a.map {|row| row.to_hash }
end
def separate_languages(all)
languages = all.first.keys.drop(1)
separated = Hash.new
languages.each do |lang|
items = Array.new
all.each do |row|
next if row.first.nil?
item = {
:key => row.first.last, # dem hacks
:translation => row[lang]
}
items.push item
end
manager = FileManager.new lang, items, @path_to_output, @platform, @dryrun
manager.create_file
end
end
end
end
| {
"pile_set_name": "Github"
} |
var convert = require('./convert'),
func = convert('isObjectLike', require('../isObjectLike'), require('./_falseOptions'));
func.placeholder = require('./placeholder');
module.exports = func;
| {
"pile_set_name": "Github"
} |
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef TITANIC_AUTO_ANIMATE_H
#define TITANIC_AUTO_ANIMATE_H
#include "titanic/core/background.h"
#include "titanic/messages/messages.h"
namespace Titanic {
class CAutoAnimate : public CBackground {
DECLARE_MESSAGE_MAP;
bool EnterViewMsg(CEnterViewMsg *msg);
bool InitializeAnimMsg(CInitializeAnimMsg *msg);
private:
bool _enabled;
bool _redo;
bool _repeat;
public:
CLASSDEF;
CAutoAnimate() : CBackground(), _enabled(true), _redo(true), _repeat(false) {}
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_AUTO_ANIMATE_H */
| {
"pile_set_name": "Github"
} |
discard """
errormsg: "cannot infer the type of the sequence"
line: 6
"""
var list = @[]
| {
"pile_set_name": "Github"
} |
//
// MainViewController.m
// HeaderViewAndPageView
//
// Created by su on 16/8/8.
// Copyright © 2016年 susu. All rights reserved.
//
#import "MainViewController.h"
#import "OneViewTableTableViewController.h"
#import "SecondViewTableViewController.h"
#import "ThirdViewCollectionViewController.h"
#import "MainTouchTableTableView.h"
#import "ParentClassScrollViewController.h"
#import "WMPageController.h"
#define Main_Screen_Height [[UIScreen mainScreen] bounds].size.height
#define Main_Screen_Width [[UIScreen mainScreen] bounds].size.width
static CGFloat const headViewHeight = 256;
@interface MainViewController ()<UITableViewDelegate,UITableViewDataSource,scrollDelegate,WMPageControllerDelegate>
@property(nonatomic ,strong)MainTouchTableTableView * mainTableView;
@property(nonatomic,strong) UIScrollView * parentScrollView;
@property(nonatomic,strong)UIImageView *headImageView;//头部图片
@property(nonatomic,strong)UIImageView * avatarImage;
@property(nonatomic,strong)UILabel *countentLabel;
/*
* canScroll= yes : mainTableView 视图可以滚动,parentScrollView 禁止滚动
*/
@property (nonatomic, assign) BOOL canScroll;
@property (nonatomic, assign) BOOL isTopIsCanNotMoveMainTableView;
@property (nonatomic, assign) BOOL isTopIsCanNotMoveParentScrollView;
@end
@implementation MainViewController
@synthesize mainTableView;
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.title = @"HeaderAndPageView";
[self.view addSubview:self.mainTableView];
[self.mainTableView addSubview:self.headImageView];
//支持下刷新。关闭弹簧效果
self.mainTableView.bounces = NO;
//
if (@available(iOS 11.0, *)) {
self.mainTableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}else {
self.automaticallyAdjustsScrollViewInsets = NO;
}
self.canScroll = YES;
}
#pragma scrollDelegate
-(void)scrollViewLeaveAtTheTop:(UIScrollView *)scrollView
{
self.parentScrollView = scrollView;
//离开顶部 主View 可以滑动
self.canScroll = YES;
}
-(void)scrollViewChangeTab:(UIScrollView *)scrollView
{
self.parentScrollView = scrollView;
/*
* 如果已经离开顶端 切换tab parentScrollView的contentOffset 应该初始化位置
* 这一规则 仿简书
*/
if (self.canScroll) {
self.parentScrollView.contentOffset = CGPointMake(0, 0);
}
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
/*
* 处理联动事件
*/
//获取滚动视图y值的偏移量
CGFloat tabOffsetY = 0;
CGFloat offsetY = scrollView.contentOffset.y;
if (offsetY >=headViewHeight) {
scrollView.contentOffset = CGPointMake(0, tabOffsetY);
offsetY = tabOffsetY;
}
self.isTopIsCanNotMoveParentScrollView = self.isTopIsCanNotMoveMainTableView;
if (offsetY>=tabOffsetY) {
scrollView.contentOffset = CGPointMake(0, tabOffsetY);
self.isTopIsCanNotMoveMainTableView = YES;
}else{
self.isTopIsCanNotMoveMainTableView = NO;
}
if (self.isTopIsCanNotMoveMainTableView != self.isTopIsCanNotMoveParentScrollView) {
if (!self.isTopIsCanNotMoveParentScrollView && self.isTopIsCanNotMoveMainTableView) {
//滑动到顶端
self.canScroll = NO;
}
if(self.isTopIsCanNotMoveParentScrollView && !self.isTopIsCanNotMoveMainTableView){
//离开顶端
if (!self.canScroll) {
scrollView.contentOffset = CGPointMake(0, tabOffsetY);
}else{
self.parentScrollView.contentOffset = CGPointMake(0, tabOffsetY);
}
}
}else
{
if (!self.canScroll){
//支持下刷新,下拉时maintableView 没有滚动到位置 parentScrollView 不进行刷新
CGFloat parentScrollViewOffsetY = self.parentScrollView.contentOffset.y;
if(parentScrollViewOffsetY >0)
self.parentScrollView.contentOffset = CGPointMake(0, 0);
}else
{
self.parentScrollView.contentOffset = CGPointMake(0, 0);
}
}
/**
* 处理头部视图
*/
// CGFloat yOffset = scrollView.contentOffset.y;
// if(yOffset < -headViewHeight) {
//
// CGRect f = self.headImageView.frame;
// f.origin.y= yOffset ;
// f.size.height= -yOffset;
// f.origin.y= yOffset;
//
// //改变头部视图的fram
// self.headImageView.frame= f;
// CGRect avatarF = CGRectMake(f.size.width/2-40, (f.size.height-headViewHeight)+56, 80, 80);
// _avatarImage.frame = avatarF;
// _countentLabel.frame = CGRectMake((f.size.width-Main_Screen_Width)/2+40, (f.size.height-headViewHeight)+172, Main_Screen_Width-80, 36);
// }
}
#pragma mark --tableDelegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return Main_Screen_Height-64;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
/* 添加pageView
* 这里可以任意替换你喜欢的pageView
*作者这里使用一款github较多人使用的 WMPageController 地址https://github.com/wangmchn/WMPageController
*/
[cell.contentView addSubview:self.setPageViewControllers];
return cell;
}
#pragma mark -- setter/getter
-(UIView *)setPageViewControllers
{
WMPageController *pageController = [self p_defaultController];
pageController.title = @"Line";
pageController.menuViewStyle = WMMenuViewStyleLine;
pageController.titleSizeSelected = 15;
[self addChildViewController:pageController];
[pageController didMoveToParentViewController:self];
return pageController.view;
}
- (WMPageController *)p_defaultController {
OneViewTableTableViewController * oneVc = [OneViewTableTableViewController new];
oneVc.delegate = self;
SecondViewTableViewController * twoVc = [SecondViewTableViewController new];
twoVc.delegate = self;
ThirdViewCollectionViewController * thirdVc = [ThirdViewCollectionViewController new];
thirdVc.delegate = self;
NSArray *viewControllers = @[oneVc,twoVc,thirdVc];
NSArray *titles = @[@"first",@"second",@"third"];
WMPageController *pageVC = [[WMPageController alloc] initWithViewControllerClasses:viewControllers andTheirTitles:titles];
[pageVC setViewFrame:CGRectMake(0, 0, Main_Screen_Width, Main_Screen_Height)];
pageVC.delegate = self;
pageVC.menuItemWidth = 85;
pageVC.menuHeight = 44;
pageVC.postNotification = YES;
pageVC.bounces = YES;
return pageVC;
}
- (void)pageController:(WMPageController *)pageController willEnterViewController:(__kindof UIViewController *)viewController withInfo:(NSDictionary *)info {
NSLog(@"%@",viewController);
}
-(UIImageView *)headImageView
{
if (_headImageView == nil)
{
_headImageView= [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"bg.jpg"]];
_headImageView.frame=CGRectMake(0, -headViewHeight ,Main_Screen_Width,headViewHeight);
_headImageView.userInteractionEnabled = YES;
_avatarImage = [[UIImageView alloc] initWithFrame:CGRectMake(Main_Screen_Width/2-40, 56, 80, 80)];
[_headImageView addSubview:_avatarImage];
_avatarImage.userInteractionEnabled = YES;
_avatarImage.layer.masksToBounds = YES;
_avatarImage.layer.borderWidth = 1;
_avatarImage.layer.borderColor =[[UIColor colorWithRed:255/255. green:253/255. blue:253/255. alpha:1.] CGColor];
_avatarImage.layer.cornerRadius = 40;
_avatarImage.image = [UIImage imageNamed:@"avatar.jpg"];
_countentLabel = [[UILabel alloc] initWithFrame:CGRectMake(40, 150, Main_Screen_Width-80, 30)];
_countentLabel.font = [UIFont systemFontOfSize:12.];
_countentLabel.textColor = [UIColor colorWithRed:255/255. green:255/255. blue:255/255. alpha:1.];
_countentLabel.textAlignment = NSTextAlignmentCenter;
_countentLabel.lineBreakMode = NSLineBreakByWordWrapping;
_countentLabel.numberOfLines = 0;
_countentLabel.text = @"我的名字叫Anna";
[_headImageView addSubview:_countentLabel];
}
return _headImageView;
}
-(MainTouchTableTableView *)mainTableView
{
if (mainTableView == nil)
{
mainTableView= [[MainTouchTableTableView alloc]initWithFrame:CGRectMake(0,64,Main_Screen_Width,Main_Screen_Height-64)];
mainTableView.delegate=self;
mainTableView.dataSource=self;
mainTableView.showsVerticalScrollIndicator = NO;
mainTableView.contentInset = UIEdgeInsetsMake(headViewHeight,0, 0, 0);
mainTableView.backgroundColor = [UIColor clearColor];
}
return mainTableView;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
| {
"pile_set_name": "Github"
} |
cheats = 6
cheat0_desc = "Infinite Health"
cheat0_code = "00C0-E304"
cheat0_enable = false
cheat1_desc = "Infinite Lives"
cheat1_code = "00C0-DC08"
cheat1_enable = false
cheat2_desc = "Infinite Health"
cheat2_code = "3AC-588-2A2"
cheat2_enable = false
cheat3_desc = "Infinite Lives"
cheat3_code = "00C-838-19E"
cheat3_enable = false
cheat4_desc = "Invulnerability"
cheat4_code = "00C5-2702"
cheat4_enable = false
cheat5_desc = "Invulnerability"
cheat5_code = "C9F-405-E69"
cheat5_enable = false | {
"pile_set_name": "Github"
} |
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np \n",
"from sklearn.model_selection import train_test_split\n",
"import matplotlib.pyplot as plt\n",
"# We will be using make_circles from scikit-learn\n",
"from sklearn.datasets import make_circles\n",
"\n",
"SEED = 2017"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"# We create an inner and outer circle\n",
"X, y = make_circles(n_samples=400, factor=.3, noise=.05, random_state=2017)\n",
"outer = y == 0\n",
"inner = y == 1"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAEICAYAAABWJCMKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJztnW2QJVd53//PXM0Iza6wmLtCL6CZgVg2ESlCoS0iYxGw\nhbFY2yWTYEVkJG2EU5sdlStK5UMsMhWnimRtp/IlwmglqyjJi+/Y4EoZUDlLKKSUJZwAYUQESAaB\nwBq9lITErkFaL7DL7pMPfZvt6Tmn+5zu0+//X1XX3Je+3T3d5zzPOc/bEVUFIYSQ4THT9AUQQghp\nBioAQggZKFQAhBAyUKgACCFkoFABEELIQKECIISQgUIFQEhJRORnROR7BX97tYg8HvqaCHGBCoB0\nChE5lthOi8gPEu9XKjzvZSLy5yJyRES+JyIPi8i/FhFR1W+o6nlVnZuQqqACIJ1CVXfGG4AnAfxa\n4rP1Ks4pIq8D8DkAjwF4/VTY/3MAVwI4O+e3MyLCfkZaCRsm6Q0islNEfigiL5++/08i8iMROWf6\n/r+KyO9PXy+IyJ+IyAsi8jci8u9ERCyH/s8A7lPV96vqcwCgqn+tqteq6g9F5HUi8uPEdXxeRD4g\nIl8AcBzAxSKyS0Q+IiLPicjfisjHLP/DJSLySRH5roh8W0T2J777eRH5fyLy4vQ4vxfivpHhQgVA\neoOqHgPwFQBvnX70NgBPA7gi8f6B6es7AcwCeA2AXwKwimhUb+IdAP675+VcD+BGAOcCeA7AxwAI\ngNcBuADA7ekfiMgIwGEA/wfAxQCuBvDvReRt010+BOB3VfXlAC4F8AnPayJkC1QApG88AOBtInI2\nIiF5x/T9uQDeAOB/T7/7pwB+W1WPqerjAP4bgBvSB5sK5Z8C8KzndXxYVR9T1ZMALkGklG5W1e+p\n6glVfdDwmysBvExV/8t0n28AuAfAddPvTwL4GREZq+pLqvoFz2siZAtUAKRvPADg7QD+EYANAP8L\n0cj/5wF8VVVfBHAhorb/ZOJ3mwBelT6Yqp4C8H0AF3lex1OJ15cAeF5VX8r5zRKA5amT+XvTyKJ/\nO71eANiLSIl9Q0S+ICK/7HlNhGyBCoD0jb8C8A8B/AoiZfAwIrPLO3HG/PMcgNMAFhO/WwTwjOWY\n9yGaMfiQLLP7FIBXisjOnN88BeDrqnpeYjtXVd8NAKr6NVX9ZwBeCeCDAP5cROY8r4uQn0AFQHqF\nqn4PwKOIbPoPqOppRDOBf4mpAlDVHwH4OIDfFZEdIvL3ANwCYGI57H8A8EsickBELgAAEflZEfmY\niLzM4Zr+BsCDAD4kIj8lInMi8o8Nu/7V9Nj/RkReJiJnicgbRORN089vnJp/4lmJYquiIcQLKgDS\nRx5A5HD9UuL9DkwF7JR/Nf27ichM9GEAxjBSVf0agLcAuAzA16ammY8C+CyAHzle03sROZ2/iWgG\nsmo4z0kAe6bn2gTwAiIfRjxz+FUAj4nISwB+D8C1098QUgjhgjCEEDJMOAMghJCBQgVACCEDhQqA\nEEIGChUAIYQMlLOavoAsdu3apcvLy01fBiGEdIaHHnrou6p6vsu+rVYAy8vL2NjYaPoyCCGkM4jI\npuu+NAERQshAoQIghJCBQgVACCEDhQqAEEIGChUAIYQMFCoA0l7W14HlZWBmJvq7XsmSv4QMllaH\ngZIBs74O7NsHHD8evd/cjN4DwMpKc9dFSI/gDIC0k7W1M8I/5vjx6HNCSBCoAEg7efJJv88JId5Q\nAZB2srjo97kN+hEIsUIFQNrJgQPA7OzWz2Zno89dif0Im5uA6hk/ApUAIQCoAEibEcl+nwf9CIRk\nQgVA2snaGnDixNbPTpzwE9599CPQpEUCQgVA2kkI4R3KjxCSMgKcJi0SGCoA0i5iAalq/t5HeB84\nAMzPb/1sft7PjxCS9XXgppu2CvCbbnIX4DRpkcBQAZD2kBzh2jh2zF1grqwAd90FLC1F/oOlpeh9\nU4lkt9wCnDy59bOTJ6PPXSgyK6LJiGQgahtp+RxE5G4AvwrgeVX9B4bvBcBtAPYAOA7gX6jql/KO\nu3v3buWCMANieTlb+MfMzzcryIuS5cR26Ye2+7O0BDzxxPbP09nUADA3B5x7LnD0aDSbOnCge/eR\nZCIiD6nqbpd9Q80A/gjA1RnfvwvApdNtH4A7Ap2X9AlX+37a7NHWUe76OrBrVyT4fSOYTPiatEwm\noxMngCNH6EMgAAIpAFV9EMDRjF2uAfARjfg8gPNE5KIQ5yYdwUVI+9j3Y2Xh6hitW0nE9v4jR/L3\nHY/djulr0nJRqPQhDBtVDbIBWAbwiOW7vwBwZeL9/QB2W/bdB2ADwMbi4qKSHjCZqM7Pq0YiOtrm\n56PP0/sl98nalpai3ywtZX/vc/6Q2K4rvc3NVXMdk4nqaOR2DSLhz08aA8CGuspt1x1zDxRIASS3\nyy+/vKJbRGrFRUjHjMduQisWmiL5Qs3n/GWZTNyEv0i0X1XCP63wXJQp6QU+CqCuKKBnAFySeP/q\n6WdkCPhEr9x223Y7d5rx+IzZwyXWP+/8RcxDpt+4RDHF13/6dOS4dXXA+lyjyfYPRL9Nl9doMiyW\nNI+rpsjbkD0D+BUAnwIgAK4A8H9djskZQE/wHYEnR9HpEX7adONi3sk6fxHzkO03rrOX2Vm/kb/v\nNWbNiuJ7W+UMhDQK6jYBAfhTAM8COAngaQC/CWA/gP3T7wXA7QC+BeCrcDD/KBVAfyhjg3cRWHn7\nZJ2/iHnI1b4fyuzie411mrxI66hdAVS1UQFUQFMjwKZHnrbzu/gQ0th+47P5OF59r7EJpzdpDVQA\nxIyvYCgqtJsW9j6EnAGMx9vvr014VzkDUC3/DIbw7HsKFQAx4yNIio4iuzb6DOkDmEy2C8DV1fL3\no+57OpRn31OoAEhEWhj5mCNclUX6HDZHaJvtz0VGrT6/CTEqrnpknTy+LX9gPM4+Bn0PrcBHAQSp\nBVQVrAVUAlMdGJGoS6Yx1ZKZmTHvKxKFMNrOYSP5O9IufJ7jZGIPXXVpM6RymqgFRNqGKRZcdXtN\nGlscuEt8vS3e3MTCQjvr9RC/55hVNqKN6y+QTKgA+oot+UkVGI2i11m1ZFwKj7kWb5udBV56iQuZ\ntBWfRXY2N+2KvG3rL5BcqAD6Stao69SpMx3TNp03FR7buzcaAcadf2HB/NvxeOvvXv7y7cs7sghZ\ne/AZoYvYFXnb1l8g+bg6C5rY6AQugUs9mNg555pslT7e7GxUzCwv6qNIrD2pD9OznZnJbjt08rYW\ntLAWECmLb72a5GjMxpNPupdTNtmJT56MFhfJG/HRNtxuTCP3V7zC/fc+JiTSLlw1RRMbZwBTysZX\nZ4XnuYbulRnFMz68e/hkO9cxA2CCmTNgHkDPKBtfnSWAXQV7iGtgB+4OtuedV5yvCjiA8IIKoG+E\nsKHbBLBPwhc74XCwPe/V1foVORPMvKAC6AomoWz6rMoO4CPYOYofFk1lMJfJYCdUAJ3AJ6qmSD2Z\nuksVEJImVJ2lEAX1BgQVQBfwqSmfnAm4CnSaa0hIigwSQlZabcL30FF8FABrATWFrW6KCd9aKsvL\n5mUJTTV/CMnDVCtofj4/yatIbaCsfrG0FIWcLi5mJzEOHNYC6gK2LFoTvvHyPmvwEpKHKQfEJZM7\nK//DlteSlV3+xBP+aymTTKgAmmB9HXjxxe2fj0bA3NzWz4rUUmHiFQlJ0QGFrTbQnj1uyYekcqgA\nmmBtLcqiTfOylwF3312+lgqLcpGQFB1Q2GoDHT5snlFcfz1w5Ij5WEePZp/LN1OeRLg6C5rYeucE\nzgrpjLdQji1G9pBQhA4qKLKmct7ylwx6+AmgE7iFuC66QUctaSPr69HMNYQT1hakYEME2L8fOHjQ\n73gD7Ut0ArcR10U34gJtnM6SNrGyEs4JazJRZqEKHDpk7wcMeigMFYArZYWya2NcWKCDjPQbl0q1\nabKijhj0UBgqABdcSyZn4dIY41FRkZA7QrpEPKOYTNxnA7ZBlEvQA2fVZlydBU1srXECh6jFY3JU\nzc2pjsdbHbVcPIUMjXTAwnhczBFsC3oYmJMYdAIHpkhGowkXRxodWmToFM08tjGwPkUncGhC2Rhd\nHGmM4SdDJ/TawnQSW6ECcKFOocyFtQkJF3W0vh7N4E3QSUwF4EQooby+DuzaFR1DJHptckaFDLkj\nZAiYnLyxKenUqe37c1YNAPQB1Mb6OvC+9wEnTmz9fHYWuOceCnlCimLzGZxzjrm0xGgU5RX0tM/5\n+ACoAOoiK/uxp84oQmqhSGaxT/BGx6ATuCxVxAxnOZzojCKkOL79Z2aGeQBTqADShEj6MpHlcKIz\nipDi2PrPzp3mz0+dYnb9FCqANEUXv8jjwIHttf6ByAdAZxQhxbFF6Z19tv03zK4HQAWwHd+YYVdz\n0cpKVOt/PD7z2XhMBzAhZbFF6eWtIVDG9NqT0hJ0AqfxyRoMnbFICAlHnnPYJ/gimcW/sAC89NLW\niL4W9fvancAicrWIPCYij4vIrYbv3y4i3xeRh6fb74Q4byX4JH1VZS4ihJQnq+y0Tx5A2i945Mj2\ncO6O9vvSCkBERgBuB/AuAJcBeK+IXGbY9bOq+sbp9oGy5w1Kcjq3tgbs3euW9OViLurJVJGQzpEu\nOz0aRX9dEjmT/XbvXve1PDrGWQGO8WYAj6vqtwFARD4K4BoAfx3g2NWTNuNsbkZJIi7TucVF8xQz\njkowHXvfvuh1C6aKhPSelZViGfvJfmvKJDbRwWi+ECagVwF4KvH+6elnad4iIl8RkU+JyOttBxOR\nfSKyISIbL7zwQoDLy6GMGSfPXEQTESHdw3X1viQdLS1RVxTQlwAsquobAPwBgE/YdlTVu1R1t6ru\nPv/886u/sjKVAvNqBLEKISHdw6V/zs5GUXwdL9gYQgE8A+CSxPtXTz/7Car6oqoem74+DGBWRHYF\nOHd5ypZ6zircxqXqCOketv45Gp0R+PfcA3z3u50v2BhCAXwRwKUi8hoRmQNwHYB7kzuIyIUiItPX\nb56e11ClqQGqLPXM2v6EdA9bvz10qPMCP01pBaCqPwbwWwA+DeBrAP5MVR8Vkf0isn+623sAPCIi\nXwbwQQDXaVsSEGxmHKB89A5r+xPSDYpGAmYdpwNRf0wEM8EEL0KGQ6j+3hK5wXLQZRnYGqKEDJpQ\n/b0lcoPloMvC6J3e0rEZOqmDUP29g3KDCgDYLhUWFsz7MXqn01RV6Zt0nFDReh2M+qMCMEmFF1/c\nXrqZ0Tudx5aXd/31nA0MmlDReh2M+qMCMEmFkyeBc89l9E7PyCoMydnAgCkbrRdbEG64IVqHuEMJ\nYnQCz8xEI/80PV83dGisr0f9M6+5089PvGhJ5E8SOoFdiLW2TSK02G5H/Flbyxf+gJu/Lu0yuvnm\nah3LdFy3mK7X+1LV1m6XX365VsJkojo/rxrJhO3b/Hy0D+kNIvbHndyWlrKPk9d0Qjcf0/nYPGtk\nMokahUj0N33jbQ1LpImrVVVVABvqKGMbF/JZW2UKYGkpWwKwd3WOvH46HucLfxfBmtV0fBSJK7bz\njUZsppXjon1tDyhUAygAFUAHtTZxJ/l4x2PVHTvyhXmeAhiP3QSq60wibkqmppjXPF3Px5lAxbgI\n9xZO0YatAEJpbZ9eSmrDxQRjepx5gtv10bvMJJITyfS1zs2pzs66y4u8GUeDA83+4zpQjBtMPDVr\n2JIwbAUQQmuvrm5/+BxutQJXE0y6n+YJbpHo8Zr2ix/9ZHKmf+dtq6t+12oT5HkKj5PWCvEx77Ro\nJjBsBeCrtdPDvMnEfozRiDOChnE1waT7qYsJKEvQLi35CXTfzSbIbUopT3GQAPgI9VC+gACWh2Er\ngLIPwrWXc0ZQGNc2btrPRwgn7fp5j9LFtOOjfHy38djsK2CwWsO4NtYQfsVAs4hhK4CyN7HoEJM4\n4fp4bPutrrr7AFyFdtakL95Go2pnAL5KiZPQlmFrHCbNruo3uvGUM8NWAKrlplFFjczECdc2nrXf\nZBJW2LrOLCaT7Q7cJrYscxHjFhrCNGKZnY28/mnNbhrFBHT0UAGUYTLZ/tCyhmHEC9eZct5+IQWq\ny8wiftRpm/zZZ1drGjJtJldUi3yQwyWtgW1TOFskge3zCmcAwy0FkYXq1vczM6wOGghbhY2FBbeK\n3KrR9+NxuGs6fhw4fDgq32I6bvJRr6xEa4HHvfOHP4xKRk0mYa8pi1OnonMnC9h1vSJBL1hZiQpJ\nxesGHz1q3u/UKfvndVcTddUUTWyNzAB8bXnEC9fYeNPsOe83ZbbkDCTLlJJnZnEdBIbcxmPmNraC\nsjOApC+AUUAVKQBmCTeOaz+Jda5N8M3M+At527lcZtlFzCw+iWtllUDR/4sEIIQPINCgkgrARkdr\ne/SBLL2bp3ND2tjL2MqLNo3k/+6aSOa77djB3MVGCREFFAgqABsdre3RdfJuad5jcQ3Mip2jWUJ2\naelMlq5v3wsxOazLYSwS/Z+kJlpkOaACsFE2S5gUIk/A2/wCpiJveULPdrwQ+jzE5LBMLoGvyYuT\n1hppkeXARwH0LwrItnrG+nr0mQku/hKc5GOwLcW4uRntF6/Il4yiOXEC+Lu/8ztn/BiTK/yZKBod\nE2LJV9MxTIxGW/8uLUWrDfrgsrgNCcSBA9sjBefm2h8p6Kopmti8ZwBF0kfTw0GagErj4/hMFlor\n4yy1PaLQM/MQk8N0OWtTdVCTmcr3njBwrUZMWYKzsywGV2bzVgC2aVhW4kX6AbVoKtdVfM0cZQut\njUZ2u34XHmdaqfgmitq2tPJrSB4Ng7zU9Ro1sY8C6Nei8LYF3m2YFn7nIvGlKfIYAL/fpJmfN6/L\nDbRuze5clpfNZrOZGXMTtH1uYjyOEtlIYLIafbpxigD79wMHD1ZyKcNdFN5my48NqS77245BP4Ez\nvrdqYaH87bVlwSb9ASLR3zYKfxefyenTZjOzz7jkyJHCl0hsZPkXRbY3TlXgzjvP+CebxHWq0MQW\n1Afgap+jD6A0PuWUYlt1FQlTXcndc/3fbdYE32xjEpCsh5eXql6RHRKD9QGoRsI+tvnHxmGTRJqb\n8ytET7zwEUqxoDYtxFZma5OdPwsX/0e8YlkS3/UR4s2ntAXJIcvv6LIMXQUMVwHYRu/Mkw+KSz2c\nIoLaZ73dPEXRpUmbq9KLKTLqN91vTnYDkBVm5rMQdUCGqwB8h0NdsRG0iDyh4WvKSYaB+uyf9ai7\nNpJ1abZZQrvIlpUxzXGRB1nRP3kPtqJGOlwF4Gs/YEv3pmzZhp07z1SvdAnXtAn2Po1efTKXy4TL\n+igH4khWQ8xaam48ruyShqsAsgoy9UVaNEyZwm02n7uLULMtG9kX+3U6OcykJFXrqSXEcZEnWQ3R\n5NiqWPYMVwHkaeO+SIsGKToDMAkVX3MGBVP1MwCTs5mUpMWJYI0L+ayt8KLwFPSVUcQHYBvw0GXj\nj01pnn32mVlD2ZLTpNv4KIAgiWAicrWIPCYij4vIrYbvRUQ+OP3+KyLyphDnNZJeli0r48dWOI5Y\nyUusckm8im+7LeHJhm2ZyCGxsgLs3XsmezpmNAKuvTZKqDt1avv38/PAzp35x7flTJKe4qopbBuA\nEYBvAXgtgDkAXwZwWWqfPQA+BUAAXAHgCy7HrnRJyD55ETuEi9lnPDYnkrGWTYRt5pQ2Ncfv44mw\na4IeMVCXZSHAeVCnCQjAzwH4dOL9+wG8P7XPHwJ4b+L9YwAuyjt2YQVguonpz5gbUAuutz2tAGxr\nAfDx+DmC0/fLJYSWpKhrsBjoPHUrgPcA+HDi/Q0APpTa5y8AXJl4fz+A3Zbj7QOwAWBjcXHR+x5a\nVxdxXUGchuZg+JaE4ONxw9d3YoITYA/qKikb6Dw+CqB1xeBU9S5V3a2qu88//3z/A6ytbS++dOIE\ncPKk2+9Z9C0Yt9wS3fqQ8PG4LyoDRL4Ak2urK0XyWoFtZZ3QK+7UdZ4EIRTAMwAuSbx/9fQz333C\nUOZm+S7vRLaQ9qmHrjzJxxNhWkHNhqp99TOfeIlBU1eF4AYqEYdQAF8EcKmIvEZE5gBcB+De1D73\nArhxGg10BYDvq+qzAc69HZ+bNR5zCBSI9fWo7v7mZiR08iJ8krc9T5Dx8Wzl5pujSCBXBculIUsS\nYi3QNp0niautKGtDFOXzDUTRQGvTz/YD2D99LQBun37/VVjs/+mtcB5A2rhpC4xeXfU/PjHiY5dO\nZ8FnZczTKbmV1VV/v4ktCY/pMh64VEAMcUO7FgVU5VZYASRDTeK8ekqXSnGNTLGFcl52mXn/HTv8\n+0CfhZtvkpethAYdwAFp2Q0drgKwPQiGlFSObQYwM2OvaxOTNQPw7Ust64vB8RH+8UI7abqwTnKn\naNkNHa4C8F0Uni0+GFkJXnkC2KcccvJ86YXUhxDfPjPjrgBs/3NeQT/iSctuqI8CaF0YaCls3q5T\np+p3rgyMODLFVEogXp8XMFffcHFSJvcxOZzvuCPb8dx2R6hLVRLfSiWbm+bfcNnrAKyvA7t2RREK\nquZ9unBDXTVFE1vQGUA8ROyjYbhFZA2GfBdsSz/CMjXx2zwDcDVbFfm/6QOogMkkP7GUPoAGFEAZ\nOwQJQpEFkkzLNdiUSJF1g9v46JMmLFcLZdG1ABgFFJg8TWxzvtSEjwLolwnI1Q5BgmAyW2SFMtvM\nMEePbs1KtVWtVAXuvNOvKmicPwC0p/Br2oR16pR5v/T9KmpRSJvPlpeBG26I3v/xHzMJzJs8e+IP\nflDPdYTAVVM0sRUuBtcyp0wfcVl7JzbdxKNQl2hc12qhefskr8V03iZnBa6mHFO+RJH1gLkIfGCK\nRC3UCAZrAoppWVhWH8m7xSZhMzu7vThcWgC5CkdbFFC6AGyWwGyqObiacmIF4LpsZpYiVGW3CIaL\nD6DBwSYVAIc6lZM3ybKN9sfjbNuzi3AcjdyuMU9oNtVHXYW5zXHuuqVN0ZwYB8Q2tWyBVqUCUK0v\ndXugZI0mJ5NiQncycc90dSFPmVTVR12anotQz3Kc+wj+GCbEV0ALB5tUAHm08KF1jaxbWCQhy3ek\nm/Qt2B5b1nVU9bhdm1beALJoxA9gLrdhs1rMzbHZl6Zlg00qABNF4u5IJrZ2nSW8igjrvC0tYJNK\nyHQtVUXpZc1gTJnMaUVRRuib/keX+5vejxQgS8DbHnSFhSipANK4Di9pDA1CEWFTVvhlOZ/Ta+PG\nhByY5TWxdNMqo/BcN5f7yyZfkrwpX9YCzhXNBKgA0rj2Ns4AglDEwlZWIMaCzDXSxcdU46Ik8q4/\nVFJXUQXACKCKyKo+kFflsKKbTwWQxqW30QcQFN/RdZlol2Rfch3p5vVb2zXZmkleNdN0mKpL+QuX\n/zkr2irv/rLJByDvwec5eiqACiBNVm9nFFBryHOMZvWjPIHoMwLPc2abBm55ZajSwvess8oJ/2Si\nWzq3wubYZeBbBbiUhah5tSMqgDQc/nSKMqPjubnt0S5FCqvFgtJ14FY0KqrIlpylxOemYG8Il6mr\nqYBVhfKHCiBNemjZcLEmkk3ZCJm8ZDPXmYavM9skiLNyIopudNy2jKyHHGct1qilqQCS+MyRSWsw\nlXrw8RHY+phPQNjqqj3j32UMUdavkfW/kRaQbKRZD6xmqACSuHrJXOBcu1HStz9vFF/W+Zq3/9xc\n9nKXVYR60nLZEnzSuWuGCmDr3bBvPtCP0BryEr1CbSJ+x09n4Ia6tvg6OOZoES7avSH54KMA+rUe\nQJWsrUVrCiThGgO1k6ylD0Q9rSpmZoAdO9z3P3kSuPHGM2sN+Nbvv+oqYHZ262ezs1HN/tOnWbe/\nVWStCSByZiGKlj+w/iuA8djvcxu2BWfbvthszzDp4ao4dQo4dszvN6dPA9dfHy0Xu2dPJAvymJ8H\nJhPgvvuAe+45szDO0lL0vuUyZJjYtPvSUqe0df8VwG23mYdVt93mfoz1dXtP7sLCzz2iSn3rIqxd\nOXIEOHQI+MVfzN5vPN46UFxZiWRHh2RIvzAtc2cia+m7LuFqK2piCxoGWsZ520A9D2Im61Gk36eD\nv5KbKVTUx2Y/M+O2n0+2LmkYXz9fS4NCQCdwCUwPNUsykFqx9VHbimCm6pxnnWXuqz4lo1ZX3fa1\nLerC+IEW0pOCSVQARbH1VK6k0Sp8Bl4mQW2qlx8f12WtYZ+chGSV0hYOFkmSnpRMpQIoSlbqZ94K\n6OzZrcR3UGdKQEs/Xp/4fiadd4i81O+OVBSgAihK1gjAlufPuX2rqWJQ5xvfzybREbKWTbOlhbew\nqoCPApBo/3aye/du3djYqO+Ey8vmcM+lpSgko+z+pHaqeES2Y45GwHnnRRFAIc9HamTXLvMDHI2i\nuGATLXu4IvKQqu522bf/YaA++IZ22WISmRvQGqqI1rMd89Ah4OhR82/YJDqC7QHahD/Q6YdLBZBk\nZSUKyk5m4piy+eJYYdvsibkBrcH1kYY6pu3Rs0l0BNuDGo38f9MFXG1FTWyNhIHmkRcqQoPvoKFb\nqONkxRn30AfAGYAvt9xir0XQkfofpDqqmHGQGrE9wIMHo7ocyRIy4zFw992dfrh0Avuwvh4VejEh\nEuXvE0JIg9AJXBVZlT+7bAckhAySs8r8WEQWAHwMwDKAJwBcq6p/a9jvCQAvATgF4Meu2ql12CqC\nAt0rAkUIGTxlZwC3ArhfVS8FcP/0vY1fUNU3dlb4A/ZIgJmZrXZA14qChJBmGXhfLTUDAHANgLdP\nXx8C8JcAfrvkMduLLRY4afuPVyyJHcWbm9F7oNPOIkJ6B/tq6RnABar67PT1cwAusOynAO4TkYdE\nZF/WAUVkn4hsiMjGCy+8UPLyArO0lP+568phAx95ENI4XOUvfwYgIvcBuNDw1Za7pKoqIraQoitV\n9RkReSWAz4jI11X1QdOOqnoXgLuAKAoo7/pq5cCBrSMGYHtaqS0rcHMzEvTxvgMfeRDSOMzkz1cA\nqvoO23ci8h0RuUhVnxWRiwA8bznGM9O/z4vIxwG8GYBRAbSaWDivrUWNZHExEuhJob24aHcWx4L+\nnHPsIw+oEYV2AAALiElEQVQqAELqwdZXBxTRV9YEdC+AvdPXewF8Mr2DiOwQkXPj1wDeCeCRkudt\njpWVSOgvLkZKYG1tq/nGVCgmyfHj5mJTQHaUESGkHGmz60//9PZ1QF0LRfXFhOuaMmzaAIwRRf98\nE8B9ABamn18M4PD09WsBfHm6PQpgzfX4nSkFkc719y0aH2+jUWP/FiG9xmW1H5Go5EORY7Wo3gdY\nDrpCfOoL2/bNosXPg5DO4toXXUo7t7wMPDOBq8THcZRnDkpjizIihJTD1bHrsl+PnMdUAL741PtN\nFpbKo2yRekKIHVfHrst+Par5TQXgi+8KIysr0bQwSwmwZCQh4TA5aF1m466DsCpWGWoIKgBfitb7\nNTWadAQCIaQccXbv5mbkT9vcjCr4Xn99FIE3MxV5S0vA6mqxut09qvlNJ3CdrK9HYaObm1HDSd77\n+fnONiJCWoOLs3durvN1/LPwcQJTATRBy6MICOksMzNukXQ97muMAmo7WVEEfUkwISQ0Ln3D1RHb\nwYidKqACaAJbI11Y2G6/3LePSoAQk23f1DdcQ687GLFTBVQATWCLIgAGX52QECOulTtdQq/n5joZ\nsVMFVABNYIsiOHrUvD+nq2TIrK/bHbumvhGHXqsCk0nvFnIPCZ3AbYLOYUK2sr4O3HQTcPKk+Xv2\njW3QCdxVepRgQkgQ1tbswl+EfaMkVAB14RLB0PYEE0YokbrJMn+qtqdvdBSagOogvfZozM6dwJ13\ndqMRm/4HJq+RqslK7KL5xwhNQG3DFMEAAMeOAe97XzdG0lw/lTTBgQPA7Oz2zxnJEwQqgDrImsae\nONENIdqjErikQ6ysAPfcA+zYceazmRngrW+N+g3NkaWgAqiDvKSTLgjRHpXAJR0kaao+fRq4/34m\nTAaACqAODhzIrvyZJ0Tb4HxlhBJpCpsJNQnNkYWgAqiDlRVg/37zd3m2TNcU+Kppe4QS6S8hV/Mi\nW6ACqIuDB4tlJVblfC0yq4gzLE+fjv5S+JM6KLKaVxtmzV3AdfX4JrbLL7/ctvD9cBBRjcb+WzeR\n4secTFTn57ceb34++pyQtmFqr+kt2X4H3r4BbKijjOUMoO1U4XxlSCfpEibzY9ZqXmzfzlABtJ0q\nnK8M6SRVE9oEkzY/HjxoN0eyfTtDBdB2ijhfbZ0v/tyW/b2wQLvpkEm3m5tv9msP8e9FgBtuaC5w\ngSHL7rjaiprY6AMogM3+ubqabUednVWdmxus3XTw+NrZk79bWjrjl8r6/dJSc//LgNoyPHwAjQv5\nrI0KoABxZ0xvo1F2xxyPm+u0sRARif4OpKM2gu1e29qNrT1MJvY2Y9vKBC6E+j8HABXAkMkbhZm2\nrN8V6bQ+nW/go7VaybrXPu3GZbbQ5Axg4FABDBnbqCxLwCen8WU7ra9AD3XeogxppJh1r11nAIDq\nzIy/8KdSrw0qgCFjUwA7d9qVQCz4QozEfQV6FXkONlZXz5jCRiPVq67q1uyjrLKyCed4EFBkVJ+1\nxc+274q1ZVABDJksgZrVUVXDjIZ9BXpdM4DVVXfB1UZTRVkFnWXmSdr1k8+/LqE/pFlYDVABDJki\n0/yQAs/3HEUFm6/QyHKCuyqrJgVV2Wdn+308+vf5jW0bj/3vCX1AwaECGDJZHaqOzlbkHGnBurqa\nLWhdzlFmNGsSqk0LqrKmsqwZoI08s9BoVF4ZNu0D6iFUAEMna6Raxyi2zDlcBG2e0Chjz7YJ9aYF\nVVUzgLzf28I9Qym/On1AA4EKgNRDFcrERVDlCQ2fEf9VV7n9D00LqhA+gLK/r2Lg0LRi7SFUAKR6\nsjKOywgKF0GbJzSyzB3JKKDVVffraoOgKiuEm54Z2q6JPoCgUAGQ6slyKpbpzC6CNk9oZGVDlxGe\ndTirm6BpIdyFe9QhalMAAH4DwKMATgPYnbHf1QAeA/A4gFtdj08F0EKyksZsm88o2VUY5Y1mi9S1\ncf3fs5zTaWe26TqKRMtUSRtmNyQYdSqAvw/gZwH8pU0BABgB+BaA1wKYA/BlAJe5HJ8KoGUUda76\n2slDjAiTx7BlroYUcKZ7k2WK8o2MqlJhNO3fIEGp3QSUowB+DsCnE+/fD+D9LselAmgZeSP/vEQj\nE1ULuskknGLKokjiVOjcCNNxXO4tZwC9om0K4D0APpx4fwOAD2Ucax+ADQAbi4uL1d0l4k/WiNZm\n8sgSXHXYnrMEc0gBV6QIX9HsaBfB7nNvm/YBkKAEVQAA7gPwiGG7JrFPMAWQ3DgDaBmuDlrXEX0d\nI88swVyHoslTmj7XbKvZYxLWRTKy6YjtBW2bAdAE1BdCjxTrsD3bBOF4HO4cqvZ7c9VVZh9E0Qqp\nroKddv3B4qMA6lgS8osALhWR14jIHIDrANxbw3lJaIosT5lFHUv32dZUvu22cOcAzPdm717gc5+L\n1q1NMh5n37esdaBd17vlsojEBVdNYdoAvBvA0wB+BOA7mI70AVwM4HBivz0AvoEoGmjN9ficAfSc\numzP6TLQPglgZShj4rKZZFyPSbv+YAETwUhnqCMKqClBWIUZxte5S7v+4PBRABLt3052796tGxsb\nTV8G6TLLy8Dm5vbPl5aAJ57o5rnX14G1tcjss7gYmYaKmuFI7xCRh1R1t8u+dfgACGkOV5t5FWTZ\n8suwshIpkNOno78U/qQgVACk3zTpDA3tNCckMFQApN9UNQp3haN10mKoAEi/4SicECtnNX0BhFTO\nygoFPiEGOAMghJCBQgVACCEDhQqAEEIGChUAIYQMFCoAQggZKK0uBSEiLwAw5NKXZheA71Zw3D7A\ne2OH98YO742duu/Nkqqe77JjqxVAVYjIhmutjKHBe2OH98YO742dNt8bmoAIIWSgUAEQQshAGaoC\nuKvpC2gxvDd2eG/s8N7Yae29GaQPgBBCyHBnAIQQMnioAAghZKAMQgGIyG+IyKMiclpErOFYInK1\niDwmIo+LyK11XmNTiMiCiHxGRL45/fsKy35PiMhXReRhEentOp15bUAiPjj9/isi8qYmrrMpHO7P\n20Xk+9N28rCI/E4T11k3InK3iDwvIo9Yvm9luxmEAgDwCIB/AuBB2w4iMgJwO4B3AbgMwHtF5LJ6\nLq9RbgVwv6peCuD+6Xsbv6Cqb2xrTHNZHNvAuwBcOt32Abij1otsEI8+8tlpO3mjqn6g1otsjj8C\ncHXG961sN4NQAKr6NVV9LGe3NwN4XFW/raonAHwUwDXVX13jXAPg0PT1IQC/3uC1NI1LG7gGwEc0\n4vMAzhORi+q+0IYYah/JRVUfBHA0Y5dWtptBKABHXgXgqcT7p6ef9Z0LVPXZ6evnAFxg2U8B3Cci\nD4nIvnourXZc2sBQ2wng/r+/ZWrm+JSIvL6eS2s9rWw3vVkRTETuA3Ch4as1Vf1k3dfTJrLuTfKN\nqqqI2OKCr1TVZ0TklQA+IyJfn456CEnyJQCLqnpMRPYA+AQiswdpIb1RAKr6jpKHeAbAJYn3r55+\n1nmy7o2IfEdELlLVZ6dT0uctx3hm+vd5Efk4InNA3xSASxvobTtxIPd/V9UXE68Pi8hBEdmlqkMv\nFNfKdkMT0Bm+COBSEXmNiMwBuA7AvQ1fUx3cC2Dv9PVeANtmSyKyQ0TOjV8DeCcix3rfcGkD9wK4\ncRrVcQWA7ydMaH0n9/6IyIUiItPXb0YkY47UfqXto5XtpjczgCxE5N0A/gDA+QD+h4g8rKq/LCIX\nA/iwqu5R1R+LyG8B+DSAEYC7VfXRBi+7Ln4fwJ+JyG8iKr19LQAk7w0iv8DHp/36LAB/oqr/s6Hr\nrQxbGxCR/dPv7wRwGMAeAI8DOA7gpqaut24c7897AKyKyI8B/ADAdTqAcgMi8qcA3g5gl4g8DeA/\nApgF2t1uWAqCEEIGCk1AhBAyUKgACCFkoFABEELIQKECIISQgUIFQAghA4UKgBBCBgoVACGEDJT/\nD4CqBkj89BbFAAAAAElFTkSuQmCC\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x7fc4f6f46208>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.title(\"Two Circles\")\n",
"plt.plot(X[outer, 0], X[outer, 1], \"ro\")\n",
"plt.plot(X[inner, 0], X[inner, 1], \"bo\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"X = X+1"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"X_train, X_val, y_train, y_val = train_test_split(X, y, test_size=0.2, random_state=SEED)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"def sigmoid(x):\n",
" return 1 / (1 + np.exp(-x))"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"n_hidden = 50 # number of hidden units\n",
"n_epochs = 1000\n",
"learning_rate = 1"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"# Initialise weights\n",
"weights_hidden = np.random.normal(0.0, size=(X_train.shape[1], n_hidden))\n",
"weights_output = np.random.normal(0.0, size=(n_hidden))\n",
"\n",
"hist_loss = []\n",
"hist_accuracy = []"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Epoch: 0 ; Validation loss: 0.2532 ; Validation accuracy: 0.65\n",
"Epoch: 100 ; Validation loss: 0.207 ; Validation accuracy: 0.75\n",
"Epoch: 200 ; Validation loss: 0.1707 ; Validation accuracy: 0.8\n",
"Epoch: 300 ; Validation loss: 0.1428 ; Validation accuracy: 0.825\n",
"Epoch: 400 ; Validation loss: 0.1211 ; Validation accuracy: 0.8625\n",
"Epoch: 500 ; Validation loss: 0.1043 ; Validation accuracy: 0.9125\n",
"Epoch: 600 ; Validation loss: 0.0914 ; Validation accuracy: 0.925\n",
"Epoch: 700 ; Validation loss: 0.0813 ; Validation accuracy: 0.95\n",
"Epoch: 800 ; Validation loss: 0.0733 ; Validation accuracy: 0.9875\n",
"Epoch: 900 ; Validation loss: 0.0669 ; Validation accuracy: 1.0\n"
]
}
],
"source": [
"for e in range(n_epochs):\n",
" del_w_hidden = np.zeros(weights_hidden.shape)\n",
" del_w_output = np.zeros(weights_output.shape)\n",
"\n",
" # Loop through training data in batches of 1\n",
" for x_, y_ in zip(X_train, y_train):\n",
" # Forward computations\n",
" hidden_input = np.dot(x_, weights_hidden)\n",
" hidden_output = sigmoid(hidden_input)\n",
" output = sigmoid(np.dot(hidden_output, weights_output))\n",
"\n",
" # Backward computations\n",
" error = y_ - output\n",
" output_error = error * output * (1 - output)\n",
" hidden_error = np.dot(output_error, weights_output) * hidden_output * (1 - hidden_output)\n",
" del_w_output += output_error * hidden_output\n",
" del_w_hidden += hidden_error * x_[:, None]\n",
"\n",
" # Update weights\n",
" weights_hidden += learning_rate * del_w_hidden / X_train.shape[0]\n",
" weights_output += learning_rate * del_w_output / X_train.shape[0]\n",
"\n",
" # Print stats (validation loss and accuracy)\n",
" if e % 100 == 0:\n",
" hidden_output = sigmoid(np.dot(X_val, weights_hidden))\n",
" out = sigmoid(np.dot(hidden_output, weights_output))\n",
" loss = np.mean((out - y_val) ** 2)\n",
" # Final prediction is based on a threshold of 0.5\n",
" predictions = out > 0.5\n",
" accuracy = np.mean(predictions == y_val)\n",
" print(\"Epoch: \", '{:>4}'.format(e), \n",
" \"; Validation loss: \", '{:>6}'.format(loss.round(4)), \n",
" \"; Validation accuracy: \", '{:>6}'.format(accuracy.round(4)))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
},
"widgets": {
"state": {},
"version": "1.1.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
| {
"pile_set_name": "Github"
} |
/*
*
* Copyright 2020 WeBank
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.webank.wedatasphere.exchangis.job.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import javax.validation.constraints.NotBlank;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* Executor node
* @author davidhua
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class ExecutorNode {
private Integer id;
@NotBlank(message = "{udes.domain.executor.address.notBlank}")
private String address;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date heartbeatTime;
private Integer status;
private Float memRate;
private Float cpuRate;
private List<TaskState> taskStates = new ArrayList<>();
private List<Integer> tabIds = new ArrayList<>();
private List<String> tabNames = new ArrayList<>();
private boolean defaultNode = false;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Date getHeartbeatTime() {
return heartbeatTime;
}
public void setHeartbeatTime(Date heartbeatTime) {
this.heartbeatTime = heartbeatTime;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Float getMemRate() {
return memRate;
}
public void setMemRate(Float memRate) {
this.memRate = memRate;
}
public Float getCpuRate() {
return cpuRate;
}
public void setCpuRate(Float cpuRate) {
this.cpuRate = cpuRate;
}
public List<TaskState> getTaskStates() {
return taskStates;
}
public void setTaskStates(List<TaskState> taskStates) {
this.taskStates = taskStates;
}
public List<Integer> getTabIds() {
return tabIds;
}
public void setTabIds(List<Integer> tabIds) {
this.tabIds = tabIds;
}
@Override
public boolean equals(Object obj) {
if(obj instanceof ExecutorNode){
return address.equals(((ExecutorNode) obj).address);
}
return address.equals(obj);
}
@Override
public int hashCode() {
return address.hashCode();
}
public List<String> getTabNames() {
return tabNames;
}
public void setTabNames(List<String> tabNames) {
this.tabNames = tabNames;
}
public boolean isDefaultNode() {
return defaultNode;
}
public void setDefaultNode(boolean defaultNode) {
this.defaultNode = defaultNode;
}
}
| {
"pile_set_name": "Github"
} |
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.avenwu.deepinandroid.MarkdownDemo">
<item android:id="@+id/action_settings" android:title="@string/action_settings"
android:orderInCategory="100" app:showAsAction="never" />
</menu>
| {
"pile_set_name": "Github"
} |
# translation of gimp-tips.HEAD.po to Dzongkha
# This file is distributed under the same license as the PACKAGE package.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER.
# Dorji Tashi <[email protected]>, 2006.
#
msgid ""
msgstr ""
"Project-Id-Version: gimp-tips.HEAD\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gimp/issues\n"
"POT-Creation-Date: 2007-06-07 03:44+0100\n"
"PO-Revision-Date: 2007-06-19 12:48+0530\n"
"Last-Translator: yumkee lhamo <[email protected]>\n"
"Language-Team: Dzongkha <[email protected]>\n"
"Language: dz\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: KBabel 1.10.2\n"
"Plural-Forms: nplurals=2;plural=(n!=1)\n"
#: ../data/tips/gimp-tips.xml.in.h:1
msgid "<big>Welcome to the GNU Image Manipulation Program!</big>"
msgstr "</big>ཇི་ཨིན་ཡུ་ མ་ནུ་པ་ལེ་ཤན་ ལས་རིམ་ལུ་ བྱོན་པ་ལེགས་སོ་ཡོད!</big>"
#: ../data/tips/gimp-tips.xml.in.h:2
msgid "<tt>Ctrl</tt>-click with the Bucket Fill tool to have it use the background color instead of the foreground color. Similarly, <tt>Ctrl</tt>-clicking with the eyedropper tool sets the background color instead of the foreground color."
msgstr "<tt>Ctrl</tt>-གདོང་གཞིའི་ཚོས་གཞི་གི་ཚབ་ལུ་རྒྱབ་གཞི་ཚོས་གཞི་ལག་ལེན་འཐབ་ནི་ལུ་ བ་ཀེཊི་བཀང་བའི་ལག་ཆས་དང་ཅིག་ཁར་ཨེབ་གཏང་འབད། ཆ་འདྲ་བ་འབད་ <tt>Ctrl</tt>- ཚོས་གཞི་འདེམས་བྱེད་ལག་ཆས་དང་ཅིག་ཁར་ཨེབ་གཏང་འབད་མི་དེ་གིས་ གདོང་གཞི་ཚོས་གཞིའི་ཚབ་ལུ་རྒྱབ་གཞི་ཚོས་གཞི་འདི་ གཞི་སྒྲིག་འབདཝ་ཨིན།"
#: ../data/tips/gimp-tips.xml.in.h:3
msgid "<tt>Ctrl</tt>-clicking on the layer mask's preview in the Layers dialog toggles the effect of the layer mask. <tt>Alt</tt>-clicking on the layer mask's preview in the Layers dialog toggles viewing the mask directly."
msgstr "<tt>Ctrl</tt>-བང་རིམ་ཌའི་ལོག་བང་རིམ་གདོང་ཁེབས་སྔོན་ལྟ་གུ་ཨེབ་གཏང་འབད་མི་དེ་གིས་ བང་རིམ་གདོང་ཁེབས་གྱི་ནུས་པ་འདི་སོར་སྟོན་འབདཝ་ཨིན། <tt>Alt</tt>- བང་རིམ་ཌའི་ལོག་ནང་བང་རིམ་གདོང་ཁེབས་སྔོན་ལྟ་གུ་ཨེབ་གཏང་འབད་མི་དེ་གིས་ གདོང་ཁེབས་ཐད་ཀར་དུ་མཐོང་མི་དེ་ལུ་སོར་སྟོན་འབདཝ་ཨིན།"
#: ../data/tips/gimp-tips.xml.in.h:4
msgid "<tt>Ctrl</tt>-drag with the Rotate tool will constrain the rotation to 15 degree angles."
msgstr "<tt>ཚད་འཛིན་</tt>-བསྒྱིར་ནིའི་ལག་ཆས་དང་གཅིག་ཁར་འདྲུད་མི་དེ་གིས་ བསྒྱིར་ནི་དེ་ དབྱེ་རིམ་གྲུ་ཟུར་༡༥་ཚུན་དམ་འོང་། "
#: ../data/tips/gimp-tips.xml.in.h:5
msgid "<tt>Shift</tt>-click on the eye icon in the Layers dialog to hide all layers but that one. <tt>Shift</tt>-click again to show all layers."
msgstr "<tt>སོར་ལྡེ་</tt>བང་རིམ་ཆ་མཉམ་སྦ་བཞག་ནིའི་དོན་ལུ་ བང་རིམ་ཌའི་ལོག་ནང་གི་ མིག་ཏོ་ངོས་པར་གུར་ ཨེབ་གཏང་འབད་ དོ་འབདཝ་ད་ འ་ཕི་<tt>སོར་ལྡེ་</tt>-བང་རིམ་ཆ་མཉམ་སྟོན་ནིའི་དོན་ལུ་ ལོག་ཨེབ་གཏང་འབད།"
#: ../data/tips/gimp-tips.xml.in.h:6
msgid "A floating selection must be anchored to a new layer or to the last active layer before doing other operations on the image. Click on the "New Layer" or the "Anchor Layer" button in the Layers dialog, or use the menus to do the same."
msgstr "འཕུར་ལྡིང་འབད་ཡོད་པའི་སེལ་འཐུ་དེ་ བང་རིམ་གསརཔ་ལུ་དང་ ཡང་ན་ གཟུགས་བརྙན་གུ་ལུ་བཀོལ་སྤྱོད་མ་འབད་བའི་ཧེ་མ་ མཇུག་མམ་གྱི་ཤུགས་ལྡན་བང་རིམ་ལུ་ ཨེན་ཀོར་འབད་དགོ "གུར་ཨེབ་གཏང་འབད། བང་རིམ་གསརཔ་" ཡང་ན་ "དེ། ཨེན་ཀོར་འབད་ནི་བང་རིམ་" བང་རིམ་ཚུ་གུ་ཌའི་ལོག་ནང་གི་ཨེབ་རྟ་ ཡང་ན་ ཅོག་གཅིགཔ་སྦེ་འབད་ནི་དོན་ལུ་ དཀར་ཆག་ལག་ལེན་འཐབ།"
#: ../data/tips/gimp-tips.xml.in.h:7
msgid "After you enabled "Dynamic Keyboard Shortcuts" in the Preferences dialog, you can reassign shortcut keys. Do so by bringing up the menu, selecting a menu item, and pressing the desired key combination. If "Save Keyboard Shortcuts" is enabled, the key bindings are saved when you exit GIMP. You should probably disable "Dynamic Keyboard Shortcuts" afterwards, to prevent accidentally assigning/reassigning shortcuts."
msgstr "དགའ་གདམ་ཌའི་ལོག་ནང་ ཁྱོད་ཀྱིས་"ནུས་ཅན་ལྡེ་སྒྲོམ་མགྱོགས་ཐབས་" དེ་ ཤུགས་ཅན་བཟོ་ཚར་བའི་ཤུལ་ལས་ ཁྱོད་ཀྱིས་མགྱོགས་ཐབས་ལྡེ་མིག་ཚུ་འགན་སྤྲོད་འབད་ཚུགས། དེ་ཡང་ དཀར་ཆག་ཡར་འབག་འོང་སྟེ་འབད་ནི་དང་ དཀར་ཆག་གི་རྣམ་གྲངས་སེལ་འཐུ་འབད་བའི་ཐོག་ལས་དང་ རེ་འདུན་ཅན་གྱི་མཉམ་མཐུད་ལྡེ་སྒྲོམ་ཨེབ་པའི་ཐོག་ལས་འབད་དགོཔ་ཨིན། "ལྡེ་སྒྲོམ་མགྱོགས་ཐབས་སྲུང་བཞག་འབད་ནི་"དེ་ལྕོགས་ཅན་བཟོ་ཚར་བ་ཅིན་ ཁྱོད་ཀྱིས་ཇི་ཨའི་ཨེམ་པི་དེ་ཕྱིར་ཐོན་འབད་བའི་སྐབས་ལུ་ ཀི་བཱའིན་ཌིང་ཚུ་ སྲུང་བཞག་འབདཝ་ཨིན། ཁྱོད་ཀྱིས་ ཤུལ་ལས་" ནུས་ཅན་ལྡེ་སྒྲོམ་མགྱོགས་ཐབས་" འདི་ལྕོགས་མེད་བཟོ་དགོ་ དེ་ཡང་ གློ་བུར་དུ་འགན་སྤྲོད་འབད་ནི་/ལོག་འགན་སྤྲོད་འབད་བའི་མགྱོགས་ཐབས་ཚུ་སྔོན་བཀག་འབད་ནི་ལུ་ཨིན།"
#: ../data/tips/gimp-tips.xml.in.h:8
msgid "Click and drag on a ruler to place a guide on an image. All dragged selections will snap to the guides. You can remove guides by dragging them off the image with the Move tool."
msgstr "ལམ་སྟོན་པ་དེ་ གཟུགས་བརྙན་གུར་བཞག་ནིའི་དོན་ལུ་ ཐིག་ཤིང་གུར་ཨེབ་གཏང་འབད་དེ་འདྲུད། འདྲུད་མི་སེལ་འཐུ་ཆ་མཉམ་གྱི་ ལམ་སྟོན་པ་ལུ་པར་བཏབ་ཨིན། ཁྱོད་ཀྱིས་ ལམ་སྟོན་པ་ཚུ་ གཟུགས་བརྙན་གུ་ལས་སྤོ་བཤུད་ལག་ཆས་གཅིག་ཁར་ ཕྱི་ཁར་ལུ་ འདྲུད་པའི་ཐོག་ལས་ རྩ་བསྐྲད་གཏང་ཚུགས། "
#: ../data/tips/gimp-tips.xml.in.h:9
msgid "GIMP allows you to undo most changes to the image, so feel free to experiment."
msgstr "ཇི་ཨའི་ཨེམ་པི་གིས་ བསྒྱུར་བཅོས་མང་ཤོས་རང་གཟུགས་བརྙན་ལུ་འབད་བཤོལ་བཞག་བཅུགཔ་ཨིན་ དེ་འབདཝ་ལས་ ཐེ་ཚོམ་ག་ནི་ཡང་མེད་པར་ བརྟག་དཔྱད་འབད།"
#: ../data/tips/gimp-tips.xml.in.h:10
msgid "GIMP supports gzip compression on the fly. Just add <tt>.gz</tt> (or <tt>.bz2</tt>, if you have bzip2 installed) to the filename and your image will be saved compressed. Of course loading compressed images works too."
msgstr "ཇི་ཨའི་ཨེམ་པི་གིས་ ཇི་ཛིབ་ཨེབ་བཙུགས་དེ་ ཕ་ལའི་གུར་རྒྱབ་སྐྱོར་འབདཝ་ཨིན།<tt>.gz</tt>(ཡང་ན་ ཁྱོད་ཀྱིས་ བི་ཛིབ་༢་དེ་གཞི་བཙུགས་འབད་དེ་ཡོད་པ་ཅིན་ཡང་ན་ <tt>.gz</tt>)དེ་ ཡིག་སྣོད་མིང་ལུ་ཁ་སྐོང་རྐྱབས་དང་ ཁྱོད་ཀྱི་གཟུགས་བརྙན་དེ་ཨེབ་བཙུགས་སྦེ་སྲུང་བཞག་འབད་བཞག་འོང་། དེ་མ་ཚད་ཨེབ་བཙུགས་འབད་ཡོད་པའི་གཟུགས་བརྙན་ལཱ་གཡོག་ཚུ་ མངོན་གསལ་འབད་ནི་ཡང་ ངེས་བདེན་སྲུང་བཞག་འབད་ཚུགས།"
#: ../data/tips/gimp-tips.xml.in.h:11
msgid "GIMP uses layers to let you organize your image. Think of them as a stack of slides or filters, such that looking through them you see a composite of their contents."
msgstr "ཇི་ཨའི་ཨེམ་པི་གིས་ ཁྱོད་ཀྱིས་ཁྱོད་རའི་གཟུགས་བརྙན་འགོ་འདྲེན་འཐབ་བཅུག་ནིའི་དོན་ལུ་ བང་རིམ་ཚུ་ལག་ལེན་འཐབ་ཨིན། ཁྱོད་ཀྱིས་དེ་ཚུ་ བཤུད་བརྙན་གྱི་བརྩེགས་ཕུང་དང་ཡང་ན་ ཚགས་མ་སྦེ་མནོ་་མནོ་བསམ་བཏངདེ་ཚེ་བརྒྱུད་དེ་བལྟ་མི་དེ་གིས་ དེ་ཚུའི་ནང་དོན་གྱི་སྣ་སྡུད་ཅིག་མཐོང་ཚུགས།་ཏེ་ "
#: ../data/tips/gimp-tips.xml.in.h:12
msgid "If a layer's name in the Layers dialog is displayed in <b>bold</b>, this layer doesn't have an alpha-channel. You can add an alpha-channel using Layer→Transparency→Add Alpha Channel."
msgstr "བང་རིམ་ཌའི་ལོག་ནང་གི་བང་རིམ་གྱི་མིང་དེ་ <b>རྒྱགས་པ་</b>,ནང་ལུ་བསྐྲམ་སྟོན་འབད་དེ་ཡོད་པ་ཅིན་ བང་རིམ་འདི་ལུ་ ཨཱལ་ཕ་རྒྱུ་ལམ་དེ་མེདཔ་ཨིན། ཁྱོད་ཀྱིས་ བང་རིམ་→དྭངས་གསལ་ཅན་→དེ་ལག་ལེན་འཐབ་པའི་ཐོག་ལས་ ཨཱལ་ཕ་རྒྱུ་ལམ་དེ་ ཁ་སྐོང་རྐྱབ་ཚུགས། ཨཱལ་ཕ་རྒྱུ་་ལམ་ཁ་སྐོང་རྐྱབས།"
#: ../data/tips/gimp-tips.xml.in.h:13
msgid "If some of your scanned photos do not look colorful enough, you can easily improve their tonal range with the "Auto" button in the Levels tool (Colors→Levels). If there are any color casts, you can correct them with the Curves tool (Colors→Curves)."
msgstr "ཁྱོད་ཀྱིས་ཞིབ་ལྟ་འབད་ཚར་མི་པར་ཚུ་ ཚོས་གཞི་དང་ལྡནམ་སྦེ་མ་མཐོང་པ་ཅིན་ ཁྱོད་ཀྱིས་ དེ་ཚུ་གི་ཊོ་ནལ་ཁྱབ་ཚད་ཚུ་ "Auto"གནས་རིམ་ནང་གི་ལག་ཆས་ཚུ་གི་ཐོག་ལས་་ལེགས་བཅོས་བཏང་ཚུགས་ (ཚོས་གཞི་→གནས་རིམ་→ཚུ་) དེ་ནང་ལུ་ཚོས་གཞི་གི་ཁྱད་པར་ཡོད་པ་ཅིན་ ཁྱོད་ཀྱིས་ གུག་གུག་པའི་ལག་ཆས་ཀྱི་ཐོག་ལས་ ནོར་བཅོས་འབད་ཚུགས། (ཚོས་གཞི་ཚུ་→གུག་གུགཔ་)"
#: ../data/tips/gimp-tips.xml.in.h:14
msgid "If you stroke a path (Edit→Stroke Path), the paint tools can be used with their current settings. You can use the Paintbrush in gradient mode or even the Eraser or the Smudge tool."
msgstr "ཁྱོད་ཀྱིས་འགྲུལ་ལམ་ཅིག་སིཊོཀ་འབད་བ་ཅིན་(ཞུན་དག་→འགྲུལ་ལམ་སི་ཊོག་འབད་) ཚོན་གཏང་ནིའི་ལག་ཆས་ཚུ་ དེ་ཚུའི་ད་ལྟོའི་སྒྲིག་སྟངས་ཚུ་དང་ཅིག་ཁར་ལག་ལེན་འཐབ་བཏུབ། ཁྱོད་ཀྱིས་ཚོན་གཏང་པྱིར་འདི་སྟེགས་རིས་ཐབས་ལམ་ནང་ལུ་ ཡང་ན་ གསད་ནི་ཡང་ན་རབ་རིབ་ལག་ཆས་ནང་ལག་ལེན་འཐབ་བཏུབ།"
#: ../data/tips/gimp-tips.xml.in.h:15
msgid "If your screen is too cluttered, you can press <tt>Tab</tt> in an image window to toggle the visibility of the toolbox and other dialogs."
msgstr "ཁྱོད་ཀྱི་གསལ་གཞི་དེ་གནམ་མེད་ས་མེད་ཟིང་ཆ་ཅན་ཅིག་ཨིན་པ་ཅིན་ ལག་ཆས་སྒྲོམ་དང་གཞན་མི་ཌའི་ལོག་ཚུ་སོར་སྟོན་འབད་ནི་ལུ་ ཁྱོད་ཀྱིས་གཟུགས་བརྙན་སྒོ་སྒྲིག་ནང་གི་<tt>མཆོང་ལྡེ་</tt>འདི་ཨེབ་གཏང་།"
#: ../data/tips/gimp-tips.xml.in.h:16
msgid "Most plug-ins work on the current layer of the current image. In some cases, you will have to merge all layers (Image→Flatten Image) if you want the plug-in to work on the whole image."
msgstr "པ་ལག་ཨིནསི་མང་ཤོས་རང་ ད་ལྟོའི་གཟུགས་བརྙན་གྱི་བང་རིམ་གུར་ལཱ་འབདག་བཏུབ་ཨིན། གནད་དོན་ལ་ལུ་ཅིག་ནང་ལུ་ པ་ལག་ཨིན་དེ་གཟུགས་བརྙན་ཧྲིལ་བུམ་གུར་ལཱ་འབད་དགོ་པ་ཅིན་ ཁྱོད་ཀྱིས་བང་རིམ་ཚུ་ཆ་མཉམ་མཉམ་བསྡོམས་འབད་དགོ(གཟུགས་བརྙན་→གཟུགས་བརྙན་ལེབ་ཏེམ་བཟོ་) "
#: ../data/tips/gimp-tips.xml.in.h:17
msgid "Not all effects can be applied to all kinds of images. This is indicated by a grayed-out menu-entry. You may need to change the image mode to RGB (Image→Mode→RGB), add an alpha-channel (Layer→Transparency→Add Alpha Channel) or flatten it (Image→Flatten Image)."
msgstr "ནུས་པ་ཚུ་ཆ་མཉམ་ གཟུགས་བརྙན་དབྱེ་ཁག་ཆ་མཆམ་ལུ་འཇུག་སྤྱོད་འབད་མི་བཏུབ། འདི་ཡང་ grayed-out དཀར་ཆག-ཐོ་བཀོད་ཀྱིས་བརྡ་སྟོནམ་ཨིན། ཁྱོད་ཀྱིས་གཟུགས་བརྙན་ཐབས་ལམ་དེ་ ཨཱར་བི་ཇི་ལུ་ བསྒྱུར་བཅོས་འབད་དགོཔ་འོང་། (གཟུགས་བརྙན་→ཐབས་ལམ་→ཨཱར་ཇི་བི་),ཨཱལ་ཕ་རྒྱུ་ལམ་ཁ་སྐོང་རྐྱབས་(བང་རིམ་→དྭངས་གསལ་→ཨཱལ་ཕ་རྒྱུ་ལམ་ཁ་སྐོང་རྐྱབས་) ཡང་ན་དེ་ལེབ་ཏེམ་བཟོ་(གཟུགས་བརྙན་→གཟུགས་བརྙན་ལེབ་ཏེམ་བཟོ)"
#: ../data/tips/gimp-tips.xml.in.h:18
msgid "Pressing and holding the <tt>Shift</tt> key before making a selection allows you to add to the current selection instead of replacing it. Using <tt>Ctrl</tt> before making a selection subtracts from the current one."
msgstr "ལྡེ་མིག་<tt>སོར་ལྡེ་</tt>དེ་ སེལ་འཐུ་མ་འབད་བའི་ཧེ་མ་ ཨེབ་ནི་དང་ འཆང་མི་དེ་གིས་ ཚབ་བཙུགས་ནི་གི་ཚབ་ལུ་ ད་ལྟོའི་སེལ་འཐུ་ལུ་ཁ་སྐོང་འབད་བཅུགཔ་ཨིན།སེལ་འཐུ་མ་འབད་བའི་ཧེ་མ་<tt>ཚད་འཛིན་</tt>དེལག་ལེན་འཐབ་མི་དེ་གིས་ ད་ལྟོ་གི་ནང་ལས་ཕབ་ཨིན།"
#: ../data/tips/gimp-tips.xml.in.h:19
msgid "To create a circle-shaped selection, hold <tt>Shift</tt> while doing an ellipse select. To place a circle precisely, drag horizontal and vertical guides tangent to the circle you want to select, place your cursor at the intersection of the guides, and the resulting selection will just touch the guides."
msgstr "དབྱིབས་སྒོར་ཐིག་ཅན་དབྱིབས་སེལ་འཐུ་དེ་གསར་བསྐྲུན་འབད་ནི་དོན་ལུ་ སྒོང་དབྱིབས་སེལ་འཐུ་འབད་བའི་སྐབས་ལུ་ <tt>དེ་འཆང་</tt>སོར་གནང་། སྒོར་ཐིག་ཀྲིག་ཀྲིག་འབད་བཀལ་ནིའི་དོན་ལུ་ ཁྱོད་ཀྱིས་སེལ་འཐུ་སེལ་འཐུ་འབད་དགོ་མནོ་མི་སྒོར་ཐིག་དེ་ལུ་ ཐད་སྙོམས་དང་ཀེར་ཕྲེང་སྦེ་ཡོད་མི་ ལམ་སྟོན་ཊེན་ཇེནཊི་དོ་འདྲུད། ཁྱོད་ཀྱི་འོད་རྟགས་དེ་ལམ་སྟོན་པའི་འཛོམས་ས་ལུ་བཞག་ནི་དང་ འདི་ནང་ལས་གྲུབ་འབྲས་བྱིང་མི་སེལ་འཐུ་དེ་གིས་ ལམ་སྟོན་པ་ལུ་རེགཔ་ཨིན།"
#: ../data/tips/gimp-tips.xml.in.h:20
msgid "When you save an image to work on it again later, try using XCF, GIMP's native file format (use the file extension <tt>.xcf</tt>). This preserves the layers and every aspect of your work-in-progress. Once a project is completed, you can save it as JPEG, PNG, GIF, ..."
msgstr "ཁྱོད་ཀྱིས་གཟུགས་བརྙན་དེ་ཤུལ་ལས་ཁོ་ར་ལུ་ལོག་ལཱ་འབད་བཏུབ་མི་སྲུང་བཞག་འབདཝ་སྐབས་ལུ་ ཨེགསི་སི་ཨེཕ་དང་ ཇི་ཨའི་ཨེམ་པི་གི་ནེ་ཊིབ་ཡིག་སྣོད་རྩ་སྒྲིག་དེ་ལག་ེན་འཐབ་པའི་ཐོག་ལས་འབད་རྩོལ་བསྐྱེད་(ཡིག་སྣོད་རྒྱ་བསྐྱེད་ལག་ལེན་འཐབ་<tt>.xcf</tt>).འདི་གིས་ཁྱོད་ཀྱི་བང་རིམ་དང་ ལཱ་གི་རྣམ་པ་ཡར་འཕེལ་བཏང་སྟེ་བཞག་ནི་ཚུ་ཉམས་སྲུང་འབདཝ་ཨིན། ལས་འགུལ་དེ་ཚར་ཅིག་མཇུག་བསྡུ་ཞིནམ་ལས་ ཁྱོད་ཀྱིས་དེ་ ཇེ་པི་ཨི་ཇི་ པི་ཨེན་ཀེ་ ཇི་ཨའི་ཨེཕ་སྦེ་སྲུང་བཞག་འབད་ཚུགས།"
#: ../data/tips/gimp-tips.xml.in.h:21
msgid "You can adjust or move a selection by using <tt>Alt</tt>-drag. If this makes the window move, your window manager uses the <tt>Alt</tt> key already."
msgstr "ཁྱོད་ཀྱིས་<tt>གདམ་ལྡེ</tt>-འདྲུད་ དེ་ལག་ལེན་འཐབ་པའི་ཐོག་ལས་ སེལ་འཐུ་དེ་བདེ་སྒྲིག་འབད་ནི་དང་ ཡང་ན སྤོ་བཤུད་འབད་ནི་ཚུགས། འདི་གིས་ཁྱོད་ཀྱི་སྒོ་སྒྲིག་སྤོ་བཤུད་འབད་བཅུག་པ་ཅིན་ ཁྱོད་ཀྱི་སྒོ་སྒྲིག་འཛིན་སྐྱོང་པ་དེ་གིས་ <tt>གདམ་ལྡེ་</tt>ཧེ་མ་ལས་རང་ལྡེ་མིག་ལག་ལེན་འཐབ་ཨིན། "
#: ../data/tips/gimp-tips.xml.in.h:22
msgid "You can create and edit complex selections using the Path tool. The Paths dialog allows you to work on multiple paths and to convert them to selections."
msgstr "ཁྱོད་ཀྱིས་འགྲུལ་ལམ་ལག་ཆས་ལག་ལེན་འཐབ་པའི་ཐོག་ལས གོ་བཀའ་བའི་སེལ་འཐུ་ཚུ་ གསར་བསྐྲུན་འབད་ནི་དང་ ཞུན་དག་འབད་ཚུགས། འགྲུལ་ལམ་ཚུ་ཌའི་ལོག་གིས་ ཁྱོད་ལམ་སྣ་མང་གུར་ལཱ་འབད་ནི་དང་ དེ་ཚུ་སེལ་འཐུ་ལུ་གཞི་བསྒྱུར་འབད་བཅུགཔ་ཨིན།ུ་"
#: ../data/tips/gimp-tips.xml.in.h:23
msgid "You can drag a layer from the Layers dialog and drop it onto the toolbox. This will create a new image containing only that layer."
msgstr "ཁྱོད་ཀྱིས་བང་རིམ་དེ་ བང་རིམ་ཚུ་གི་དའི་ལོག་དེ་ནང་ལས་འདྲུད་དེ་ འ་ནི་དེ་ལག་ཆས་སྒྲོམ་ནང་ལུ་སར་འཇོག་འབད་ཚུགས། འདི་གིས་འ་ཕི་བང་རིམ་རྐྱངམ་ཅིག་ཡོད་མི་གཟུགས་བརྙན་གསརཔ་ཅིག་གསར་བསྐྲུན་འབད་འོང་།"
#: ../data/tips/gimp-tips.xml.in.h:24
msgid "You can drag and drop many things in GIMP. For example, dragging a color from the toolbox or from a color palette and dropping it into an image will fill the current selection with that color."
msgstr "ཁྱོད་ཀྱིས་ ཇི་ཨའི་ཨེམ་པི་ནང་ལུ་ ལེ་ཤ་ཅིག་རང་འདྲུད་དེ་ སར་འཇོག་འབད་ཚུགས། དཔེ་འབད་བ་ཅིན་ ཚོས་གཞི་ཅིག་ ལག་ཆས་སྒྲོམ་ནང་ལས་དང་ ཡང་ན་ ཚོས་གཞི་པེ་ལིཊི་ནང་ལས་ འདྲུད་དེ་ གཟུགས་བརྙན་ནང་ལུ་སར་འཇོག་འབད་མི་དེ་གིས་ ད་ལྟོའི་གཟུགས་བརྙན་ ཡང་ན་ སེལ་འཐུ་དེ་ཚོས་གཞི་དང་གཅིག་ཁར་བཀང་འོང་།"
#: ../data/tips/gimp-tips.xml.in.h:25
msgid "You can draw simple squares or circles using Edit→Stroke Selection. It strokes the edge of your current selection. More complex shapes can be drawn using the Path tool or with Filters→Render→Gfig."
msgstr "ཁྱོད་ཀྱིས་གྲུ་བཞི་ཡང་ན་ སྒོར་ཐིག་འཇམ་སམ་ཚུ་ ཞུན་དག་→སི་ཊོག་ སེལ་འཐུ་ དེ་ལག་ལེན་འཐབ་པའི་ཐོག་ལས་འབྲི་ཚུགས། གོ་བཀའ་བའི་དབྱིབས་ཧེང་བཀལ་ འགྲུལ་ལམ་ལག་ཆས་ ཡང་ན་ ཚགས་མ་→ལྷག་སྟོན་འབད་ནི་→ཇི་ཕིག་དེ་གི་ཐོག་ལསའབྲི་ཚུགས།"
#: ../data/tips/gimp-tips.xml.in.h:26
msgid "You can get context-sensitive help for most of GIMP's features by pressing the F1 key at any time. This also works inside the menus."
msgstr "ཁྱོད་ཀྱིས་སྐབས་དོན་- ཚོར་ཅན་གྲོགས་རམ་འདི་ དུས་ཚོད་ནམ་རང་འབད་རུང་ ཨེཕ་༡་ལྡེ་མིག་དེ་ཨེབ་པའི་ཐོག་ལས་ ཇི་ཨའི་ཨེམ་པི་གི་ཁྱད་རྣམ་ཚུ་མང་ཤོས་ཀྱི་དོན་ལུ་ འཐོབ་ཚུགས། འདི་གིས་དཀར་ཆག་ནང་ལུ་ཡང་ལཱ་འབད་བཏུབ་ཨིན།"
#: ../data/tips/gimp-tips.xml.in.h:27
msgid "You can perform many layer operations by right-clicking on the text label of a layer in the Layers dialog."
msgstr "ཁྱོད་ཀྱིས་བང་རིམ་ཚུ་གི་ཌའི་ལོག་ནང་ལུ་ བང་རིམ་གྱི་ཚིག་ཡིག་ཁ་ཡིག་གུར་གཡས་ལུ་ ཨེབ་གཏང་འབད་བའི་ཐོག་ལས བང་རིམ་ལེ་ཤ་གི་བཀོལ་སྤྱོད་ཀྱི་ལཱ་འགན་འགྲུབ་ཚུགས།"
#: ../data/tips/gimp-tips.xml.in.h:28
msgid "You can save a selection to a channel (Select→Save to Channel) and then modify this channel with any paint tools. Using the buttons in the Channels dialog, you can toggle the visibility of this new channel or convert it to a selection."
msgstr "ཁྱོད་ཀྱིས་སེལ་འཐུ་དེ་རྒྱུ་་ལམ་ལུ་སྲུང་བཞག་འབད་ཚུགས་(སེལ་འཐུ་→རྒྱུ་་ལམ་ལུ་སྲུང་བཞག་འབད་) དེ་ལས་ ཚོན་གཏང་ནིའི་ལག་ཆས་གང་རུང་ཅིག་གིས་ཐོག་ལས རྒྱ་ལམ་འདི་ལེགས་བཅོས་འབད། རྒྱུ་་ལམ་ཌའི་ལོག་ནང་གི་ཨེབ་རྟ་ལག་ལེན་འཐབ་མི་དེ་གིས་ ཁྱོད་ཀྱིས་རྒྱུ་ལམ་གསརཔ་འདི་གི་མཐོང་གསལ་སོར་སྟོན་འབད་ཚུགས་ཡང་ན་ སེལ་འཐུ་ལུ་གཞི་བསྒྱུར་འབད་ཚུགས།"
#: ../data/tips/gimp-tips.xml.in.h:29
msgid "You can use <tt>Ctrl</tt>-<tt>Tab</tt> to cycle through all layers in an image (if your window manager doesn't trap those keys...)."
msgstr "ཁྱོད་ཀྱིས་ བང་རིམ་ཆ་མཉམ་བརྒྱུད་དེ་གཟུགས་བརྙན་ནང་ལུ་ བསྐྱར་འཁོར་འབད་ནིའི་དོན་ལུ་ <tt>གདམ་ལྡེ</tt>-<tt>མཆོང་ལྡེ་</tt>དེ་ལག་ལེན་འཐབ་ཚུགས་(ཁྱོད་རའི་སྒོ་སྒྲིག་འཛིན་སྐྱོང་པ་དེ་གིས་ ལྡེ་མིག་དེ་ཚུ་དམ་བཟུང་མ་འབད་བ་ཅིན་...)"
#: ../data/tips/gimp-tips.xml.in.h:30
msgid "You can use the middle mouse button to pan around the image (or optionally hold <tt>Spacebar</tt> while you move the mouse)."
msgstr "གཟུགས་བརྙན་གྱི་མཐའ་སྐོར་ཏེ་པཱན་འབད་ནིའི་དོན་ལུ་ ཁྱོད་ཀྱིས་བར་ན་གི་མའུསུ་ཨེབ་རྟ་འདི་ལག་ལེན་འཐབ་ཆོག་(ཡང་ན་གདམ་ཁ་ཅན་གྱི་ཐོག་ལས་ <tt>བར་སྟོང་ཕྲ་རིང་</tt> འདི་ཁྱོད་ཀྱིས་མཱའུསི་སྤོ་བཤུད་འབད་བའི་སྐབས་འཆང་་)།"
#: ../data/tips/gimp-tips.xml.in.h:31
msgid "You can use the paint tools to change the selection. Click on the "Quick Mask" button at the bottom left of an image window. Change your selection by painting in the image and click on the button again to convert it back to a normal selection."
msgstr "ཁྱོད་ཀྱིས་སེལ་འཐུ་དེ་བསྒྱུར་བཅོས་འབད་ནིའི་དོན་ལུ་ ཚོན་གཏང་ནིའི་ལག་ཆས་ལག་ལེན་འཐབ།"འཕྲལ་མགྱོགས་གདོང་ཁེབས་"གཟུགས་བརྙན་སྒོ་སྒྲིག་གི་གཤམ་གྱི་གཡོན་ལུ་ཡོད་མི་ཨེབ་རྟ་ལུ་ ཨེབ་གཏང་འབད། ཁྱོད་ཀྱི་སེལ་འཐུ་དེ་ གཟུགས་བརྙན་ནང་ལུ་་ཚོན་གཏང་པའི་ཐོག་ལས་བསྒྱུར་བཅོས་འབད་ དེ་ལས་ པྱིར་གཏང་སེལ་འཐུ་ལུ་ལོག་གཞི་བསྒྱུར་འབད་ནིའི་དོན་ལུ་ ཨེབ་རྟ་ལུ་ལོག་ཨེབ་གཏང་འབད།"
#~ msgid ""
#~ "<tt>Alt</tt>-click on the layer mask's preview in the Layers dialog "
#~ "toggles viewing the mask directly."
#~ msgstr ""
#~ "<tt>གདམ་ལྡེ་</tt>-གདོང་ཁེབས་ལུ་ཐད་ཀར་སྦེ་བལྟ་བའི་ཐོག་ལས་ བང་རིམ་ཌའིི་ལོག་སོར་སྟོན་ནང་ལུ་ཡོན་"
#~ "མི་ བང་རིམ་གདོང་ཁེབས་ཀྱི་སྔོན་བལྟའི་གུར་ ཨེབ་གཏང་འབད།"
#~ msgid ""
#~ "When using a drawing tool (Paintbrush, Airbrush, or Pencil), <tt>Shift</"
#~ "tt>-click will draw a straight line from your last drawing point to your "
#~ "current cursor position. If you also press <tt>Ctrl</tt>, the line will "
#~ "be constrained to 15 degree angles."
#~ msgstr ""
#~ "པར་འབྲི་ནིའི་ལག་ཆས་ལག་ལེན་འཐབ་པའི་སྐབས་སུ་ (ཚོན་བཏང་ནིའི་པྱིར་,རླུང་པྱིར་, ཡང་ན་ ཞ་མྱུག),"
#~ "<tt>སོར་ལྡེ་</tt>-ཨེབ་གཏང་འབད་མི་དེ་གིས་ ཁྱོད་ཀྱི་མཐའ་མཇུག་ལུ་འབྲི་མི་ཡིག་ཚད་ལས་ ཁྱོད་རའི་ད་"
#~ "ལྟོའི་འོད་རྟགས་གནས་ས་ཚུན་ལུ་ གྲལ་ཐིག་ཕྲང་ཏང་ཏ་ཅིག་འབྲི་འོང་། དོ་རུང་ཁྱོད་ཀྱིས་<tt>Ctrl</tt>,"
#~ "ཨེབ་མི་དེ་གིས་ གྲལ་ཐིག་དེ་དབྱེ་རིམ་ཟུར་ཁུག་༡༥་ཚུན་ལུ་དམ་བཞག་འོང་།"
#~ msgid ""
#~ "You can adjust the selection range for fuzzy select by clicking and "
#~ "dragging left and right."
#~ msgstr ""
#~ "ཁྱོད་ཀྱིས་ཕུ་ཛི་སེལ་འཐུའི་དོན་ལུ་ གཡོན་དང་གནས་ལུ་ཨེབ་གཏང་འབད་དེ་དང་ འདྲུད་པའི་ཐོག་ལས་ སེལ་འཐུ་"
#~ "དེ་བདེ་སྒྲིག་འབད་ཚུགས།"
#~ msgid ""
#~ "You can press or release the <tt>Shift</tt> and <tt>Ctrl</tt> keys while "
#~ "you are making a selection in order to constrain it to a square or a "
#~ "circle, or to have it centered on its starting point."
#~ msgstr ""
#~ "གྲུ་བཞི་ཡང་ན་ སྒོར་ཐིག་ ཡང་ན་ འགོ་བཙུགས་གནས་ལུ་དབུས་སྒྲིག་འབད་བཞག་ནི་ལུ་དམ་ནིའི་དོན་ལུ་ སེལ་"
#~ "འཐུ་འབད་བའི་སྐབས་སུ་ ཁྱོད་ཀྱིས་<tt>སོར་ལྡེ་</tt> དང་ <tt>ཚད་འཛིན་</tt> སྡེ་མིག་དེ་ ཨེབ་ཡང་"
#~ "ན་འཛིན་གྲོལ་འབད་ཚགས།"
| {
"pile_set_name": "Github"
} |
<?php
/**
* Smarty plugin
*
* @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {html_radios} function plugin
* File: function.html_radios.php
* Type: function
* Name: html_radios
* Date: 24.Feb.2003
* Purpose: Prints out a list of radio input types
* Params:
*
* - name (optional) - string default "radio"
* - values (required) - array
* - options (required) - associative array
* - checked (optional) - array default not set
* - separator (optional) - ie <br> or
* - output (optional) - the output next to each radio button
* - assign (optional) - assign the output as an array to this variable
* - escape (optional) - escape the content (not value), defaults to true
*
* Examples:
*
* {html_radios values=$ids output=$names}
* {html_radios values=$ids name='box' separator='<br>' output=$names}
* {html_radios values=$ids checked=$checked separator='<br>' output=$names}
*
* @link http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios}
* (Smarty online manual)
* @author Christopher Kvarme <[email protected]>
* @author credits to Monte Ohrt <monte at ohrt dot com>
* @version 1.0
*
* @param array $params parameters
* @param Smarty_Internal_Template $template template object
*
* @return string
* @uses smarty_function_escape_special_chars()
* @throws \SmartyException
*/
function smarty_function_html_radios($params, Smarty_Internal_Template $template)
{
$template->_checkPlugins(
array(
array(
'function' => 'smarty_function_escape_special_chars',
'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'
)
)
);
$name = 'radio';
$values = null;
$options = null;
$selected = null;
$separator = '';
$escape = true;
$labels = true;
$label_ids = false;
$output = null;
$extra = '';
foreach ($params as $_key => $_val) {
switch ($_key) {
case 'name':
case 'separator':
$$_key = (string)$_val;
break;
case 'checked':
case 'selected':
if (is_array($_val)) {
trigger_error('html_radios: the "' . $_key . '" attribute cannot be an array', E_USER_WARNING);
} elseif (is_object($_val)) {
if (method_exists($_val, '__toString')) {
$selected = smarty_function_escape_special_chars((string)$_val->__toString());
} else {
trigger_error(
'html_radios: selected attribute is an object of class \'' . get_class($_val) .
'\' without __toString() method',
E_USER_NOTICE
);
}
} else {
$selected = (string)$_val;
}
break;
case 'escape':
case 'labels':
case 'label_ids':
$$_key = (bool)$_val;
break;
case 'options':
$$_key = (array)$_val;
break;
case 'values':
case 'output':
$$_key = array_values((array)$_val);
break;
case 'radios':
trigger_error(
'html_radios: the use of the "radios" attribute is deprecated, use "options" instead',
E_USER_WARNING
);
$options = (array)$_val;
break;
case 'assign':
break;
case 'strict':
break;
case 'disabled':
case 'readonly':
if (!empty($params[ 'strict' ])) {
if (!is_scalar($_val)) {
trigger_error(
"html_options: {$_key} attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute",
E_USER_NOTICE
);
}
if ($_val === true || $_val === $_key) {
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"';
}
break;
}
// omit break; to fall through!
// no break
default:
if (!is_array($_val)) {
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
} else {
trigger_error("html_radios: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
}
break;
}
}
if (!isset($options) && !isset($values)) {
/* raise error here? */
return '';
}
$_html_result = array();
if (isset($options)) {
foreach ($options as $_key => $_val) {
$_html_result[] =
smarty_function_html_radios_output(
$name,
$_key,
$_val,
$selected,
$extra,
$separator,
$labels,
$label_ids,
$escape
);
}
} else {
foreach ($values as $_i => $_key) {
$_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
$_html_result[] =
smarty_function_html_radios_output(
$name,
$_key,
$_val,
$selected,
$extra,
$separator,
$labels,
$label_ids,
$escape
);
}
}
if (!empty($params[ 'assign' ])) {
$template->assign($params[ 'assign' ], $_html_result);
} else {
return implode("\n", $_html_result);
}
}
/**
* @param $name
* @param $value
* @param $output
* @param $selected
* @param $extra
* @param $separator
* @param $labels
* @param $label_ids
* @param $escape
*
* @return string
*/
function smarty_function_html_radios_output(
$name,
$value,
$output,
$selected,
$extra,
$separator,
$labels,
$label_ids,
$escape
) {
$_output = '';
if (is_object($value)) {
if (method_exists($value, '__toString')) {
$value = (string)$value->__toString();
} else {
trigger_error(
'html_options: value is an object of class \'' . get_class($value) .
'\' without __toString() method',
E_USER_NOTICE
);
return '';
}
} else {
$value = (string)$value;
}
if (is_object($output)) {
if (method_exists($output, '__toString')) {
$output = (string)$output->__toString();
} else {
trigger_error(
'html_options: output is an object of class \'' . get_class($output) .
'\' without __toString() method',
E_USER_NOTICE
);
return '';
}
} else {
$output = (string)$output;
}
if ($labels) {
if ($label_ids) {
$_id = smarty_function_escape_special_chars(
preg_replace(
'![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER,
'_',
$name . '_' . $value
)
);
$_output .= '<label for="' . $_id . '">';
} else {
$_output .= '<label>';
}
}
$name = smarty_function_escape_special_chars($name);
$value = smarty_function_escape_special_chars($value);
if ($escape) {
$output = smarty_function_escape_special_chars($output);
}
$_output .= '<input type="radio" name="' . $name . '" value="' . $value . '"';
if ($labels && $label_ids) {
$_output .= ' id="' . $_id . '"';
}
if ($value === $selected) {
$_output .= ' checked="checked"';
}
$_output .= $extra . ' />' . $output;
if ($labels) {
$_output .= '</label>';
}
$_output .= $separator;
return $_output;
}
| {
"pile_set_name": "Github"
} |
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var Subscriber_1 = require("../Subscriber");
function skip(count) {
return function (source) { return source.lift(new SkipOperator(count)); };
}
exports.skip = skip;
var SkipOperator = (function () {
function SkipOperator(total) {
this.total = total;
}
SkipOperator.prototype.call = function (subscriber, source) {
return source.subscribe(new SkipSubscriber(subscriber, this.total));
};
return SkipOperator;
}());
var SkipSubscriber = (function (_super) {
__extends(SkipSubscriber, _super);
function SkipSubscriber(destination, total) {
var _this = _super.call(this, destination) || this;
_this.total = total;
_this.count = 0;
return _this;
}
SkipSubscriber.prototype._next = function (x) {
if (++this.count > this.total) {
this.destination.next(x);
}
};
return SkipSubscriber;
}(Subscriber_1.Subscriber));
//# sourceMappingURL=skip.js.map | {
"pile_set_name": "Github"
} |
// (C) Copyright Gennadiy Rozental 2001.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
// File : $RCSfile$
//
// Version : $Revision$
//
// Description : runtime parameters forward declaration
// ***************************************************************************
#ifndef BOOST_TEST_UTILS_RUNTIME_FWD_HPP
#define BOOST_TEST_UTILS_RUNTIME_FWD_HPP
// Boost.Test
#include <boost/test/detail/config.hpp>
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
#include <boost/test/utils/basic_cstring/io.hpp> // operator<<(boost::runtime::cstring)
// Boost
#include <boost/shared_ptr.hpp>
// STL
#include <map>
namespace boost {
namespace runtime {
typedef unit_test::const_string cstring;
class argument;
typedef shared_ptr<argument> argument_ptr;
template<typename T> class typed_argument;
class basic_param;
typedef shared_ptr<basic_param> basic_param_ptr;
} // namespace runtime
} // namespace boost
#endif // BOOST_TEST_UTILS_RUNTIME_FWD_HPP
| {
"pile_set_name": "Github"
} |
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeOperators #-}
module Numerals where
import Data.Kind
data Z -- empty data type
data S a -- empty data type
data SNat n where -- natural numbers as singleton type
Zero :: SNat Z
Succ :: SNat n -> SNat (S n)
zero = Zero
one = Succ zero
two = Succ one
three = Succ two
-- etc...we really would like some nicer syntax here
type family (:+:) n m :: Type
type instance Z :+: m = m
type instance (S n) :+: m = S (n :+: m)
add :: SNat n -> SNat m -> SNat (n :+: m)
add Zero m = m
add (Succ n) m = Succ (add n m)
| {
"pile_set_name": "Github"
} |
namespace Server.Items
{
public class StandardOfChaosG : DualPointedSpear
{
public override bool IsArtifact => true;
public override int LabelNumber => 1113522; // Standard of Chaos
[Constructable]
public StandardOfChaosG()
{
Hue = 2209;
WeaponAttributes.HitHarm = 30;
WeaponAttributes.HitFireball = 20;
WeaponAttributes.HitLightning = 10;
WeaponAttributes.HitLowerDefend = 40;
Attributes.WeaponSpeed = 30;
Attributes.WeaponDamage = -40;
Attributes.CastSpeed = 1;
AosElementDamages.Chaos = 100;
}
public StandardOfChaosG(Serial serial)
: base(serial)
{
}
//TODO: DoubleBladedSpear
public override int InitMinHits => 255;
public override int InitMaxHits => 255;
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
} | {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html lang="en" prefix="og: http://ogp.me/ns#">
<head>
<meta charset="UTF-8">
<title>Workbook: Questions - Lesson 7 | Genki Study Resources - 2nd Edition</title>
<meta name="title" content="Workbook: Questions - Lesson 7 | Genki Study Resources - 2nd Edition">
<meta name="twitter:title" content="Workbook: Questions - Lesson 7 | Genki Study Resources - 2nd Edition">
<meta property="og:title" content="Workbook: Questions - Lesson 7 | Genki Study Resources - 2nd Edition">
<meta name="description" content="Answer the questions about your friend, Mai Morishita, in Japanese.">
<meta property="og:description" content="Answer the questions about your friend, Mai Morishita, in Japanese.">
<link rel="shortcut icon" type="image/x-icon" href="../../../resources/images/genkico.ico">
<meta name="keywords" content="Genki I Workbook, page 72, japanese, quizzes, exercises, 2nd Edition" lang="en">
<meta name="language" content="en">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:site_name" content="sethclydesdale.github.io">
<meta property="og:url" content="https://sethclydesdale.github.io/genki-study-resources/lessons/lesson-7/workbook-8/">
<meta property="og:type" content="website">
<meta property="og:image" content="https://sethclydesdale.github.io/genki-study-resources/resources/images/genki-thumb.png">
<meta name="twitter:card" content="summary">
<meta name="twitter:creator" content="@SethC1995">
<link rel="stylesheet" href="../../../resources/css/stylesheet.min.css">
<script src="../../../resources/javascript/head.min.js"></script>
<script src="../../../resources/javascript/ga.js" async></script>
</head>
<body>
<header>
<h1><a href="../../../" id="home-link" class="edition-icon second-ed">Genki Study Resources</a></h1>
<a id="fork-me" href="https://github.com/SethClydesdale/genki-study-resources">Fork Me</a>
</header>
<div id="content">
<div id="exercise" class="content-block">
<div id="quiz-result"></div>
<div id="quiz-zone" class="clear"></div>
<div id="quiz-timer" class="center"></div>
</div>
</div>
<footer class="clear">
<ul class="footer-left">
<li><a href="../../../" id="footer-home">Home</a></li>
<li><a href="../../../privacy/">Privacy</a></li>
<li><a href="../../../report/">Report a Bug</a></li>
<li><a href="../../../help/">Help</a></li>
<li><a href="../../../donate/">Donate</a></li>
</ul>
<ul class="footer-right">
<li>Created by <a href="https://github.com/SethClydesdale">Seth Clydesdale</a> and the <a href="https://github.com/SethClydesdale/genki-study-resources/graphs/contributors">GitHub Community</a></li>
</ul>
</footer>
<script src="../../../resources/javascript/dragula.min.js"></script>
<script src="../../../resources/javascript/easytimer.min.js"></script>
<script src="../../../resources/javascript/exercises/2nd-ed.min.js"></script>
<script src="../../../resources/javascript/genki.min.js"></script>
<script src="../../../resources/javascript/all.min.js"></script>
<script>Genki.generateQuiz({
type : 'fill',
info : 'Answer the questions about your friend, Mai Morishita, in Japanese.',
quizlet :
'<div class="count-problems">'+
'<div class="problem">'+
'名前<span class="define">[なまえ]</span>は何ですか。<br>'+
'(Her name is Mai Morishita.)<br>'+
'{もりした%( / /)まいさんです}。'+
'</div>'+
'<div class="problem">'+
'何歳ですか。<br>'+
'(She\'s 22 years old)<br>'+
'{二十二歳です|にじゅうにさいです|answer}。'+
'</div>'+
'<div class="problem">'+
'どこに住んでいますか。<br>'+
'(She lives in Nagoya.)<br>'+
'{名古屋に住んでいます|なごやにすんでいます|' + Genki.getAlts('{名古屋}に{住}んでいます', 'なごや|す') + 'answer}。'+
'</div>'+
'<div class="problem">'+
'何をしていますか。<br>'+
'(She\'s a university student. She\'s studying economics at a university.)<br>'+
'{大学生です。大学で経済を勉強しています。|だいがくせいです。だいがくでけいざいをべんきょうしています。|' + Genki.getAlts('{大学生}です。{大学}で{経済}を{勉強}しています。', 'だいがくせい|だいがく|けいざい|べんきょう') + 'answer}'+
'</div>'+
'<div class="problem">'+
'結婚していますか。<br>'+
'(No, she\'s not married.)<br>'+
'{いいえ、結婚していません|いいえ、けっこんしていません|answer}。'+
'</div>'+
'<div class="problem">'+
'背が高いですか。<br>'+
'(No, she\'s not very tall.)<br>'+
'{いいえ、あまり背が高くないです|いいえ、あまりせがたかくないです|' + Genki.getAlts('いいえ、あまり{背}が{高}くないです', 'せ|たか') + 'answer}。'+
'</div>'+
'<div class="problem">'+
'髪が長いですか。<br>'+
'(Yes, her hair is long.)<br>'+
'{はい、髪が長いです|はい、かみがながいです|' + Genki.getAlts('はい、{髪}が{長}いです', 'かみ|なが') + 'answer}。'+
'</div>'+
'<div class="problem">'+
'どんな人ですか。(about personality)<br>'+
'(She\'s a smart and interesting person.)<br>'+
'{頭がよくて、おもしろい人です|あたまがよくて、おもしろいひとです|' + Genki.getAlts('{頭}がよくて、{面白}い{人}です', 'あたま|おもしろ|ひと') + 'answer}。'+
'</div>'+
'</div>'
});</script>
</body>
</html> | {
"pile_set_name": "Github"
} |
package checkstyle
import (
"go/parser"
"go/token"
"io/ioutil"
"reflect"
"testing"
)
const baseDir = "testdata/"
func readFile(fileName string) []byte {
file, _ := ioutil.ReadFile(baseDir + fileName)
return file
}
func TestFileLine(t *testing.T) {
fileName := "fileline.go"
file := readFile(fileName)
_checkerOk := checker{FileLine: 9}
ps, err := _checkerOk.Check(fileName, file)
if err != nil {
t.Fatal(err)
}
if len(ps) != 0 {
t.Fatal("expect no error")
}
_checkerFail := checker{FileLine: 8}
ps, _ = _checkerFail.Check(fileName, file)
if len(ps) != 1 || ps[0].Type != FileLine {
t.Fatal("expect an error")
}
//pos is at file end
fset := token.NewFileSet()
f, _ := parser.ParseFile(fset, fileName, file, parser.ParseComments)
if reflect.DeepEqual(ps[0], fset.Position(f.End())) {
t.Fatal("file line problem position not match")
}
}
func TestFunctionLine(t *testing.T) {
fileName := "functionline.go"
file := readFile(fileName)
_checkerOk := checker{FunctionLine: 9}
ps, err := _checkerOk.Check(fileName, file)
if err != nil {
t.Fatal(err)
}
if len(ps) != 0 {
t.Fatal("expect no error")
}
_checkerFail := checker{FunctionLine: 8}
ps, _ = _checkerFail.Check(fileName, file)
if len(ps) != 1 || ps[0].Type != FunctionLine {
t.Fatal("expect an error")
}
if ps[0].Position.Filename != fileName {
t.Fatal("file name is not correct")
}
if ps[0].Position.Line != 7 {
t.Fatal("start position is not correct")
}
}
func TestParamsNum(t *testing.T) {
fileName := "params_num.go"
file := readFile(fileName)
_checkerOk := checker{ParamsNum: 4}
ps, err := _checkerOk.Check(fileName, file)
if err != nil {
t.Fatal(err)
}
if len(ps) != 0 {
t.Fatal("expect no error")
}
_checkerFail := checker{ParamsNum: 3}
ps, _ = _checkerFail.Check(fileName, file)
if len(ps) != 1 || ps[0].Type != ParamsNum {
t.Fatal("expect an error")
}
if ps[0].Position.Filename != fileName {
t.Fatal("file name is not correct")
}
if ps[0].Position.Line != 7 {
t.Fatal("start position is not correct")
}
_checkerFail = checker{ParamsNum: 2}
ps, _ = _checkerFail.Check(fileName, file)
if len(ps) != 2 {
t.Fatal("expect 2 error")
}
}
func TestResulsNum(t *testing.T) {
fileName := "results_num.go"
file := readFile(fileName)
_checkerOk := checker{ResultsNum: 4}
ps, err := _checkerOk.Check(fileName, file)
if err != nil {
t.Fatal(err)
}
if len(ps) != 0 {
t.Fatal("expect no error")
}
_checkerFail := checker{ResultsNum: 3}
ps, _ = _checkerFail.Check(fileName, file)
if len(ps) != 1 || ps[0].Type != ResultsNum {
t.Fatal("expect an error")
}
if ps[0].Position.Filename != fileName {
t.Fatal("file name is not correct")
}
if ps[0].Position.Line != 7 {
t.Fatal("start position is not correct")
}
_checkerFail = checker{ResultsNum: 2}
ps, _ = _checkerFail.Check(fileName, file)
if len(ps) != 2 {
t.Fatal("expect 2 error")
}
}
func TestFormated(t *testing.T) {
fileName := "formated.go"
file := readFile(fileName)
_checker := checker{Formated: true}
ps, err := _checker.Check(fileName, file)
if err != nil {
t.Fatal(err)
}
if len(ps) != 0 {
t.Fatal("expect no error")
}
fileName = "unformated.go"
file = readFile(fileName)
ps, _ = _checker.Check(fileName, file)
if len(ps) != 1 || ps[0].Type != Formated {
t.Fatal("expect an error")
}
//pos is at file begin
fset := token.NewFileSet()
f, _ := parser.ParseFile(fset, fileName, file, parser.ParseComments)
if reflect.DeepEqual(ps[0], fset.Position(f.Pos())) {
t.Fatal("file line problem position not match")
}
}
func TestPackageName(t *testing.T) {
fileName := "caps_pkg.go"
file := readFile(fileName)
_checker := checker{PackageName: false}
ps, err := _checker.Check(fileName, file)
if err != nil {
t.Fatal(err)
}
if len(ps) != 0 {
t.Fatal("expect no error")
}
fileName = "underscore_pkg.go"
file = readFile(fileName)
ps, err = _checker.Check(fileName, file)
if err != nil {
t.Fatal(err)
}
if len(ps) != 0 {
t.Fatal("expect no error")
}
fileName = "caps_pkg.go"
file = readFile(fileName)
_checkerFail := checker{PackageName: true}
ps, err = _checkerFail.Check(fileName, file)
if err != nil {
t.Fatal(err)
}
if len(ps) == 0 {
t.Fatal("expect 1 error")
}
fileName = "underscore_pkg.go"
file = readFile(fileName)
ps, err = _checkerFail.Check(fileName, file)
if err != nil {
t.Fatal(err)
}
if len(ps) == 0 {
t.Fatal("expect 1 error")
}
}
func TestCamelName(t *testing.T) {
fileName := "underscore_name.go"
file := readFile(fileName)
_checker := checker{CamelName: false}
ps, err := _checker.Check(fileName, file)
if err != nil {
t.Fatal(err)
}
if len(ps) != 0 {
t.Fatal("expect no error")
}
_checkerFail := checker{CamelName: true}
ps, err = _checkerFail.Check(fileName, file)
if err != nil {
t.Fatal(err)
}
if len(ps) != 30 {
t.Fatal("expect 30 error but ", len(ps))
}
fileName = "camel_name.go"
file = readFile(fileName)
ps, err = _checkerFail.Check(fileName, file)
if err != nil {
t.Fatal(err)
}
if len(ps) != 0 {
t.Fatal("expect no error")
}
}
| {
"pile_set_name": "Github"
} |
js_fragment(name = "find_element",
module = "webdriver.atoms.inject.locators",
function = "webdriver.atoms.inject.locators.findElement",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "find_elements",
module = "webdriver.atoms.inject.locators",
function = "webdriver.atoms.inject.locators.findElements",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "get_text",
module = "webdriver.atoms.inject.dom",
function = "webdriver.atoms.inject.dom.getText",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "is_selected",
module = "webdriver.atoms.inject.dom",
function = "webdriver.atoms.inject.dom.isSelected",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "get_top_left_coordinates",
module = "webdriver.atoms.inject.dom",
function = "webdriver.atoms.inject.dom.getTopLeftCoordinates",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "get_attribute_value",
module = "webdriver.atoms.inject.dom",
function = "webdriver.atoms.inject.dom.getAttributeValue",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "get_size",
module = "webdriver.atoms.inject.dom",
function = "webdriver.atoms.inject.dom.getSize",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "get_value_of_css_property",
module = "webdriver.atoms.inject.dom",
function = "webdriver.atoms.inject.dom.getValueOfCssProperty",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "is_enabled",
module = "webdriver.atoms.inject.dom",
function = "webdriver.atoms.inject.dom.isEnabled",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "clear",
module = "webdriver.atoms.inject.action",
function = "webdriver.atoms.inject.action.clear",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "click",
module = "webdriver.atoms.inject.action",
function = "webdriver.atoms.inject.action.click",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "is_displayed",
module = "webdriver.atoms.inject.dom",
function = "webdriver.atoms.inject.dom.isDisplayed",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "submit",
module = "webdriver.atoms.inject.action",
function = "webdriver.atoms.inject.action.submit",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "type",
module = "webdriver.atoms.inject.action",
function = "webdriver.atoms.inject.action.type",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "frame_by_id_or_name",
module = "webdriver.atoms.inject.frame",
function = "webdriver.atoms.inject.frame.findFrameByIdOrName",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "frame_by_index",
module = "webdriver.atoms.inject.frame",
function = "webdriver.atoms.inject.frame.findFrameByIndex",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "default_content",
module = "webdriver.atoms.inject.frame",
function = "webdriver.atoms.inject.frame.defaultContent",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "get_parent_frame",
module = "webdriver.atoms.inject.frame",
function = "webdriver.atoms.inject.frame.parentFrame",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "get_frame_window",
module = "webdriver.atoms.inject.frame",
function = "webdriver.atoms.inject.frame.getFrameWindow",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "active_element",
module = "webdriver.atoms.inject.frame",
function = "webdriver.atoms.inject.frame.activeElement",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "execute_script",
module = "webdriver.atoms.inject",
function = "webdriver.atoms.inject.executeScript",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "execute_async_script",
module = "webdriver.atoms.inject",
function = "webdriver.atoms.inject.executeAsyncScript",
deps = ["//javascript/webdriver/atoms/inject:deps"])
# Local Storage
js_fragment(name = "set_local_storage_item",
module = "webdriver.atoms.inject.storage.local",
function = "webdriver.atoms.inject.storage.local.setItem",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "get_local_storage_item",
module = "webdriver.atoms.inject.storage.local",
function = "webdriver.atoms.inject.storage.local.getItem",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "get_local_storage_keys",
module = "webdriver.atoms.inject.storage.local",
function = "webdriver.atoms.inject.storage.local.keySet",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "remove_local_storage_item",
module = "webdriver.atoms.inject.storage.local",
function = "webdriver.atoms.inject.storage.local.removeItem",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "clear_local_storage",
module = "webdriver.atoms.inject.storage.local",
function = "webdriver.atoms.inject.storage.local.clear",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "get_local_storage_size",
module = "webdriver.atoms.inject.storage.local",
function = "webdriver.atoms.inject.storage.local.size",
deps = ["//javascript/webdriver/atoms/inject:deps"])
# Session Storage
js_fragment(name = "set_session_storage_item",
module = "webdriver.atoms.inject.storage.session",
function = "webdriver.atoms.inject.storage.session.setItem",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "get_session_storage_item",
module = "webdriver.atoms.inject.storage.session",
function = "webdriver.atoms.inject.storage.session.getItem",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "get_session_storage_keys",
module = "webdriver.atoms.inject.storage.session",
function = "webdriver.atoms.inject.storage.session.keySet",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "remove_session_storage_item",
module = "webdriver.atoms.inject.storage.session",
function = "webdriver.atoms.inject.storage.session.removeItem",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "clear_session_storage",
module = "webdriver.atoms.inject.storage.session",
function = "webdriver.atoms.inject.storage.session.clear",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "get_session_storage_size",
module = "webdriver.atoms.inject.storage.session",
function = "webdriver.atoms.inject.storage.session.size",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "execute_sql",
module = "webdriver.atoms.inject.storage.database",
function = "webdriver.atoms.inject.storage.database.executeSql",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "get_appcache_status",
module = "webdriver.atoms.inject.storage.appcache",
function = "webdriver.atoms.inject.storage.appcache.getStatus",
deps = ["//javascript/webdriver/atoms/inject:deps"])
# Advanced User Interactions
js_fragment(name = "mouse_click",
module = "webdriver.atoms.inject.action",
function = "webdriver.atoms.inject.action.mouseClick",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "mouse_move",
module = "webdriver.atoms.inject.action",
function = "webdriver.atoms.inject.action.mouseMove",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "mouse_down",
module = "webdriver.atoms.inject.action",
function = "webdriver.atoms.inject.action.mouseButtonDown",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "mouse_up",
module = "webdriver.atoms.inject.action",
function = "webdriver.atoms.inject.action.mouseButtonUp",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "mouse_double_click",
module = "webdriver.atoms.inject.action",
function = "webdriver.atoms.inject.action.doubleClick",
deps = ["//javascript/webdriver/atoms/inject:deps"])
js_fragment(name = "send_keys_to_active_element",
module = "webdriver.atoms.inject.action",
function = "webdriver.atoms.inject.action.sendKeysToActiveElement",
deps = ["//javascript/webdriver/atoms/inject:deps"])
| {
"pile_set_name": "Github"
} |
<html>
<head>
<meta charset="utf-8">
<script src="esl.js"></script>
<script src="config.js"></script>
</head>
<body>
<style>
html, body, #main {
width: 100%;
height: 100%;
}
</style>
<div id="main"></div>
<button id="random"></button>
<script>
require([
'echarts',
'echarts/chart/pie',
'echarts/component/legend',
'echarts/component/grid',
'echarts/component/tooltip'
], function (echarts) {
var chart = echarts.init(document.getElementById('main'), null, {
renderer: 'canvas'
});
var randomData = function () {
return [
{value:Math.random().toFixed(3), name:'a'},
{value:Math.random().toFixed(3), name:'b'},
{value:Math.random().toFixed(3), name:'c'},
{value:Math.random().toFixed(3), name:'d'},
{value:Math.random().toFixed(3), name:'e'}
];
}
var itemStyle = {
normal: {
// shadowBlur: 10,
// shadowOffsetX: 0,
// shadowOffsetY: 5,
// shadowColor: 'rgba(0, 0, 0, 0.4)'
}
};
chart.setOption({
legend: {
data:['a','b','c','d','e']
},
tooltip: {
},
series: [{
name: 'pie',
type: 'pie',
stack: 'all',
symbol: 'circle',
symbolSize: 10,
data: randomData(),
itemStyle: itemStyle
}]
});
setInterval(function () {
chart.setOption({
series: [{
name: 'pie',
data: randomData()
}]
})
}, 1000)
})
</script>
</body>
</html> | {
"pile_set_name": "Github"
} |
//
// DemoRouteAdapter.m
// ZIKRouterDemo
//
// Created by zuik on 2018/1/25.
// Copyright © 2018 zuik. All rights reserved.
//
#import "DemoRouteAdapter.h"
#import "RequiredLoginViewInput.h"
#import "RequiredCompatibleAlertModuleInput.h"
#import <ZIKLoginModule/ZIKLoginModule.h>
@implementation DemoRouteAdapter
+ (void)registerRoutableDestination {
// Let ZIKCompatibleAlertViewRouter support RequiredCompatibleAlertModuleInput and ZIKLoginModuleRequiredAlertInput
// Instead of writing adapting code in the host app, the module itself can provide a default registration function
// Adding USE_DEFAULT_DEPENDENCY_ZIKLoginModule=1 in Build Settings -> Preprocessor Macros to use the default dependency
registerDependencyOfZIKLoginModule();
// The host app can ignore the default registration and registering other adaptee
// If you can get the router, you can just register the protocol to the provided module
[ZIKLoginViewRouter registerViewProtocol:ZIKRoutable(RequiredLoginViewInput)];
// [ZIKCompatibleAlertViewRouter registerModuleProtocol:ZIKRoutable(ZIKLoginModuleRequiredAlertInput)];
// If you don't know the router, you can register adapter
[self registerModuleAdapter:ZIKRoutable(RequiredCompatibleAlertModuleInput) forAdaptee:ZIKRoutable(ZIKCompatibleAlertModuleInput)];
// You can adapt other alert module. In ZIKRouterDemo-macOS, it's `NSAlert` in `AlertViewRouter`. in ZIKRouterDemo, it's ZIKAlertModule
}
@end
ZIX_ADD_CATEGORY(ZIKLoginViewController, RequiredLoginViewInput)
ADAPT_DEFAULT_DEPENDENCY_ZIKLoginModule
// Add adapter protocols to the provided adaptee class
@interface ZIKCompatibleAlertViewConfiguration (Adapter) <RequiredCompatibleAlertModuleInput>
@end
@implementation ZIKCompatibleAlertViewConfiguration (Adapter)
@end
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.