KE3BvcF9waW5nX2xh'
    'dGVuY3lfbXMY6gcgAygCUhBwb3BQaW5nTGF0ZW5jeU1zEjcKF2Rvd25saW5rX3Rocm91Z2hwdX'
    'RfYnBzGOsHIAMoAlIVZG93bmxpbmtUaHJvdWdocHV0QnBzEjMKFXVwbGlua190aHJvdWdocHV0'
    'X2JwcxjsByADKAJSE3VwbGlua1Rocm91Z2hwdXRCcHMSOAoHb3V0YWdlcxjxByADKAsyHS5TcG'
    'FjZVguQVBJLkRldmljZS5EaXNoT3V0YWdlUgdvdXRhZ2VzEhoKCHBvd2VyX2luGPIHIAMoAlIH'
    'cG93ZXJJbkoGCO0HEO4HSgYI7gcQ7wdKBgjvBxDwB0oGCPAHEPEH');

@$core.Deprecated('Use dishSetEmcResponseDescriptor instead')
const DishSetEmcResponse$json = {
  '1': 'DishSetEmcResponse',
};

/// Descriptor for `DishSetEmcResponse`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List dishSetEmcResponseDescriptor = $convert.base64Decode(
    'ChJEaXNoU2V0RW1jUmVzcG9uc2U=');

@$core.Deprecated('Use dishGetObstructionMapResponseDescriptor instead')
const DishGetObstructionMapResponse$json = {
  '1': 'DishGetObstructionMapResponse',
  '2': [
    {'1': 'num_rows', '3': 1, '4': 1, '5': 13, '10': 'numRows'},
    {'1': 'num_cols', '3': 2, '4': 1, '5': 13, '10': 'numCols'},
    {'1': 'snr', '3': 3, '4': 3, '5': 2, '10': 'snr'},
    {
      '1': 'min_elevation_deg',
      '3': 4,
      '4': 1,
      '5': 2,
      '8': {'3': true},
      '10': 'minElevationDeg',
    },
    {'1': 'max_theta_deg', '3': 5, '4': 1, '5': 2, '10': 'maxThetaDeg'},
    {'1': 'map_reference_frame', '3': 6, '4': 1, '5': 14, '6': '.SpaceX.API.Device.ObstructionMapReferenceFrame', '10': 'mapReferenceFrame'},
  ],
};

/// Descriptor for `DishGetObstructionMapResponse`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List dishGetObstructionMapResponseDescriptor = $convert.base64Decode(
    'Ch1EaXNoR2V0T2JzdHJ1Y3Rpb25NYXBSZXNwb25zZRIZCghudW1fcm93cxgBIAEoDVIHbnVtUm'
    '93cxIZCghudW1fY29scxgCIAEoDVIHbnVtQ29scxIQCgNzbnIYAyADKAJSA3NuchIuChFtaW5f'
    'ZWxldmF0aW9uX2RlZxgEIAEoAkICGAFSD21pbkVsZXZhdGlvbkRlZxIiCg1tYXhfdGhldGFfZG'
    'VnGAUgASgCUgttYXhUaGV0YURlZxJfChNtYXBfcmVmZXJlbmNlX2ZyYW1lGAYgASgOMi8uU3Bh'
    'Y2VYLkFQSS5EZXZpY2UuT2JzdHJ1Y3Rpb25NYXBSZWZlcmVuY2VGcmFtZVIRbWFwUmVmZXJlbm'
    'NlRnJhbWU=');


const int maxN = 2e5+5;

int N, M, cnt, x[maxN], pos[maxN];

void update(int a, int b){
    if(pos[x[a]-1] <= pos[x[a]] && b < pos[x[a]-1]) cnt++;
    if(pos[x[a]-1] > pos[x[a]] && b >= pos[x[a]-1]) cnt--;
    if(pos[x[a]+1] >= pos[x[a]] && b > pos[x[a]+1]) cnt++;
    if(pos[x[a]+1] < pos[x[a]] && b <= pos[x[a]+1]) cnt--;
    pos[x[a]] = b;

    if(pos[x[b]-1] <= pos[x[b]] && a < pos[x[b]-1]) cnt++;
    if(pos[x[b]-1] > pos[x[b]] && a >= pos[x[b]-1]) cnt--;
    if(pos[x[b]+1] >= pos[x[b]] && a > pos[x[b]+1]) cnt++;
    if(pos[x[b]+1] < pos[x[b]] && a <= pos[x[b]+1]) cnt--;
    pos[x[b]] = a;

    swap(x[a], x[b]);
}

int main(){
    scanf("%d %d", &N, &M);
    for(int i = 1; i <= N; i++){
        scanf("%d", &x[i]);
        pos[x[i]] = i;
    }
    pos[N+1] = N+1;

    cnt = 1;
    for(int i = 1, ptr = 0; i <= N; i++){
        if(ptr > pos[i])
            cnt++;
        ptr = pos[i];
    }

    for(int i = 0, a, b; i < M; i++){
        scanf("%d %d", &a, &b);
        update(a, b);
        printf("%d\n", cnt);
    }
}
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const int maxX = 1e6+1;

ll ans;
int N, dp[maxX];
bool b[maxX];
vector<int> primes;

void init(){
    fill(b+2, b+maxX, true);
    for(int i = 2; i*i < maxX; i++)
        if(b[i])
            for(int j = i*i; j < maxX; j += i)
                b[j] = false;
    for(int i = 2; i < maxX; i++)
        if(b[i])
            primes.push_back(i);
}

void compute(int x){
    vector<int> pf;
    for(int p : primes){
        if(x == 1)  break;
        else if(b[x]){
            pf.push_back(x);
            break;
        }

        if(x % p)   continue;
        pf.push_back(p);
        while(x % p == 0)
            x /= p;
    }

    int K = (int) pf.size();
    for(int mask = 0; mask < (1<<K); mask++){
        int mu = 1;
        for(int i = 0; i < K; i++)
            if(mask&(1<<i))
                mu *= pf[i];

        int k = __builtin_popcount(mask);
        ans += (k&1 ? -dp[mu] : dp[mu]);
        dp[mu]++;
    }
}

int main(){
    init();
    scanf("%d", &N);
    for(int i = 0, x; i < N; i++){
        scanf("%d", &x);
        compute(x);
    }
    printf("%lld\n", ans);
}#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const int maxN = 1000;

int N, Q;
char c[maxN+1][maxN+1];
ll ds[maxN+1][maxN+1];

void update(int x, int y, ll val){
    for(int i = x; i


necontext.addelement^elt" href="#user-content-inlinecontext.addelement^elt">elt: Element) → number

Add an inline element. Returns the end of the element.

  findOpeningDelimiter(type: DelimiterType) → number | null

Find an opening delimiter of the given type. Returns null if
no delimiter is found, or an index that can be passed to
takeContent otherwise.

  takeContent(startIndex: number) → Element[]

Remove all inline elements and delimiters starting from the
given index (which you should get from
findOpeningDelimiter,
resolve delimiters inside of them, and return them as an array
of elements.

  skipSpace(from: number) → number

Skip space after the given (document) position, returning either
the position of the next non-space character or the end of the
section.

  elt(type: string, from: number, to: <a href="https://developer.mozilla.


/* Trees */
.tree-container {
  margin-top: 1.2em;
  flex-grow: 1;
  min-height: 12em;
}

.tree-container > tree {
  height: 100%;
}

tree {
  width: 100%;
}
/* Stop animations when the page they are on are not displayed (bug 341749). */
#updates:not([currentpageid="checking"]) #checkingProgress,
#updates:not([currentpageid="incompatibleCheck"]) #incompatibleCheckProgress,
#updates:not([currentpageid="downloading"]) #downloadProgress {
  display: none;
}

/* Hide the wizard's header so the size of the billboard can size the window
   on creation. A custom header will be used in its place when a header is
   needed. */
.wizard-header {
  display: none;
}

/* Display the custom header */
.update-header {
  display: -moz-box !important;
}

/* Custom header implementation based on the Wizard's header. This allows the
   size of the billboard's remotecontent to size the window since it does not
   have an updateheader on the billboard page. */
updateheader {
  -moz-binding: url("chrome://mozapps/content/update/updates.xml#updateheader");
  display: -moz-box;
  -moz-box-orient: horizontal;
}

/* Remote content displayed in the billboard and license pages. */
remotecontent {
  -moz-binding: url("chrome://mozapps/content/update/updates.xml#remotecontent");
  display: -moz-deck;
}

/* Update History Window */
update {
  -moz-binding: url("chrome://mozapps/content/update/updates.xml#update");
  display: -moz-box;
  -moz-box-orient: vertical;
}

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

richlistitem[type="download"] {
  -moz-binding: url('chrome://mozapps/content/downloads/download.xml#download-starting');
  -moz-box-orient: vertical;
}

richlistitem[type="download"][state="0"] {
  -moz-binding: url('chrome://mozapps/content/downloads/download.xml#download-downloading');
}

richlistitem[type="download"][state="1"] {
  -moz-binding: url('chrome://mozapps/content/downloads/download.xml#download-done');
}

richlistitem[type="download"][state="2"] {
  -moz-binding: url('chrome://mozapps/content/downloads/download.xml#download-failed');
}

richlistitem[type="download"][state="3"] {
  -moz-binding: url('chrome://mozapps/content/downloads/download.xml#download-canceled');
}

richlistitem[type="download"][state="4"] {
  -moz-binding: url('chrome://mozapps/content/downloads/download.xml#download-paused');
}

richlistitem[type="download"][state="6"] {
  -moz-binding: url('chrome://mozapps/content/downloads/download.xml#download-blocked-parental');
}

richlistitem[type="download"][state="7"] {
  -moz-binding: url('chrome://mozapps/content/downloads/download.xml#download-scanning');
}

richlistitem[type="download"][state="8"] {
  -moz-binding: url('


anges are now applied via [#1604](https://github.com/akka/alpakka/pull/1604).

* SQS: Revise stream element data model [#1604](https://github.com/akka/alpakka/pull/1604) by [Michel Davit, @RustedBones](https://github.com/RustedBones) **api-change**
* AWS SQS/SNS: more concise docs about the HTTP client [#1695](https://github.com/akka/alpakka/pull/1695)
* SQS/SNS: Update aws-spi-akka-http to version 0.0.6 [#1681](https://github.com/akka/alpakka/pull/1681) by [Matthias Lüneberg, @matsluni](https://github.com/matsluni) **dependency-change**
* Enable Scala 2.13 for sqs and sns connectors. [#1641](https://github.com/akka/alpakka/pull/1641)  **dependency-change**
* SQS source: make parallelism configurable [#1696](https://github.com/akka/alpakka/pull/1696)
* SQS stream stops consuming messages [#1665](https://github.com/akka/alpakka/issues/1665)

[*closed in 1.0.1*](https://github.com/akka/alpakka/issues?q=is%3Aclosed+milestone%3A1.0.1+label%3Ap%3Aaws-sqs)

## 1.0.0 (changes since 0.20)

* API may change [#1621](https://github.com/akka/alpakka/pull/1621)

* Set proper equality for SQS model [#1311](https://github.com/akka/alpakka/pull/1311)

* Source - Allow configuring visibility timeout [#1287](https://github.com/akka/alpakka/pull/1287)

* towards 1.0 - major API changes [#1149](https://github.com/akka/alpakka/pull/1149)  **api-change**

* Keep message order [#1214](https://github.com/akka/alpakka/pull/1214)

* Improve SqsAckResult and SqsPublishResult consistency [#1336](https://github.com/akka/alpakka/pull/1336)  **api-change**

* Migrate to AWS SDK 2.0 [#1450](https://github.com/akka/alpakka/pull/1450)

[*closed in 1.0.0*](https://github.com/akka/alpakka/issues?q=is%3Aclosed+milestone%3A1.0.0+label%3Ap%3Aaws-sqs)
[*closed in 1.0-RC1*](https://github.com/akka/alpakka/issues?q=is%3Aclosed+milestone%3A1.0-RC1+label%3Ap%3Aaws-sqs)
[*closed in 1.0-M3*](https://github.com/akka/alpakka/issues?q=is%3Aclosed+milestone%3A1.0-M3+label%3Ap%3Aaws-sqs)
[*closed in 1.0-M2*](https://github.com/akka/alpakka/issues?q=is%3Aclosed+milestone%3A1.0-M2+label%3Ap%3Aaws-sqs)
[*closed in 1.0-M1*](https://github.com/akka/alpakka/issues?q=is%3Aclosed+milestone%3A1.0-M1+label%3Ap%3Aaws-sqs)
# MQTT Streaming

## 1.1.2

- Automatically unregister packet ids and


;
        }

        /// <summary> Sets default permissions for a newly generated realm map. </summary>
        internal static void SetRealmPerms(Player p, Level lvl) {
            lvl.Config.RealmOwner = p.name;
            const LevelPermission rank = LevelPermission.Console;
            lvl.BuildAccess.Whitelist(Player.Console, rank, lvl, p.name);
            lvl.VisitAccess.Whitelist(Player.Console, rank, lvl, p.name);

            Group grp = Group.Find(Server.Config.OSPerbuildDefault);
            if (grp == null) return;

            lvl.BuildAccess.SetMin(Player.Console, rank, lvl, grp);
        }
    }
}


.sui-nav.nav-list [class*=" icon-"]{margin-right:2px}.sui-nav.nav-list .divider{*width:100%;height:1px;margin:8px 1px;*margin:-5px 0 5px;overflow:hidden;background-color:#e5e5e5;border-bottom:1px solid #fff}.sui-nav.nav-list.nav-large .nav-header{padding:4px 13px}.sui-nav.nav-list.nav-xlarge .nav-header{padding:6px 16px;font-size:16.1px}.sui-nav.nav-tabs:before,.sui-nav.nav-pills:before,.sui-nav.nav-tabs:after,.sui-nav.nav-pills:after{display:table;content:"";line-height:0}.sui-nav.nav-tabs:after,.sui-nav.nav-pills:after{clear:both}.sui-nav.nav-tabs>li,.sui-nav.nav-pills>li{float:left}.sui-nav.nav-tabs>li a,.sui-nav.nav-pills>li a{padding-right:12px;padding-left:12px;line-height:14px}.sui-nav>li>a{padding:2px 10px}.sui-nav.nav-large>li>a{padding:4px 13px}.sui-nav.nav-xlarge>li>a{padding:6px 16px;font-size:16.1px}.sui-nav.nav-tabs{border-bottom:1px solid #ddd;padding-left:5px}.sui-nav.nav-tabs>li{margin-bottom:-1px}.sui-nav.nav-tabs>li>a{color:#666;line-height:18px;-webkit-border-radius:3px 3px 0 0;-moz-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0;border:1px solid transparent}.sui-nav.nav-tabs>li>a:hover{background-color:transparent}.sui-nav.nav-tabs>li+li{margin-left:9px}.sui-nav.nav-tabs>li+li>a{margin-left:-1px}.sui-nav.nav-tabs>.active{border-bottom:0}.sui-nav.nav-tabs>.active>a{font-weight:700;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent;cursor:default}.sui-nav.nav-tabs>.active>a:hover{background-color:#fff}.sui-nav.nav-tabs>.active>a,.sui-nav.nav-tabs>li>a:hover{color:#28a3ef}.sui-nav.nav-tabs.tab-vertical{border-bottom:0;border-right:1px solid #ddd;width:100px;display:inline-block;padding-left:0}.sui-nav.nav-tabs.tab-vertical li{float:none;margin-left:0;margin-bottom:0;margin-right:-1px}.sui-nav.nav-tabs.tab-vertical li.active a{border:1px solid #ddd;border-right:1px solid transparent}.sui-nav.nav-tabs.tab-vertical li a{-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px}.sui-nav.nav-tabs.nav-primary{border-bottom:2px solid #28a3ef}.sui-nav.nav-tabs.nav-primary>li{margin-bottom:-2px}.sui-nav.nav-tabs.nav-primary>.active>a{border-color:#28a3ef;color:#fff;background:#28a3ef;-webkit-border-radius:3px 3px 0 0;-moz-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0}.sui-nav.nav-tabs.nav-primary.tab-vertical{border-right:2px solid #


//
//  DWFixedContainer.h
//  hgfd
//
//  Created by Wicky on 2017/2/26.
//  Copyright © 2017年 Wicky. All rights reserved.
//

/**
 DWFixedContainer
 总量固定的数组/字典，遵循FIFO
 */

#import <Foundation/Foundation.h>

@interface DWFixedArray : NSObject

@property (nonatomic ,copy) void (^objectDequeueBlock)(id obj);

@property (nonatomic ,assign ,readonly) NSUInteger count;

+(instancetype)arrayWithVolunm:(NSUInteger)volumn;

-(void)addObject:(id)anObject;

-(void)removeObject:(id)anObject;

-(void)removeAllObjects;

-(BOOL)containsObject:(id)anObject;

@end

@interface DWFixedDictionary : NSObject

@property (nonatomic ,copy) void (^objectDequeueBlock)(id obj);

@property (nonatomic ,assign) NSUInteger count;

@property (nonatomic ,strong ,readonly) NSArray * allKeys;

@property (nonatomic ,strong ,readonly) NSArray * allValues;

+(instancetype)dictionaryWithVolumn:(NSUInteger)volumn;

-(void)setValue:(id)value forKey:(NSString *)key;

-(id)valueForKey:(NSString *)key;

-(void)removeObjectForKey:(NSString *)key;

-(BOOL)containsObject:(id)obj;

-(BOOL)containsKey:(NSString *)key;

@end


-spacing: 1px;
}

.DetailsDamageHeader Label.DamageTotal
{
	width: 78px;
	height: 44px;
	background-color: #00000077;
	padding-top: 14px;
	color: #DDDDDD;
	text-shadow: 1px 1px 1px #00000077;
}

.DetailsDamageHeader Label.DamageTotal,
.DetailsDamageRow Label.DamageTotal
{
	text-align: center;
	padding-right: 0px;
	text-transform: uppercase;
	font-size: 15px;
//	letter-spacing: 2px;
}

.DetailsDamageRow Image,
.DetailsDamageRow DOTAAbilityImage,
.DetailsDamageRow Label.DamageTotal
{
	//margin-right: 25px;
}

.DetailsDamageRow Label.Total,
.DetailsDamageHeader Label.DamageTotal
{
	margin-left: 0px;
}

.DetailsDamageRow Image.DamageBasicIcon
{
	wash-color: #99AABB;
	saturation: 0;
}

.DetailsDamageRow Label
{
	background-color: #00000077;
	text-align: center;
	padding-top: 28px;
	//padding-right: 14px;
	color: #DDDDDD;
	text-shadow: 1px 1px 1px #00000077;
}

.DetailsDamageRow.DamageTotalBottom Image
{
	opacity: 0.0;
}

/* End Damage Details Tab */

/* Buff Details Tab */

#DetailsBuff
{
	flow-children: down;
	width: 100%;
	padding-left: 370px;
}

#DetailsBuffTable
{
	margin-top: 10px;
	margin-left: 0px;
	flow-children: down;
	padding: 20px;
	padding-right: 0px;
	background-color: rgba( 0, 0, 0, 0.4 );
}

#DetailsBuffTableRows
{
	flow-children: down;
	overflow: clip scroll;
	max-height: 561px;
	padding-right: 10px;
	margin-bottom: 10px;
}

.DetailsBuffHeader
{
	flow-children: right;
	margin-bottom: 20px;
}

.DetailsBuffHeader DOTAHeroImage
{
	width: 78px;
	margin-right: 10px;
}

.DetailsBuffHeader #DetailsBuffHeroSource
{
	margin-right: 25px;
}

.DetailsBuffRow
{
	flow-children: right;
	margin-bottom: 10px;
}

.DetailsBuffRow Image,
.DetailsBuffRow DOTAAbilityImage,
.DetailsBuffRow Label
{
	width: 78px;
	height: 78px;
	margin-right: 10px;
}

.DetailsBuffRow Image,
.DetailsBuffRow DOTAAbilityImage
{
	margin-right: 25px;
}

.DetailsBuffRow Label
{
	background-color: #00000077;
	text-align: center;
	padding-top: 28px;
	//padding-right: 14px;
	color: #DDDDDD;
	text-shadow: 1px 1px 1px #000000;
}

.DetailsBuffRow.DurationTotalBottom Image
{
	opacity: 0.0;
}

/* End Buff Details Tab */

#DropsContainer
{
	width: 100%;
	height: 94px;
	flow-children: right;
	vertical-align: middle;
	vertical-align: bottom;
	opacity: 1;

	//background-color: black;

	transition-property: opacity;
	transition-duration: 0.3s;
}

.HeroHovered.Expanded #DropsContainer
{
	opacity: 0;

}

#LeftMarginEcon
{

}

DOTAPostGameOverviewHero.Expanded #LeftMarginEcon
{

}

#LeftMarginEcon,
#RightMarginEcon
{
	transition-timing-function: linear;
	transiti


",
                             String.format("INSERT INTO %s.%s (key, column1, column2) VALUES ('key1', 'val1', 1)", KEYSPACE, currentDenseTable()));

        // That's slightly different from 2.X, since null map keys are not allowed
        assertInvalidMessage("Column key is mandatory for SuperColumn tables",
                             String.format("INSERT INTO %s.%s (key, column1, value) VALUES ('key1', 'val1', 'value1')", KEYSPACE, currentDenseTable()));

        execute(String.format("INSERT INTO %s.%s (key, column1, column2, value) VALUES ('key1', 'val1', 1, NULL)", KEYSPACE, currentDenseTable()));
        execute(String.format("INSERT INTO %s.%s (key, column1, column2, value) VALUES ('key1', 'val1', 1, ?)", KEYSPACE, currentDenseTable()), unset());
        assertEmpty(execute(String.format("select * from %s.%s", KEYSPACE, currentDenseTable())));
    }

    @Test
    public void testDenseTableCqlInserts() throws Throwable
    {
        Cassandra.Client client = getClient();

        execute(String.format("INSERT INTO %s.%s (key, column1, column2, value) VALUES (?, ?, ?, ?)", KEYSPACE, currentDenseTable()),
                "key1", "val1", 1, "value1");
        execute(String.format("INSERT INTO %s.%s (key, column1, column2, value) VALUES (?, ?, 2, ?)", KEYSPACE, currentDenseTable()),
                "key1", "val1", "value2");
        execute(String.format("INSERT INTO %s.%s (key, column1, column2, value) VALUES ('key1', 'val2', 4, 'value4')", KEYSPACE, currentDenseTable()));
        execute(String.format("INSERT INTO %s.%s (key, column1, column2, value) VALUES ('key1', 'val2', 5, 'value5')", KEYSPACE, currentDenseTable()));

        execute(String.format("INSERT INTO %s.%s (key, column1, column2, value) VALUES ('key2', 'val1', 1, 'value1')", KEYSPACE, currentDenseTable()));
        execute(String.format("INSERT INTO %s.%s (key, column1, column2, value) VALUES ('key2', 'val1', 2, 'value2')", KEYSPACE, currentDenseTable()));
        execute(String.format("INSERT INTO %s.%s (key, column1, column2, value) VALUES ('key2', 'val2', 4, 'value4')", KEYSPACE, currentDenseTable()));
        execute(String.format("INSERT INTO %s.%s (key, column1, column2, value) VALUES ('key2', 'val2', 5, 'value5')", KEYSPACE, currentDenseTable()));

        ColumnPath path = new ColumnPath(currentDenseTable());
        path.setSuper_column(ByteBufferUtil.bytes("val1"));

        ColumnOrSuperColumn cosc = client.get(ByteBufferUtil.bytes("key1"), path, ONE);
        assertEquals(cosc.getSuper_column().columns.get(0).name, ByteBufferUtil.bytes(1));
        assertEquals(cosc.getSuper_column().columns.get(0).value, ByteBufferUtil.bytes("value1"));
        assertEquals(cosc.getSuper_column().columns.get(1).name, ByteBufferUtil.bytes(2));
        assertEquals(cosc.getSuper_column().columns.get(1).value, ByteBufferUtil.bytes("value2"));
    }

    @Test
    public void testDenseTableCqlUpdates() throws Throwable
    {
        assertInvalidMessage("Column key is mandatory for SuperColumn tables",
                             String.format("UPDATE %s.%s SET column2 = 1, value = 'value1' WHERE key = 'key1' AND column1 = 'val1'", KEYSPACE, currentDenseTable()));
        assertInvalidMessage("Column `column2` of type `int` found in SET part",
                             String.format("UPDATE %s.%s SET column2 = 1, value = 'value1' WHERE key = '


			return fmt.Errorf("failed to get user home directory: %v", err)
			}
			targetDir = filepath.Join(homeDir, targetDir[2:])
		}
	}

	// Check if target directory exists
	if exists := pathExists(targetDir); exists {
		if !overwrite {
			return fmt.Errorf("target directory %s already exists, use -f|--force flag to overwrite", targetDir)
		}
		logrus.Warnf("target directory %s already exists, overwriting", targetDir)
	} else if err := os.MkdirAll(targetDir, 0755); err != nil {
		return fmt.Errorf("failed to create target directory %s: %v", targetDir, err)
	}

	// if a valid license is found, goes to pro mode, ask user to agree the EULA
	if license.Manager.Valid {
		// fmt.Println("------------------------------------------------------------------------------")
		fmt.Println("##############################################################################")
		fmt.Println(string(embeddedEULA))
		fmt.Println("##############################################################################\n\n")
		logrus.Warnf("To proceed with the installation of Pigsty Pro Edition, you must agree to the End User License Agreement (EULA).")
		logrus.Infof("Do you accept the terms of the EULA? Please type 'yes' to accept or 'no' to decline:")
		fmt.Printf("> ")
		var response string
		fmt.Scanln(&response)
		response = strings.ToLower(strings.TrimSpace(response))
		switch strings.ToLower(response) {
		case "no", "n", "nay", "off", "false":
			logrus.Errorf("Installation aborted due to EULA rejection.")
			logrus.Warnf("Consider using the AGPLv3 OSS version instead (remove the license file)")
			return fmt.Errorf("installation aborted due to EULA rejection")
		case "yes", "y", "ok", "true":
			logrus.Infof("EULA accepted, continue pigsty pro installation")
		default:
			logrus.Errorf("Invalid response: %s", response)
			return fmt.Errorf("invalid response to EULA inquiry")
		}
	}

	// Extract content to target directory
	if err := extractPigsty(srcTarball, targetDir); err != nil {
		return fmt.Errorf("failed to extract pigsty: %v", err)
	}

	if license.Manager.Valid {
		licensePath := filepath.Join(targetDir, "EULA.md")
		if err := os.WriteFile(licensePath, embeddedEULA, 0644); err != nil {
			return fmt.Errorf("failed to write EULA file: %v", err)
		}
		logrus.Infof("the EULA is generated at %s", licensePath)
	}

	logrus.Infof("pigsty installed @ %s", targetDir)
	logrus.Infof("pig sty boot    # install ansible and prepare offline pkg")
	logrus.Infof("pig sty conf    # configure pigsty and generate config")
	logrus.Infof("pig sty install # install & provisioning env (DANGEROUS!)")

	return nil
}

// extractPigsty extracts pigsty source from embedded tarball to destination directory.
// It handles files, directories and symlinks while preserving file modes.
// Protected files like pigsty.yml and files/pki/* are not overwritten if they exist.
func extractPigsty(data []byte, dst string) error {
	buf := bytes.NewReader(data)
	gzr, err := gzip.NewReader(buf)
	if err != nil {
		return fmt


MAY(5, 31),
    JUNE(6, 30),
    JULY(7, 31),
    AUGUST(8, 31),
    SEPTEMBER(9, 30),
    OCTOBER(10, 31),
    NOVEMBER(11, 30),
    DECEMBER(12, 31);

    companion object {
        fun getMonthFromCode(code: Short): BirthdayMonth? =
            entries.firstOrNull { it.code == code.toInt() }
    }
}
// Copyright 2023 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.

package org.citra.citra_emu.overlay

import android.app.Activity
import android.content.Context
import android.content.SharedPreferences
import android.content.res.Configuration
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.graphics.Canvas
import android.graphics.Rect
import android.graphics.drawable.VectorDrawable
import android.util.AttributeSet
import android.util.DisplayMetrics
import android.view.MotionEvent
import android.view.SurfaceView
import android.view.View
import android.view.View.OnTouchListener
import androidx.core.content.ContextCompat
import androidx.preference.PreferenceManager
import org.citra.citra_emu.CitraApplication
import org.citra.citra_emu.NativeLibrary
import org.citra.citra_emu.R
import org.citra.citra_emu.utils.EmulationMenuSettings
import java.lang.NullPointerException
import kotlin.math.min

/**
 * Draws the interactive input overlay on top of the
 * [SurfaceView] that is rendering emulation.
 *
 * @param context The current [Context].
 * @param attrs   [AttributeSet] for parsing XML attributes.
 */
class InputOverlay(context: Context?, attrs: AttributeSet?) : SurfaceView(context, attrs),
    OnTouchListener {
    private val overlayButtons: MutableSet<InputOverlayDrawableButton> = HashSet()
    private val overlayDpads: MutableSet<InputOverlayDrawableDpad> = HashSet()
    private val overlayJoysticks: MutableSet<InputOverlayDrawableJoystick> = HashSet()
    private var isInEditMode = false
    private var buttonBeingConfigured: InputOverlayDrawableButton? = null
    private var dpadBeingConfigured: InputOverlayDrawableDpad? = null
    private var joystickBeingConfigured: InputOverlayDrawableJoystick? = null

    // Stores the ID of the pointer that interacted with the 3DS touchscreen.
    private var touchscreenPointerId = -1

    init {
        if (!preferences.getBoolean("OverlayInit", false)) {
            defaultOverlay()
        }

        // Reset 3ds touchscreen pointer ID
        touchscreenPointerId = -1

        // Load the controls.
        refreshControls()

        // Set the on touch listener.
        setOnTouchListener(this)

        // Force draw
        setWillNotDraw(false)

        // Request focus for the overlay so it has priority on presses.
        requestFocus()
    }

    override fun draw(canvas: Canvas) {
        super.draw(canvas)
        overlayButtons.forEach { it.draw(canvas) }
        overlayDpads.forEach { it.draw(canvas) }
        overlayJoysticks.forEach { it.draw(canvas) }
    }

    override fun onTouch(v: View, event: MotionEvent): Boolean {
        if (isInEditMode) {
            return onTouchWhileEditing(event)
        }
        var shouldUpdateView = false
        for (button in overlayButtons) {
            if (!button.updateStatus(event)) {
                continue
            }
            NativeLibrary.onGamePadEvent(NativeLibrary.TouchScreenDevice, button.id, button.status)
            shouldUpdateView = true
        }
        for (dpad in overlayDpads) {
            if (!dpad.updateStatus(event, EmulationMenuSettings.dpadSlide)) {
                continue
            }
            NativeLibrary.onGamePadEvent(NativeLibrary.TouchScreenDevice, dpad.upId, dpad.upStatus)
            NativeLibrary.onGamePadEvent(
                Native


olBar createHorizontalToolBar(UIContainer parent) {
		return new JFXToolBar((JFXContainer<?>) parent, Orientation.HORIZONTAL);
	}

	public UIToolBar createVerticalToolBar(UIContainer parent) {
		return new JFXToolBar((JFXContainer<?>) parent, Orientation.VERTICAL);
	}

	public UIMenuBar createMenuBar(UIWindow parent) {
		return new JFXMenuBar((JFXWindow) parent);
	}

	public UIPopupMenu createPopupMenu(UIWindow parent) {
		return new JFXPopupMenu((JFXWindow) parent);
	}

	public UITabFolder createTabFolder(UIContainer parent, boolean showClose) {
		return new JFXTabFolder((JFXContainer<?>) parent, showClose);
	}

	public UIDivider createHorizontalDivider(UIContainer parent) {
		return new JFXDivider((JFXContainer<?>) parent);
	}

	public UIDivider createVerticalDivider(UIContainer parent) {
		return new JFXDivider((JFXContainer<?>) parent);
	}

	public UIFontChooser createFontChooser(UIWindow parent) {
		return new JFXFontChooser(this, (JFXWindow) parent);
	}

	public UIColorChooser createColorChooser(UIWindow parent) {
		return new JFXColorChooser(this, (JFXWindow) parent);
	}

	public UIFileChooser createOpenFileChooser(UIWindow parent) {
		return new JFXFileChooser((JFXWindow) parent, JFXFileChooser.STYLE_OPEN);
	}

	public UIFileChooser createSaveFileChooser(UIWindow parent) {
		return new JFXFileChooser((JFXWindow) parent, JFXFileChooser.STYLE_SAVE);
	}

	public UIDirectoryChooser createDirectoryChooser(UIWindow parent) {
		return new JFXDirectoryChooser((JFXWindow) parent);
	}

	public UIPrinterChooser createPrinterChooser(UIWindow parent) {
		return new AWTPrinterChooser();
	}

	public UIColor createColor(int red, int green, int blue) {
		return this.resourceFactory.createColor(red, green, blue);
	}

	public UIColor createColor(UIColorModel model) {
		return this.resourceFactory.createColor(model);
	}

	public UIFont createFont(String name, float height, boolean bold, boolean italic) {
		return this.resourceFactory.createFont(name, height, bold, italic);
	}

	public UIFont createFont(UIFontModel model) {
		return this.resourceFactory.createFont(model);
	}

	public UIImage createImage(float width, float height) {
		return this.resourceFactory.createImage(width, height);
	}

	public UIImage createImage(InputStream inputStream) {
		return this.resourceFactory.createImage(inputStream);
	}

	public UIBrowser createBrowser(UIWindow parent) {
		return new JFXBrowser((JFXWindow) parent);
	}
}package app.tuxguitar.ui.jfx.widget;

import app.tuxguitar.ui.widget.UILegendPanel;

import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.control.TitledPane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.Region;

public class JFXLegendPanel extends JFXLayoutContainer<TitledPane> implements UILegendPanel {

	private static final float PADDING_TOP = 26f;

	public JFXLegendPanel(JFXContainer<? extends Region> parent) {
		super(new TitledPane(), parent);

		this.getControl().setContent(new Pane());
		this.getControl().setCollapsible(false);
		this.getControl().setAnimated(false);
		this.getContentPane().setFocusTraversable(false);
	}

	public void addChild(JFXNode<? extends Node> uiControl) {
		super.addChild(uiControl);


.control::before{content:"-";background-color:#d33333}table.dataTable>tbody>tr.child{padding:.5em 1em}table.dataTable>tbody>tr.child:hover{background:0 0!important}table.dataTable>tbody>tr.child ul.dtr-details{display:inline-block;list-style-type:none;margin:0;padding:0}table.dataTable>tbody>tr.child ul.dtr-details>li{border-bottom:1px solid #efefef;padding:.5em 0}table.dataTable>tbody>tr.child ul.dtr-details>li:first-child{padding-top:0}table.dataTable>tbody>tr.child ul.dtr-details>li:last-child{border-bottom:none}table.dataTable>tbody>tr.child span.dtr-title{display:inline-block;min-width:75px;font-weight:700}div.dtr-modal{position:fixed;-webkit-box-sizing:border-box;box-sizing:border-box;top:0;left:0;height:100%;width:100%;z-index:100;padding:10em 1em}div.dtr-modal div.dtr-modal-display{position:absolute;top:0;left:0;bottom:0;right:0;width:50%;height:50%;overflow:auto;margin:auto;z-index:102;overflow:auto;background-color:#f5f5f7;border:1px solid #000;border-radius:.5em;-webkit-box-shadow:0 12px 30px rgba(0,0,0,.6);box-shadow:0 12px 30px rgba(0,0,0,.6)}div.dtr-modal div.dtr-modal-content{position:relative;padding:1em}div.dtr-modal div.dtr-modal-close{position:absolute;top:6px;right:6px;width:22px;height:22px;border:1px solid #eaeaea;background-color:#f9f9f9;text-align:center;border-radius:3px;cursor:pointer;z-index:12}div.dtr-modal div.dtr-modal-close:hover{background-color:#eaeaea}div.dtr-modal div.dtr-modal-background{position:fixed;top:0;left:0;right:0;bottom:0;z-index:101;background:rgba(0,0,0,.6)}@media screen and (max-width:767px){div.dtr-modal div.dtr-modal-display{width:95%}}table.dataTable tr.dtrg-group td{background-color:#e0e0e0}table.dataTable tr.dtrg-group.dtrg-level-0 td{font-weight:700}table.dataTable tr.dtrg-group.dtrg-level-1 td,table.dataTable tr.dtrg-group.dtrg-level-2 td{background-color:#f0f0f0;padding-top:.25em;padding-bottom:.25em;padding-left:2em;font-size:.9em}table.dataTable tr.dtrg-group.dtrg-level-2 td{background-color:#f3f3f3}.ekit_table .dataTables_wrapper{padding-top:20px;padding-bottom:20px}.dataTables_filter,.ekit_table .dataTables_wrapper .dataTables_length,.ekit_table .ekit_table_length{padding-bottom:20px}.ekit_table table.dataTable.no-footer{border-bottom:1px solid #e6e6e6}.ekit_table .dataTables_wrapper select:not([multiple]){-webkit-appearance:none;-ms-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent;border-radius:0;border:solid 1px #bbb;padding:12px 48px 12px 18px}.ekit_table .dataTables_wrapper select:not([multiple])::after{content:" - Remember this"}.ekit_table .dataTables_wrapper .dataTables_filter input{border:solid 1px #bbb;padding:12px 48px 12px 1


board[start_x][start_y]==-9) {
					start_y++;
					cnt--;
					if(start_y>m)
						return;
				}
				else {
					copy_board[start_x][start_y]=-9;
					point++;
					cnt--;
					start_y++;
					if(start_y>m)
						return;
				}
			}
			break;
		}
	}

	private static void defence(int row, int col)
	{
		copy_board[row][col] = (char)board[row][col];
	}
}package bfs;
import java.io.*;
import java.util.*;

public class 확장게임 {
	static int n;
	static int m;
	static int people;
	static int[] dx = {-1,0,1,0};
	static int[] dy = {0,1,0,-1};
	public static void main(String[] args) throws IOException{
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		StringTokenizer st =new StringTokenizer(br.readLine());

		n = Integer.parseInt(st.nextToken());
		m = Integer.parseInt(st.nextToken());
		people = Integer.parseInt(st.nextToken());
		int[][] board= new int[n][m];
		int[][] arr = new int[n][m];
		int[] turn = new int[people+1];
		st = new StringTokenizer(br.readLine());
		for(int i=1; i<=people; i++)
			turn[i] = Integer.parseInt(st.nextToken());
		PriorityQueue<Node> pq = new PriorityQueue<>((a1,a2)->{return a1.weight-a2.weight;});

		int[] check = new int[people+1];
		for(int i=0; i<n; i++)
		{
			String temp = br.readLine();
			for(int j=0; j<m; j++)
			{
				if(temp.charAt(j)=='.')
				{
					board[i][j]=0;
				}
				else if(temp.charAt(j)=='#')
					board[i][j]=-1;
				else
				{
					board[i][j]=(temp.charAt(j)-'0');
					pq.offer(new Node(i,j,board[i][j],board[i][j]));
					check[board[i][j]]+=1;
				}

			}
		}
		int weight = people;
		boolean[][] visited = new boolean[n][m];
		while(!pq.isEmpty())
		{

			Node temp = pq.peek();
			int end = check[temp.idx];
			check[temp.idx]=0;
			weight+=1;
			int count = turn[temp.idx]; //해당 횟수만큼 돌아야한다는뜻
			Queue<Node> queue = new LinkedList<>();
			int cnt = 1;
			for(int k=0; k<end; k++)
			{
				Node tmp = pq.poll();
				for(int i=0; i<dx.length; i++)
				{
					int dir_x = tmp.x+dx[i];
					int dir_y = tmp.y+dy[i];
					if(0<=dir_x && dir_x<n && 0<=dir_y && dir_y<m)
					{
						if(board[dir_x][dir_y]==0 )
						{
							board[dir_x][dir_y] = temp.idx;

							if(cnt==count)
							{
								pq.offer(new Node(dir_x,dir_y,temp.idx,weight));
								check[temp.idx]+=1;


, r1, r0
	add r1, #0xf2
	mov r0, #0x1
	strb r0, [r1, #0x0]
	mov r0, #0x5f
	add r1, sp, #0x4
	bl sub_02030C4C
_0204EC98:
	add r4, r4, #0x1
	add r5, r5, #0x4
	cmp r4, r7
	blt _0204EC6A
_0204ECA0:
	add r0, sp, #0x4
	ldrb r1, [r0, #0x0]
	add r1, r1, #0x1
	strb r1, [r0, #0x0]
	ldrb r0, [r0, #0x0]
	cmp r0, r7
	blt _0204EC4E
_0204ECAE:
	add sp, #0x8
	pop {r3-r7, pc}
	nop
_0204ECB4: .word UNK_02105E5C
_0204ECB8: .word UNK_02105E64
_0204ECBC: .word UNK_021C5A68

	thumb_func_start sub_0204ECC0
sub_0204ECC0: ; 0x0204ECC0
	push {r4, lr}
	bl sub_02031190
	add r4, r0, #0x0
	bl sub_0204E3EC
	cmp r0, #0x8
	ble _0204ECE0
	mov r0, #0x2
	bl sub_0204F6DC
	mov r0, #0x2
	mov r1, #0x24
	bl sub_0205AFDC
	b _0204ECEE
_0204ECE0:
	mov r0, #0x3
	bl sub_0204F6DC
	mov r0, #0x3
	mov r1, #0x24
	bl sub_0205AFDC
_0204ECEE:
	add r1, r0, #0x0
	ldr r0, _0204ED04 ; =UNK_021C5A68
	ldr r2, [r0, #0x0]
	lsl r0, r4, #0x2
	add r0, r2, r0
	ldr r0, [r0, #0x8]
	bl sub_02057260
	bl sub_0204FB14
	pop {r4, pc}
	.balign 4
_0204ED04: .word UNK_021C5A68

	thumb_func_start sub_0204ED08
sub_0204ED08: ; 0x0204ED08
	push {r3-r7, lr}
	sub sp, #0x8
	bl sub_02033534
	bl sub_02031248
	mov r3, #0x0
	str r0, [sp, #0x0]
	cmp r0, #0x0
	ble _0204ED3C
	ldr r0, _0204ED94 ; =UNK_021C5A68
	mov r1, #0x66
	add r2, r1, #0x0
	ldr r4, [r0, #0x0]
	sub r2, #0x67
_0204ED26:
	ldrsb r0, [r4, r1]
	cmp r0, r2
	bne _0204ED32
	add sp, #0x8
	mov r0, #0x0
	pop {r3-r7, pc}
_0204ED32:
	ldr r0, [sp, #0x0]
	add r3, r3, #0x1
	add r4, #0x8
	cmp r3, r0
	blt _0204ED26
_0204ED3C:
	ldr r0, [sp


api::um::wingdi::wglGetProcAddress;
use core::mem;

pub enum CVoid {}

pub type GLboolean = u8;
pub type GLchar = u8;
pub type GLfloat = f32;
pub type GLenum = u32;
pub type GLint = i32;
pub type GLuint = u32;
pub type GLsizei = i32;
pub type GLsizeiptr = isize;

pub const FALSE: GLboolean = 0;
pub const TRIANGLES: GLenum = 0x0004;
pub const TRIANGLE_STRIP: GLenum = 0x0005;
pub const FLOAT: GLenum = 0x1406;
pub const COLOR: GLenum = 0x1800;
pub const FRAGMENT_SHADER: GLenum = 0x8B30;
pub const VERTEX_SHADER: GLenum = 0x8B31;
pub const COMPILE_STATUS: GLenum = 0x8B81;
pub const LINK_STATUS: GLenum = 0x8B82;
pub const ARRAY_BUFFER: GLenum = 0x8892;
pub const STATIC_DRAW: GLenum = 0x88E4;

const AttachShaderIdx: u16 = 2;     //
const BindBufferIdx: u16 = 8;
const BindVertexArrayIdx: u16 = 26;
const BufferDataIdx: u16 = 40;
const CreateProgramIdx: u16 = 96;
const ClearBufferfvIdx: u16 = 49;
const CompileShaderIdx: u16 = 73;
const CreateShaderIdx: u16 = 101;
const DetachShaderIdx: u16 = 128;
const DrawArraysIdx: u16 = 135;
const EnableVertexAttribArrayIdx: u16 = 157;
const GenBuffersIdx: u16 = 175;
const GenVertexArraysIdx: u16 = 185;
const GetProgramInfoLogIdx: u16 = 254;
const GetProgramivIdx: u16 = 256;
const GetShaderInfoLogIdx: u16 = 280;
const GetShaderivIdx: u16 = 281;
const GetUniformLocationIdx: u16 = 313;
const LinkProgramIdx: u16 = 350;
const ShaderSourceIdx: u16 = 479;
const Uniform1fIdx: u16 = 539;
const UseProgramIdx: u16 = 591;
const VertexAttribPointerIdx: u16 = 682;

const wglSwapIntervalIdx: u16 = 695;

static LOAD_DESC: &'static [(u16, &'static str)] = &[

    ( wglSwapIntervalIdx, "wglSwapIntervalEXT\0" ),
    (DrawArraysIdx, "glDrawArrays\0"),

    // Program functions
    (CreateProgramIdx, "glCreateProgram\0"),
    (GetProgramivIdx, "glGetProgramiv\0"),
    (AttachShaderIdx, "glAttachShader\0"),
    (DetachShaderIdx, "glDetachShader\0"),
    (UseProgramIdx, "glUseProgram\0"),

    (LinkProgramIdx, "glLinkProgram\0"),
    (ClearBufferfvIdx, "glClearBufferfv\0"),
    (CreateShaderIdx, "glCreateShader\0"),
    (ShaderSourceIdx, "glShaderSource\0"),
    (CompileShaderIdx, "glCompileShader\0"),
    (GetShaderivIdx, "glGetShaderiv\0"),
    (GetShaderInfoLogIdx, "glGetShaderInfoLog\0"),
    (GetProgramInfoLogIdx, "glGetProgramInfoLog\0"),

    (GenVertexArraysIdx, "glGenVertexArrays\0"),
    (BindVertexArrayIdx, "glBindVertexArray\0"),

    (GenBuffersIdx, "glGenBuffers\0"),
    (BindBufferIdx, "glBindBuffer\0"),
    (BufferDataIdx, "glBufferData\0"),
    (EnableVertexAttribArrayIdx, "glEnableVertexAttribArray\0"),
    (VertexAttribPointerIdx, "glVertexAttribPointer\0"),

    (GetUniformLocationIdx, "glGetUniformLocation\0"),
    (Uniform1fIdx, "glUniform1f\0"),

//    ( wglSwapInterval


"""The code template to supply to the front end. This is what the user will
    be asked to complete and submit for grading.

    Do not include any imports.

    This is not a REPL environment so include explicit 'print' statements
    for any outputs you want to be displayed back to the user.

    Use triple single quotes to enclose the formatted code block.
"""

challenge_code = '''dev = qml.device('default.qubit', wires=3)

@qml.qnode(dev)
def controlled_rotations(theta, phi, omega):
    """Implement the circuit above and return measurement outcome probabilities.

    Args:
        theta (float): A rotation angle
        phi (float): A rotation angle
        omega (float): A rotation angle

    Returns:
        array[float]: Measurement outcome probabilities of the 3-qubit
        computational basis states.
    """

    ##################
    # YOUR CODE HERE #
    ##################

    # APPLY THE OPERATIONS IN THE CIRCUIT AND RETURN MEASUREMENT PROBABILITIES

    return

theta, phi, omega = 0.1, 0.2, 0.3
print(controlled_rotations(theta, phi, omega))
'''


metacall_load_from_memory(tag, buffer, sizeof(buffer), NULL));

	const enum metacall_value_id node_memory_enc_ids[] = {
		METACALL_DOUBLE
	};

	void *ret = metacallt("enc", node_memory_enc_ids, 15.0);

	EXPECT_NE((void *)NULL, (void *)ret);

	EXPECT_EQ((double)5.0, (double)metacall_value_to_double(ret));

	metacall_destroy();
}
/*
 *	MetaCall Library by Parra Studios
 *	A library for dynamic loading and linking shared objects at run-time.
 *
 *	Copyright (C) 2016 - 2025 Vicente Eduardo Ferrer Garcia <vic798@gmail.com>
 *
 *	Licensed under the Apache License, Version 2.0 (the "License");
 *	you may not use this file except in compliance with the License.
 *	You may obtain a copy of the License at
 *
 *		http://www.apache.org/licenses/LICENSE-2.0
 *
 *	Unless required by applicable law or agreed to in writing, software
 *	distributed under the License is distributed on an "AS IS" BASIS,
 *	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *	See the License for the specific language governing permissions and
 *	limitations under the License.
 *
 */
#include <metacall-cs-test/environment.hpp>

#include <gtest/gtest.h>

#include <metacall/metacall.h>

void environment::SetUp()
{
	const char *cs_scripts[] = {
		"hello.cs",
		"IJump.cs",
		"JumpMaster.cs",
		"SuperJump.cs",
		"TinyJump.cs"
	};

	ASSERT_EQ((int)0, (int)metacall_initialize());

	EXPECT_EQ((int)0, (int)metacall_load_from_file("cs", cs_scripts, sizeof(cs_scripts) / sizeof(cs_scripts[0]), NULL));
}

void environment::TearDown()
{
	metacall_destroy();
}
/*
 *	MetaCall Library by Parra Studios
 *	A library for providing a foreign function interface calls.
 *
 *	Copyright (C) 2016 - 2025 Vicente Eduardo Ferrer Garcia <vic798@gmail.com>
 *
 *	Licensed under the Apache License, Version 2.0 (the "License");
 *	you may not use this file except in compliance with the License.
 *	You may obtain a copy of the License at
 *
 *		http://www.apache.org/licenses/LICENSE-2.0
 *
 *	Unless required by applicable law or agreed to in writing, software
 *	distributed under the License is distributed on an "AS IS" BASIS,
 *	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *	See the License for the specific language governing permissions and
 *	limitations under the License.
 *
 */

#include <gtest/gtest.h>

#include <metacall/metacall.h>
#include <metacall/metacall_loaders.h>
#include <metacall/metacall_value.h>

#include <limits.h>

#if defined(WIN32) || defined(_WIN32)
	#ifndef NOMINMAX
		#define NOMINMAX
	#endif

	#ifndef WIN32_LEAN_AND_MEAN
		#define WIN32_LEAN_AND_MEAN
	#endif

	#include <windows.h>
#elif defined(unix) || defined(__unix__) || defined(__unix) || \
	defined(linux) || defined(__linux__) || defined(__linux) || defined(__gnu_linux) || \
	defined(__CYGWIN_


4eef,U+4ef3-4ef5,U+4ef8-4efa,U+4efc,U+4f00,U+4f03-4f05,U+4f08,U+4f09,U+4f0b,U+4f0e,U+4f12,U+4f13,U+4f15,U+4f1b,U+4f1d,U+4f21,U+4f22,U+4f25,U+4f27-4f29,U+4f2b-4f2e,U+4f31-4f33,U+4f36,U+4f37,U+4f39,U+4f3e,U+4f40,U+4f41,U+4f43,U+4f47-4f49,U+4f54,U+4f57,U+4f58,U+4f5d,U+4f5e,U+4f61,U+4f62,U+4f64,U+4f65,U+4f67,U+4f6a,U+4f6e,U+4f6f,U+4f72,U+4f74-4f7e,U+4f80-4f82,U+4f84,U+4f89,U+4f8a,U+4f8e-4f98,U+4f9e,U+4fa1,U+4fa5,U+4fa9,U+4faa,U+4fac,U+4fb3,U+4fb6-4fb8,U+4fbd,U+4fc2,U+4fc5,U+4fc6,U+4fcd,U+4fce,U+4fd0,U+4fd1,U+4fd3,U+4fda-4fdc,U+4fdf,U+4fe0,U+4fe2;
}
@font-face {
  font-family: 'HarmonyOS Sans SC';
  src: url("./HarmonyOS_Sans_SC_Light.67.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
  unicode-range: U+3127-3129,U+3220-3229,U+3231,U+32a3,U+338e,U+338f,U+339c-339e,U+33c4,U+33d1,U+33d2,U+33d5,U+3434,U+34dc,U+34ee,U+353e,U+355d,U+3566,U+3575,U+3592,U+35a0,U+35a1,U+35ad,U+35ce,U+36a2,U+36ab,U+38a8,U+3dab,U+3de7,U+3deb,U+3e1a,U+3f1b,U+3f6d,U+4495,U+4723,U+48fa,U+4ca3,U+4e02,U+4e04-4e06,U+4e0c,U+4e0f,U+4e15,U+4e17,U+4e1f-4e21,U+4e26,U+4e29,U+4e2c,U+4e2f,U+4e31,U+4e35,U+4e37,U+4e3c,U+4e3f-4e42,U+4e44,U+4e46,U+4e47,U+4e57,U+4e5a-4e5c,U+4e64,U+4e65,U+4e67,U+4e69,U+4e6d,U+4e78,U+4e7f-4e82,U+4e85,U+4e87,U+4e8a,U+4e8d,U+4e93,U+4e96,U+4e98,U+4e99,U+4e9c,U+4e9e-4ea0,U+4ea2,U+4ea3,U+4ea5,U+4eb0,U+4eb1,U+4eb3-4eb6;
}
@font-face {
  font-family: '


},
                                ],
                            },
                            {
                                "label": "월별 추이",
                                "method": "update",
                                "args": [
                                    {"visible": visibility_monthly},
                                    {
                                        "title": {
                                            "text": "제조품질 외주사별 월별 불량률",
                                            "x": 0.5,
                                            "xanchor": "center",
                                        },
                                        "xaxis": {"title": "월"},
                                        "yaxis": {"title": "불량률 (%)"},
                                    },
                                ],
                            },
                        ],
                        "direction": "down",
                        "showactive": True,
                        "x": -0.05,
                        "xanchor": "left",
                        "y": 1.18,
                        "yanchor": "top",
                    }
                ]
            )

            # 기본 레이아웃 설정
            fig.update_layout(
                title={
                    "text": "제조품질 외주사별 불량 현황 (누적)",
                    "x": 0.5,
                    "xanchor": "center",
                    "font": {"size": 18, "family": "Arial, sans-serif"},
                },
                xaxis_title="외주사",
                yaxis_title="불량 건수",
                xaxis=dict(tickfont=dict(size=12), title_font=dict(size=14)),
                yaxis=dict(tickfont=dict(size=12), title_font=dict(size=14)),
                legend=dict(
                    orientation="h", yanchor="bottom", y=1.02, xanchor="right", x=1
                ),
                height=500,
                margin=dict(l=50, r=50, t=120, b=50),
                template="plotly_white",
                barmode="group",
            )

            return fig

        except Exception as e:
            logger.error(f"❌ 제조품질 외주사별 통합 차트 생성 실패: {e}")
            flush_log(logger)
            raise

    def create_quality_part_integrated_chart(self) -> go.Figure:
        """제조품질 부품별 통합 차트 (드롭다운 형태)"""
        try:
            logger.info("📊 제조품질 부품별 통합 차트 생성 (드롭다운 형태)...")

            # 제조품질 불량내역 데이터 로드
            defect_data = self.load_quality_defect_data()

            # 데이터 전처리
            df = defect_data.copy()
            df["발생일_pd"] = pd.to_datetime(df["발생일"], errors="coerce")
            df["발생월"] = df["발생일_pd"].dt.to_period("M")
            df["발생분기"] = df["발생일_pd"].dt.to_period("Q")

            # 유효한 데이터만 필터링
            df_filtered = df.dropna(subset=["발생분기", "부품명"])

            # 차트 생성
            fig = go.Figure()
            colors = self.generate_colors(10)

            # ===================================================================
            # 1. 전체 분포 파이차트 (TOP10 + 기타)
            # ===================================================================
            part_counts = df_filtered["부품명"].value_counts()
            top10_parts = part_counts.head(10)
            other_count = part_counts.iloc[10:].sum() if len(part_counts) > 10 else 0

            if other_count > 0:
                pie_labels = list(top10_parts.index) + ["기타"]
                pie_values = list(top10_parts.values) + [other_count]
            else:
                pie_labels = list(top10_parts.index)
                pie_values = list(top10_parts.values)

            fig.add_trace(
                go.Pie(
                    labels=pie_labels,
                    values=pie_values,
                    hole=0.4,
                    textinfo="label+percent+value",
                    textposition="outside",
                    textfont=dict(size=12),
                    marker_colors=colors[: len(pie_labels)],
                    pull=[
                        0.05 if i == 0 or i == len(pie_labels) - 1 else 0
                        for i in range(len(pie_labels))
                    ],
                    texttemplate="%{label}
%{value}건 (%{percent})",
                    hovertemplate="%{label}
건수: %{value}
비율: %{percent}<extra></extra>",
                    visible=True,  # 기본 표시
                    showlegend=True,
                )
            )

            # ===================================================================


 a [Right] or [Both] to `B`.
   *
   * Example:
   * ```kotlin
   * import arrow.core.Ior
   *
   * fun main() {
   *   Ior.Right(12).map { "flower" } // Result: Right("flower")
   *   Ior.Left(12).map { "flower" }  // Result: Left(12)
   *   Ior.Both(12, "power").map { "flower $it" }  // Result: Both(12, "flower power")
   * }
   * ```
   * <!--- KNIT example-ior-04.kt -->
   */
  public inline fun <D> map(f: (B) -> D): Ior<A, D> {
    contract { callsInPlace(f, InvocationKind.AT_MOST_ONCE) }
    return when (this) {
      is Left -> this
      is Right -> Right(f(value))
      is Both -> Both(leftValue, f(rightValue))
    }
  }

  /**
   * The given function is applied if this is a [Left] or [Both] to `A`.
   *
   * Example:
   * ```kotlin
   * import arrow.core.Ior
   *
   * fun main() {
   *   Ior.Right(12).mapLeft { "flower" } // Result: Right(12)
   *   Ior.Left(12).mapLeft { "flower" }  // Result: Left("power")
   *   Ior.Both(12, "power").mapLeft { "flower $it" }  // Result: Both("flower 12", "power")
   * }
   * ```
   * <!--- KNIT example-ior-05.kt -->
   */
  public inline fun <C> mapLeft(fa: (A) -> C): Ior<C, B> {
    contract { callsInPlace(fa, InvocationKind.AT_MOST_ONCE) }
    return when (this) {
      is Left -> Left(fa(value))
      is Right -> this
      is Both -> Both(fa(leftValue), rightValue)
    }
  }

  /**
   * If this is a [Left], then return the left value in [Right] or vice versa,
   * when this is [Both] , left and right values are swap
   *
   * Example:
   * ```kotlin
   * import arrow.core.Ior
   *
   * fun main() {
   *   Ior.Left("left").swap()   // Result: Right("left")
   *   Ior.Right("right").swap() // Result: Left("right")
   *   Ior.Both("left", "right").swap() // Result: Both("right", "left")
   * }
   * ```
   * <!--- KNIT example-ior-06.kt -->
   */
  public fun swap(): Ior<B, A> = fold(
    { Right(it) },
    { Left(it) },
    { a, b -> Both(b, a) }
  )

  /**
   * Return the isomorphic [Either] of this [Ior]
   */
  public fun unwrap(): Either<Either<A, B>, Pair<A, B>> = fold(
    { Either.Left(Either.Left(it)) },
    { Either.Left(Either.Right(it)) },
    { a, b -> Either.Right(Pair(a, b)) }
  )

  public fun toPair(): Pair<A?, B?> = fold(
    { Pair(it, null) },
    { Pair(null, it) },
    { a, b -> Pair(a, b) }
  )

  /**
   * Returns a [Either.Right] containing the [Right] value or `B` if this is [Right] or [Both]
   * and [Either.Left] if this is a [Left].
   *
   * Example:
   * ```kotlin
   * import arrow.core.Ior
   *
   * fun main() {
   *   Ior.Right(12).toEither() // Result: Either.Right(12)
   *   Ior.Left(12).toEither()  // Result: Either.Left(12)
   *   Ior.Both


t, kNotExtended, kWasUp}.Build(
          kWmResultZero)});

  EXPECT_EQ(tester.key_calls.size(), 1);
  EXPECT_CALL_IS_EVENT(tester.key_calls[0], kFlutterKeyEventTypeDown,
                       kPhysicalShiftLeft, kLogicalShiftLeft, "",
                       kNotSynthesized);
  tester.clear_key_calls();
  EXPECT_EQ(tester.RedispatchedMessageCountAndClear(), 1);

  // Hold ShiftLeft
  tester.InjectKeyboardChanges(std::vector<KeyboardChange>{
      WmKeyDownInfo{VK_SHIFT, kScanCodeShiftLeft, kNotExtended, kWasDown}.Build(
          kWmResultZero)});

  EXPECT_EQ(tester.key_calls.size(), 1);
  EXPECT_CALL_IS_EVENT(tester.key_calls[0], kFlutterKeyEventTypeRepeat,
                       kPhysicalShiftLeft, kLogicalShiftLeft, "",
                       kNotSynthesized);
  tester.clear_key_calls();
  EXPECT_EQ(tester.RedispatchedMessageCountAndClear(), 1);

  // Release ShiftLeft
  tester.InjectKeyboardChanges(std::vector<KeyboardChange>{
      KeyStateChange{VK_LSHIFT, false, true},
      WmKeyUpInfo{VK_SHIFT, kScanCodeShiftLeft, kNotExtended}.Build(
          kWmResultZero)});

  EXPECT_EQ(tester.key_calls.size(), 1);
  EXPECT_CALL_IS_EVENT(tester.key_calls[0], kFlutterKeyEventTypeUp,
                       kPhysicalShiftLeft, kLogicalShiftLeft, "",
                       kNotSynthesized);
  tester.clear_key_calls();
  EXPECT_EQ(tester.RedispatchedMessageCountAndClear(), 1);
}

TEST_F(KeyboardTest, ShiftRightUnhandled) {
  KeyboardTester tester{GetContext()};
  tester.Responding(false);

  // US Keyboard layout

  // Press ShiftRight
  tester.InjectKeyboardChanges(std::vector<KeyboardChange>{
      KeyStateChange{VK_RSHIFT, true, false},
      WmKeyDownInfo{VK_SHIFT, kScanCodeShiftRight, kNotExtended, kWasUp}.Build(
          kWmResultZero)});

  EXPECT_EQ(tester.key_calls.size(), 1);
  EXPECT_CALL_IS_EVENT(tester.key_calls[0], kFlutterKeyEventTypeDown,
                       kPhysicalShiftRight, kLogicalShiftRight, "",
                       kNotSynthesized);
  tester.clear_key_calls();
  EXPECT_EQ(tester.RedispatchedMessageCountAndClear(), 1);

  // Release ShiftRight
  tester.InjectKeyboardChanges(std::vector<KeyboardChange>{
      KeyStateChange{VK_RSHIFT, false, true},
      WmKeyUpInfo{VK_SHIFT, kScanCodeShiftRight, kNotExtended}.Build(
          kWmResultZero)});

  EXPECT_EQ(tester.key_calls.size(), 1);
  EXPECT_CALL_IS_EVENT(tester.key_calls[0], kFlutterKeyEventTypeUp,
                       kPhysicalShiftRight, kLogicalShiftRight, "",
                       kNotSynthesized);
  tester.clear_key_calls();
  EXPECT_EQ(tester.RedispatchedMessageCountAndClear(), 1);
}

TEST_F(KeyboardTest, CtrlLeftUnhandled) {
  KeyboardTester tester{GetContext()};
  tester.Responding(false);

  // US Keyboard layout

  // Press CtrlLeft
  tester.InjectKeyboardChanges(std::vector<KeyboardChange>{
      KeyStateChange{VK_LCONTROL, true, false},
      WmKeyDownInfo{VK_CONTROL, kScanCodeControl, kNotExtended,


import os
import subprocess
import sys
import platform

# Repositories and their build instructions
repos = {
    "clang": {
        "url": "https://github.com/llvm/llvm-project.git",
        "branch": "main",
        "build_cmds": [
            "cmake -S llvm -B build -DCMAKE_BUILD_TYPE=Release",
            "cmake --build build --target clang",
        ],
    },
    "python": {
        "url": "https://github.com/python/cpython.git",
        "branch": "main",
        "build_cmds": [
            "./configure --enable-optimizations",
            "make -j$(nproc)",
        ],
    },
    "cheerp": {
        "url": "https://github.com/leaningtech/cheerp-compiler.git",
        "branch": "master",
        "build_cmds": [
            "cmake -S llvm -B ../build/llvm -C llvm/CheerpCmakeConf.cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS=clang -DCLANG_ENABLE_OPAQUE_POINTERS=OFF -G Ninja",
            "cmake --build ../build/llvm",
        ],
    },
    "emscripten": {
        "url": "https://github.com/emscripten-core/emsdk.git",
        "branch": "main",
        "build_cmds": [
            "./emsdk install latest",
            "./emsdk activate latest",
            "source ./emsdk_env.sh",
        ],
    }
}

# Install dependencies
def install_dependencies():
    os_name = platform.system().lower()
    try:
        if "linux" in os_name:
            subprocess.run(["sudo", "apt", "update"], check=True)
            subprocess.run(["sudo", "apt", "install", "-y", "git", "cmake", "gcc", "g++", "make"], check=True)
        elif "darwin" in os_name:  # macOS
            subprocess.run(["brew", "install", "git", "cmake", "gcc"], check=True)
        elif "windows" in os_name:
            subprocess.run(["choco", "install", "-y", "git", "cmake", "visualstudio2022buildtools"], check=True)
        else:
            print("Unsupported OS")
            sys.exit(1)
    except subprocess.CalledProcessError:
        print("ErrorMessage installing dependencies.")
        sys.exit(1)

# Clone and build repositories
def clone_and_build():
    for repo_name, repo_info in repos.items():
        print(f"Cloning and building {repo_name}...")
        try:
            # Clone repo
            if not os.path.exists(repo_name):
                subprocess.run(["git", "clone", "--branch", repo_info["branch"], repo_info["url"], repo_name],
                               check=True)
            os.chdir(repo_name)

            # Run build commands
            for cmd in repo_info["build_cmds"]:
                subprocess.run(cmd, shell=True, check=True)

            os.chdir("..")
        except subprocess.CalledProcessError:
            print(f"ErrorMessage building {repo_name}.")
            os.chdir("..")
            continue

# Main script logic
def main():
    install_dependencies()
    clone_and_build()

if __name__ == "__main__":
    main()


('Foo')");
}

testMultiLine() {
  var r1 = new RegExp(r'^foo$');
  var r2 = new RegExp(r'^foo$', multiLine: true);
  var r3 = new RegExp(r'^foo$', multiLine: false);
  Expect.isNull(r1.firstMatch('\nfoo\n'), "r1.firstMatch('\\nfoo\\n')");
  Expect.isNotNull(r2.firstMatch('\nfoo\n'), "r2.firstMatch('\\nfoo\\n')");
  Expect.isNull(r3.firstMatch('\nfoo\n'), "r3.firstMatch('\\nfoo\\n')");
}
// Copyright (c) 2014, the Dart project authors. All rights reserved.
// Copyright 2009 the V8 project authors. 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 Google Inc. 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.

import 'v8_regexp_utils.dart';
import 'package:expect/expect.dart';

void main() {
  dynamic oneMatch(re) {
    assertEquals("acd", "abcd".replaceAll(re, ""));
  }

  oneMatch(new RegExp(r"b"));
  oneMatch(new RegExp(r"b"));

  assertEquals("acdacd", "abcdabcd".replaceAll(new RegExp(r"b"), ""));

  dynamic captureMatch(re) {
    var match = firstMatch("abcd", re)!;
    assertEquals("b", match.group(1));
    assertEquals("c", match.group(2));
  }

  captureMatch(new RegExp(r"(b)(c)"));
  captureMatch(new RegExp(r"(b)(c)"));

  // A test that initially does a zero width match, but later does a non-zero
  // width match.
  var a = "foo bar baz".replaceAll(new RegExp(r"^|bar"), "");
  assertEquals("foo  baz", a);

  a = "foo bar baz".replaceAll(new RegExp(r"^|bar"), "*");
  assertEquals("*foo * baz", a);

  // We test FilterASCII using regexps that will backtrack forever.  Since
  // a regexp with a non-ASCII character in it can never


uction Set{{$}}
# Too few operands
andn t0, t1 # CHECK: :[[@LINE]]:1: error: too few operands for instruction
# Too few operands
orn t0, t1 # CHECK: :[[@LINE]]:1: error: too few operands for instruction
# Too few operands
xnor t0, t1 # CHECK: :[[@LINE]]:1: error: too few operands for instruction
# Too few operands
rol t0, t1 # CHECK: :[[@LINE]]:1: error: too few operands for instruction
# Too few operands
ror t0, t1 # CHECK: :[[@LINE]]:1: error: too few operands for instruction
# Too few operands
rori t0, t1 # CHECK: :[[@LINE]]:1: error: too few operands for instruction
# Immediate operand out of range
rori t0, t1, 32 # CHECK: :[[@LINE]]:14: error: immediate must be an integer in the range [0, 31]
rori t0, t1, -1 # CHECK: :[[@LINE]]:14: error: immediate must be an integer in the range [0, 31]
rolw t0, t1, t2 # CHECK: :[[@LINE]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
rorw t0, t1, t2 # CHECK: :[[@LINE]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
roriw t0, t1, 31 # CHECK: :[[@LINE]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
roriw t0, t1, 0 # CHECK: :[[@LINE]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}


 08 03 A6 */	mtlr r0
/* 8034CE04 00348A64  38 21 00 30 */	addi r1, r1, 0x30
/* 8034CE08 00348A68  4E 80 00 20 */	blr

.global gti2ResendMessage
gti2ResendMessage:
/* 8034CE0C 00348A6C  94 21 FF F0 */	stwu r1, -0x10(r1)
/* 8034CE10 00348A70  7C 08 02 A6 */	mflr r0
/* 8034CE14 00348A74  90 01 00 14 */	stw r0, 0x14(r1)
/* 8034CE18 00348A78  93 E1 00 0C */	stw r31, 0xc(r1)
/* 8034CE1C 00348A7C  7C 7F 1B 78 */	mr r31, r3
/* 8034CE20 00348A80  93 C1 00 08 */	stw r30, 8(r1)
/* 8034CE24 00348A84  7C 9E 23 78 */	mr r30, r4
/* 8034CE28 00348A88  80 A3 00 08 */	lwz r5, 8(r3)
/* 8034CE2C 00348A8C  A1 03 00 66 */	lhz r8, 0x66(r3)
/* 8034CE30 00348A90  80 C5 00 44 */	lwz r6, 0x44(r5)
/* 8034CE34 00348A94  80 A4 00 00 */	lwz r5, 0(r4)
/* 8034CE38 00348A98  55 00 C6 3E */	rlwinm r0, r8, 0x18, 0x18, 0x1f
/* 8034CE3C 00348A9C  80 E3 00 50 */	lwz r7, 0x50(r3)
/* 8034CE40 00348AA0  7C A5 32 14 */	add r5, r5, r6
/* 8034CE44 00348AA4  38 A5 00 05 */	addi r5, r5, 5
/* 8034CE48 00348AA8  7C 07 29 AE */	stbx r0, r7, r5
/* 8034CE4C 00348AAC  38 A5 00 01 */	addi r5, r5, 1
/* 8034CE50 00348AB0  7D 07 29 AE */	stbx r8, r7, r5
/* 8034CE54 00348AB4  80 C3 00 50 */	lwz r6, 0x50(r3)
/* 8034CE58 00348AB8  80 04 00 00 */	lwz r0, 0(r4)
/* 8034CE5C 00348ABC  80 A4 00 04 */	lwz r5, 4(r4)
/* 8034CE60 00348AC0  7C 86 02 14 */	add r4, r6, r0
/* 8034CE64 00348AC4  4B FF C7 41 */	bl gti2ConnectionSendData
/* 8034CE68 00348AC8  2C 03 00 00 */	cmpwi r3, 0
/* 8034CE6C 00348ACC  40 82 00 0C */	bne lbl_8034CE78
/* 8034CE70 00348AD0  38 60 00 00 */	li r3, 0
/* 8034CE74 00348AD4  48 00 00 3C */	b lbl_8034CEB0
lbl_8034CE78:
/* 8034CE78 00348AD8  80 7F 00 88 */	lwz r3, 0x88(r31)
/* 8034CE7C 00348ADC  80 1E 00 00 */	lwz r0, 0(r30)
/* 8034CE80 00348AE0  90 7E 00 0C */	stw r3, 0xc(r30)
/* 8034CE84 00348AE4  80 7F 00 08 */	lwz r3, 8(r31)
/* 8034CE88 00348AE8  80 9F 00 50 */	l


_type = cnrtFuncTypeUnion1;
    int task_type = mluop::runtime::getJobLimitCapability(handle);
    int task_num = 1;

    switch (task_type) {
      default:
        task_num = core_num;
        break;
      case (int)cnrtFuncTypeUnion2:
        task_num = core_num * 2;
        break;
      case (int)cnrtFuncTypeUnion4:
        task_num = core_num * 4;
        break;
      case (int)cnrtFuncTypeUnion8:
        task_num = core_num * 8;
        break;
      case (int)cnrtFuncTypeUnion16:
        task_num = core_num * 16;
        break;
    }

    unsigned int dimx = task_num;
    cnrtDim3_t k_dim = {dimx, 1, 1};
    k_type = (cnrtFunctionType_t)dimx;
    kernelFFTCooleyTukey(k_dim, k_type, handle->queue, fft_plan, -1, IRFFT);
    // direction, -1 means invalid(only FFT_IFFT use)
  } else if (fft_plan->fft_strategy == CNFFT_FUNC_STOCKHAM) {
    cnrtDim3_t k_dim;
    cnrtFunctionType_t k_type;
    policyFunc(handle, &k_dim, &k_type);
    kernelFFTStockham(k_dim, k_type, handle->queue, fft_plan, -1, scale_factor,
                      IRFFT);
    // direction, -1 means invalid(only FFT_IFFT use).
  }
  return status;
}

// input    : in output_contiguous_addr
// output   : in output
static mluOpStatus_t makeIRFFT1dContiguousOutput(mluOpHandle_t handle,
                                                 mluOpFFTPlan_t fft_plan,
                                                 void *output) {
  std::string api = "[mluOpExecFFT]";
  VLOG(5) << "into makeIRFFT1dContiguousOutput";
  mluOpStatus_t status = MLUOP_STATUS_SUCCESS;
  if (!fft_plan->is_output_contiguous) {
    VLOG(5) << "launch copy with stride";
    mluOpDataType_t out_r_dtype = fft_plan->output_dtype;
    // create tensor desc
    mluOpTensorDescriptor_t copy_src_desc, copy_dst_desc;
    status = mluOpCreateTensorDescriptor(&copy_src_desc);
    CHECK_RETURN(api, status);
    status = mluOpCreateTensorDescriptor(&copy_dst_desc);
    CHECK_RETURN(api, status);

    // set up tensor desc
    const int OUT_DIM_NUM = 2;
    int64_t dims[OUT_DIM_NUM] = {fft_plan->batch, fft_plan->prime
                                                      ? fft_plan->onembed[0]
                                                      : fft_plan->n[0]};
    int64_t strides[OUT_DIM_NUM] = {fft_plan->odist, fft_plan->ostride};
    status = mluOpSetTensorDescriptor_v2(copy_src_desc, MLUOP_LAYOUT_ARRAY,
                                         out_r_dtype, OUT_DIM_NUM, dims);
    CHECK_RETURN(api, status);
    status =
        mluOpSetTensorDescriptorEx_v2(copy_dst_desc, MLUOP_LAYOUT_ARRAY,
                                      out_r_dtype, OUT_DIM_NUM, dims, strides);
    CHECK_RETURN(api, status);

    // copy
    void *copy_src_addr = fft_plan->prime
                              ? fft_plan->matmul_addrs.output_contiguous_addr
                              : fft_plan->mlu_addrs.output;
    DEFINE_CREATE_AND_SET_CNNL_HA


.push_seven:first-child {
  margin-left: 50.90909%;
}
.row .push_eight {
  margin-left: 60.0%;
}
.row .push_eight:first-child {
  margin-left: 58.18182%;
}
.row .push_nine {
  margin-left: 67.27273%;
}
.row .push_nine:first-child {
  margin-left: 65.45455%;
}
.row .push_ten {
  margin-left: 74.54545%;
}
.row .push_ten:first-child {
  margin-left: 72.72727%;
}
.row .push_eleven {
  margin-left: 81.81818%;
}
.row .push_eleven:first-child {
  margin-left: 80.0%;
}
.row .push_twelve {
  margin-left: 89.09091%;
}
.row .push_twelve:first-child {
  margin-left: 87.27273%;
}
.row .push_thirteen {
  margin-left: 96.36364%;
}
.row .push_thirteen:first-child {
  margin-left: 94.54545%;
}

/* Centered Classes */
.row .one.centered {
  margin-left: 47.27273%;
}
.row .two.centered {
  margin-left: 43.63636%;
}
.row .three.centered {
  margin-left: 40%;
}
.row .four.centered {
  margin-left: 36.36364%;
}
.row .five.centered {
  margin-left: 32.72727%;
}
.row .six.centered {
  margin-left: 29.09091%;
}
.row .seven.centered {
  margin-left: 25.45455%;
}
.row .eight.centered {
  margin-left: 21.81818%;
}
.row .nine.centered {
  margin-left: 18.18182%;
}
.row .ten.centered {
  margin-left: 14.54545%;
}
.row .eleven.centered {
  margin-left: 10.90909%;
}
.row .twelve.centered {
  margin-left: 7.27273%;
}
.row .thirteen.centered {
  margin-left: 3.63636%;
}

/* Hybrid Grid Columns */
.sixteen.colgrid .row .one.column, .sixteen.colgrid .row .one.columns {
  width: 4.54545%;
}
.sixteen.colgrid .row .two.columns {
  width: 10.90909%;
}
.sixteen.colgrid .row .three.columns {
  width: 17.27273%;
}
.sixteen.colgrid .row .four.columns {
  width: 23.63636%;
}
.sixteen.colgrid .row .five.columns {
  width: 30%;
}
.sixteen.colgrid .row .six.columns {
  width: 36.36364%;
}
.sixteen.colgrid .row .seven.columns {
  width: 42.72727%;
}
.sixteen.colgrid .row .eight.columns {
  width: 49.09091%;
}
.sixteen.colgrid .row .nine.columns {
  width: 55.45455%;
}
.sixteen.colgrid .row .ten.columns {
  width: 61.81818%;
}
.sixteen.colgrid .row .eleven.columns {
  width: 68.18182%;
}
.sixteen.colgrid .row .twelve.columns {
  width: 74.54545%;
}
.sixteen.colgrid .row .thirteen.columns {
  width: 80.90909%;
}
.sixteen.colgrid .row .fourteen.columns {
  width: 87.27273%;
}
.sixteen.colgrid .row .fifteen.columns {
  width: 93.63636%;
}
.sixteen.colgrid .row .sixteen.columns {
  width: 100%;
}

/* Hybrid Push Classes


の追加資料を読んでください。

### のドキュメント

- [eBPF Docs](https://docs.ebpf.io/), Technical documentation for eBPF
- [BPF & XDP Reference Guide](https://cilium.readthedocs.io/en/stable/bpf/), Cilium Documentation, Aug 2020
- [BPF Documentation](https://www.kernel.org/doc/html/latest/bpf/index.html), BPF Documentation in the Linux Kernel
- [BPF Design Q&A](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/bpf/bpf_design_QA.rst), FAQ for kernel-related eBPF questions

### チュートリアル

- [Learn eBPF Tracing: Tutorial and Examples](http://www.brendangregg.com/blog/2019-01-01/learn-ebpf-tracing.html), Brendan Gregg's Blog, Jan 2019
- [XDP Hands-On Tutorials](https://github.com/xdp-project/xdp-tutorial), Various authors, 2019
- [BCC, libbpf and BPF CO-RE Tutorials](https://facebookmicrosites.github.io/bpf/blog/), Facebook's BPF Blog, 2020
- [eBPF Tutorial: Learning eBPF Step by Step with Examples](https://github.com/eunomia-bpf/bpf-developer-tutorial), Various authors, 2024

### 発表

#### 一般

- [eBPF and Kubernetes: Little Helper Minions for Scaling Microservices](https://www.youtube.com/watch?v=99jUcLt3rSk) ([Slides](https://kccnceu20.sched.com/event/ZemQ/ebpf-and-kubernetes-little-helper-minions-for-scaling-microservices-daniel-borkmann-cilium)), Daniel Borkmann, KubeCon EU, Aug 2020
- [eBPF - Rethinking the Linux Kernel](https://www.infoq.com/presentations/facebook-google-bpf-linux-kernel/) ([Slides](https://docs.google.com/presentation/d/1AcB4x7JCWET0ysDr0gsX-EIdQSTyBtmi6OAW7bE0jm0)), Thomas Graf, QCon London, April 2020
- [BPF as a revolutionary technology for the container landscape](https://www.youtube.com/watch?v=U3PdyHlrG1o&t=7) ([Slides](https


_encoder_create(
    WirehairCodec reuseOpt, ///< [Optional] Pointer to prior codec object
    const void*    message, ///< Pointer to message
    uint64_t  messageBytes, ///< Bytes in the message
    uint32_t    blockBytes  ///< Bytes in an output block
)
{
    // If input is invalid:
    if (!m_init || !message || messageBytes < 1 || blockBytes < 1) {
        return nullptr;
    }

    wirehair::Codec* codec = reinterpret_cast<wirehair::Codec*>(reuseOpt);

    // Allocate a new Codec object
    if (!codec) {
        codec = new (std::nothrow) wirehair::Codec;
    }

    // Initialize codec
    WirehairResult result = codec->InitializeEncoder(messageBytes, blockBytes);

    // If initialization succeeded:
    if (result == Wirehair_Success) {
        // Feed message to codec
        result = codec->EncodeFeed(message);
    }

    // If either function failed:
    if (result != Wirehair_Success)
    {
        // Note this will also release the reuse parameter
        delete codec;
        codec = nullptr;
    }

    return reinterpret_cast<WirehairCodec>(codec);
}

WIREHAIR_EXPORT WirehairResult wirehair_encode(
    WirehairCodec    codec, ///< Pointer to codec from wirehair_encoder_init()
    unsigned       blockId, ///< Identifier of block to generate
    void*     blockDataOut, ///< Pointer to output block data
    uint32_t      outBytes, ///< Bytes in the output buffer
    uint32_t* dataBytesOut  ///< Number of bytes written <= blockBytes
)
{
    if (!codec || !blockDataOut || !dataBytesOut) {
        return Wirehair_InvalidInput;
    }

    wirehair::Codec* session = reinterpret_cast<wirehair::Codec*>(codec);

    const uint32_t writtenBytes = session->Encode(blockId, blockDataOut, outBytes);
    *dataBytesOut = writtenBytes;

    if (writtenBytes <= 0) {
        return Wirehair_InvalidInput;
    }

    return Wirehair_Success;
}

WIREHAIR_EXPORT WirehairCodec wirehair_decoder_create(
    WirehairCodec reuseOpt, ///< Codec object to reuse
    uint64_t  messageBytes, ///< Bytes in the message to decode
    uint32_t    blockBytes  ///< Bytes in each encoded block
)
{
    // If input is invalid:
    if (!m_init || messageBytes < 1 || blockBytes < 1) {
        return nullptr;
    }

    wirehair::Codec* codec = reinterpret_cast<wirehair::Codec*>(reuseOpt);

    // Allocate a new Codec object
    if (!codec) {
        codec = new (std::nothrow) wirehair::Codec;
    }

    // Allocate memory for decoding
    WirehairResult result = codec->InitializeDecoder(messageBytes, blockBytes);

    // If either function failed:
    if (result != Wirehair_Success)
    {
        // Note this will also release the reuse parameter
        delete codec;
        codec = nullptr;
    }

    return reinterpret_cast<WirehairCodec>(codec);
}

WIREHAIR_EXPORT WirehairResult wirehair_decode(
    WirehairCodec   codec, ///< Codec object
    unsigned      blockId, ///< ID number of received block
    const void* blockData, ///< Pointer to block data
    uint32_t    dataBytes  ///< Number of bytes in the data block
)
{
    // If input is invalid:
    if (!codec || !blockData || dataBytes < 1) {
        return Wirehair_InvalidInput;
    }

    wirehair::Codec* decoder = reinterpret_


erference/lack of coverage.
# CAUV CAN PMU

CAN PMU® is a high-precision [DroneCAN](index.md) power module developed by CUAV®.
Він використовує алгоритм компенсації CUAV ITT, який дозволяє дронам отримувати більш точні дані про заряд батареї.

![CAN PMU](../../assets/hardware/power_module/cuav_can/can_pmu.jpg)

Рекомендується для використання у великих комерційних транспортних засобах, але також може застосовуватися для дослідницьких транспортних засобів.

## Де купити

- [CUAV store](https://store.cuav.net/index.php)
- [CUAV aliexpress ](https://www.aliexpress.com/item/4000369700535.html)

## Характеристики обладнання

- **Processor:** STM32F412
- **Voltage input**: 6~62V\(2-15S\)
- **Max current:** 110A
- **Voltage accuracy:** ±0.05V
- **Current accuracy:** ±0.1A
- **Resolution:** 0.01A/V
- **Max output power:** 6000W/90S
- **Max stable power:** 5000W
- **Power port output:** 5.4V/5A
- **Operating temp:** -20~+100
- **Firmware upgrade:** Supported.
- **Calibration:** Not needed.
- **Interface Type:**
  - **IN/OUT:** XT90\(Cable）/Amass 8.0\(Module）
  - **Power port:** 5025850670
  - **CAN:** GHR-04V-S
- **Appearance:**
  - **Size:** 46.5mm \* 38.5mm \* 22.5mm
  - **Weight:** 76g

## Налаштування програмного забезпечення

### Вміст набору

![CAN PMU list](../../assets/hardware/power_module/cuav_can/can_pmu_list.png)

### Схема розташування виводів

![CAN PMU](../../assets/hardware/power_module/cuav_can/can_pmu_pinouts_en.png)

![CAN PMU](../../assets/hardware/power_module/cuav_can/can_pmu_pinouts_en2.png)

## Підключення

![CAN PMU](../../assets/hardware/power_module/cuav_can/can_pmu_connection_en.png)

Кроки підключення:

- Підключіть керування польотом CAN1/2 та інтерфейс CAN модуля.
- Підключіть кабель живлення серії V5 до живлення керування польотом V5 Power2 (якщо інші керуючі пристрої підключені до інтерфейсу живлення) та інтерфейсу живлення модуля.

## Налаштування польотного контролера

Set the following parameters in _QGroundControl_ [Vehicle Setup > Parameters](../advanced_config/parameters.md) and then restart:

- [UAVCAN_ENABLE](../advanced_config/parameter_reference.md#UAVCAN_ENABLE): set to: _Sensors Automatic Config_

  ![qgc set](../../assets/hardware/power_module/cuav_can/qgc_set_en.png)

- [UAVCAN_SUB_BAT](../advanced_config/parameter_reference.md#UAVCAN_SUB_BAT): set to: _Raw data_

  ![QGC - Set UAVCAN\_SUB\_BAT parameter to raw data](../../assets/hardware/power_module/cuav_can/qgc_set_usavcan_sub_bat.png)

## Подальша інформація

[CAN PMU Manual](http://manual.cuav.net/power-module/CAN-PMU.pdf)

[CAN PMU Power detection module > Enable CAN


AssocPrev, ihvoEnd, ttp, true);
		}

		/// <summary>
		/// This menu item is on if a slash already exists in the environment.
		/// </summary>
		/// <param name="commandObject"></param>
		/// <param name="display"></param>
		/// <returns></returns>
		public bool OnDisplayInsertHashMark(object commandObject,
			ref UIItemDisplayProperties display)
		{
			CheckDisposed();
			PhoneEnvReferenceLauncher rl = (PhoneEnvReferenceLauncher)th


ass */
                                /*   (prevents injections into empty */
                                /*   <clinit>, finalize, and <init> methods) */

         char* tclass_name,     /* Class that has methods we will call at */
                                /*   the injection sites (tclass) */

         char* tclass_sig,      /* Signature of tclass */
                                /*  (Must be "L" + tclass_name + ";") */

         char* call_name,       /* Method name in tclass to call at offset 0 */
                                /*   for every method */

         char* call_sig,        /* Signature of this call_name method */
                                /*  (Must be "(II)V") */

         char* return_name,     /* Method name in tclass to call at all */
                                /*  return opcodes in every method */

         char* return_sig,      /* Signature of this return_name method */
                                /*  (Must be "(II)V") */

         char* obj_init_name,   /* Method name in tclass to call first thing */
                                /*   when injecting java.lang.Object.<init> */

         char* obj_init_sig,    /* Signature of this obj_init_name method */
                                /*  (Must be "(Ljava/lang/Object;)V") */

         char* newarray_name,   /* Method name in tclass to call after every */
                                /*   newarray opcode in every method */

         char* newarray_sig,    /* Signature of this method */
                                /*  (Must be "(Ljava/lang/Object;II)V") */

         unsigned char
           **pnew_file_image,   /* Returns a pointer to new classfile image */

         long *pnew_file_len,   /* Returns the length of the new image */

         FatalErrorHandler
           fatal_error_handler, /* Pointer to function to call on any */
                                /*  fatal error. NULL sends error to stderr */

         MethodNumberRegister
           mnum_callback        /* Pointer to function that gets called */
                                /*   with all details on methods in this */
                                /*   class. NULL means skip this call. */

           );

/* External to read the class name out of a class file .
 *
 *   WARNING: If You change the typedef, you MUST change
 *            multiple things in this file, including this name.
 */

#define JAVA_CRW_DEMO_CLASSNAME_SYMBOLS \
         { "java_crw_demo_classname", "_java_crw_demo_classname@12" }

/* Typedef needed for type casting in dynamic access situations. */

typedef char * (JNICALL *JavaCrwDemoClassname)(
         const unsigned char *file_image,
         long file_len,
         FatalErrorHandler fatal_error_handler);

JNIEXPORT char * JNICALL java_crw_demo_classname(
         const unsigned char *file_image,
         long file_len,
         FatalErrorHandler fatal_error_handler);

#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */

#endif


using System;

namespace MSCL_Inertial_Example_CSharp
{
    class Example1
    {
        public static void getCurrentConfig(mscl.InertialNode node)
        {
            //many other settings are available than shown below
            //reference the documentation for the full list of commands

            //if the node supports AHRS/IMU
            if (node.features().supportsCategory(mscl.MipTypes.DataClass.CLASS_AHRS_IMU))
            {
                //get a list of the AHRS/IMU channels currently active on the Node
                mscl.MipChannels ahrsImuActiveChs = node.getActiveChannelFields(mscl.MipTypes.DataClass.CLASS_AHRS_IMU);

                Console.WriteLine("AHRS/IMU Channels");
                Console.WriteLine("-----------------");
                foreach (mscl.MipChannel ch in ahrsImuActiveChs)
                {
                    Console.WriteLine("Channel Field: " + ch.channelField().ToString("X"));
                    Console.WriteLine("Sample Rate: " + ch.sampleRate().prettyStr());
                }
            }

            //if the node supports Estimation Filter
            if (node.features().supportsCategory(mscl.MipTypes.DataClass.CLASS_ESTFILTER))
            {
                //get a list of the Estimation Filter channels currently active on the Node
                mscl.MipChannels estFilterActiveChs = node.getActiveChannelFields(mscl.MipTypes.DataClass.CLASS_ESTFILTER);

                Console.WriteLine();
                Console.WriteLine("Estimation Filter Channels");


;
			messageBox.anchorOffsetY = messageBox.height * .5;
			messageBox.scaleX = messageBox.scaleY = 0;
			let offset = (<any>messageBox).AllowMultipleOffsetPosition ? container.numChildren * gardener.Configuration.showMultipleMessageBoxesOffset : 0;
			messageBox.x = gardener.StageWidth * .5 + offset;
			messageBox.y = gardener.StageHeight * .5 + offset;
			container.addChild(messageBox);
			egret.Tween.get(messageBox).wait(30).to({ scaleX: 1, scaleY: 1 }, 260, egret.Ease.backOut).call(() => {
				(<any>messageBox).display();
			});
		}
		/**
		 * 关闭指定的messagebox
		 * @param target IMessageBox
		 * @param closeAll boolean  关闭全部
		 */
		public __closeMessageBox(target: IMessageBox, closeAll: boolean = false) {
			let container = this.__messageContainer;
			if (!target && container.numChildren <= 0) {
				container.visible = false;
				return;
			}
			if (closeAll) {
				if (container.numChildren > 0) {
					let msgs: any[] = container.$children;
					container.removeChildren();
					msgs.forEach((msg) => {
						egret.Tween.removeTweens(msg);
						(<any>msg).dispose();
					});
					msgs = null;
				}
			} else if (target) {
				egret.Tween.removeTweens(target);
				if (target.parent)
					target.parent.removeChild(target);
				(<any>target).dispose();
			}
			if (container.numChildren <= 0) {
				container.visible = false;
			}
		}

		/**
		 * 点击messagebox背景触发事件
		 */
		public __onMessageContainerBg_Tap(e: egret.TouchEvent) {
			let container = this.__messageContainer;
			if (e.target != container) {
				return;
			}
			if (container.numChildren > 0) {
				let target = container.getChildAt(container.numChildren - 1);
				if (true === (<IMessageBox>target).AllowCloseByTapBg)
					this.__closeMessageBox(target as IMessageBox);
			} else {
				container.visible = false;
			}
		}
		/**
		 * 添加导航模块，window层之上，popup层之下
		 * @param navi egret.DisplayObject
		 */
		public __addNavigator(navi: egret.DisplayObject) {
			this.__navigatorContainer.addChild(navi);
		}

		// 查找当前打开的popup
		public __findCurrentPopup(): IPopup {
			return this.__popupContainer.numChildren > 0 ? this.__popupContainer.getChildAt(0) as IPopup : null;
		}

		// 查找当前打开的popup
		public __findCurrentPopupByClass(targetClass): IPopup {
			if (this.__popupContainer.numChildren > 0 && this.__popupContainer.getChildAt(0) instanceof targetClass) {
				return this.__popupContainer.getChildAt(0) as IPopup;
			} else {
				return null;
			}
		}

		// 查找当前打开的window
		public __findCurrentWindow(): IWindow {
			return this.__windowContainer.numChildren > 0 ? this.__windowContainer.getChildAt(0) as IWindow : null;
		}

		// 查找当前打开的window
		public __findCurrentWindowByClass(targetClass): IWindow {
			if (this.__windowContainer.numChildren > 0 && this.__windowContainer.getChildAt(0) instanceof targetClass) {
				return this.__windowContainer.getChildAt(0) as IWindow;
			} else {
				return null;
			}
		}

		// 查找当前打开的Scene


) => HashSet.ofIterable(p.vec)],
        ['immSet (from vector)', (p:Prerequisites) => imm.Set(p.vec)]);

compare(['HashSet.contains', (p:Prerequisites) => p.hashset.contains(p.array[Math.floor(Math.random()*p.array.length)])],
        ['immSet.contains', (p:Prerequisites) => p.immSet.contains(p.array[Math.floor(Math.random()*p.array.length)])]);

compare(['HashSet.filter', (p:Prerequisites) => p.hashset.filter(x => x<p.length/2)],
        ['immSet.filter', (p:Prerequisites) => p.immSet.filter(x => x<p.length/2)]);

compare(['HashMap.ofIterable', (p:Prerequisites) =>
         HashMap.ofIterable<string,number>(p.array.map<[string,number]>(x => [x+"",x]))],
        ['immMap', (p:Prerequisites) => imm.Map(p.array.map<[string,number]>(x => [x+"",x]))]);

compare(['HashMap.ofIterable (from vector)', (p:Prerequisites) =>
         HashMap.ofIterable(p.vec.map<[string,number]>(x => [x+"",x]))],
        ['immMap (from vector)', (p:Prerequisites) =>
         imm.Map(p.vec.map<[string,number]>(x => [x+"",x]))]);

compare(['HashMap.get', (p:Prerequisites) => p.hashmap.get(p.array[Math.floor(Math.random()*p.array.length)]+"")],
        ['immMap.get', (p:Prerequisites) => p.immMap.get(p.array[Math.floor(Math.random()*p.array.length)]+"")]);

compare(['HashMap.filter', (p:Prerequisites) => p.hashmap.filter((k,v) => parseInt(k)<p.length/2)],
        ['immMap.filter', (p:Prerequisites) => p.immMap.filter((v,k) => parseInt(k)<p.length/2)]);
module.exports = (router, crud) => {
    // 添加分类
    router.post("/category/addCategory", async (ctx: any) => {
        const params: any = ctx.request.body;
        let countData = await crud('SELECT * FROM `categories` WHERE state = ? AND categoryName =? ', [0, params.categoryName]);
        if (countData.data.length > 0) {
            ctx.body = {
                success: false,
                msg: '该分类已存在！'
            }
            return;
        }
        let addCate = await crud('INSERT INTO `categories` SET ?', params);
        if (!addCate.success) {
            ctx.body = {
                success: false,
                msg: '添加分类失败！'
            }
            return;
        }
        ctx.body = {
            success: true,
            msg: '添加分类成功！'
        }
    });

    // 获取分类
    router.get('/category/queryCategory', async (ctx: any) => {
        let countData = await crud('SELECT * FROM `categories` WHERE state = ? ', [0]);
        if (!countData.success) {
            ctx.body = {
                success: false,
                msg: '获取分类失败！'
            }
            return;
        }
        ctx.body = {
            success: true,
            list: countData.data,
            msg: '获取分类成功！'
        }
    })

    // 获取各个分类详情
    router.get('/category/queryAllCategory', async (ctx: any) => {
        const { id } = ctx.query;
        let categories: any[] = [];
        if (!ctx.session.info) {
            let cateData = await crud("SELECT * FROM `categories`", []);
            categories = cateData.data;
        } else {
            categories = ctx.session.info.categories;
        }

        if (id) {
            let cateData = await crud("SELECT * FROM `article


.signature)
    }

    /// Create SignedMessage from message.
    pub fn from_message(message: M, secret_key: &SecretKey, signer_idx: u16) -> Self {
        let signature = message.sign(secret_key);
        Self {
            message,
            signer_idx,
            signature,
        }
    }
}

// XXX The contents of ViewChangeMessage and PbftMessage (and any other message that is signed by
// a validator) must be distinguishable!
// Therefore all signed messages should be prefixed with a standardized type. We should keep those
// prefixed at one place to not accidentally create collisions.

/// prefix to sign view change messages
pub const PREFIX_VIEW_CHANGE: u8 = 0x01;
/// prefix to sign a pbft-proposal
pub const PREFIX_PBFT_PROPOSAL: u8 = 0x02;
/// prefix to sign pbft-prepare messages
pub const PREFIX_PBFT_PREPARE: u8 = 0x03;
/// prefix to sign pbft-commit messages
pub const PREFIX_PBFT_COMMIT: u8 = 0x04;
/// prefix to sign proof of knowledge of secret key
pub const PREFIX_POKOSK: u8 = 0x05;
/// prefix to sign a validator info
pub const PREFIX_VALIDATOR_INFO: u8 = 0x06;

pub trait Message: Clone + Debug + Serialize + Deserialize + SerializeContent + Send + Sync + Sized + PartialEq + 'static {
    const PREFIX: u8;

    fn hash_with_prefix(&self) -> SigHash {
        let mut h = Blake2bHasher::new();
        h.write_u8(Self::PREFIX).expect("Failed to write prefix to hasher for signature.");
        self.serialize_content(&mut h).expect("Failed to write message to hasher for signature.");
        h.finish()
    }

    fn sign(&self, secret_key: &SecretKey) -> Signature {
        secret_key.sign_hash(self.hash_with_prefix())
    }
}

pub enum AggregateError {
    Overlapping
}

/// DEPRECATED: We don't need this anymore.
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub struct AggregateProofBuilder<M> {
    /// Indices of validators that signed this proof
    pub signers: BitSet,

    /// The aggregate public key of the signers
    pub public_key: AggregatePublicKey,

    /// The aggregate signature
    pub signature: AggregateSignature,

    /// The cumulative number of slots of the signers
    pub num_slots: u16,

    #[beserial(skip)]
    _message: PhantomData<M>
}

impl<M: Message> AggregateProofBuilder<M> {
    pub fn new() -> Self {
        Self {
            signers: BitSet::with_capacity(0), // TODO: Fix this by the size of the active validator set
            public_key: AggregatePublicKey::new(),
            signature: AggregateSignature::new(),
            num_slots: 0,
            _message: PhantomData,
        }
    }

    pub fn contains(&self, signed: &SignedMessage<M>) -> bool {
        self.signers.contains(signed.signer_idx as usize)
    }

    /// Adds a signed message to an aggregate proof
    /// NOTE: This method assumes the signature of the message was already checked
    pub fn add_signature(&mut self, public_key: &PublicKey, num_slots: u16, signed: &SignedMessage<M>) -> bool {
        debug_assert!(signed.verify(public_key));
        let signer_idx = signed.signer_idx as usize;
        if self.signers.contains(signer_idx) {
            return false;
        }
        self.signers.insert(signer_idx);
        self.public_key.aggregate(public_key);
        self.signature.aggregate(&signed.signature);
        self.num_slots += num_


#include <am.h>
#include <klib-macros.h>

void __am_timer_init();
void __am_gpu_init();
void __am_audio_init();
void __am_input_keybrd(AM_INPUT_KEYBRD_T *);
void __am_timer_rtc(AM_TIMER_RTC_T *);
void __am_timer_uptime(AM_TIMER_UPTIME_T *);
void __am_gpu_config(AM_GPU_CONFIG_T *);
void __am_gpu_status(AM_GPU_STATUS_T *);
void __am_gpu_fbdraw(AM_GPU_FBDRAW_T *);
void __am_audio_config(AM_AUDIO_CONFIG_T *);
void __am_audio_ctrl(AM_AUDIO_CTRL_T *);
void __am_audio_status(AM_AUDIO_STATUS_T *);
void __am_audio_play(AM_AUDIO_PLAY_T *);
void __am_disk_config(AM_DISK_CONFIG_T *cfg);
void __am_disk_status(AM_DISK_STATUS_T *stat);
void __am_disk_blkio(AM_DISK_BLKIO_T *io);

static void __am_timer_config(AM_TIMER_CONFIG_T *cfg) { cfg->present = true; cfg->has_rtc = true; }
static void __am_input_config(AM_INPUT_CONFIG_T *cfg) { cfg->present = true;  }
static void __am_uart_config(AM_UART_CONFIG_T *cfg)   { cfg->present = false; }
static void __am_net_config (AM_NET_CONFIG_T *cfg)    { cfg->present = false; }

typedef void (*handler_t)(void *buf);
static void *lut[128] = {
  [AM_TIMER_CONFIG] = __am_timer_config,
  [AM_TIMER_RTC   ] = __am_timer_rtc,
  [AM_TIMER_UPTIME] = __am_timer_uptime,
  [AM_INPUT_CONFIG] = __am_input_config,
  [AM_INPUT_KEYBRD] = __am_input_keybrd,
  [AM_GPU_CONFIG  ] = __am_gpu_config,
  [AM_GPU_FBDRAW  ] = __am_gpu_fbdraw,
  [AM_GPU_STATUS  ] = __am_gpu_status,
  [AM_UART_CONFIG ] = __am_uart_config,
  [AM_AUDIO_CONFIG] = __am_audio_config,
  [AM_AUDIO_CTRL  ] = __am_audio_ctrl,
  [AM_AUDIO_STATUS] = __am_audio_status,
  [AM_AUDIO_PLAY  ] = __am_audio_play,
  [AM_DISK_CONFIG ] = __am_disk_config,
  [AM_DISK_STATUS ] = __am_disk_status,
  [AM_DISK_BLKIO  ] = __am_disk_blkio,
  [AM_NET_CONFIG  ] = __am_net_config,
};

static void fail(void *buf) { panic("access nonexist register"); }

bool ioe_init() {
  for (int i = 0; i < LENGTH(lut); i++)
    if (!lut[i]) lut[i] = fail;
  __am_gpu_init();
  __am_timer_init();
  __am_audio_init();
  return true;
}

void ioe_read (int reg, void *buf) { ((handler_t)lut[reg])(buf); }
void ioe_write(int reg, void *buf) { ((handler_t)lut[reg])(buf); }


</emu-alg>
 </emu-clause>
 <emu-clause id=sec-setrealmglobalobject aoid=SetRealmGlobalObject>

8.2.3SetRealmGlobalObject ( <var>realmRec</var>, <var>globalObj</var>, <var>thisValue</var> )

The abstract operation SetRealmGlobalObject with arguments <var>realmRec</var>, <var>globalObj</var>, and <var>thisValue</var> performs the following steps:

 <emu-alg>

If <var>globalObj</var> is <emu-val>undefined</emu-val>, then

Let <var>intrinsics</var> be <var>realmRec</var>.[[Intrinsics]].
Set <var>globalObj</var> to <emu-xref aoid=ObjectCreate id=_ref_2092>ObjectCreate</emu-xref>(<var>intrinsics</var>.[[<emu-xref href=#sec-properties-of-the-object-prototype-object id=_ref_2093>%ObjectPrototype%</emu-xref>]]).

<emu-xref href=#assert id=_ref_2094>Assert</emu-xref>: <emu-xref aoid=Type id=_ref_2095>Type</emu-xref>(<var>globalObj</var>) is Object.
If <var>thisValue</var> is <emu-val>undefined</emu-val>, set <var>thisValue</var> to <var>globalObj</var>.
Set <var>realmRec</var>.[[GlobalObject]] to <var>globalObj</var>.
Let <var>newGlobalEnv</var> be <emu-xref aoid=NewGlobalEnvironment id=_ref_2096>NewGlobalEnvironment</emu-xref>(<var>globalObj</var>, <var>thisValue</var>).
Set <var>realmRec</var>.[[GlobalEnv]] to <var>newGlobalEnv</var>.
Return <var>realmRec</var>.

</emu-alg>
 </emu-clause>
 <emu-clause id=sec-setdefaultglobalbindings aoid=SetDefaultGlobalBindings>

8.2.4SetDefaultGlobalBindings ( <var>realmRec</var> )

The abstract operation SetDefaultGlobalBindings with argument <var>realmRec</var> performs the following steps:

 <emu-alg>

Let <var>global</var> be <var>realmRec</var>.[[GlobalObject]].
For each property of the Global Object specified in clause <emu-xref href=#sec-global-object id=_ref_173>18</emu-xref>, do

Let <var>name</var> be the String value of the <emu-xref href=#property-name id=_ref_2097>property name</emu-xref>.
Let <var>desc</var> be the fully populated <emu-xref href=#sec-object-type id=_ref_2098>data property</emu-xref> descriptor for the property containing the specified attributes for the property. For properties listed in <emu-xref href=#sec-function-properties-of-the-global-object id=_ref_174>18.2</emu-xref>, <emu-xref href=#sec-constructor-properties-of-the-global-object id=_ref_175>18.3</emu-xref>, or <emu-xref href=#sec-other-properties-of-the-global-object id=_ref_176


}

    public String getSbtCommandArgs() {
        return sbtOptions.getText();
    }

    public void setSbtCommandArgs(String text) {
        sbtOptions.setText(text);
    }

    public Map<String, String> getSbtEnvironment() {
        return sbtEnvironment.getEnvs();
    }

    public void setSbtEnvironment(Map<String, String> envs) {
        sbtEnvironment.setEnvs(envs);
    }

    public Boolean getSbtPassParentEnvironment() {
        return sbtEnvironment.isPassParentEnvs();
    }

    public void setSbtPassParentEnvironment(Boolean shouldPass) {
        sbtEnvironment.setPassParentEnvs(shouldPass);
    }

    /**
     * Method generated by IntelliJ IDEA GUI Designer
     * >>> IMPORTANT!! <<<
     * DO NOT edit this method OR call it in your code!
     *
     * @noinspection ALL
     */
    private void $$$setupUI$$$() {
        createUIComponents();
        myContentPanel = new JPanel();
        myContentPanel.setLayout(new GridLayoutManager(4, 4, new Insets(0, 0, 0, 0), -1, -1));
        final JPanel panel1 = new JPanel();
        panel1.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
        myContentPanel.add(panel1, new GridConstraints(2, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 1, false));
        final Spacer spacer1 = new Spacer();
        panel1.add(spacer1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
        vmSettingsPanel = new JPanel();
        vmSettingsPanel.setLayout(new GridLayoutManager(6, 5, new Insets(0, 0, 0, 0), 18, -1));
        myContentPanel.add(vmSettingsPanel, new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(450, 107), null, 1, false));
        maximumHeapSizeLabel = new JLabel();
        this.$$$loadLabelText$$$(maximumHeapSizeLabel, this.$$$getMessageFromBundle$$$("messages/SbtBundle", "sbt.settings.maxHeapSize"));
        vmSettingsPanel.add(maximumHeapSizeLabel, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
        vmParametersLabel = new JLabel();
        this.$$$loadLabelText$$$(vmParametersLabel, this.$$$getMessageFromBundle$$$("messages/SbtBundle", "sbt.settings.vmParams"));
        vmSettingsPanel.add(vmParametersLabel, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
        maximumHeapSize = new JTextField();
        maximumHeapSize.setColumns(5);
        maximumHeapSize.setMargin(new Insets(2, 6