# Message Sessions

Function Monkey supports (FIFO message sessions)[https://docs.microsoft.com/en-us/azure/service-bus-messaging/message-sessions] for both message processing and output triggers.

To enable on a Service Bus queue or subscription function set the isSessionEnabled parameter to true. For example:

    .ServiceBus(serviceBus => serviceBus
        .QueueFunction<ServiceBusSessionIdQueueCommand>("myqueue", true)
    )

To specify the message ID in a service bus output binding you need to supply the session ID in the command response and tell Function Monkey which property contains the ID. For example:

    .HttpRoute("outputBindings", route => route
        .HttpFunction<MyCommand>("/toServiceBusQueueWithResultSessionId")
        .OutputTo.ServiceBusQueue<MyCommandResult>("myqueue", result => result.SessionId)
    )

{'repo_name': 'JamesRandall/FunctionMonkey', 'stars': '229', 'repo_language': 'C#', 'file_name': 'SignalRNegotiate.cs', 'mime_type': 'text/x-c++', 'hash': 6813604511152400816, 'source_dataset': 'data'}


package io.xream.reliable;

import io.xream.reliable.bean.Cat;
import io.xream.x7.reyc.ReyClient;
import org.springframework.web.bind.annotation.RequestMapping;
import io.xream.x7.base.web.ViewEntity;

@ReyClient(value = "${reliable.demo}/payment")

/**
 * @Author Sim
 */
public interface PaymentServiceRemote {

    @RequestMapping("/pay")
    ViewEntity pay(Cat cat);
}

{'repo_name': 'x-ream/reliable', 'stars': '192', 'repo_language': 'Java', 'file_name': 'FailedService.java', 'mime_type': 'text/x-java', 'hash': 2062229156117908531, 'source_dataset': 'data'}


#include "fe.h"
#include "crypto_int64.h"

/*
h = f * g
Can overlap h with f or g.

Preconditions:
   |f| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc.
   |g| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc.

Postconditions:
   |h| bounded by 1.01*2^25,1.01*2^24,1.01*2^25,1.01*2^24,etc.
*/

/*
Notes on implementation strategy:

Using schoolbook multiplication.
Karatsuba would save a little in some cost models.

Most multiplications by 2 and 19 are 32-bit precomputations;
cheaper than 64-bit postcomputations.

There is one remaining multiplication by 19 in the carry chain;
one *19 precomputation can be merged into this,
but the resulting data flow is considerably less clean.

There are 12 carries below.
10 of them are 2-way parallelizable and vectorizable.
Can get away with 11 carries, but then data flow is much deeper.

With tighter constraints on inputs can squeeze carries into int32.
*/

void fe_mul(fe h,const fe f,const fe g)
{
  crypto_int32 f0 = f[0];
  crypto_int32 f1 = f[1];
  crypto_int32 f2 = f[2];
  crypto_int32 f3 = f[3];
  crypto_int32 f4 = f[4];
  crypto_int32 f5 = f[5];
  crypto_int32 f6 = f[6];
  crypto_int32 f7 = f[7];
  crypto_int32 f8 = f[8];
  crypto_int32 f9 = f[9];
  crypto_int32 g0 = g[0];
  crypto_int32 g1 = g[1];
  crypto_int32 g2 = g[2];
  crypto_int32 g3 = g[3];
  crypto_int32 g4 = g[4];
  crypto_int32 g5 = g[5];
  crypto_int32 g6 = g[6];
  crypto_int32 g7 = g[7];
  crypto_int32 g8 = g[8];
  crypto_int32 g9 = g[9];
  crypto_int32 g1_19 = 19 * g1; /* 1.959375*2^29 */
  crypto_int32 g2_19 = 19 * g2; /* 1.959375*2^30; still ok */
  crypto_int32 g3_19 = 19 * g3;
  crypto_int32 g4_19 = 19 * g4;
  crypto_int32 g5_19 = 19 * g5;
  crypto_int32 g6_19 = 19 * g6;
  crypto_int32 g7_19 = 19 * g7;
  crypto_int32 g8_19 = 19 * g8;
  crypto_int32 g9_19 = 19 * g9;
  crypto_int32 f1_2 = 2 * f1;
  crypto_int32 f3_2 = 2 * f3;
  crypto_int32 f5_2 = 2 * f5;
  crypto_int32 f7_2 = 2 * f7;
  crypto_int32 f9_2 = 2 * f9;
  crypto_int64 f0g0    = f0   * (crypto_int64) g0;
  crypto_int64 f0g1    = f0   * (crypto_int64) g1;
  crypto_int64 f0g2    = f0   * (crypto_int64) g2;
  crypto_int64 f0g3    = f0   * (crypto_int64) g3;
  crypto_int64 f0g4    = f0   * (crypto_int64) g4;
  crypto_int64 f0g5    = f0   * (crypto_int64) g5;
  crypto_int64 f0g6    = f0   * (crypto_int64) g6;
  crypto_int64 f0g7    = f0   * (crypto_int64) g7;
  crypto_int64 f0g8    = f0   * (crypto_int64) g8;
  crypto_int64 f0g9    = f0   * (crypto_int64) g9;
  crypto_int64 f1g0    = f1   * (crypto_int64) g0;
  crypto_int64 f1g1_2  = f1_2 * (crypto_int64) g1;
  crypto_int64 f1g2    = f1   * (crypto_int64) g2;
  crypto_int64 f1g3_2  = f1_2 * (crypto_int64) g3;
  crypto_int64 f1g4    = f1   * (crypto_int64) g4;
  crypto_int64 f1g5_2  = f1_2 * (crypto_int64) g5;
  crypto_int64 f1g6    = f1   * (crypto_int64) g6;
  crypto_int64 f1g7_2  = f1_2 * (crypto_int64) g7;
  crypto_int64 f1g8    = f1   * (crypto_int64) g8;
  crypto_int64 f1g9_38 = f1_2 * (crypto_int64) g9_19;
  crypto_int64 f2g0    = f2   * (crypto_int64) g0;
  crypto_int64 f2g1    = f2   * (crypto_int64) g1;
  crypto_int64 f2g2    = f2   * (crypto_int64) g2;
  crypto_int64 f2g3    = f2   * (crypto_int64) g3;
  crypto_int64 f2g4    = f2   * (crypto_int64) g4;
  crypto_int64 f2g5    = f2   * (crypto_int64) g5;
  crypto_int64 f2g6    = f2   * (crypto_int64) g6;
  crypto_int64 f2g7    = f2   * (crypto_int64) g7;
  crypto_int64 f2g8_19 = f2   * (crypto_int64) g8_19;
  crypto_int64 f2g9_19 = f2   * (crypto_int64) g9_19;
  crypto_int64 f3g0    = f3   * (crypto_int64) g0;
  crypto_int64 f3g1_2  = f3_2 * (crypto_int64) g1;
  crypto_int64 f3g2    = f3   * (crypto_int64) g2;
  crypto_int64 f3g3_2  = f3_2 * (crypto_int64) g3;
  crypto_int64 f3g4    = f3   * (crypto_int64) g4;
  crypto_int64 f3g5_2  = f3_2 * (crypto_int64) g5;
  crypto_int64 f3g6    = f3   * (crypto_int64) g6;
  crypto_int64 f3g7_38 = f3_2 * (crypto_int64) g7_19;
  crypto_int64 f3g8_19 = f3   * (crypto_int64) g8_19;
  crypto_int64 f3g9_38 = f3_2 * (crypto_int64) g9_19;
  crypto_int64 f4g0    = f4   * (crypto_int64) g0;
  crypto_int64 f4g1    = f4   * (crypto_int64) g1;
  crypto_int64 f4g2    = f4   * (crypto_int64) g2;
  crypto_int64 f4g3    = f4   * (crypto_int64) g3;
  crypto_int64 f4g4    = f4   * (crypto_int64) g4;
  crypto_int64 f4g5    = f4   * (crypto_int64) g5;
  crypto_int64 f4g6_19 = f4   * (crypto_int64) g6_19;
  crypto_int64 f4g7_19 = f4   * (crypto_int64) g7_19;
  crypto_int64 f4g8_19 = f4   * (crypto_int64) g8_19;
  crypto_int64 f4g9_19 = f4   * (crypto_int64) g9_19;
  crypto_int64 f5g0    = f5   * (crypto_int64) g0;
  crypto_int64 f5g1_2  = f5_2 * (crypto_int64) g1;
  crypto_int64 f5g2    = f5   * (crypto_int64) g2;
  crypto_int64 f5g3_2  = f5_2 * (crypto_int64) g3;
  crypto_int64 f5g4    = f5   * (crypto_int64) g4;
  crypto_int64 f5g5_38 = f5_2 * (crypto_int64) g5_19;
  crypto_int64 f5g6_19 = f5   * (crypto_int64) g6_19;
  crypto_int64 f5g7_38 = f5_2 * (crypto_int64) g7_19;
  crypto_int64 f5g8_19 = f5   * (crypto_int64) g8_19;
  crypto_int64 f5g9_38 = f5_2 * (crypto_int64) g9_19;
  crypto_int64 f6g0    = f6   * (crypto_int64) g0;
  crypto_int64 f6g1    = f6   * (crypto_int64) g1;
  crypto_int64 f6g2    = f6   * (crypto_int64) g2;
  crypto_int64 f6g3    = f6   * (crypto_int64) g3;
  crypto_int64 f6g4_19 = f6   * (crypto_int64) g4_19;
  crypto_int64 f6g5_19 = f6   * (crypto_int64) g5_19;
  crypto_int64 f6g6_19 = f6   * (crypto_int64) g6_19;
  crypto_int64 f6g7_19 = f6   * (crypto_int64) g7_19;
  crypto_int64 f6g8_19 = f6   * (crypto_int64) g8_19;
  crypto_int64 f6g9_19 = f6   * (crypto_int64) g9_19;
  crypto_int64 f7g0    = f7   * (crypto_int64) g0;
  crypto_int64 f7g1_2  = f7_2 * (crypto_int64) g1;
  crypto_int64 f7g2    = f7   * (crypto_int64) g2;
  crypto_int64 f7g3_38 = f7_2 * (crypto_int64) g3_19;
  crypto_int64 f7g4_19 = f7   * (crypto_int64) g4_19;
  crypto_int64 f7g5_38 = f7_2 * (crypto_int64) g5_19;
  crypto_int64 f7g6_19 = f7   * (crypto_int64) g6_19;
  crypto_int64 f7g7_38 = f7_2 * (crypto_int64) g7_19;
  crypto_int64 f7g8_19 = f7   * (crypto_int64) g8_19;
  crypto_int64 f7g9_38 = f7_2 * (crypto_int64) g9_19;
  crypto_int64 f8g0    = f8   * (crypto_int64) g0;
  crypto_int64 f8g1    = f8   * (crypto_int64) g1;
  crypto_int64 f8g2_19 = f8   * (crypto_int64) g2_19;
  crypto_int64 f8g3_19 = f8   * (crypto_int64) g3_19;
  crypto_int64 f8g4_19 = f8   * (crypto_int64) g4_19;
  crypto_int64 f8g5_19 = f8   * (crypto_int64) g5_19;
  crypto_int64 f8g6_19 = f8   * (crypto_int64) g6_19;
  crypto_int64 f8g7_19 = f8   * (crypto_int64) g7_19;
  crypto_int64 f8g8_19 = f8   * (crypto_int64) g8_19;
  crypto_int64 f8g9_19 = f8   * (crypto_int64) g9_19;
  crypto_int64 f9g0    = f9   * (crypto_int64) g0;
  crypto_int64 f9g1_38 = f9_2 * (crypto_int64) g1_19;
  crypto_int64 f9g2_19 = f9   * (crypto_int64) g2_19;
  crypto_int64 f9g3_38 = f9_2 * (crypto_int64) g3_19;
  crypto_int64 f9g4_19 = f9   * (crypto_int64) g4_19;
  crypto_int64 f9g5_38 = f9_2 * (crypto_int64) g5_19;
  crypto_int64 f9g6_19 = f9   * (crypto_int64) g6_19;
  crypto_int64 f9g7_38 = f9_2 * (crypto_int64) g7_19;
  crypto_int64 f9g8_19 = f9   * (crypto_int64) g8_19;
  crypto_int64 f9g9_38 = f9_2 * (crypto_int64) g9_19;
  crypto_int64 h0 = f0g0+f1g9_38+f2g8_19+f3g7_38+f4g6_19+f5g5_38+f6g4_19+f7g3_38+f8g2_19+f9g1_38;
  crypto_int64 h1 = f0g1+f1g0   +f2g9_19+f3g8_19+f4g7_19+f5g6_19+f6g5_19+f7g4_19+f8g3_19+f9g2_19;
  crypto_int64 h2 = f0g2+f1g1_2 +f2g0   +f3g9_38+f4g8_19+f5g7_38+f6g6_19+f7g5_38+f8g4_19+f9g3_38;
  crypto_int64 h3 = f0g3+f1g2   +f2g1   +f3g0   +f4g9_19+f5g8_19+f6g7_19+f7g6_19+f8g5_19+f9g4_19;
  crypto_int64 h4 = f0g4+f1g3_2 +f2g2   +f3g1_2 +f4g0   +f5g9_38+f6g8_19+f7g7_38+f8g6_19+f9g5_38;
  crypto_int64 h5 = f0g5+f1g4   +f2g3   +f3g2   +f4g1   +f5g0   +f6g9_19+f7g8_19+f8g7_19+f9g6_19;
  crypto_int64 h6 = f0g6+f1g5_2 +f2g4   +f3g3_2 +f4g2   +f5g1_2 +f6g0   +f7g9_38+f8g8_19+f9g7_38;
  crypto_int64 h7 = f0g7+f1g6   +f2g5   +f3g4   +f4g3   +f5g2   +f6g1   +f7g0   +f8g9_19+f9g8_19;
  crypto_int64 h8 = f0g8+f1g7_2 +f2g6   +f3g5_2 +f4g4   +f5g3_2 +f6g2   +f7g1_2 +f8g0   +f9g9_38;
  crypto_int64 h9 = f0g9+f1g8   +f2g7   +f3g6   +f4g5   +f5g4   +f6g3   +f7g2   +f8g1   +f9g0   ;
  crypto_int64 carry0;
  crypto_int64 carry1;
  crypto_int64 carry2;
  crypto_int64 carry3;
  crypto_int64 carry4;
  crypto_int64 carry5;
  crypto_int64 carry6;
  crypto_int64 carry7;
  crypto_int64 carry8;
  crypto_int64 carry9;

  /*
  |h0| <= (1.65*1.65*2^52*(1+19+19+19+19)+1.65*1.65*2^50*(38+38+38+38+38))
    i.e. |h0| <= 1.4*2^60; narrower ranges for h2, h4, h6, h8
  |h1| <= (1.65*1.65*2^51*(1+1+19+19+19+19+19+19+19+19))
    i.e. |h1| <= 1.7*2^59; narrower ranges for h3, h5, h7, h9
  */

  carry0 = (h0 + (crypto_int64) (1L << 25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
  carry4 = (h4 + (crypto_int64) (1L << 25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
  /* |h0| <= 2^25 */
  /* |h4| <= 2^25 */
  /* |h1| <= 1.71*2^59 */
  /* |h5| <= 1.71*2^59 */

  carry1 = (h1 + (crypto_int64) (1L << 24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
  carry5 = (h5 + (crypto_int64) (1L << 24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
  /* |h1| <= 2^24; from now on fits into int32 */
  /* |h5| <= 2^24; from now on fits into int32 */
  /* |h2| <= 1.41*2^60 */
  /* |h6| <= 1.41*2^60 */

  carry2 = (h2 + (crypto_int64) (1L << 25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
  carry6 = (h6 + (crypto_int64) (1L << 25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
  /* |h2| <= 2^25; from now on fits into int32 unchanged */
  /* |h6| <= 2^25; from now on fits into int32 unchanged */
  /* |h3| <= 1.71*2^59 */
  /* |h7| <= 1.71*2^59 */

  carry3 = (h3 + (crypto_int64) (1L << 24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
  carry7 = (h7 + (crypto_int64) (1L << 24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
  /* |h3| <= 2^24; from now on fits into int32 unchanged */
  /* |h7| <= 2^24; from now on fits into int32 unchanged */
  /* |h4| <= 1.72*2^34 */
  /* |h8| <= 1.41*2^60 */

  carry4 = (h4 + (crypto_int64) (1L << 25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
  carry8 = (h8 + (crypto_int64) (1L << 25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
  /* |h4| <= 2^25; from now on fits into int32 unchanged */
  /* |h8| <= 2^25; from now on fits into int32 unchanged */
  /* |h5| <= 1.01*2^24 */
  /* |h9| <= 1.71*2^59 */

  carry9 = (h9 + (crypto_int64) (1L << 24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
  /* |h9| <= 2^24; from now on fits into int32 unchanged */
  /* |h0| <= 1.1*2^39 */

  carry0 = (h0 + (crypto_int64) (1L << 25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
  /* |h0| <= 2^25; from now on fits into int32 unchanged */
  /* |h1| <= 1.01*2^24 */

  h[0] = (crypto_int32) h0;
  h[1] = (crypto_int32) h1;
  h[2] = (crypto_int32) h2;
  h[3] = (crypto_int32) h3;
  h[4] = (crypto_int32) h4;
  h[5] = (crypto_int32) h5;
  h[6] = (crypto_int32) h6;
  h[7] = (crypto_int32) h7;
  h[8] = (crypto_int32) h8;
  h[9] = (crypto_int32) h9;
}

{'repo_name': 'we11cheng/WCPotatso', 'stars': '137', 'repo_language': 'Swift', 'file_name': 'IDEWorkspaceChecks.plist', 'mime_type': 'text/xml', 'hash': -6598122605159442387, 'source_dataset': 'data'}


//
//     Generated by class-dump 3.5 (64 bit).
//
//     class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//

#import "NSObject.h"

#import "FTMessageQueueDelegate.h"

@class FTMessageQueue, IDSBaseMessage, IMTimer, NSArray, NSNumber, NSString;

@interface FTMessageDelivery : NSObject <FTMessageQueueDelegate>
{
    unsigned int _retries;
    NSNumber *_protocolVersion;
    FTMessageQueue *_queue;
    NSString *_userAgent;
    unsigned int _maxConcurrentMessages;
    BOOL _retryInAirplaneMode;
    IMTimer *_timer;
}

+ (id)_errorForTDMessageDeliveryStatus:(int)arg1 userInfo:(id)arg2;
+ (id)alloc;
+ (Class)APNSMessageDeliveryClass;
+ (Class)HTTPMessageDeliveryClass;
@property BOOL retryInAirplaneMode; // @synthesize retryInAirplaneMode=_retryInAirplaneMode;
@property unsigned int maxConcurrentMessages; // @synthesize maxConcurrentMessages=_maxConcurrentMessages;
@property(copy) NSString *userAgent; // @synthesize userAgent=_userAgent;
@property(copy) NSNumber *protocolVersion; // @synthesize protocolVersion=_protocolVersion;
- (void)_signMessage:(id)arg1 useDataSignatures:(BOOL)arg2 body:(id)arg3 queryString:(id)arg4 intoDictionary:(id)arg5;
- (void)networkStateChanged;
@property(readonly) int maxMessageSize;
- (void)_setRetryTimer:(double)arg1;
- (void)_clearRetryTimer;
- (void)_retryTimerHit:(id)arg1;
- (BOOL)sendMessage:(id)arg1;
- (void)cancelMessage:(id)arg1;
- (void)queue:(id)arg1 hitTimeoutForMessage:(id)arg2;
- (id)_queue;
@property(readonly) BOOL hasQueuedItems;
@property(readonly) BOOL busy;
@property(readonly) NSArray *allMessages;
@property(readonly) IDSBaseMessage *currentMessage;
@property(readonly) NSArray *queuedMessages;
- (BOOL)_sendMessageAsynchronously:(id)arg1 error:(id *)arg2;
- (void)_informDelegateAboutMessage:(id)arg1 error:(id)arg2 result:(id)arg3 resultCode:(int)arg4;
- (void)invalidate;
- (void)dealloc;
- (id)init;

@end

{'repo_name': 'MP0w/iOS-Headers', 'stars': '405', 'repo_language': 'Objective-C', 'file_name': 'IMAVChat-IMAVChatAudioAdditions.h', 'mime_type': 'text/x-objective-c', 'hash': 8442609419153412725, 'source_dataset': 'data'}


/**
  ******************************************************************************
  * @file    stm32f0xx_hal_smartcard_ex.c
  * @author  MCD Application Team
  * @brief   SMARTCARD HAL module driver.
  *          This file provides extended firmware functions to manage the following
  *          functionalities of the SmartCard.
  *           + Initialization and de-initialization functions
  *           + Peripheral Control functions
  *
  *
  @verbatim
  =============================================================================
               ##### SMARTCARD peripheral extended features  #####
  =============================================================================
  [..]
  The Extended SMARTCARD HAL driver can be used as follows:

    (#) After having configured the SMARTCARD basic features with HAL_SMARTCARD_Init(),
        then program SMARTCARD advanced features if required (TX/RX pins swap, TimeOut,
        auto-retry counter,...) in the hsmartcard AdvancedInit structure.

  @endverbatim
  ******************************************************************************
  * @attention
  *
  *
© COPYRIGHT(c) 2016 STMicroelectronics

  *
  * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *   1. Redistributions of source code must retain the above copyright notice,
  *      this list of conditions and the following disclaimer.
  *   2. Redistributions in binary form must reproduce the above copyright notice,
  *      this list of conditions and the following disclaimer in the documentation
  *      and/or other materials provided with the distribution.
  *   3. Neither the name of STMicroelectronics nor the names of its contributors
  *      may be used to endorse or promote products derived from this software
  *      without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  ******************************************************************************
  */

/* Includes ------------------------------------------------------------------*/
#include "stm32f0xx_hal.h"

#if !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)

/** @addtogroup STM32F0xx_HAL_Driver
  * @{
  */

/** @defgroup SMARTCARDEx SMARTCARDEx
  * @brief SMARTCARD Extended HAL module driver
  * @{
  */
#ifdef HAL_SMARTCARD_MODULE_ENABLED

/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macros ------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/

/* Exported functions --------------------------------------------------------*/
/** @defgroup SMARTCARDEx_Exported_Functions  SMARTCARD Extended Exported Functions
  * @{
  */

/** @defgroup SMARTCARDEx_Exported_Functions_Group1 Extended Peripheral Control functions
  * @brief    Extended control functions
  *
@verbatim
  ===============================================================================
                      ##### Peripheral Control functions #####
  ===============================================================================
  [..]
  This subsection provides a set of functions allowing to initialize the SMARTCARD.
     (+) HAL_SMARTCARDEx_BlockLength_Config() API allows to configure the Block Length on the fly
     (+) HAL_SMARTCARDEx_TimeOut_Config() API allows to configure the receiver timeout value on the fly
     (+) HAL_SMARTCARDEx_EnableReceiverTimeOut() API enables the receiver timeout feature
     (+) HAL_SMARTCARDEx_DisableReceiverTimeOut() API disables the receiver timeout feature

@endverbatim
  * @{
  */

/**
  * @brief Update on the fly the SMARTCARD block length in RTOR register.
  * @param hsmartcard Pointer to a SMARTCARD_HandleTypeDef structure that contains
  *                    the configuration information for the specified SMARTCARD module.
  * @param BlockLength SMARTCARD block length (8-bit long at most)
  * @retval None
  */
void HAL_SMARTCARDEx_BlockLength_Config(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t BlockLength)
{
  MODIFY_REG(hsmartcard->Instance->RTOR, USART_RTOR_BLEN, ((uint32_t)BlockLength << SMARTCARD_RTOR_BLEN_LSB_POS));
}

/**
  * @brief Update on the fly the receiver timeout value in RTOR register.
  * @param hsmartcard Pointer to a SMARTCARD_HandleTypeDef structure that contains
  *                    the configuration information for the specified SMARTCARD module.
  * @param TimeOutValue receiver timeout value in number of baud blocks. The timeout
  *                     value must be less or equal to 0x0FFFFFFFF.
  * @retval None
  */
void HAL_SMARTCARDEx_TimeOut_Config(SMARTCARD_HandleTypeDef *hsmartcard, uint32_t TimeOutValue)
{
  assert_param(IS_SMARTCARD_TIMEOUT_VALUE(hsmartcard->Init.TimeOutValue));
  MODIFY_REG(hsmartcard->Instance->RTOR, USART_RTOR_RTO, TimeOutValue);
}

/**
  * @brief Enable the SMARTCARD receiver timeout feature.
  * @param hsmartcard Pointer to a SMARTCARD_HandleTypeDef structure that contains
  *                    the configuration information for the specified SMARTCARD module.
  * @retval HAL status
  */
HAL_StatusTypeDef HAL_SMARTCARDEx_EnableReceiverTimeOut(SMARTCARD_HandleTypeDef *hsmartcard)
{

  if(hsmartcard->gState == HAL_SMARTCARD_STATE_READY)
  {
    /* Process Locked */
    __HAL_LOCK(hsmartcard);

    hsmartcard->gState = HAL_SMARTCARD_STATE_BUSY;

    /* Set the USART RTOEN bit */
    SET_BIT(hsmartcard->Instance->CR2, USART_CR2_RTOEN);

    hsmartcard->gState = HAL_SMARTCARD_STATE_READY;

    /* Process Unlocked */
    __HAL_UNLOCK(hsmartcard);

    return HAL_OK;
  }
  else
  {
    return HAL_BUSY;
  }
}

/**
  * @brief Disable the SMARTCARD receiver timeout feature.
  * @param hsmartcard Pointer to a SMARTCARD_HandleTypeDef structure that contains
  *                    the configuration information for the specified SMARTCARD module.
  * @retval HAL status
  */
HAL_StatusTypeDef HAL_SMARTCARDEx_DisableReceiverTimeOut(SMARTCARD_HandleTypeDef *hsmartcard)
{

  if(hsmartcard->gState == HAL_SMARTCARD_STATE_READY)
  {
    /* Process Locked */
    __HAL_LOCK(hsmartcard);

    hsmartcard->gState = HAL_SMARTCARD_STATE_BUSY;

    /* Clear the USART RTOEN bit */
    CLEAR_BIT(hsmartcard->Instance->CR2, USART_CR2_RTOEN);

    hsmartcard->gState = HAL_SMARTCARD_STATE_READY;

    /* Process Unlocked */
    __HAL_UNLOCK(hsmartcard);

    return HAL_OK;
  }
  else
  {
    return HAL_BUSY;
  }
}

/**
  * @}
  */

/**
  * @}
  */

#endif /* HAL_SMARTCARD_MODULE_ENABLED */

/**
  * @}
  */

/**
  * @}
  */

#endif /* !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)  */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

{'repo_name': 'apache/mynewt-core', 'stars': '570', 'repo_language': 'C', 'file_name': 'startup_stm32f318xx.s', 'mime_type': 'text/plain', 'hash': 7436903909340769781, 'source_dataset': 'data'}


//
//  ViewController.h
//  Example
//
//  Created by jiaxin on 2019/11/22.
//  Copyright © 2019 jiaxin. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface ViewController : UITableViewController

@end

{'repo_name': 'pujiaxin33/JXCategoryView', 'stars': '4704', 'repo_language': 'Objective-C', 'file_name': '常用属性说明.md', 'mime_type': 'text/plain', 'hash': 5197593700163966056, 'source_dataset': 'data'}


#ifndef SYSTEM_H
#define SYSTEM_H

#include <rtems.h>
#include <rtems/test-info.h>
#include <rtems/console.h>
#include <rtems/clockdrv.h>

/* functions */
extern rtems_task Init(rtems_task_argument argument);
extern int pppdapp_initialize(void);

#include <bsp.h>

#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER

#ifndef TTY1_DRIVER_TABLE_ENTRY
  #define TTY1_DRIVER_TABLE_ENTRY NULL_DRIVER_TABLE_ENTRY
#endif
#ifndef TTY2_DRIVER_TABLE_ENTRY
  #define TTY2_DRIVER_TABLE_ENTRY NULL_DRIVER_TABLE_ENTRY
#endif

#define CONFIGURE_APPLICATION_EXTRA_DRIVERS \
  TTY1_DRIVER_TABLE_ENTRY, TTY2_DRIVER_TABLE_ENTRY

#define CONFIGURE_RTEMS_INIT_TASKS_TABLE

#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 8

#define CONFIGURE_UNIFIED_WORK_AREAS

#define CONFIGURE_UNLIMITED_OBJECTS

#define CONFIGURE_MICROSECONDS_PER_TICK 10000

#define CONFIGURE_INIT_TASK_STACK_SIZE (10*1024)
#define CONFIGURE_INIT_TASK_PRIORITY   120
#define CONFIGURE_INIT_TASK_INITIAL_MODES (RTEMS_PREEMPT | \
                                           RTEMS_NO_TIMESLICE | \
                                           RTEMS_NO_ASR | \
                                           RTEMS_INTERRUPT_LEVEL(0))
#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT

#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION

#include <rtems/confdefs.h>

#endif

{'repo_name': 'RTEMS/rtems', 'stars': '378', 'repo_language': 'C', 'file_name': 'doxygen.h', 'mime_type': 'text/plain', 'hash': 2627697005206780956, 'source_dataset': 'data'}


[platformio]
src_dir=UTFT
; lib_dir=~/Arduino/Libraries

[env:due]
platform = atmelsam
board = due
framework = arduino
; build_flags = -Wno-comment -Wno-reorder -Wno-strict-aliasing -Wno-builtin-macro-redefined

; [env:teensy31]
; platform=teensy
; board=teensy31
; framework=arduino

; [env:nanoatmega328]
; platform=atmelavr
; board=nanoatmega328
; framework=arduino

; [env:esp12e]
; platform = espressif8266
; board = esp12e
; framework = arduino
; upload_speed=921600
; build_flags = -Wno-comment -Wno-reorder -Wno-strict-aliasing -Wno-builtin-macro-redefined -lstdc++ -DDEBUG

{'repo_name': 'neu-rah/ArduinoMenu', 'stars': '409', 'repo_language': 'C++', 'file_name': 'plugins.ino', 'mime_type': 'text/x-c', 'hash': 314894300474077386, 'source_dataset': 'data'}


<zk>
	<menubar id="menubar" width="200px">
		<menu id="menu" label="click me"
			image="/img/Centigrade-Widget-Icons/QuestionmarkButton-16x16.png">
			<menupopup>
				<menuitem id="menuitem" label="Change"
					onClick='menu.setImage("/img/Centigrade-Widget-Icons/Briefcase-16x16.png")' />
			</menupopup>
		</menu>
	</menubar>
</zk>

{'repo_name': 'zkoss/zk', 'stars': '317', 'repo_language': 'Java', 'file_name': 'MANIFEST.MF', 'mime_type': 'text/plain', 'hash': -1178815348015726397, 'source_dataset': 'data'}


// 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/.

use base::prelude::*;
use base::{error};
use core::{ptr, mem};
use {rt};
use rt::{AtExit};
use lock::{SingleThreadMutexGuard};
use mmem::{MemMap};
use mmem::flags::{PROT_WRITE, PROT_READ, MMAP_NONE, MREMAP_MAY_MOVE};

pub fn at_exit<F>(f: F) -> Result
    where F: FnOnce() + 'static,
{
    // The memory is organized as follows
    //
    //        -------------------------------------------------
    //        | size | invoke | closure | padding | size ...
    //        -------------------------------------------------
    //   ____/ \____                      _______/ \________
    //  /memory base\                    /memory base + size\
    //
    // Where `size` is the size of this section plus padding.
    // Where `invoke` is a pointer to the function that will invoke the closure.
    // Where `closure` is the data of the closure.
    // Where `padding` is enough padding to align the next `size` to an appropriate
    // boundary.
    //
    // Note that the alignment of the closure doesn't matter, since `invoke` will copy it
    // onto its stack.

    let mut at_exit = match rt::at_exit().try_lock() {
        Some(g) => g,
        _ => return Err(error::ResourceBusy),
    };

    let needed = mem::size_of::<usize>() + mem::size_of::<*mut u8>()
                        + mem::size_of::<F>();
    let needed = align!(needed, [%] mem::align_of::<Entry>());

    if at_exit.cap - at_exit.len < needed {
        let ps = rt::aux::page_size();
        let new_cap = align!(at_exit.cap + needed, [%] ps);
        unsafe {
            at_exit.ptr = if at_exit.ptr.is_null() {
                let map = try!(MemMap::anon(new_cap, PROT_READ | PROT_WRITE, false,
                                            MMAP_NONE));
                map.into_raw_parts().0
            } else {
                let mut map = MemMap::from_raw_parts(at_exit.ptr, (*at_exit).cap);
                try!(map.resize(new_cap, MREMAP_MAY_MOVE));
                map.into_raw_parts().0
            };
        }
        at_exit.cap = new_cap;
    }

    unsafe {
        let ptr = at_exit.ptr.add(at_exit.len) as *mut Entry;
        (*ptr).size = needed;
        (*ptr).invoke = invoke::<F>;
        ptr::write(&mut (*ptr).data as *mut _ as *mut _, f);
    }

    at_exit.len += needed;

    Ok(())
}

#[repr(C)]
struct Entry {
    size: usize,
    invoke: unsafe extern fn(SingleThreadMutexGuard<AtExit>, *mut u8),
    data: u8,
}

/// Runs all closures and deallocates the memory. This function is not reentrant.
pub unsafe fn run() {
    let at_exit = rt::at_exit();
    let mut pos = 0;

    loop {
        let mut at_exit = at_exit.lock();
        if pos == at_exit.len {
            if pos != 0 {
                MemMap::from_raw_parts(at_exit.ptr, at_exit.cap);
                at_exit.ptr = 0 as *mut u8;
                at_exit.len = 0;
                at_exit.cap = 0;
            }
            return;
        }
        let ptr = at_exit.ptr.add(pos) as *mut Entry;
        pos += (*ptr).size;
        ((*ptr).invoke)(at_exit, &mut (*ptr).data);
    }
}

/// Reads the closure onto its stack, drops the guard, and invokes the closure.
unsafe extern fn invoke<F>(guard: SingleThreadMutexGuard<AtExit>, f: *mut u8)
    where F: FnOnce() + 'static,
{
    let f = ptr::read(f as *mut F);
    drop(guard);
    f();
}

{'repo_name': 'lrs-lang/lib', 'stars': '204', 'repo_language': 'Rust', 'file_name': 'building_and_using.adoc', 'mime_type': 'text/x-c', 'hash': -8378333128737331409, 'source_dataset': 'data'}


package org.jkiss.utils;

import org.jkiss.utils.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

public class ArrayUtilsTest {

  @Test
  public void testIsEmpty() {
    Object[] arr = null;
    Assert.assertTrue(ArrayUtils.isEmpty(arr));
    Assert.assertTrue(ArrayUtils.isEmpty(new Object[]{}));
    Assert.assertFalse(ArrayUtils.isEmpty(new Object[]{0}));
  }

  @Test
  public void testIsEmptyShort() {
    short[] arr = null;
    Assert.assertTrue(ArrayUtils.isEmpty(arr));
    Assert.assertTrue(ArrayUtils.isEmpty(new short[]{}));
    Assert.assertFalse(ArrayUtils.isEmpty(new short[]{(short)0}));
  }

  @Test
  public void testContainsShort() {
    short[] arr = null;
    Assert.assertFalse(ArrayUtils.contains(arr, (short)0));
    Assert.assertFalse(ArrayUtils.contains(new short[]{}, (short)0));
    Assert.assertFalse(ArrayUtils.contains(new short[]{(short)1}, (short)0));
    Assert.assertTrue(ArrayUtils.contains(new short[]{(short)0}, (short)0));
  }

  @Test
  public void testContainsChar() {
    char[] arr = null;
    Assert.assertFalse(ArrayUtils.contains(arr, 'a'));
    Assert.assertFalse(ArrayUtils.contains(new char[]{}, 'a'));
    Assert.assertFalse(ArrayUtils.contains(new char[]{'b'}, 'a'));
    Assert.assertTrue(ArrayUtils.contains(new char[]{'a'}, 'a'));
  }

  @Test
  public void testIsEmptyInt() {
    int[] arr = null;
    Assert.assertTrue(ArrayUtils.isEmpty(arr));
    Assert.assertTrue(ArrayUtils.isEmpty(new int[]{}));
    Assert.assertFalse(ArrayUtils.isEmpty(new int[]{0}));
  }

  @Test
  public void testContainsInt() {
    int[] arr = null;
    Assert.assertFalse(ArrayUtils.contains(arr, 0));
    Assert.assertFalse(ArrayUtils.contains(new int[]{}, 0));
    Assert.assertFalse(ArrayUtils.contains(new int[]{1}, 0));
    Assert.assertTrue(ArrayUtils.contains(new int[]{0}, 0));
  }

  @Test
  public void testIsEmptyLong() {
    long[] arr = null;
    Assert.assertTrue(ArrayUtils.isEmpty(arr));
    Assert.assertTrue(ArrayUtils.isEmpty(new long[]{}));
    Assert.assertFalse(ArrayUtils.isEmpty(new long[]{0L}));
  }

  @Test
  public void testContainsLong() {
    long[] arr = null;
    Assert.assertFalse(ArrayUtils.contains(arr, 0L));
    Assert.assertFalse(ArrayUtils.contains(new long[]{}, 0L));
    Assert.assertFalse(ArrayUtils.contains(new long[]{1L}, 0L));
    Assert.assertTrue(ArrayUtils.contains(new long[]{0L}, 0L));
  }

  @Test
  public void testContainsObjectType() {
    String[] arr = null;
    Assert.assertFalse(ArrayUtils.contains(arr, "a"));
    Assert.assertFalse(ArrayUtils.contains(new String[]{}, "a"));
    Assert.assertFalse(ArrayUtils.contains(new String[]{"b"}, "a"));
    Assert.assertTrue(ArrayUtils.contains(new String[]{"a"}, "a"));
  }

  @Test
  public void testContainsIgnoreCase() {
    Assert.assertFalse(ArrayUtils.containsIgnoreCase(new String[]{}, "A"));
    Assert.assertFalse(ArrayUtils.containsIgnoreCase(new String[]{"a"}, null));
    Assert.assertFalse(ArrayUtils.containsIgnoreCase(new String[]{"b"}, "A"));
    Assert.assertTrue(ArrayUtils.containsIgnoreCase(new String[]{"a"}, "A"));
    Assert.assertTrue(ArrayUtils.containsIgnoreCase(new String[]{"a"}, "a"));
  }

  @Test
  public void testContainsRef() {
    Assert.assertFalse(ArrayUtils.containsRef(new String[]{}, "a"));
    Assert.assertFalse(ArrayUtils.containsRef(new String[]{"b"}, "a"));
    Assert.assertTrue(ArrayUtils.containsRef(new String[]{"a"}, "a"));
  }

  @Test
  public void testContains() {
    Assert.assertFalse(ArrayUtils.contains(new String[]{}, new String[]{"a"}));
    Assert.assertFalse(ArrayUtils.contains(new String[]{"b"}, new String[]{"a"}));
    Assert.assertTrue(ArrayUtils.contains(new String[]{"a"}, new String[]{"a"}));
  }

  @Test
  public void testConcatArrays() {
    Assert.assertArrayEquals(new String[]{"a", "b"}, ArrayUtils.concatArrays(new String[]{"a"}, new String[]{"b"}));
  }

  @Test
  public void testSafeArray() {
    String[] arr = null;
    List<Object> emptyList = new ArrayList<>();
    Assert.assertEquals(emptyList, ArrayUtils.safeArray(null));

    List<String> list = new ArrayList<>();
    list.add("a");
    Assert.assertEquals(list, ArrayUtils.safeArray(new String[]{"a"}));
  }

  @Test
  public void testIndexOf() {
    Assert.assertEquals(-1, ArrayUtils.indexOf(new String[]{"a"}, "b"));
    Assert.assertEquals(0, ArrayUtils.indexOf(new String[]{"a"}, "a"));
  }

  @Test
  public void testIndexOfByte() {
    Assert.assertEquals(1, ArrayUtils.indexOf(new byte[]{ (byte)'a', (byte)'b', 'c'}, 1, (byte)'b'));
    Assert.assertEquals(-1, ArrayUtils.indexOf(new byte[]{ (byte)'a', (byte)'b', 'c'}, 1, (byte)'a'));
  }

  @Test
  public void testDeleteArea() {
    Assert.assertArrayEquals(new Object[]{ 'a', 'c'}, ArrayUtils.deleteArea(Object.class, new Object[]{ 'a', 'b', 'c'}, 1, 1));
    Assert.assertArrayEquals(new Object[]{ 'a'}, ArrayUtils.deleteArea(Object.class, new Object[]{ 'a', 'b', 'c'}, 1, 2));
  }

  @Test
  public void testInsertArea() {
    Assert.assertArrayEquals(new Object[]{ 'a', 'b', 'c'}, ArrayUtils.insertArea(Object.class, new Object[]{ 'a', 'c'}, 1, new Object[]{ 'b' }));
  }

  @Test
  public void testAdd() {
    Assert.assertArrayEquals(new Object[]{ 'a', 'b', 'c' }, ArrayUtils.add(Object.class, new Object[]{ 'a', 'b'}, 'c'));
  }

  @Test
  public void testRemove() {
    Assert.assertArrayEquals(new Object[]{ 1L, 3L }, ArrayUtils.remove(Object.class, new Object[]{ 1L, 2L, 3L}, 2L));
    Assert.assertArrayEquals(new Object[]{ 1L, 2L }, ArrayUtils.remove(Object.class, new Object[]{ 1L, 2L, 3L}, 3L));
    Assert.assertArrayEquals(new Object[]{ 1L, 2L, 3L }, ArrayUtils.remove(Object.class, new Object[]{ 1L, 2L, 3L}, 4L));
  }

  @Test
  public void testToArray() {
    List<String> list = new ArrayList<>();
    list.add("a");
    Assert.assertEquals(new String[]{"a"}, ArrayUtils.toArray(Object.class, list));
  }
}

{'repo_name': 'dbeaver/dbeaver', 'stars': '14217', 'repo_language': 'Java', 'file_name': 'JDBCObjectLookupCache.java', 'mime_type': 'text/x-java', 'hash': -1194749349143737266, 'source_dataset': 'data'}


// Scintilla source code edit control
/** @file LexRebol.cxx
 ** Lexer for REBOL.
 ** Written by Pascal Hurni, inspired from LexLua by Paul Winwood & Marcos E. Wurzius & Philippe Lhoste
 **
 ** History:
 **		2005-04-07	First release.
 **		2005-04-10	Closing parens and brackets go now in default style
 **					String and comment nesting should be more safe
 **/
// Copyright 2005 by Pascal Hurni <pascal_hurni@fastmail.fm>
// The License.txt file describes the conditions under which this software may be distributed.

#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>

#include "Platform.h"

#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "StyleContext.h"

static inline bool IsAWordChar(const int ch) {
	return (isalnum(ch) || ch == '?' || ch == '!' || ch == '.' || ch == '\'' || ch == '+' || ch == '-' || ch == '*' || ch == '&' || ch == '|' || ch == '=' || ch == '_' || ch == '~');
}

static inline bool IsAWordStart(const int ch, const int ch2) {
	return ((ch == '+' || ch == '-' || ch == '.') && !isdigit(ch2)) ||
		(isalpha(ch) || ch == '?' || ch == '!' || ch == '\'' || ch == '*' || ch == '&' || ch == '|' || ch == '=' || ch == '_' || ch == '~');
}

static inline bool IsAnOperator(const int ch, const int ch2, const int ch3) {
	// One char operators
	if (IsASpaceOrTab(ch2)) {
		return ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '<' || ch == '>' || ch == '=' || ch == '?';
	}

	// Two char operators
	if (IsASpaceOrTab(ch3)) {
		return (ch == '*' && ch2 == '*') ||
			   (ch == '/' && ch2 == '/') ||
			   (ch == '<' && (ch2 == '=' || ch2 == '>')) ||
			   (ch == '>' && ch2 == '=') ||
			   (ch == '=' && (ch2 == '=' || ch2 == '?')) ||
			   (ch == '?' && ch2 == '?');
	}

	return false;
}

static inline bool IsBinaryStart(const int ch, const int ch2, const int ch3, const int ch4) {
	return (ch == '#' && ch2 == '{') ||
		   (IsADigit(ch) && ch2 == '#' && ch3 == '{' ) ||
		   (IsADigit(ch) && IsADigit(ch2) && ch3 == '#' && ch4 == '{' );
}

static void ColouriseRebolDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) {

	WordList &keywords = *keywordlists[0];
	WordList &keywords2 = *keywordlists[1];
	WordList &keywords3 = *keywordlists[2];
	WordList &keywords4 = *keywordlists[3];
	WordList &keywords5 = *keywordlists[4];
	WordList &keywords6 = *keywordlists[5];
	WordList &keywords7 = *keywordlists[6];
	WordList &keywords8 = *keywordlists[7];

	int currentLine = styler.GetLine(startPos);
	// Initialize the braced string {.. { ... } ..} nesting level, if we are inside such a string.
	int stringLevel = 0;
	if (initStyle == SCE_REBOL_BRACEDSTRING || initStyle == SCE_REBOL_COMMENTBLOCK) {
		stringLevel = styler.GetLineState(currentLine - 1);
	}

	bool blockComment = initStyle == SCE_REBOL_COMMENTBLOCK;
	int dotCount = 0;

	// Do not leak onto next line
	if (initStyle == SCE_REBOL_COMMENTLINE) {
		initStyle = SCE_REBOL_DEFAULT;
	}

	StyleContext sc(startPos, length, initStyle, styler);
	if (startPos == 0) {
		sc.SetState(SCE_REBOL_PREFACE);
	}
	for (; sc.More(); sc.Forward()) {

		//--- What to do at line end ?
		if (sc.atLineEnd) {
			// Can be either inside a {} string or simply at eol
			if (sc.state != SCE_REBOL_BRACEDSTRING && sc.state != SCE_REBOL_COMMENTBLOCK &&
				sc.state != SCE_REBOL_BINARY && sc.state != SCE_REBOL_PREFACE)
				sc.SetState(SCE_REBOL_DEFAULT);

			// Update the line state, so it can be seen by next line
			currentLine = styler.GetLine(sc.currentPos);
			switch (sc.state) {
			case SCE_REBOL_BRACEDSTRING:
			case SCE_REBOL_COMMENTBLOCK:
				// Inside a braced string, we set the line state
				styler.SetLineState(currentLine, stringLevel);
				break;
			default:
				// Reset the line state
				styler.SetLineState(currentLine, 0);
				break;
			}

			// continue with next char
			continue;
		}

		//--- What to do on white-space ?
		if (IsASpaceOrTab(sc.ch))
		{
			// Return to default if any of these states
			if (sc.state == SCE_REBOL_OPERATOR || sc.state == SCE_REBOL_CHARACTER ||
				sc.state == SCE_REBOL_NUMBER || sc.state == SCE_REBOL_PAIR ||
				sc.state == SCE_REBOL_TUPLE || sc.state == SCE_REBOL_FILE ||
				sc.state == SCE_REBOL_DATE || sc.state == SCE_REBOL_TIME ||
				sc.state == SCE_REBOL_MONEY || sc.state == SCE_REBOL_ISSUE ||
				sc.state == SCE_REBOL_URL || sc.state == SCE_REBOL_EMAIL) {
				sc.SetState(SCE_REBOL_DEFAULT);
			}
		}

		//--- Specialize state ?
		// URL, Email look like identifier
		if (sc.state == SCE_REBOL_IDENTIFIER)
		{
			if (sc.ch == ':' && !IsASpace(sc.chNext)) {
				sc.ChangeState(SCE_REBOL_URL);
			} else if (sc.ch == '@') {
				sc.ChangeState(SCE_REBOL_EMAIL);
			} else if (sc.ch == '$') {
				sc.ChangeState(SCE_REBOL_MONEY);
			}
		}
		// Words look like identifiers
		if (sc.state == SCE_REBOL_IDENTIFIER || (sc.state >= SCE_REBOL_WORD && sc.state <= SCE_REBOL_WORD8)) {
			// Keywords ?
			if (!IsAWordChar(sc.ch) || sc.Match('/')) {
				char s[100];
				sc.GetCurrentLowered(s, sizeof(s));
				blockComment = strcmp(s, "comment") == 0;
				if (keywords8.InList(s)) {
					sc.ChangeState(SCE_REBOL_WORD8);
				} else if (keywords7.InList(s)) {
					sc.ChangeState(SCE_REBOL_WORD7);
				} else if (keywords6.InList(s)) {
					sc.ChangeState(SCE_REBOL_WORD6);
				} else if (keywords5.InList(s)) {
					sc.ChangeState(SCE_REBOL_WORD5);
				} else if (keywords4.InList(s)) {
					sc.ChangeState(SCE_REBOL_WORD4);
				} else if (keywords3.InList(s)) {
					sc.ChangeState(SCE_REBOL_WORD3);
				} else if (keywords2.InList(s)) {
					sc.ChangeState(SCE_REBOL_WORD2);
				} else if (keywords.InList(s)) {
					sc.ChangeState(SCE_REBOL_WORD);
				}
				// Keep same style if there are refinements
				if (!sc.Match('/')) {
					sc.SetState(SCE_REBOL_DEFAULT);
				}
			}
		// special numbers
		} else if (sc.state == SCE_REBOL_NUMBER) {
			switch (sc.ch) {
			case 'x':	sc.ChangeState(SCE_REBOL_PAIR);
						break;
			case ':':	sc.ChangeState(SCE_REBOL_TIME);
						break;
			case '-':
			case '/':	sc.ChangeState(SCE_REBOL_DATE);
						break;
			case '.':	if (++dotCount >= 2) sc.ChangeState(SCE_REBOL_TUPLE);
						break;
			}
		}

		//--- Determine if the current state should terminate
		if (sc.state == SCE_REBOL_QUOTEDSTRING || sc.state == SCE_REBOL_CHARACTER) {
			if (sc.ch == '^' && sc.chNext == '\"') {
				sc.Forward();
			} else if (sc.ch == '\"') {
				sc.ForwardSetState(SCE_REBOL_DEFAULT);
			}
		} else if (sc.state == SCE_REBOL_BRACEDSTRING || sc.state == SCE_REBOL_COMMENTBLOCK) {
			if (sc.ch == '}') {
				if (--stringLevel == 0) {
					sc.ForwardSetState(SCE_REBOL_DEFAULT);
				}
			} else if (sc.ch == '{') {
				stringLevel++;
			}
		} else if (sc.state == SCE_REBOL_BINARY) {
			if (sc.ch == '}') {
				sc.ForwardSetState(SCE_REBOL_DEFAULT);
			}
		} else if (sc.state == SCE_REBOL_TAG) {
			if (sc.ch == '>') {
				sc.ForwardSetState(SCE_REBOL_DEFAULT);
			}
		} else if (sc.state == SCE_REBOL_PREFACE) {
			if (sc.MatchIgnoreCase("rebol"))
			{
				int i;
				for (i=5; IsASpaceOrTab(styler.SafeGetCharAt(sc.currentPos+i, 0)); i++);
				if (sc.GetRelative(i) == '[')
					sc.SetState(SCE_REBOL_DEFAULT);
			}
		}

		//--- Parens and bracket changes to default style when the current is a number
		if (sc.state == SCE_REBOL_NUMBER || sc.state == SCE_REBOL_PAIR || sc.state == SCE_REBOL_TUPLE ||
			sc.state == SCE_REBOL_MONEY || sc.state == SCE_REBOL_ISSUE || sc.state == SCE_REBOL_EMAIL ||
			sc.state == SCE_REBOL_URL || sc.state == SCE_REBOL_DATE || sc.state == SCE_REBOL_TIME) {
			if (sc.ch == '(' || sc.ch == '[' || sc.ch == ')' || sc.ch == ']') {
				sc.SetState(SCE_REBOL_DEFAULT);
			}
		}

		//--- Determine if a new state should be entered.
		if (sc.state == SCE_REBOL_DEFAULT) {
			if (IsAnOperator(sc.ch, sc.chNext, sc.GetRelative(2))) {
				sc.SetState(SCE_REBOL_OPERATOR);
			} else if (IsBinaryStart(sc.ch, sc.chNext, sc.GetRelative(2), sc.GetRelative(3))) {
				sc.SetState(SCE_REBOL_BINARY);
			} else if (IsAWordStart(sc.ch, sc.chNext)) {
				sc.SetState(SCE_REBOL_IDENTIFIER);
			} else if (IsADigit(sc.ch) || sc.ch == '+' || sc.ch == '-' || /*Decimal*/ sc.ch == '.' || sc.ch == ',') {
				dotCount = 0;
				sc.SetState(SCE_REBOL_NUMBER);
			} else if (sc.ch == '\"') {
				sc.SetState(SCE_REBOL_QUOTEDSTRING);
			} else if (sc.ch == '{') {
				sc.SetState(blockComment ? SCE_REBOL_COMMENTBLOCK : SCE_REBOL_BRACEDSTRING);
				++stringLevel;
			} else if (sc.ch == ';') {
				sc.SetState(SCE_REBOL_COMMENTLINE);
			} else if (sc.ch == '$') {
				sc.SetState(SCE_REBOL_MONEY);
			} else if (sc.ch == '%') {
				sc.SetState(SCE_REBOL_FILE);
			} else if (sc.ch == '<') {
				sc.SetState(SCE_REBOL_TAG);
			} else if (sc.ch == '#' && sc.chNext == '"') {
				sc.SetState(SCE_REBOL_CHARACTER);
				sc.Forward();
			} else if (sc.ch == '#' && sc.chNext != '"' && sc.chNext != '{' ) {
				sc.SetState(SCE_REBOL_ISSUE);
			}
		}
	}
	sc.Complete();
}

static void FoldRebolDoc(unsigned int startPos, int length, int /* initStyle */, WordList *[],
                            Accessor &styler) {
	unsigned int lengthDoc = startPos + length;
	int visibleChars = 0;
	int lineCurrent = styler.GetLine(startPos);
	int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
	int levelCurrent = levelPrev;
	char chNext = styler[startPos];
	int styleNext = styler.StyleAt(startPos);
	for (unsigned int i = startPos; i < lengthDoc; i++) {
		char ch = chNext;
		chNext = styler.SafeGetCharAt(i + 1);
		int style = styleNext;
		styleNext = styler.StyleAt(i + 1);
		bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
		if (style == SCE_REBOL_DEFAULT) {
			if (ch == '[') {
				levelCurrent++;
			} else if (ch == ']') {
				levelCurrent--;
			}
		}
		if (atEOL) {
			int lev = levelPrev;
			if (visibleChars == 0)
				lev |= SC_FOLDLEVELWHITEFLAG;
			if ((levelCurrent > levelPrev) && (visibleChars > 0))
				lev |= SC_FOLDLEVELHEADERFLAG;
			if (lev != styler.LevelAt(lineCurrent)) {
				styler.SetLevel(lineCurrent, lev);
			}
			lineCurrent++;
			levelPrev = levelCurrent;
			visibleChars = 0;
		}
		if (!isspacechar(ch))
			visibleChars++;
	}
	// Fill in the real level of the next line, keeping the current flags as they will be filled in later
	int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
	styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}

static const char * const rebolWordListDesc[] = {
	"Keywords",
	0
};

LexerModule lmREBOL(SCLEX_REBOL, ColouriseRebolDoc, "rebol", FoldRebolDoc, rebolWordListDesc);

{'repo_name': 'OGRECave/ogre-next', 'stars': '278', 'repo_language': 'C++', 'file_name': 'UniqueModel.MESH.material', 'mime_type': 'text/plain', 'hash': -7245107823909503913, 'source_dataset': 'data'}


# Predixy [中文版](https://github.com/joyieldInc/predixy/blob/master/README_CN.md)

**Predixy** is a high performance and fully featured proxy for redis sentinel and redis cluster

## Features

+ High performance and lightweight.
+ Multi-threads support.
+ Works on Linux, OSX, BSD, Windows([Cygwin](http://www.cygwin.com/)).
+ Supports Redis Sentinel, single/multi redis group[s].
+ Supports Redis Cluster.
+ Supports redis block command, eg:blpop, brpop, brpoplpush.
+ Supports scan command, even multi redis instances.
+ Multi-keys command support: mset/msetnx/mget/del/unlink/touch/exists.
+ Multi-databases support, means redis command select is avaliable.
+ Supports redis transaction, limit in Redis Sentinel single redis group.
+ Supports redis Scripts, script load, eval, evalsha.
+ Supports redis Pub/Sub.
+ Multi-DataCenters support, read from slaves.
+ Extend AUTH, readonly/readwrite/admin permission, keyspace limit.
+ Log level sample, async log record.
+ Log file auto rotate by time and/or file size.
+ Stats info, CPU/Memory/Requests/Responses and so on.
+ Latency monitor.

## Build

Predixy can be compiled and used on Linux, OSX, BSD, Windows([Cygwin](http://www.cygwin.com/)). Requires C++11 compiler.

It is as simple as:

    $ make

To build in debug mode:

    $ make debug

Some other build options:
+ CXX=c++compiler, default is g++, you can specify other, eg:CXX=clang++
+ EV=epoll|poll|kqueue, default it is auto detect according by platform.
+ MT=false, disable multi-threads support.
+ TS=true, enable predixy function call time stats, debug only for developer.

For examples:

    $ make CXX=clang++
    $ make EV=poll
    $ make MT=false
    $ make debug MT=false TS=true

## Install

Just copy src/predixy to the install path

    $ cp src/predixy /path/to/bin

## Configuration

See below files:
+ predixy.conf, basic config, will refrence below config files.
+ cluster.conf, Redis Cluster backend config.
+ sentinel.conf, Redis Sentinel backend config.
+ auth.conf, authority control config.
+ dc.conf, multi-datacenters config.
+ latency.conf, latency monitor config.

## Running

    $ src/predixy conf/predixy.conf

With default predixy.conf, Predixy will listen at 0.0.0.0:7617 and
proxy to Redis Cluster 127.0.0.1:6379.
In general, 127.0.0.1:6379 is not running in Redis Cluster mode.
So you will look mass log output, but you can still test it with redis-cli.

    $ redis-cli -p 7617 info

More command line arguments:

    $ src/predixy -h

## Stats

Like redis, predixy use INFO command to give stats.

Show predixy running info and latency monitors

    redis> INFO

Show latency monitors by latency name

    redis> INFO Latency <latency-name>

A latency monitor example:

    LatencyMonitorName:all
                latency(us)   sum(us)           counts
    <=          100              3769836            91339 91.34%
    <=          200               777185             5900 97.24%
    <=          300               287565             1181 98.42%
    <=          400               185891              537 98.96%
    <=          500               132773              299 99.26%
    <=          600                85050              156 99.41%
    <=          700                85455              133 99.54%
    <=          800                40088               54 99.60%
    <=         1000                67788               77 99.68%
    >          1000               601012              325 100.00%
    T            60              6032643           100001
    The last line is total summary, 60 is average latency(us)

Show latency monitors by server address and latency name

    redis> INFO ServerLatency <server-address> [latency-name]

Reset all stats and latency monitors, require admin permission.

    redis> CONFIG ResetStat

## Benchmark

predixy is fast, how fast? more than twemproxy, codis, redis-cerberus

See wiki
[benchmark](https://github.com/joyieldInc/predixy/wiki/Benchmark)

## License

Copyright (C) 2017 Joyield, Inc. <joyield.com#gmail.com>

All rights reserved.

License under BSD 3-clause "New" or "Revised" License

WeChat:cppfan ![wechat](https://github.com/joyieldInc/predixy/blob/master/doc/wechat-cppfan.jpeg)

{'repo_name': 'joyieldInc/predixy', 'stars': '680', 'repo_language': 'C++', 'file_name': 'benchmark_with_redis_CN.md', 'mime_type': 'text/plain', 'hash': 2427258264596053282, 'source_dataset': 'data'}


<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2018 The Android Open Source Project
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->
<androidx.constraintlayout.motion.widget.MotionLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    app:layoutDescription="@xml/scene_18">

    <include layout="@layout/motion_17_coordination_header" />
    <include layout="@layout/content_scrolling" />

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_add_a_photo_24dp"/>

</androidx.constraintlayout.motion.widget.MotionLayout>

{'repo_name': 'googlearchive/android-ConstraintLayoutExamples', 'stars': '2580', 'repo_language': 'Java', 'file_name': 'ExampleUnitTest.java', 'mime_type': 'text/html', 'hash': -4772168229855278717, 'source_dataset': 'data'}


<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema

    Version 2.0

    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.

    Example:

    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>

    There are any number of "resheader" rows that contain simple
    name/value pairs.

    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.

    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:

    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.

    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <data name="DoubleClick" xml:space="preserve">
    <value>Double clicking without an action</value>
  </data>
  <data name="EventCategory" xml:space="preserve">
    <value>Toolbox Events</value>
  </data>
  <data name="ToolBoxSearch" xml:space="preserve">
    <value>Tool Box Search</value>
  </data>
</root>

{'repo_name': 'Warewolf-ESB/Warewolf', 'stars': '227', 'repo_language': 'C#', 'file_name': 'testElasticsearchSource.xml', 'mime_type': 'text/plain', 'hash': -5750275549060309724, 'source_dataset': 'data'}


/*
 * Copyright (c) 2014-2016,2018 Red Hat.
 * Copyright (c) 1995-2001 Silicon Graphics, Inc.  All Rights Reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 */
#ifndef _LOGGER_H
#define _LOGGER_H

#include "pmapi.h"
#include "libpcp.h"
#include <assert.h>

/*
 * a task is a bundle of fetches to be done together - it
 * originally corresponded one-to-one with a configuration
 * file curly-brace-enclosed block, but no longer does.
 */
typedef struct task_s {
    struct task_s	*t_next;
    struct timeval	t_delta;
    int			t_state;	/* logging state */
    int			t_numpmid;
    int			t_numvalid;
    pmID		*t_pmidlist;
    char		**t_namelist;
    pmDesc		*t_desclist;
    fetchctl_t		*t_fetch;
    int			t_afid;
    int			t_alarm;	/* set when log_callback() called for this task */
    int			t_size;		/* pdu size for -r flag reporting */
    int			t_dm;		/* 1 if derived metrics included */
} task_t;

extern task_t		*tasklist;	/* master list of tasks */
extern __pmLogCtl	logctl;		/* global log control */
extern __pmArchCtl	archctl;	/* global archive control */
extern int log_alarm;			/* set when log_callback() called for any task */

typedef struct {
    char		*name;
    int			state;
    int			control;
    struct timeval	delta;
} dynroot_t;

extern dynroot_t	*dyn_roots;	/* dynamic root list - never free'd */
extern int		n_dyn_roots;	/* and length of ~ */

/* config file parser states */
#define GLOBAL  0
#define INSPEC  1

/* generic error messages */
extern char	*chk_emess[];
extern void die(char *, int);

/*
 * hash control for per-metric (really per-metric per-log specification)
 * -- used to establish and maintain state for ControlLog operations
 */
extern __pmHashCtl	pm_hash;

/* another hash list used for maintaining information about all metrics and
 * instances that have EVER appeared in the log as opposed to just those
 * currently being logged.  It's a history list.
 */
extern __pmHashCtl	hist_hash;

typedef struct {
    int	ih_inst;
    int	ih_flags;
} insthist_t;

typedef struct {
    pmID	ph_pmid;
    pmInDom	ph_indom;
    int		ph_numinst;
    insthist_t	*ph_instlist;
} pmidhist_t;

/* access control goo */
#define PM_OP_LOG_ADV	0x1
#define PM_OP_LOG_MAND	0x2
#define PM_OP_LOG_ENQ	0x4

#define PM_OP_NONE	0x0
#define PM_OP_ALL	0x7

#define PMLC_SET_MAYBE(val, flag) \
	val = ((val) & ~0x10) | (((flag) & 0x1) << 4)
#define PMLC_GET_MAYBE(val) \
	(((val) & 0x10) >> 4)

/* volume switch types */
#define VOL_SW_SIGHUP  0
#define VOL_SW_PMLC    1
#define VOL_SW_COUNTER 2
#define VOL_SW_BYTES   3
#define VOL_SW_TIME    4
#define VOL_SW_MAX     5

/* initial time of day from remote PMCD */
extern struct timeval	epoch;

/* offset to start of last written pmResult */
extern int	last_log_offset;

/* yylex() gets input from here ... */
extern FILE		*fconfig;
extern FILE		*yyin;
extern char		*configfile;
extern int		lineno;

extern int myFetch(int, pmID *, __pmPDU **);
extern void yyerror(char *);
extern void yywarn(char *);
extern void yylinemarker(char *);
extern int yylex(void);
extern int yyparse(void);
extern void yyend(void);
extern void buildinst(int *, int **, char ***, int, char *);
extern void freeinst(int *, int *, char **);
extern void linkback(task_t *);
extern optreq_t *findoptreq(pmID, int);
extern void log_callback(int, void *);
extern void do_work(task_t *);
extern int chk_one(task_t *, pmID, int);
extern int chk_all(task_t *, pmID);
extern int newvolume(int);
extern void validate_metrics(void);
extern void check_dynamic_metrics();
extern int do_control_req(pmResult *, int, int, int, int);

extern void disconnect(int);
extern int reconnect(void);
extern int do_prologue(void);
extern int do_epilogue(void);
extern void run_done(int,char *);
extern __pmPDU *rewrite_pdu(__pmPDU *, int);
extern int putmark(void);
extern void dumpit(void);

#include <sys/param.h>
extern char pmlc_host[];

#define LOG_DELTA_ONCE		-1
#define LOG_DELTA_DEFAULT	-2

/* command line parameters */
extern char	    	*archName;		/* real base name for log files */
extern char		*pmcd_host;		/* collecting from PMCD on this host */
extern char		*pmcd_host_conn;	/* ... and this is how we connected to it */
extern int		primary;		/* Non-zero for primary logger */
extern int		rflag;
extern struct timeval	delta;			/* default logging interval */
extern int		ctlport;		/* pmlogger control port number */
extern char		*note;			/* note for port map file */

/* pmlc support */
extern void init_ports(void);
extern int control_req(int ctlfd);
extern int client_req(void);
extern __pmHashCtl	hist_hash;
extern unsigned int	denyops;	/* for access control (ops not allowed) */
extern struct timeval	last_stamp;
extern int		clientfd;
#define CFD_INET	0
#define CFD_IPV6	1
#define CFD_UNIX	2
#define CFD_NUM		3
extern int		ctlfds[CFD_NUM];
extern int		exit_samples;
extern int		vol_switch_samples;
extern __int64_t	vol_switch_bytes;
extern int		vol_switch_flag; /* logvol switch: set on SIGHUP */
extern int		log_switch_flag; /* archive switch: set on SIGUSR2 */
extern int		pmlogger_reexec;
extern int		vol_samples_counter;
extern int		archive_version;
extern int		parse_done;
extern __int64_t	exit_bytes;
extern __int64_t	vol_bytes;
extern int		sig_code;

/* event record handling */
extern int do_events(pmValueSet *);

/* cleanup control fds and sockets etc prior to reexec or exit */
extern void cleanup(void);

/* QA testing and error injection support ... see do_request() */
extern int	qa_case;
#define QA_OFF		100
#define QA_SLEEPY	101

#endif /* _LOGGER_H */

{'repo_name': 'performancecopilot/pcp', 'stars': '658', 'repo_language': 'C', 'file_name': 'pmdastatsd_test_utils.py', 'mime_type': 'text/plain', 'hash': -9155529041440797137, 'source_dataset': 'data'}


export interface IPage {
  id: number;
  title: string;
  etag?: string | null;
  url: string;
  parentPageId?: number;
}

{'repo_name': 'pnp/sp-dev-fx-webparts', 'stars': '1081', 'repo_language': 'TypeScript', 'file_name': 'copy-assets.json', 'mime_type': 'text/plain', 'hash': -6741531104856065728, 'source_dataset': 'data'}


<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * Provides upload functionalities for the import plugins
 *
 * @package PhpMyAdmin
 */
if (! defined('PHPMYADMIN')) {
    exit;
}

/* Get the transformations interface */
require_once 'libraries/plugins/UploadInterface.int.php';

/**
 * Implementation for upload progress
 *
 * @package PhpMyAdmin
 */
class UploadProgress implements UploadInterface
{
    /**
     * Gets the specific upload ID Key
     *
     * @return string ID Key
     */
    public static function getIdKey()
    {
        return 'UPLOAD_IDENTIFIER';
    }

    /**
     * Returns upload status.
     *
     * This is implementation for upload progress
     *
     * @param string $id upload id
     *
     * @return array|null
     */
    public static function getUploadStatus($id)
    {
        global $SESSION_KEY;

        if (trim($id) == "") {
            return null;
        }

        if (! array_key_exists($id, $_SESSION[$SESSION_KEY])) {
            $_SESSION[$SESSION_KEY][$id] = array(
                'id'       => $id,
                'finished' => false,
                'percent'  => 0,
                'total'    => 0,
                'complete' => 0,
                'plugin'   => UploadProgress::getIdKey()
            );
        }
        $ret = $_SESSION[$SESSION_KEY][$id];

        if (! PMA_Import_progressCheck() || $ret['finished']) {
            return $ret;
        }

        $status = uploadprogress_get_info($id);

        if ($status) {
            if ($status['bytes_uploaded'] == $status['bytes_total']) {
                $ret['finished'] = true;
            } else {
                $ret['finished'] = false;
            }
            $ret['total']    = $status['bytes_total'];
            $ret['complete'] = $status['bytes_uploaded'];

            if ($ret['total'] > 0) {
                $ret['percent'] = $ret['complete'] / $ret['total'] * 100;
            }
        } else {
            $ret = array(
                'id'       => $id,
                'finished' => true,
                'percent'  => 100,
                'total'    => $ret['total'],
                'complete' => $ret['total'],
                'plugin'   => UploadProgress::getIdKey()
            );
        }

        $_SESSION[$SESSION_KEY][$id] = $ret;
        return $ret;
    }
}
?>

{'repo_name': 'EwingYangs/weixin-order', 'stars': '125', 'repo_language': 'PHP', 'file_name': 'index.php', 'mime_type': 'text/x-php', 'hash': 6914561383966895183, 'source_dataset': 'data'}


Sequel.migration do
  up {
    DB.add_column :tags, :is_nsfw, :boolean, default: false, index: true
  }

  down {
    DB.drop_column :tags, :is_nsfw
  }
end

{'repo_name': 'neocities/neocities', 'stars': '665', 'repo_language': 'HTML', 'file_name': 'stats.erb', 'mime_type': 'text/html', 'hash': -3543625934424143436, 'source_dataset': 'data'}


# == Class <%= metadata.name %>::params
#
# This class is meant to be called from <%= metadata.name %>.
# It sets variables according to platform.
#
class <%= metadata.name %>::params {
  case $::osfamily {
    'Debian': {
      $package_name = '<%= metadata.name %>'
      $service_name = '<%= metadata.name %>'
    }
    'RedHat', 'Amazon': {
      $package_name = '<%= metadata.name %>'
      $service_name = '<%= metadata.name %>'
    }
    default: {
      fail("${::operatingsystem} not supported")
    }
  }
}

{'repo_name': 'garethr/puppet-module-skeleton', 'stars': '329', 'repo_language': 'HTML', 'file_name': 'init.pp.erb', 'mime_type': 'text/plain', 'hash': -6746120596307213590, 'source_dataset': 'data'}


"******************************************************************************
"  c.vim
"------------------------------------------------------------------------------
"
"  Language:      C
"  Maintainer:    Chris Ahlstrom <ahlstromcj@users.sourceforge.net>
"  Last Change:   2006-08-04 to 2019-02-03
"  Project:       XPC Suite library project
"  License:       None.  Use it in any manner whatsover, and don't blame me.
"  Usage:
"
"     This file is a Vim syntax add-on file for c.vim (and cpp.vim) as
"     installed when vim is installed.
"
"     Do a ":set runtimepath" command in vim to see what it has in it.  The
"     first entry is usually "~/.vim", so create that directory, then add an
"     "after" and "syntax" directory, so that you end up with this directory:
"
"              ~/.vim/after/syntax
"
"     Then copy the present file (c.vim) to
"
"              ~/.vim/after/syntax/c.vim
"
"     Verify that your code now highlights the following symbols.
"
"     Not necessary if the above instructions are followed:
"
"              :runtime ~/.vim/after/syntax/syncolor.vim
"
"  Tip:
"
"     If you want to quickly validate your Doxygen comments, run the following
"     command to highlight them using doxygen.vim in
"     /usr/share/vim/vimfiles/syntax:
"
"              :set syntax=doxygen
"
"  syn keyword XPCC
"
"------------------------------------------------------------------------------

syn keyword XPCC errno errprintfunc infoprintfunc warnprintfunc
syn keyword XPCC strerrprintfunc strerrorprintfunc strerrnoprintfunc

syn keyword XPCC atomic_int_t bool_string bool_to_code debugprint_func
syn keyword XPCC EXTERN_C_DEC EXTERN_C_END find_data_t
syn keyword XPCC find_function_t find_type_t ftw_function_t
syn keyword XPCC is_invalid_handle is_invalid_thread
syn keyword XPCC is_NULL is_nullptr is_nullptr_2 is_nullptr_3 is_nullptr_4
syn keyword XPCC is_nullfunc
syn keyword XPCC is_posix_error is_posix_success is_socket_error is_thisptr
syn keyword XPCC is_valid_handle is_valid_socket is_valid_thread not_thisptr
syn keyword XPCC not_nullptr not_nullptr_2 not_nullptr_3 not_nullptr_4
syn keyword XPCC not_NULL not_nullfunc not_posix_error not_posix_success
syn keyword XPCC not_null_result
syn keyword XPCC not_socket_error not_valid_socket
syn keyword XPCC perf_bits_enum_t perf_cpu_speed_t perf_function_t perf_hyper_t
syn keyword XPCC perf_lock_enum_t perf_os_enum_t perf_processor_t perf_task_enum_t
syn keyword XPCC perf_test_row_t
syn keyword XPCC POSIX_ERROR POSIX_FAILURE POSIX_SUCCESS
syn keyword XPCC xpc xpc_addrinfo_t xpc_always_inline xpc_hidden
syn keyword XPCC xpc_app_arguments_t xpc_closesocket
syn keyword XPCC xpc_cond_mutex xpc_cond_struct xpc_cond_t xpc_critex_struct
syn keyword XPCC xpc_critex_t xpc_error_level_t xpc_filename_change_t
syn keyword XPCC xpc_errprint_func
syn keyword XPCC XPC_PACKAGE XPC_VERSION XPC_API_VERSION
syn keyword XPCC xpc_filename_split_t xpc_filename_t xpc_filename_type_t
syn keyword XPCC XPC_INLINE_CODE
syn keyword XPCC XPC_INT_CAST xpc_invalid_handle XPC_INVALID_HANDLE
syn keyword XPCC XPC_INVALID_SOCKET XPC_INVALID_THREAD XPC_LOCALHOST
syn keyword XPCC XPC_LOCALHOST_NAME xpc_lseek_offset_t xpc_mutex_struct
syn keyword XPCC xpc_mutex_t xpc_pointer_t xpc_recast
syn keyword XPCC xpc_return XPC_REVISION XPC_REVISION_DECL
syn keyword XPCC xpc_ringbuffer_t xpc_seedings_t xpc_semaphore_struct
syn keyword XPCC xpc_semaphore_t xpc_server_socket_T XPC_SHOWINFO
syn keyword XPCC xpc_string_t
syn keyword XPCC xpc_sockaddr_list_t xpc_sockaddr_storage_t xpc_sock_cs_codes_t
syn keyword XPCC XPC_SOCK_DEF_FRAGSIZE XPC_SOCK_DEF_NODELAY XPC_SOCK_DEF_RETRY
syn keyword XPCC xpc_sock_endpoint_t xpc_sock_error_t XPC_SOCKET_ERRNO
syn keyword XPCC XPC_SOCKET_ERROR xpc_socket_t xpc_sockbase_t xpc_sock_flag_t
syn keyword XPCC xpc_sock_mode_t xpc_sock_parameters_t xpc_sock_pending_t
syn keyword XPCC xpc_sock_port_t xpc_sock_state_t xpc_sock_status_t
syn keyword XPCC XPC_SOCK_TIMEOUT_ERROR XPC_SOCK_TIMEOUT_INF XPC_SOCK_TIMEOUT_NONE
syn keyword XPCC xpc_sock_timeout_t xpc_sock_tos_t xpc_statcast
syn keyword XPCC xpc_test_arguments_t xpc_test_function_t xpc_test_row_t
syn keyword XPCC xpc_timeout_t xpc_inline xpc_unused
syn keyword XPCC XPC_VERSION XPC_VERSION_TAG XPC_LIB_VERSION
syn keyword XPCC xpc_widetime_t
syn keyword XPCC xpc_xdr_discrim_t xpc_xdr_enum_t xpc_xdrf_destroy_t
syn keyword XPCC xpc_xdrf_func_t xpc_xdrf_getbyte_t xpc_xdrf_getint32_t
syn keyword XPCC xpc_xdrf_getlong_t xpc_xdrf_getpost_t xpc_xdrf_inline_t
syn keyword XPCC xpc_xdrf_putbyte_t xpc_xdrf_putint32_t xpc_xdrf_putlong_t
syn keyword XPCC xpc_xdrf_setpost_t xpc_xdrf_sock_t xpc_xdr_mem_alloc
syn keyword XPCC xpc_xdr_mem_free xpc_xdr_netobj_t xpc_xdr_ops_t
syn keyword XPCC xpc_xdr_op_t xpc_xdr_t set_invalid_socket
syn keyword XPCC xpc_strerrnoprint_func xpc_strerrprint_func
syn keyword XPCC xpc_infoprint_func xpc_warnprint_func
syn keyword XPCC safe_array_delete safe_ptr_delete safe_pointer_delete thisptr
syn keyword XPCC set_nullptr set_posix_error set_posix_success
syn keyword XPCC bussbyte colorbyte ctrlkey ctrlop
syn keyword XPCC midibool midibooleans midibyte midibyte_t midilong
syn keyword XPCC midipulse midishort midibpm

"------------------------------------------------------------------------------
" More keywords from POSIX itself.  Includes less common C data typedefs and
" GNU keywords.
"------------------------------------------------------------------------------

syn keyword cType __int64
syn keyword cType caddr_t u_char u_short u_int u_long quad_t u_quad_t
syn keyword cType off_t pid_t uid_t socklen_t wchar_t
syn keyword cType pollfd timeval timespec

"------------------------------------------------------------------------------
" Keywords from GNU
"------------------------------------------------------------------------------

syn keyword cType __inline__ __attribute__

"------------------------------------------------------------------------------
" Keywords from POSIX.
"------------------------------------------------------------------------------

syn keyword cType pthread_cond_t pthread_mutex_t sem_t addrinfo sockaddr_in
syn keyword cType sockaddr_in6 sockaddr sockaddr_un sockaddr_nl
syn keyword cType sockaddr_storeage SOCKET in_port_t in_addr_t stat

"------------------------------------------------------------------------------
" Keywords from Windows.
"------------------------------------------------------------------------------

syn keyword cType CRITICAL_SECTION
syn keyword cType HANDLE SOCKET _finddata_t _stat

"------------------------------------------------------------------------------
" Change the Todo coloring to something less obtrusive than black-on-yellow.
"------------------------------------------------------------------------------

highlight todo term=standout cterm=NONE ctermfg=DarkGreen ctermbg=NONE gui=NONE guifg=DarkGreen guibg=Yellow

"------------------------------------------------------------------------------
"  Doxygen tags.
"------------------------------------------------------------------------------
"
"  'sideeffect', 'usage', and many others are ALIASES in doc/doxygen.cfg.
"  The rest are provided by Doxygen or by convention.  They appear only in
"  comments, and so we can use the existing cTodo highlight group.
"
"------------------------------------------------------------------------------

syn keyword cTodo contained FIXME WARNING WTF XXX TBD unknown HUH __func__
syn keyword cTodo contained abc abstract accessor algorithm application
syn keyword cTodo contained assumptions author
syn keyword cTodo contained background bit32 bit64 brief bug
syn keyword cTodo contained callback callgraph case change code class
syn keyword cTodo contained configuration convention
syn keyword cTodo contained contents
syn keyword cTodo contained crossplatform cutnpaste cygwin
syn keyword cTodo contained date debug default deprecated designdoc
syn keyword cTodo contained doxygen dummy endcode
syn keyword cTodo contained endverbatim enum example exception
syn keyword cTodo contained file followup freebsd friend friendof goals
syn keyword cTodo contained gcc getter group gnu hardwired history idea inline
syn keyword cTodo contained image install interface internal
syn keyword cTodo contained library license linux
syn keyword cTodo contained macosx macro mainpage namespace note obsolete
syn keyword cTodo contained op overload page par param posix
syn keyword cTodo contained private protected xpc xpcc XPCC public
syn keyword cTodo contained question recursive return ref references
syn keyword cTodo contained relates relatesalso security
syn keyword cTodo contained section seealso setter sideeffect
syn keyword cTodo contained solaris steps struct subpage subsection
syn keyword cTodo contained subsubsection summary template
syn keyword cTodo contained test tests threadsafe threadunsafe throw todo
syn keyword cTodo contained tip tricky typedef undocumented usecase
syn keyword cTodo contained unittests unix updates usage
syn keyword cTodo contained validator var verbatim version
syn keyword cTodo contained warning win32 win64
syn keyword cTodo contained utility xoperator
syn keyword cTodo contained Revision Chris Ahlstrom

"------------------------------------------------------------------------------
" Our boolean definitions
"------------------------------------------------------------------------------

syn keyword cType cbool_t ubool_t

"------------------------------------------------------------------------------
" Our slough of macros, including a pre C++-TR-1 definition for 'nullptr' used
" in both C and C++, and some underscore macros related to GNU gettext()
" support.
"------------------------------------------------------------------------------

syn keyword cConstant nullptr NULLptr
syn keyword cDefine _ N_ M_

"------------------------------------------------------------------------------
" Additional POSIX/BSD error codes not provided by vim
"------------------------------------------------------------------------------

syn keyword cConstant EHOSTUNREACH ENETUNREACH EADDRNOTAVAIL ECONNREFUSED
syn keyword cConstant ECONNRESET ENOTSOCK ENOTCONN ENOBUFS

"------------------------------------------------------------------------------
" WinSock 2 error codes
"------------------------------------------------------------------------------

syn keyword cConstant WSAENETDOWN WSAEINPROGRESS WSAEADDRNOTAVAIL
syn keyword cConstant WSAECONNREFUSED WSAENETUNREACH

"------------------------------------------------------------------------------
" XPCC socket error codes
"------------------------------------------------------------------------------

syn keyword cDefine XPC_SOCK_ERR_SUCCESS XPC_SOCK_ERR_CREATEFAILED
syn keyword cDefine XPC_SOCK_ERR_COPYFAILED XPC_SOCK_ERR_INPUT
syn keyword cDefine XPC_SOCK_ERR_INPUTINTERRUPT XPC_SOCK_ERR_RESOURCEFAILURE
syn keyword cDefine XPC_SOCK_ERR_OUTPUT XPC_SOCK_ERR_OUTPUTINTERRUPT
syn keyword cDefine XPC_SOCK_ERR_NOTCONNECTED XPC_SOCK_ERR_CONNECTREFUSED
syn keyword cDefine XPC_SOCK_ERR_CONNECTREJECTED
syn keyword cDefine XPC_SOCK_ERR_CONNECTRESETBYPEER
syn keyword cDefine XPC_SOCK_ERR_CONNECTTIMEOUT XPC_SOCK_ERR_CONNECTFAILED
syn keyword cDefine XPC_SOCK_ERR_CONNECTINVALID XPC_SOCK_ERR_CONNECTBUSY
syn keyword cDefine XPC_SOCK_ERR_CONNECTNOROUTE XPC_SOCK_ERR_BINDINGFAILED
syn keyword cDefine XPC_SOCK_ERR_LISTENFAILED XPC_SOCK_ERR_BROADCASTDENIED
syn keyword cDefine XPC_SOCK_ERR_ROUTINGDENIED XPC_SOCK_ERR_KEEPALIVEDENIED
syn keyword cDefine XPC_SOCK_ERR_SERVICEDENIED XPC_SOCK_ERR_SERVICEUNAVAILABLE
syn keyword cDefine XPC_SOCK_ERR_MULTICASTDISABLED XPC_SOCK_ERR_TIMEOUT
syn keyword cDefine XPC_SOCK_ERR_NODELAY XPC_SOCK_ERR_BADDESCRIPTOR
syn keyword cDefine XPC_SOCK_ERR_NOTASOCKET XPC_SOCK_ERR_INVALIDADDRESS
syn keyword cDefine XPC_SOCK_ERR_BLOCKINGMODE XPC_SOCK_ERR_WOULDBLOCK
syn keyword cDefine XPC_SOCK_ERR_OTHER XPC_SOCK_ERR_GENERIC
syn keyword cDefine XPC_SOCK_ERR_OS XPC_SOCK_ERR_EXTENDED

"------------------------------------------------------------------------------
" c.vim
"------------------------------------------------------------------------------
" vim: ts=3 sw=3 et ft=vim
"------------------------------------------------------------------------------

{'repo_name': 'ahlstromcj/sequencer64', 'stars': '177', 'repo_language': 'C++', 'file_name': 'erroneous.rc', 'mime_type': 'text/plain', 'hash': -3743094443830022366, 'source_dataset': 'data'}


/* Copyright 2010-2015 MongoDB Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace MongoDB.Bson.Serialization.Serializers
{
    /// <summary>
    /// Represents a serializer for BsonInt64s.
    /// </summary>
    public class BsonInt64Serializer : BsonValueSerializerBase<BsonInt64>
    {
        // private static fields
        private static BsonInt64Serializer __instance = new BsonInt64Serializer();

        // constructors
        /// <summary>
        /// Initializes a new instance of the BsonInt64Serializer class.
        /// </summary>
        public BsonInt64Serializer()
            : base(BsonType.Int64)
        {
        }

        // public static properties
        /// <summary>
        /// Gets an instance of the BsonInt64Serializer class.
        /// </summary>
        public static BsonInt64Serializer Instance
        {
            get { return __instance; }
        }

        // protected methods
        /// <summary>
        /// Deserializes a value.
        /// </summary>
        /// <param name="context">The deserialization context.</param>
        /// <param name="args">The deserialization args.</param>
        /// <returns>A deserialized value.</returns>
        protected override BsonInt64 DeserializeValue(BsonDeserializationContext context, BsonDeserializationArgs args)
        {
            var bsonReader = context.Reader;
            return (BsonInt64)bsonReader.ReadInt64();
        }

        /// <summary>
        /// Serializes a value.
        /// </summary>
        /// <param name="context">The serialization context.</param>
        /// <param name="args">The serialization args.</param>
        /// <param name="value">The object.</param>
        protected override void SerializeValue(BsonSerializationContext context, BsonSerializationArgs args, BsonInt64 value)
        {
            var bsonWriter = context.Writer;
            bsonWriter.WriteInt64(value.Value);
        }
    }
}

{'repo_name': 'Viagi/LandlordsCore', 'stars': '228', 'repo_language': 'C#', 'file_name': '网络组件学习笔记.MD', 'mime_type': 'text/plain', 'hash': -6663990669845768370, 'source_dataset': 'data'}


// Formatting library for C++ - std::locale support
//
// Copyright (c) 2012 - present, Victor Zverovich
// All rights reserved.
//
// For the license information refer to format.h.

#ifndef FMT_LOCALE_H_
#define FMT_LOCALE_H_

#include <locale>
#include "format.h"

FMT_BEGIN_NAMESPACE

namespace internal {
template <typename Char>
typename buffer_context<Char>::type::iterator vformat_to(
    const std::locale& loc, basic_buffer<Char>& buf,
    basic_string_view<Char> format_str,
    basic_format_args<typename buffer_context<Char>::type> args) {
  typedef back_insert_range<basic_buffer<Char>> range;
  return vformat_to<arg_formatter<range>>(buf, to_string_view(format_str), args,
                                          internal::locale_ref(loc));
}

template <typename Char>
std::basic_string<Char> vformat(
    const std::locale& loc, basic_string_view<Char> format_str,
    basic_format_args<typename buffer_context<Char>::type> args) {
  basic_memory_buffer<Char> buffer;
  internal::vformat_to(loc, buffer, format_str, args);
  return fmt::to_string(buffer);
}
}  // namespace internal

template <typename S, typename Char = FMT_CHAR(S)>
inline std::basic_string<Char> vformat(
    const std::locale& loc, const S& format_str,
    basic_format_args<typename buffer_context<Char>::type> args) {
  return internal::vformat(loc, to_string_view(format_str), args);
}

template <typename S, typename... Args>
inline std::basic_string<FMT_CHAR(S)> format(const std::locale& loc,
                                             const S& format_str,
                                             const Args&... args) {
  return internal::vformat(
      loc, to_string_view(format_str),
      *internal::checked_args<S, Args...>(format_str, args...));
}

template <typename String, typename OutputIt, typename... Args>
inline typename std::enable_if<internal::is_output_iterator<OutputIt>::value,
                               OutputIt>::type
vformat_to(OutputIt out, const std::locale& loc, const String& format_str,
           typename format_args_t<OutputIt, FMT_CHAR(String)>::type args) {
  typedef output_range<OutputIt, FMT_CHAR(String)> range;
  return vformat_to<arg_formatter<range>>(
      range(out), to_string_view(format_str), args, internal::locale_ref(loc));
}

template <typename OutputIt, typename S, typename... Args>
inline
    typename std::enable_if<internal::is_string<S>::value &&
                                internal::is_output_iterator<OutputIt>::value,
                            OutputIt>::type
    format_to(OutputIt out, const std::locale& loc, const S& format_str,
              const Args&... args) {
  internal::check_format_string<Args...>(format_str);
  typedef typename format_context_t<OutputIt, FMT_CHAR(S)>::type context;
  format_arg_store<context, Args...> as{args...};
  return vformat_to(out, loc, to_string_view(format_str),
                    basic_format_args<context>(as));
}

FMT_END_NAMESPACE

#endif  // FMT_LOCALE_H_

{'repo_name': 'Kronuz/Xapiand', 'stars': '336', 'repo_language': 'C++', 'file_name': 'AC_HEADER_STDC.cmake', 'mime_type': 'text/plain', 'hash': -7436603675161836377, 'source_dataset': 'data'}


/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/* $Id$ */

package org.apache.fop.afp;

import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

/**
 * Test case for {@link AFPPaintingState}.
 */
public class AFPPaintingStateTestCase {
    private AFPPaintingState sut;

    /**
     * Set up the system under test
     */
    @Before
    public void setUp() {
        sut = new AFPPaintingState();
    }

    /**
     * Test {get,set}BitmapEncodingQuality()
     */
    @Test
    public void testGetSetBitmapEncodingQuality() {
        sut.setBitmapEncodingQuality(0.5f);
        assertEquals(0.5f, sut.getBitmapEncodingQuality(), 0.01f);

        sut.setBitmapEncodingQuality(0.9f);
        assertEquals(0.9f, sut.getBitmapEncodingQuality(), 0.01f);
    }

    /**
     * Test {,set}CanEmbedJpeg
     */
    public void testGetSetCanEmbedJpeg() {
        assertEquals(false, sut.canEmbedJpeg());
        sut.setCanEmbedJpeg(true);
        assertEquals(true, sut.canEmbedJpeg());
    }
}

{'repo_name': 'apache/xmlgraphics-fop', 'stars': '111', 'repo_language': 'Java', 'file_name': 'AdvancedMessageFormat.java', 'mime_type': 'text/x-java', 'hash': -3505136946589030796, 'source_dataset': 'data'}


node --inspect --inspect-brk node_modules/.bin/mochapack "src/**/*.test.*"

node --inspect --inspect-brk node_modules/.bin/mochapack --watch "src/**/*.test.*"

{'repo_name': 'sysgears/mochapack', 'stars': '137', 'repo_language': 'TypeScript', 'file_name': 'entry.ts', 'mime_type': 'text/plain', 'hash': -1715805649704447910, 'source_dataset': 'data'}


/* Copyright (c) 2007-2008 CSIRO
   Copyright (c) 2007-2009 Xiph.Org Foundation
   Copyright (c) 2007-2016 Jean-Marc Valin */
/*
   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.

   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.
*/

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <xmmintrin.h>
#include <emmintrin.h>
#include "celt_lpc.h"
#include "stack_alloc.h"
#include "mathops.h"
#include "vq.h"
#include "x86cpu.h"

#ifndef FIXED_POINT

opus_val16 op_pvq_search_sse2(celt_norm *_X, int *iy, int K, int N, int arch)
{
   int i, j;
   int pulsesLeft;
   float xy, yy;
   VARDECL(celt_norm, y);
   VARDECL(celt_norm, X);
   VARDECL(float, signy);
   __m128 signmask;
   __m128 sums;
   __m128i fours;
   SAVE_STACK;

   (void)arch;
   /* All bits set to zero, except for the sign bit. */
   signmask = _mm_set_ps1(-0.f);
   fours = _mm_set_epi32(4, 4, 4, 4);
   ALLOC(y, N+3, celt_norm);
   ALLOC(X, N+3, celt_norm);
   ALLOC(signy, N+3, float);

   OPUS_COPY(X, _X, N);
   X[N] = X[N+1] = X[N+2] = 0;
   sums = _mm_setzero_ps();
   for (j=0;j<N;j+=4)
   {
      __m128 x4, s4;
      x4 = _mm_loadu_ps(&X[j]);
      s4 = _mm_cmplt_ps(x4, _mm_setzero_ps());
      /* Get rid of the sign */
      x4 = _mm_andnot_ps(signmask, x4);
      sums = _mm_add_ps(sums, x4);
      /* Clear y and iy in case we don't do the projection. */
      _mm_storeu_ps(&y[j], _mm_setzero_ps());
      _mm_storeu_si128((__m128i*)&iy[j], _mm_setzero_si128());
      _mm_storeu_ps(&X[j], x4);
      _mm_storeu_ps(&signy[j], s4);
   }
   sums = _mm_add_ps(sums, _mm_shuffle_ps(sums, sums, _MM_SHUFFLE(1, 0, 3, 2)));
   sums = _mm_add_ps(sums, _mm_shuffle_ps(sums, sums, _MM_SHUFFLE(2, 3, 0, 1)));

   xy = yy = 0;

   pulsesLeft = K;

   /* Do a pre-search by projecting on the pyramid */
   if (K > (N>>1))
   {
      __m128i pulses_sum;
      __m128 yy4, xy4;
      __m128 rcp4;
      opus_val32 sum = _mm_cvtss_f32(sums);
      /* If X is too small, just replace it with a pulse at 0 */
      /* Prevents infinities and NaNs from causing too many pulses
         to be allocated. 64 is an approximation of infinity here. */
      if (!(sum > EPSILON && sum < 64))
      {
         X[0] = QCONST16(1.f,14);
         j=1; do
            X[j]=0;
         while (++j<N);
         sums = _mm_set_ps1(1.f);
      }
      /* Using K+e with e < 1 guarantees we cannot get more than K pulses. */
      rcp4 = _mm_mul_ps(_mm_set_ps1((float)(K+.8)), _mm_rcp_ps(sums));
      xy4 = yy4 = _mm_setzero_ps();
      pulses_sum = _mm_setzero_si128();
      for (j=0;j<N;j+=4)
      {
         __m128 rx4, x4, y4;
         __m128i iy4;
         x4 = _mm_loadu_ps(&X[j]);
         rx4 = _mm_mul_ps(x4, rcp4);
         iy4 = _mm_cvttps_epi32(rx4);
         pulses_sum = _mm_add_epi32(pulses_sum, iy4);
         _mm_storeu_si128((__m128i*)&iy[j], iy4);
         y4 = _mm_cvtepi32_ps(iy4);
         xy4 = _mm_add_ps(xy4, _mm_mul_ps(x4, y4));
         yy4 = _mm_add_ps(yy4, _mm_mul_ps(y4, y4));
         /* double the y[] vector so we don't have to do it in the search loop. */
         _mm_storeu_ps(&y[j], _mm_add_ps(y4, y4));
      }
      pulses_sum = _mm_add_epi32(pulses_sum, _mm_shuffle_epi32(pulses_sum, _MM_SHUFFLE(1, 0, 3, 2)));
      pulses_sum = _mm_add_epi32(pulses_sum, _mm_shuffle_epi32(pulses_sum, _MM_SHUFFLE(2, 3, 0, 1)));
      pulsesLeft -= _mm_cvtsi128_si32(pulses_sum);
      xy4 = _mm_add_ps(xy4, _mm_shuffle_ps(xy4, xy4, _MM_SHUFFLE(1, 0, 3, 2)));
      xy4 = _mm_add_ps(xy4, _mm_shuffle_ps(xy4, xy4, _MM_SHUFFLE(2, 3, 0, 1)));
      xy = _mm_cvtss_f32(xy4);
      yy4 = _mm_add_ps(yy4, _mm_shuffle_ps(yy4, yy4, _MM_SHUFFLE(1, 0, 3, 2)));
      yy4 = _mm_add_ps(yy4, _mm_shuffle_ps(yy4, yy4, _MM_SHUFFLE(2, 3, 0, 1)));
      yy = _mm_cvtss_f32(yy4);
   }
   X[N] = X[N+1] = X[N+2] = -100;
   y[N] = y[N+1] = y[N+2] = 100;
   celt_assert2(pulsesLeft>=0, "Allocated too many pulses in the quick pass");

   /* This should never happen, but just in case it does (e.g. on silence)
      we fill the first bin with pulses. */
   if (pulsesLeft > N+3)
   {
      opus_val16 tmp = (opus_val16)pulsesLeft;
      yy = MAC16_16(yy, tmp, tmp);
      yy = MAC16_16(yy, tmp, y[0]);
      iy[0] += pulsesLeft;
      pulsesLeft=0;
   }

   for (i=0;i<pulsesLeft;i++)
   {
      int best_id;
      __m128 xy4, yy4;
      __m128 max, max2;
      __m128i count;
      __m128i pos;
      /* The squared magnitude term gets added anyway, so we might as well
         add it outside the loop */
      yy = ADD16(yy, 1);
      xy4 = _mm_load1_ps(&xy);
      yy4 = _mm_load1_ps(&yy);
      max = _mm_setzero_ps();
      pos = _mm_setzero_si128();
      count = _mm_set_epi32(3, 2, 1, 0);
      for (j=0;j<N;j+=4)
      {
         __m128 x4, y4, r4;
         x4 = _mm_loadu_ps(&X[j]);
         y4 = _mm_loadu_ps(&y[j]);
         x4 = _mm_add_ps(x4, xy4);
         y4 = _mm_add_ps(y4, yy4);
         y4 = _mm_rsqrt_ps(y4);
         r4 = _mm_mul_ps(x4, y4);
         /* Update the index of the max. */
         pos = _mm_max_epi16(pos, _mm_and_si128(count, _mm_castps_si128(_mm_cmpgt_ps(r4, max))));
         /* Update the max. */
         max = _mm_max_ps(max, r4);
         /* Update the indices (+4) */
         count = _mm_add_epi32(count, fours);
      }
      /* Horizontal max */
      max2 = _mm_max_ps(max, _mm_shuffle_ps(max, max, _MM_SHUFFLE(1, 0, 3, 2)));
      max2 = _mm_max_ps(max2, _mm_shuffle_ps(max2, max2, _MM_SHUFFLE(2, 3, 0, 1)));
      /* Now that max2 contains the max at all positions, look at which value(s) of the
         partial max is equal to the global max. */
      pos = _mm_and_si128(pos, _mm_castps_si128(_mm_cmpeq_ps(max, max2)));
      pos = _mm_max_epi16(pos, _mm_unpackhi_epi64(pos, pos));
      pos = _mm_max_epi16(pos, _mm_shufflelo_epi16(pos, _MM_SHUFFLE(1, 0, 3, 2)));
      best_id = _mm_cvtsi128_si32(pos);

      /* Updating the sums of the new pulse(s) */
      xy = ADD32(xy, EXTEND32(X[best_id]));
      /* We're multiplying y[j] by two so we don't have to do it here */
      yy = ADD16(yy, y[best_id]);

      /* Only now that we've made the final choice, update y/iy */
      /* Multiplying y[j] by 2 so we don't have to do it everywhere else */
      y[best_id] += 2;
      iy[best_id]++;
   }

   /* Put the original sign back */
   for (j=0;j<N;j+=4)
   {
      __m128i y4;
      __m128i s4;
      y4 = _mm_loadu_si128((__m128i*)&iy[j]);
      s4 = _mm_castps_si128(_mm_loadu_ps(&signy[j]));
      y4 = _mm_xor_si128(_mm_add_epi32(y4, s4), s4);
      _mm_storeu_si128((__m128i*)&iy[j], y4);
   }
   RESTORE_STACK;
   return yy;
}

#endif

{'repo_name': 'Samsung/TizenRT', 'stars': '345', 'repo_language': 'C', 'file_name': 'Kconfig', 'mime_type': 'text/plain', 'hash': 6469597712645526596, 'source_dataset': 'data'}