//
// usbendpoint.c
//
// USPi - An USB driver for Raspberry Pi written in C
// Copyright (C) 2014  R. Stange <rsta2@o2online.de>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
//
#include <uspi/usbendpoint.h>
#include <uspi/assert.h>

void USBEndpoint (TUSBEndpoint *pThis, TUSBDevice *pDevice)
{
	assert (pThis != 0);
	pThis->m_pDevice = pDevice;
	pThis->m_ucNumber = 0;
	pThis->m_Type = EndpointTypeControl;
	pThis->m_bDirectionIn = FALSE;
	pThis->m_nMaxPacketSize = USB_DEFAULT_MAX_PACKET_SIZE;
	pThis->m_nInterval = 1;
	pThis->m_NextPID = USBPIDSetup;

	assert (pThis->m_pDevice != 0);
}

void USBEndpoint2 (TUSBEndpoint *pThis, TUSBDevice *pDevice, const TUSBEndpointDescriptor *pDesc)
{
	assert (pThis != 0);
	pThis->m_pDevice = pDevice;
	pThis->m_nInterval = 1;

	assert (pThis->m_pDevice != 0);

	assert (pDesc != 0);
	assert (pDesc->bLength == sizeof *pDesc || pDesc->bLength == sizeof (TUSBAudioEndpointDescriptor));
	assert (pDesc->bDescriptorType == DESCRIPTOR_ENDPOINT);

	switch (pDesc->bmAttributes & 0x03)
	{
	case 2:
		pThis->m_Type = EndpointTypeBulk;
		pThis->m_NextPID = USBPIDData0;
		break;

	case 3:
		pThis->m_Type = EndpointTypeInterrupt;
		pThis->m_NextPID = USBPIDData0;
		break;

	default:
		assert (0);	// endpoint configuration should be checked by function driver
		return;
	}

	pThis->m_ucNumber       = pDesc->bEndpointAddress & 0x0F;
	pThis->m_bDirectionIn   = pDesc->bEndpointAddress & 0x80 ? TRUE : FALSE;
	pThis->m_nMaxPacketSize = pDesc->wMaxPacketSize;

	if (pThis->m_Type == EndpointTypeInterrupt)
	{
		u8 ucInterval = pDesc->bInterval;
		if (ucInterval < 1)
		{
			ucInterval = 1;
		}

		// see USB 2.0 spec chapter 9.6.6
		if (USBDeviceGetSpeed (pThis->m_pDevice) != USBSpeedHigh)
		{
			pThis->m_nInterval = ucInterval;
		}
		else
		{
			if (ucInterval > 16)
			{
				ucInterval = 16;
			}

			unsigned nValue = 1 << (ucInterval - 1);

			pThis->m_nInterval = nValue / 8;

			if (pThis->m_nInterval < 1)
			{
				pThis->m_nInterval = 1;
			}
		}
	}
}

void USBEndpointCopy (TUSBEndpoint *pThis, TUSBEndpoint *pEndpoint, TUSBDevice *pDevice)
{
	assert (pThis != 0);

	assert (pEndpoint != 0);

	pThis->m_pDevice = pDevice;
	assert (pThis->m_pDevice != 0);

	pThis->m_ucNumber	 = pEndpoint->m_ucNumber;
	pThis->m_Type		 = pEndpoint->m_Type;
	pThis->m_bDirectionIn	 = pEndpoint->m_bDirectionIn;
	pThis->m_nMaxPacketSize  = pEndpoint->m_nMaxPacketSize;
	pThis->m_nInterval       = pEndpoint->m_nInterval;
	pThis->m_NextPID	 = pEndpoint->m_NextPID;
}

void _USBEndpoint (TUSBEndpoint *pThis)
{
	assert (pThis != 0);
	pThis->m_pDevice = 0;
}

TUSBDevice *USBEndpointGetDevice (TUSBEndpoint *pThis)
{
	assert (pThis != 0);
	assert (pThis->m_pDevice != 0);
	return pThis->m_pDevice;
}

u8 USBEndpointGetNumber (TUSBEndpoint *pThis)
{
	assert (pThis != 0);
	return pThis->m_ucNumber;
}

TEndpointType USBEndpointGetType (TUSBEndpoint *pThis)
{
	assert (pThis != 0);
	return pThis->m_Type;
}

boolean USBEndpointIsDirectionIn (TUSBEndpoint *pThis)
{
	assert (pThis != 0);
	return pThis->m_bDirectionIn;
}

void USBEndpointSetMaxPacketSize (TUSBEndpoint *pThis, u32 nMaxPacketSize)
{
	assert (pThis != 0);
	pThis->m_nMaxPacketSize = nMaxPacketSize;
}

u32 USBEndpointGetMaxPacketSize (TUSBEndpoint *pThis)
{
	assert (pThis != 0);
	return pThis->m_nMaxPacketSize;
}

unsigned USBEndpointGetInterval (TUSBEndpoint *pThis)
{
	assert (pThis != 0);
	assert (pThis->m_Type == EndpointTypeInterrupt);

	return pThis->m_nInterval;
}

TUSBPID USBEndpointGetNextPID (TUSBEndpoint *pThis, boolean bStatusStage)
{
	assert (pThis != 0);
	if (bStatusStage)
	{
		assert (pThis->m_Type == EndpointTypeControl);

		return USBPIDData1;
	}

	return pThis->m_NextPID;
}

void USBEndpointSkipPID (TUSBEndpoint *pThis, unsigned nPackets, boolean bStatusStage)
{
	assert (pThis != 0);
	assert (   pThis->m_Type == EndpointTypeControl
		|| pThis->m_Type == EndpointTypeBulk
		|| pThis->m_Type == EndpointTypeInterrupt);

	if (!bStatusStage)
	{
		switch (pThis->m_NextPID)
		{
		case USBPIDSetup:
			pThis->m_NextPID = USBPIDData1;
			break;

		case USBPIDData0:
			if (nPackets & 1)
			{
				pThis->m_NextPID = USBPIDData1;
			}
			break;

		case USBPIDData1:
			if (nPackets & 1)
			{
				pThis->m_NextPID = USBPIDData0;
			}
			break;

		default:
			assert (0);
			break;
		}
	}
	else
	{
		assert (pThis->m_Type == EndpointTypeControl);

		pThis->m_NextPID = USBPIDSetup;
	}
}

void USBEndpointResetPID (TUSBEndpoint *pThis)
{
	assert (pThis != 0);
	assert (pThis->m_Type == EndpointTypeBulk);

	pThis->m_NextPID = USBPIDData0;
}


/*
*
* Copyright (c) 2013 fpgaminer@bitcoin-mining.com
*
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*
*/

/*
* Golden nonces are sent over UART, hex encoded, with new-lines between each
* result.
*
* New work is received over UART, hex encoded, little-endian, and with
* new-lines between each new piece of work.
*
* If using the getwork protocol, new work should be sent as follows (Python
* pseudo-code):
* uart_write (data[128:128+24] + midstate + '\n')
*
*/
module comm_uart # (
	parameter comm_clk_frequency = 100000000,
	parameter baud_rate = 115200
) (
	input comm_clk,
	input uart_rx,
	output uart_tx,

	input hash_clk,
	input rx_new_golden_ticket,
	input [31:0] rx_golden_ticket,

	output reg tx_new_work = 1'b0,
	output [255:0] tx_midstate,
	output [95:0] tx_blockdata
);

	localparam temperature_report_delay = comm_clk_frequency * 4;	// Every 4 seconds

	//-----------------------------------------------------------------------------
	// Transfer golden tickets from hashing clock domain to comm clock domain.
	//-----------------------------------------------------------------------------
	reg fifo_rd = 1'b0;

	wire fifo_full, fifo_empty;
	wire [31:0] fifo_q;

	golden_ticket_fifo golden_ticket_fifo_blk (
		.wr_clk (hash_clk),
		.din (rx_golden_ticket),
		.wr_en (rx_new_golden_ticket & ~fifo_full),

		.rd_clk (comm_clk),
		.rd_en (fifo_rd),
		.dout (fifo_q),
		.full (fifo_full),
		.empty (fifo_empty)
	);

	//-----------------------------------------------------------------------------
	// UART Transmitter
	//-----------------------------------------------------------------------------
	reg uart_tx_new_byte = 1'b0;
	reg [7:0] uart_tx_byte = 8'd0;
	wire uart_tx_ready;

	uart_transmitter # (
		.comm_clk_frequency (comm_clk_frequency),
		.baud_rate (baud_rate)
	) uart_transmitter_blk (
		.clk (comm_clk),
		.uart_tx (uart_tx),
		.rx_new_byte (uart_tx_new_byte),
		.rx_byte (uart_tx_byte),
		.tx_ready (uart_tx_ready)
	);

	//-----------------------------------------------------------------------------
	// Temperature Measurement
	//-----------------------------------------------------------------------------
	wire [15:0] measured_temperature;

	comm_temperature_measurement temperature_blk (
		.clk (comm_clk),
		.tx_temp (measured_temperature)
	);

	//-----------------------------------------------------------------------------
	// Comm Clock Domain
	//-----------------------------------------------------------------------------
	reg [31:0] temperature_timeout = 32'd0;
	reg [4:0] transmit_state = 5'b00001;
	reg [31:0] outgoing_nonce = 32'd0;
	reg [7:0] outgoing_state = 8'd0;

	// Read golden tickets and output over UART.
	always @ (posedge comm_clk)
	begin
		if (temperature_timeout != temperature_report_delay)
			temperature_timeout <= temperature_timeout + 32'd1;
		uart_tx_new_byte <= 1'b0;
		fifo_rd <= 1'b0;

		case (transmit_state)
			5'b00001: if (!fifo_empty) begin
				transmit_state <= 5'b00010;
				fifo_rd <= 1'b1;
			end
			else if (temperature_timeout == temperature_report_delay)
			begin
				temperature_timeout <= 32'd0;
				outgoing_nonce <= {measured_temperature, 16'h0000};
				outgoing_state <= 8'h0F;
				transmit_state <= 5'b10000;
			end
			5'b00010: transmit_state <= 5'b00100;
			5'b00100: transmit_state <= 5'b01000;
			5'b01000: begin
				outgoing_nonce <= fifo_q;
				outgoing_state <= 8'hFF;
				transmit_state <= 5'b10000;
			end
			5'b10000: if (uart_tx_ready) begin
				if (outgoing_state == 8'd0)
				begin
					transmit_state <= 5'b00001;
					uart_tx_new_byte <= 1'b1;
					uart_tx_byte <= 8'd10;
				end
				else
				begin
					outgoing_state <= {1'b0, outgoing_state[7:1]};
					outgoing_nonce <= outgoing_nonce << 4;
					uart_tx_new_byte <= 1'b1;

					// Hex encode 4 bits of nonce
					if (outgoing_nonce[31:28] < 10)
						uart_tx_byte <= outgoing_nonce[31:28] + 8'd48;
					else
						uart_tx_byte <= outgoing_nonce[31:28] + 8'd65 - 8'd10;
				end
			end
			default: transmit_state <= 5'b00001;
		endcase
	end

	//-----------------------------------------------------------------------------
	// Receive new work
	//-----------------------------------------------------------------------------
	wire uart_rx_new_byte;
	wire [7:0] uart_rx_byte;

	uart_receiver # (
		.comm_clk_frequency (comm_clk_frequency),
		.baud_rate (baud_rate)
	) uart_receiver_blk (
		.clk (comm_clk),
		.uart_rx (uart_rx),
		.tx_new_byte (uart_rx_new_byte),
		.tx_byte (uart_rx_byte)
	);

	reg [351:0] job;
	reg new_job_flag = 1'b0;
	reg [256+96-1:0] incoming_work = 352'd0;
	reg digit = 1'b0;
	reg [3:0] uart_rx_hex, uart_last_digit;

	always @ (posedge comm_clk)
	begin
		// Decode incoming UART byte as hexidecimal
		if (uart_rx_byte >= "A" && uart_rx_byte <= "F")
			uart_rx_hex = uart_rx_byte - "A" + 4'd10;
		else if (uart_rx_byte >= "a" && uart_rx_byte <= "f")
			uart_rx_hex = uart_rx_byte - "A" + 4'd10;
		else
			uart_rx_hex = uart_rx_byte - "0";

		if (uart_rx_new_byte)
		begin
			uart_last_digit <= uart_rx_hex;
			digit <= ~digit;

			if (digit == 1'b1)
				incoming_work <= {uart_last_digit, uart_rx_hex, incoming_work[351:8]};

			if (uart_rx_byte == "\n")
			begin
				digit <= 1'b0;
				job <= incoming_work;
				new_job_flag <= ~new_job_flag;
			end
		end
	end

	// Transfer job from comm clock domain to hash clock domain
	reg [351:0] job_meta0, job_meta1;
	reg [2:0] new_job_meta;
	always @ (posedge hash_clk)
	begin
		{job_meta1, job_meta0} <= {job_meta0, job};
		new_job_meta <= {new_job_meta[1:0], new_job_flag};

		if (new_job_meta[2] != new_job_meta[1])
			tx_new_work <= 1'b1;
		else
			tx_new_work <= 1'b0;
	end

	assign {tx_midstate, tx_blockdata} = job_meta1;

endmodule

module comm_temperature_measurement (
	input clk,
	output reg [15:0] tx_temp
);

	wire drdy;
	wire [15:0] do;

	xadc_temp_sensor xadc_blk (
		.daddr_in (7'd0),
		.dclk_in (clk),
		.den_in (1'b1),
		.di_in (16'd0),
		.dwe_in (1'b0),
		.vp_in (),
		.vn_in (),
		.busy_out (),
		.channel_out (),
		.do_out (do),
		.drdy_out (drdy),
		.eoc_out (),
		.eos_out (),
		.ot_out (),
		.vccaux_alarm_out (),
		.vccint_alarm_out (),
		.user_temp_alarm_out (),
		.alarm_out ()
	);

	always @ (posedge clk)
	begin
		if (drdy)
			tx_temp <= do;
	end

endmodule

{'repo_name': 'progranism/Open-Source-FPGA-Bitcoin-Miner', 'stars': '918', 'repo_language': 'VHDL', 'file_name': 'hashing_pll.v', 'mime_type': 'text/plain', 'hash': 709464330034238274, 'source_dataset': 'data'}


//
// Templates UnitTests
// Copyright © 2020 SwiftGen
// MIT Licence
//

import StencilSwiftKit
import XCTest

final class JsonTests: XCTestCase {
  private enum Contexts {
    static let all = ["empty", "all"]
  }

  // generate variations to test customname generation
  private let inlineVariations: VariationGenerator = { name, context in
    guard name == "all" else { return [(context: context, suffix: "")] }

    return [
      (
        context: context,
        suffix: ""
      ),
      (
        context: try StencilContext.enrich(context: context, parameters: ["enumName=CustomJSON"]),
        suffix: "-customName"
      ),
      (
        context: try StencilContext.enrich(context: context, parameters: ["forceFileNameEnum"]),
        suffix: "-forceFileNameEnum"
      ),
      (
        context: try StencilContext.enrich(context: context, parameters: ["publicAccess"]),
        suffix: "-publicAccess"
      )
    ]
  }

  func testInlineSwift4() {
    test(
      template: "inline-swift4",
      contextNames: Contexts.all,
      directory: .json,
      contextVariations: inlineVariations
    )
  }

  func testInlineSwift5() {
    test(
      template: "inline-swift5",
      contextNames: Contexts.all,
      directory: .json,
      contextVariations: inlineVariations
    )
  }

  // generate variations to test customname generation
  private let runtimeVariations: VariationGenerator = { name, context in
    guard name == "all" else { return [(context: context, suffix: "")] }

    return [
      (
        context: context,
        suffix: ""
      ),
      (
        context: try StencilContext.enrich(context: context, parameters: ["bundle=ResourcesBundle.bundle"]),
        suffix: "-customBundle"
      ),
      (
        context: try StencilContext.enrich(context: context, parameters: ["enumName=CustomJSON"]),
        suffix: "-customname"
      ),
      (
        context: try StencilContext.enrich(context: context, parameters: ["forceFileNameEnum"]),
        suffix: "-forceFileNameEnum"
      ),
      (
        context: try StencilContext.enrich(
          context: context,
          parameters: ["lookupFunction=myJSONFinder(path:)"]
        ),
        suffix: "-lookupFunction"
      ),
      (
        context: try StencilContext.enrich(context: context, parameters: ["preservePath"]),
        suffix: "-preservePath"
      ),
      (
        context: try StencilContext.enrich(context: context, parameters: ["publicAccess"]),
        suffix: "-publicAccess"
      )
    ]
  }

  func testRuntimeSwift4() {
    test(
      template: "runtime-swift4",
      contextNames: Contexts.all,
      directory: .json,
      contextVariations: runtimeVariations
    )
  }

  func testRuntimeSwift5() {
    test(
      template: "runtime-swift5",
      contextNames: Contexts.all,
      directory: .json,
      contextVariations: runtimeVariations
    )
  }
}

{'repo_name': 'SwiftGen/SwiftGen', 'stars': '6396', 'repo_language': 'Swift', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': -8062853567957151480, 'source_dataset': 'data'}


---
date: 2016-08-01T09:42:02+05:00
title: Observed habits
weight: 81
---

## No Code Freeze

Developers living in a Trunk-Based Development reality, mostly do not experience variance in their days or weeks on the
trunk. In particular, there is no "we're close to a release so let's freeze code", and generally there is no indication
of a slowdown in proximity to a release.  Sure, a couple of developers out of a team might be assigned to bug-fixing closer
to the release but everyone else is going to work at full speed.

Generally speaking, the trunk is a place to firehose commits into, and the habits of the developers are such that
everything is ready to go live. If a team is doing 12 releases a year, then a release branch that is cut on the just in time
basis and is the one that is observed to be 'frozen' because of the absence of developers. Refer [branch for release](/branch-for-release/).

### Every Day is the same

Ignoring meetings, developers commit/push at the same rate and to the same place regardless of the day of the week or
the week of the month. This is a reinforcement of the "No Code Freeze" rule above. Sure a small subset of the team
may focus on an imminent release (bug fixes in the trunk, cherry-picked to the release branch), but the majority
should be focusing on 'business as usual' implementation of functionality for a future release.

## Quick Reviews

Teams doing Trunk-Based Development know that their commits/pushes will be scrutinized by others, as soon
as they have landed on the shared trunk. They are keen on bringing that forward, not delaying it, so they may prefer to
pair-program on code changes. Or they may ask colleagues for a code review at the time the change is submitted to be
merged into the trunk.

## Chasing HEAD

Trunk-Based Development teams update/pull/sync from the shared trunk often. Many times a day in fact.

## Running the build locally

Developers practicing Trunk-Based Development run the build before a commit/push in order to not break the build.
This one practice, for very small teams, allows them to not set up a CI server until later. If they cannot push their
commits to the shared trunk because someone else beat them to it then they have to do another update/sync/pull and
another build and push their revised commit(s). "It worked on my machine" says the developer that does not
want to confess to breaking the build (assuming quick reliable idempotent builds).

## Facilitating commits

Because everyone in a team is chasing HEAD of the trunk, there could be a moment where one change is imagined that
could inconvenience everyone else in some way. Say a big directory rename as part of an extensive rework of the
source with it. It could be that the developer performing those two changes does the rename first and pushes it through to
the trunk where everyone will get it on the next pull/sync/update. It might be that if separated somehow, the rename
on its own is easier to consume by teammates, with the second being a relatively smaller commit later.

Git and Mercurial track files through their content rather than by directory and file name, so they make light of the
situation described above, anyway.

## Powering through broken builds

So because of that lazy developer, or the flaky build, or pure accident of timing (Google has a commit every 30
seconds into their monorepo - there must be quantum entangled commits on a 0.0001% basis), the trunk will be observed
to be broken occasionally.

The best implementations are going to perform automatic rollback of a broken commit that lands in the trunk. The
developer gets notified and they get to fix it quietly on their workstation.

A developer wanting to update/pull/sync from the shared trunk often runs the risk of encountering that
statistically improbable broken build. They do not want to have the commits that broke the trunk, on their workstation
if they are developing. So what they do is update/pull/sync to the last known good commit, and only go further
ahead when the trunk build is officially repaired. This way they know they can stay 'green' on their workstation. Some
companies engineer a system where the last known good commit hash/number is stored in a network share, and a shell
script used for update/pull/sync does so to that instead of HEAD revision.

### Build Cop

If the Continuous Integration server is batching commits to trunk in each build, or the elapsed time for a build is
long then a "build cop" role might be required within the team to help sort out build breakages. Sadly that
means that locking the trunk to prevent further checkins on top of the broken one might be necessary as some form
of bisecting is performed to work out which commit broke the build and should be rolled back. Obviously a Continuous
Integration server setup that can run one build per commit is best.

## Shared Nothing

Developers on their workstations rely on a 'microcosm' setup for the application or service
they are developing. They can:

* bring up the application on their workstation and play with it.
* run all unit, integration and functional tests against it locally

Shared nothing requires significant discipline to achieve. It generally means that no TCP-IP leaves the developers
box, and being able to prove that by running those operations while disconnected from the network.  The
implementing of the wire mocking (service virtualization) of dependent tiers outside the team, is a given. The highest
accomplished Trunk-Based Development teams employ mocking of tiers within the same application, in order to make
tests fast and stable. Technologies such as Mountebank{{< ext url="http://www.mbtest.org" >}} make
programming working with wire mocking easy. Tiers refer to a layer-cake view of an applications construction, of course.

With a Microcosm strategy which delivers shared nothing for a developer workstation, it is acknowledged that
non-functional consistency with production has been thrown out of the window and that only functional correctness
is being honored.  This is only really any good for the act of development on a workstation, and the verification of
that (per commit) by a Continuous Integration daemon.

Your team will need many named QA environments, and many named
user acceptance testing (UAT) environments. Each of those with different rules about the frequency of deployment, and even perhaps even
a temporarily reservation for different reasons. Those environments pull together **real** dependent services
and integrated applications. As much as possible those environs should not have shared services.

Companies often make a classic mistake when buying software in that they (say) buy one license for prod, and another
for all dev, QA, and UAT, meaning the DevOps team had configured it as shared for all those environments, with a
wide-ranging negative impact on productivity and quality for innumerable and sometimes subtle psychological reasons.

## Common code ownership

Committing to the trunk many times a day requires a broad sense of ownership to code, and a willingness to allow
developers to contribute changes to sections of an application or service that they have not previously be involved
with. This privilege does come with responsibilities and checks. The former is to standards, and the checks are by the CI server,
and by humans who should honor to do a speedy code review. That last, for the highest performing teams, means as soon
as the proposed commit is ready.

## Always Release Ready

Not only do developers practicing Trunk-Based Development not break the build with any commit, they also sign up to
being able to go live at short notice. For example, one hour, if the CIO visits and says it is going to happen. That
means there is a bunch of automated tests that come with the build.

## Thin vertical slices

Where possible stories or tasks that have been pulled from the backlog should be achievable by a developer or pair of
developers in a short period of time, and in a small number of commits. They should also transcend all the apparent
tiers of the stack, and not have to jump between developers with specialized knowledge in order to be able to
completed. The Agile industry donates the INVEST{{< ext url="https://en.wikipedia.org/wiki/INVEST_(mnemonic)" >}} principle
as well as "Thin Vertical Slices"{{< ext url="http://www.scruminc.com/wp-content/uploads/2015/06/User-Stories-2.0.pdf" >}}
for this purpose, and that are great enablers of high throughput commits to the trunk, and always being release ready.

{'repo_name': 'paul-hammant/tbd', 'stars': '272', 'repo_language': 'CSS', 'file_name': 'default.md', 'mime_type': 'text/plain', 'hash': 7414975098624960067, 'source_dataset': 'data'}


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

import java.util.Iterator;

import org.springframework.statemachine.listener.AbstractCompositeListener;

/**
 * Default {@link TriggerListener} dispatcher.
 *
 * @author Janne Valkealahti
 *
 */
public class CompositeTriggerListener extends AbstractCompositeListener<TriggerListener> implements TriggerListener {

	@Override
	public void triggered() {
		for (Iterator<TriggerListener> iterator = getListeners().reverse(); iterator.hasNext();) {
			TriggerListener listener = iterator.next();
			listener.triggered();
		}
	}

}

{'repo_name': 'spring-projects/spring-statemachine', 'stars': '909', 'repo_language': 'Java', 'file_name': 'TestAutoConfigurationPackage.java', 'mime_type': 'text/x-java', 'hash': -1622700876685083737, 'source_dataset': 'data'}


<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.google.android</groupId>
  <artifactId>android-espresso</artifactId>
  <version>1.0-SNAPSHOT</version>
</project>

{'repo_name': 'stephanenicolas/Quality-Tools-for-Android', 'stars': '1266', 'repo_language': 'Java', 'file_name': 'UIAutomatorSampleTest.java', 'mime_type': 'text/x-java', 'hash': 4015210996386310432, 'source_dataset': 'data'}


using Microsoft.VisualStudio.TestTools.UnitTesting;
using Terminals.Connections;

namespace Tests.UserInterface
{
    [TestClass]
    public class VmrcMenuVisitorTests
    {
        [TestMethod]
        public void EmptyToolBar_UpdateMenu_CreatesNewButtons()
        {
            var sut = new MenuVisitorSut();
            var menuVisitor = new VmrcMenuVisitor(sut.MockProvider.Object);
            menuVisitor.Visit(sut.Toolbar);
            int itemsCount = sut.Toolbar.Items.Count;
            Assert.AreEqual(2, itemsCount, "First visit should update the menu by addint its own menu items");
        }
    }
}

{'repo_name': 'Terminals-Origin/Terminals', 'stars': '867', 'repo_language': 'C#', 'file_name': 'Advanced-usage.md', 'mime_type': 'text/plain', 'hash': 7223851797616756170, 'source_dataset': 'data'}


.admin-configuration__page {
    padding: 10px 25px;
}

.admin-configuration__menu {
    .ui.list .item  {
        padding-bottom: 15px !important;
        padding-top: 15px !important;

        .icon {
            min-width: 33px;
        }
    }
}

{'repo_name': 'JoelSanchez/ventas', 'stars': '106', 'repo_language': 'Clojure', 'file_name': 'Endpoints.md', 'mime_type': 'text/plain', 'hash': -854894070283406964, 'source_dataset': 'data'}


/*
*Hi, I'm Lin Dong,
*this shader's algorithm is from ppsspp
*this is a shader about CRT
*maybe something wrong, welcome to contect me
*if you want to get more detail please enter my blog http://blog.csdn.net/wolf96
*/
Shader "Custom/Retroc_CRT" {
		Properties{
		_MainTex("Main", 2D) = "white" {}
		_Size("Size", range(0.00005, 0.0008)) = 0.0001
		_Inten("Inten", range(0.5, 4)) = 2
	}
		SubShader{
			pass{
			Tags{ "LightMode" = "ForwardBase" }
			Cull off
				CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "MyFunc.cginc"

				float _Size;
			float _Inten;

				float4 _LightColor0;
			sampler2D _MainTex;
			float4 _MainTex_TexelSize;
			float4 _MainTex_ST;
			struct v2f {
				float4 pos : SV_POSITION;
				float2 uv_MainTex : TEXCOORD0;

			};

			v2f vert(appdata_full v) {
				v2f o;
				o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
				o.uv_MainTex = TRANSFORM_TEX(v.texcoord, _MainTex);
				return o;
			}

			float4 frag(v2f i) :COLOR
			{

				// scanlines
				float vPos = float((i.uv_MainTex.y + _Time.z * 0.5) * 272.0);
				float j = 2;
				float line_intensity = modf(float(vPos), j);

				// color shift
				float off = line_intensity *0.00001;
				float2 shift = float2(off, 0);

				// shift R and G channels to simulate NTSC color bleed
				float2 colorShift = float2(0.001, 0);
				float r = tex2D(_MainTex, i.uv_MainTex + colorShift + shift).x;
				float g = tex2D(_MainTex, i.uv_MainTex - colorShift + shift).y;
				float b = tex2D(_MainTex, i.uv_MainTex).z;

				float4 c = float4(r, g * 0.99, b, 1) * clamp(line_intensity, 0.85, 1);

				float rollbar = sin((i.uv_MainTex.y + _Time.z) * 30);

				return c + (rollbar * 0.02);
			}
			ENDCG
		}//

		}
	}

{'repo_name': 'wolf96/shader_for_unity', 'stars': '270', 'repo_language': 'GLSL', 'file_name': 'plant1.shader', 'mime_type': 'text/x-c', 'hash': 8455883400447859551, 'source_dataset': 'data'}


/*!
 * is-posix-bracket <https://github.com/jonschlinkert/is-posix-bracket>
 *
 * Copyright (c) 2015-2016, Jon Schlinkert.
 * Licensed under the MIT License.
 */

module.exports = function isPosixBracket(str) {
  return typeof str === 'string' && /\[([:.=+])(?:[^\[\]]|)+\1\]/.test(str);
};

{'repo_name': 'houdunwang/video', 'stars': '323', 'repo_language': 'PHP', 'file_name': 'phpcms.sql', 'mime_type': 'text/plain', 'hash': -267269356540217138, 'source_dataset': 'data'}


/*-------------------------------------------------------------------------
 *
 * fsmpage.c
 *	  routines to search and manipulate one FSM page.
 *
 *
 * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 * IDENTIFICATION
 *	  src/backend/storage/freespace/fsmpage.c
 *
 * NOTES:
 *
 *	The public functions in this file form an API that hides the internal
 *	structure of a FSM page. This allows freespace.c to treat each FSM page
 *	as a black box with SlotsPerPage "slots". fsm_set_avail() and
 *	fsm_get_avail() let you get/set the value of a slot, and
 *	fsm_search_avail() lets you search for a slot with value >= X.
 *
 *-------------------------------------------------------------------------
 */
#include "postgres.h"

#include "storage/bufmgr.h"
#include "storage/fsm_internals.h"

/* Macros to navigate the tree within a page. Root has index zero. */
#define leftchild(x)	(2 * (x) + 1)
#define rightchild(x)	(2 * (x) + 2)
#define parentof(x)		(((x) - 1) / 2)

/*
 * Find right neighbor of x, wrapping around within the level
 */
static int
rightneighbor(int x)
{
	/*
	 * Move right. This might wrap around, stepping to the leftmost node at
	 * the next level.
	 */
	x++;

	/*
	 * Check if we stepped to the leftmost node at next level, and correct if
	 * so. The leftmost nodes at each level are numbered x = 2^level - 1, so
	 * check if (x + 1) is a power of two, using a standard
	 * twos-complement-arithmetic trick.
	 */
	if (((x + 1) & x) == 0)
		x = parentof(x);

	return x;
}

/*
 * Sets the value of a slot on page. Returns true if the page was modified.
 *
 * The caller must hold an exclusive lock on the page.
 */
bool
fsm_set_avail(Page page, int slot, uint8 value)
{
	int			nodeno = NonLeafNodesPerPage + slot;
	FSMPage		fsmpage = (FSMPage) PageGetContents(page);
	uint8		oldvalue;

	Assert(slot < LeafNodesPerPage);

	oldvalue = fsmpage->fp_nodes[nodeno];

	/* If the value hasn't changed, we don't need to do anything */
	if (oldvalue == value && value <= fsmpage->fp_nodes[0])
		return false;

	fsmpage->fp_nodes[nodeno] = value;

	/*
	 * Propagate up, until we hit the root or a node that doesn't need to be
	 * updated.
	 */
	do
	{
		uint8		newvalue = 0;
		int			lchild;
		int			rchild;

		nodeno = parentof(nodeno);
		lchild = leftchild(nodeno);
		rchild = lchild + 1;

		newvalue = fsmpage->fp_nodes[lchild];
		if (rchild < NodesPerPage)
			newvalue = Max(newvalue,
						   fsmpage->fp_nodes[rchild]);

		oldvalue = fsmpage->fp_nodes[nodeno];
		if (oldvalue == newvalue)
			break;

		fsmpage->fp_nodes[nodeno] = newvalue;
	} while (nodeno > 0);

	/*
	 * sanity check: if the new value is (still) higher than the value at the
	 * top, the tree is corrupt.  If so, rebuild.
	 */
	if (value > fsmpage->fp_nodes[0])
		fsm_rebuild_page(page);

	return true;
}

/*
 * Returns the value of given slot on page.
 *
 * Since this is just a read-only access of a single byte, the page doesn't
 * need to be locked.
 */
uint8
fsm_get_avail(Page page, int slot)
{
	FSMPage		fsmpage = (FSMPage) PageGetContents(page);

	Assert(slot < LeafNodesPerPage);

	return fsmpage->fp_nodes[NonLeafNodesPerPage + slot];
}

/*
 * Returns the value at the root of a page.
 *
 * Since this is just a read-only access of a single byte, the page doesn't
 * need to be locked.
 */
uint8
fsm_get_max_avail(Page page)
{
	FSMPage		fsmpage = (FSMPage) PageGetContents(page);

	return fsmpage->fp_nodes[0];
}

/*
 * Searches for a slot with category at least minvalue.
 * Returns slot number, or -1 if none found.
 *
 * The caller must hold at least a shared lock on the page, and this
 * function can unlock and lock the page again in exclusive mode if it
 * needs to be updated. exclusive_lock_held should be set to true if the
 * caller is already holding an exclusive lock, to avoid extra work.
 *
 * If advancenext is false, fp_next_slot is set to point to the returned
 * slot, and if it's true, to the slot after the returned slot.
 */
int
fsm_search_avail(Buffer buf, uint8 minvalue, bool advancenext,
				 bool exclusive_lock_held)
{
	Page		page = BufferGetPage(buf);
	FSMPage		fsmpage = (FSMPage) PageGetContents(page);
	int			nodeno;
	int			target;
	uint16		slot;

restart:

	/*
	 * Check the root first, and exit quickly if there's no leaf with enough
	 * free space
	 */
	if (fsmpage->fp_nodes[0] < minvalue)
		return -1;

	/*
	 * Start search using fp_next_slot.  It's just a hint, so check that it's
	 * sane.  (This also handles wrapping around when the prior call returned
	 * the last slot on the page.)
	 */
	target = fsmpage->fp_next_slot;
	if (target < 0 || target >= LeafNodesPerPage)
		target = 0;
	target += NonLeafNodesPerPage;

	/*----------
	 * Start the search from the target slot.  At every step, move one
	 * node to the right, then climb up to the parent.  Stop when we reach
	 * a node with enough free space (as we must, since the root has enough
	 * space).
	 *
	 * The idea is to gradually expand our "search triangle", that is, all
	 * nodes covered by the current node, and to be sure we search to the
	 * right from the start point.  At the first step, only the target slot
	 * is examined.  When we move up from a left child to its parent, we are
	 * adding the right-hand subtree of that parent to the search triangle.
	 * When we move right then up from a right child, we are dropping the
	 * current search triangle (which we know doesn't contain any suitable
	 * page) and instead looking at the next-larger-size triangle to its
	 * right.  So we never look left from our original start point, and at
	 * each step the size of the search triangle doubles, ensuring it takes
	 * only log2(N) work to search N pages.
	 *
	 * The "move right" operation will wrap around if it hits the right edge
	 * of the tree, so the behavior is still good if we start near the right.
	 * Note also that the move-and-climb behavior ensures that we can't end
	 * up on one of the missing nodes at the right of the leaf level.
	 *
	 * For example, consider this tree:
	 *
	 *		   7
	 *	   7	   6
	 *	 5	 7	 6	 5
	 *	4 5 5 7 2 6 5 2
	 *				T
	 *
	 * Assume that the target node is the node indicated by the letter T,
	 * and we're searching for a node with value of 6 or higher. The search
	 * begins at T. At the first iteration, we move to the right, then to the
	 * parent, arriving at the rightmost 5. At the second iteration, we move
	 * to the right, wrapping around, then climb up, arriving at the 7 on the
	 * third level.  7 satisfies our search, so we descend down to the bottom,
	 * following the path of sevens.  This is in fact the first suitable page
	 * to the right of (allowing for wraparound) our start point.
	 *----------
	 */
	nodeno = target;
	while (nodeno > 0)
	{
		if (fsmpage->fp_nodes[nodeno] >= minvalue)
			break;

		/*
		 * Move to the right, wrapping around on same level if necessary, then
		 * climb up.
		 */
		nodeno = parentof(rightneighbor(nodeno));
	}

	/*
	 * We're now at a node with enough free space, somewhere in the middle of
	 * the tree. Descend to the bottom, following a path with enough free
	 * space, preferring to move left if there's a choice.
	 */
	while (nodeno < NonLeafNodesPerPage)
	{
		int			childnodeno = leftchild(nodeno);

		if (childnodeno < NodesPerPage &&
			fsmpage->fp_nodes[childnodeno] >= minvalue)
		{
			nodeno = childnodeno;
			continue;
		}
		childnodeno++;			/* point to right child */
		if (childnodeno < NodesPerPage &&
			fsmpage->fp_nodes[childnodeno] >= minvalue)
		{
			nodeno = childnodeno;
		}
		else
		{
			/*
			 * Oops. The parent node promised that either left or right child
			 * has enough space, but neither actually did. This can happen in
			 * case of a "torn page", IOW if we crashed earlier while writing
			 * the page to disk, and only part of the page made it to disk.
			 *
			 * Fix the corruption and restart.
			 */
			RelFileNode rnode;
			ForkNumber	forknum;
			BlockNumber blknum;

			BufferGetTag(buf, &rnode, &forknum, &blknum);
			elog(DEBUG1, "fixing corrupt FSM block %u, relation %u/%u/%u",
				 blknum, rnode.spcNode, rnode.dbNode, rnode.relNode);

			/* make sure we hold an exclusive lock */
			if (!exclusive_lock_held)
			{
				LockBuffer(buf, BUFFER_LOCK_UNLOCK);
				LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);
				exclusive_lock_held = true;
			}
			fsm_rebuild_page(page);
			MarkBufferDirtyHint(buf, false);
			goto restart;
		}
	}

	/* We're now at the bottom level, at a node with enough space. */
	slot = nodeno - NonLeafNodesPerPage;

	/*
	 * Update the next-target pointer. Note that we do this even if we're only
	 * holding a shared lock, on the grounds that it's better to use a shared
	 * lock and get a garbled next pointer every now and then, than take the
	 * concurrency hit of an exclusive lock.
	 *
	 * Wrap-around is handled at the beginning of this function.
	 */
	fsmpage->fp_next_slot = slot + (advancenext ? 1 : 0);

	return slot;
}

/*
 * Sets the available space to zero for all slots numbered >= nslots.
 * Returns true if the page was modified.
 */
bool
fsm_truncate_avail(Page page, int nslots)
{
	FSMPage		fsmpage = (FSMPage) PageGetContents(page);
	uint8	   *ptr;
	bool		changed = false;

	Assert(nslots >= 0 && nslots < LeafNodesPerPage);

	/* Clear all truncated leaf nodes */
	ptr = &fsmpage->fp_nodes[NonLeafNodesPerPage + nslots];
	for (; ptr < &fsmpage->fp_nodes[NodesPerPage]; ptr++)
	{
		if (*ptr != 0)
			changed = true;
		*ptr = 0;
	}

	/* Fix upper nodes. */
	if (changed)
		fsm_rebuild_page(page);

	return changed;
}

/*
 * Reconstructs the upper levels of a page. Returns true if the page
 * was modified.
 */
bool
fsm_rebuild_page(Page page)
{
	FSMPage		fsmpage = (FSMPage) PageGetContents(page);
	bool		changed = false;
	int			nodeno;

	/*
	 * Start from the lowest non-leaf level, at last node, working our way
	 * backwards, through all non-leaf nodes at all levels, up to the root.
	 */
	for (nodeno = NonLeafNodesPerPage - 1; nodeno >= 0; nodeno--)
	{
		int			lchild = leftchild(nodeno);
		int			rchild = lchild + 1;
		uint8		newvalue = 0;

		/* The first few nodes we examine might have zero or one child. */
		if (lchild < NodesPerPage)
			newvalue = fsmpage->fp_nodes[lchild];

		if (rchild < NodesPerPage)
			newvalue = Max(newvalue,
						   fsmpage->fp_nodes[rchild]);

		if (fsmpage->fp_nodes[nodeno] != newvalue)
		{
			fsmpage->fp_nodes[nodeno] = newvalue;
			changed = true;
		}
	}

	return changed;
}

{'repo_name': 'ADBSQL/AntDB', 'stars': '178', 'repo_language': 'C', 'file_name': 'create_extension.sgml', 'mime_type': 'text/html', 'hash': -4843975404157327274, 'source_dataset': 'data'}


/*
 * Swagger Petstore
 * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
 *
 * OpenAPI spec version: 1.0.0
 * Contact: apiteam@swagger.io
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 */

package io.swagger.client;

import java.util.List;
import java.util.Map;

/**
 * API response returned by API call.
 *
 * @param <T> The type of data that is deserialized from response body
 */
public class ApiResponse<T> {
    final private int statusCode;
    final private Map<String, List<String>> headers;
    final private T data;

    /**
     * @param statusCode The status code of HTTP response
     * @param headers The headers of HTTP response
     */
    public ApiResponse(int statusCode, Map<String, List<String>> headers) {
        this(statusCode, headers, null);
    }

    /**
     * @param statusCode The status code of HTTP response
     * @param headers The headers of HTTP response
     * @param data The object deserialized from response bod
     */
    public ApiResponse(int statusCode, Map<String, List<String>> headers, T data) {
        this.statusCode = statusCode;
        this.headers = headers;
        this.data = data;
    }

    public int getStatusCode() {
        return statusCode;
    }

    public Map<String, List<String>> getHeaders() {
        return headers;
    }

    public T getData() {
        return data;
    }
}

{'repo_name': 'swagger-api/swagger-codegen', 'stars': '11746', 'repo_language': 'HTML', 'file_name': 'settings.xml', 'mime_type': 'text/plain', 'hash': -6206724976063472160, 'source_dataset': 'data'}


angular.module('foundationDemoApp').controller('TooltipDemoCtrl', function ($scope) {
  $scope.dynamicTooltip = "Hello, World!";
  $scope.dynamicTooltipText = "dynamic";
  $scope.htmlTooltip = "I've been made <b>bold</b>!";
});

{'repo_name': 'yalabot/angular-foundation', 'stars': '1074', 'repo_language': 'JavaScript', 'file_name': 'helpers.js', 'mime_type': 'text/plain', 'hash': 6192832277162862606, 'source_dataset': 'data'}


function varargout = legcoeffs(varargin) %#ok<STOUT>
%LEGCOEFFS   LEGCOEFFS does not support TRIGTECH objects.
%
% Copyright 2017 by The University of Oxford and The Chebfun Developers.
% See http://www.chebfun.org/ for Chebfun information.

% TODO: Add support for this.

error('CHEBFUN:TRIGTECH:legcoeffs:nosupport', ...
      'LEGCOEFFS does not support TRIGTECH objects.')

end

{'repo_name': 'chebfun/chebfun', 'stars': '328', 'repo_language': 'MATLAB', 'file_name': 'compose.m', 'mime_type': 'text/plain', 'hash': 7355883403690747504, 'source_dataset': 'data'}


10

dir
1824
https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Core/OpenFOAM-1.5-dev/tutorials/icoDyMFoam/mixerGgi/0
https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend

2009-04-02T10:19:15.967477Z
1160
hjasak

e4e07f05-0c2f-0410-a05a-b8ba57e0c909

p
file

2010-09-12T03:25:12.586382Z
dd2b863de322b1d9c35faef303f89f85
2009-04-02T10:19:15.967477Z
1160
hjasak

1312

U
file

2010-09-12T03:25:12.586382Z
c1b8734ca81431daedfa5badc1f03002
2009-04-02T10:19:15.967477Z
1160
hjasak

1416

{'repo_name': 'openfoamtutorials/OpenFOAM_Tutorials_', 'stars': '149', 'repo_language': 'C++', 'file_name': 'transportProperties', 'mime_type': 'text/plain', 'hash': -6971455238936376932, 'source_dataset': 'data'}


extern crate cli_test_dir;

use cli_test_dir::*;

include!("includes/config.rs");

/// Should fail if there's no authorship configured and no git configs available
#[cfg(feature = "git")]
#[test]
fn web_no_authorship_no_git() {
    let dir = TestDir::new("sit", "web_no_authorship_no_git");
    dir.cmd()
        .arg("init")
        .expect_success();
    no_user_config(&dir);
    let out = dir.cmd()
        .env("HOME", dir.path(".").to_str().unwrap()) // to ensure there are no configs
        .env("USERPROFILE", dir.path(".").to_str().unwrap())
        .args(&["web"])
        .expect_failure().stderr;
    assert!(String::from_utf8(out).unwrap().contains("SIT needs your authorship identity to be configured"));
}

/// Should derive authorship from git if it is available
#[cfg(feature = "git")]
#[test]
fn web_no_authorship() {
    let dir = TestDir::new("sit", "web_no_authorship");
    dir.cmd()
        .arg("init")
        .expect_success();
    no_user_config(&dir);
    dir.create_file(".git/config", "[user]\nname=Test\nemail=test@test.com");
    let out = dir.cmd()
        .env("HOME", dir.path(".").to_str().unwrap()) // to ensure there are no configs
        .env("USERPROFILE", dir.path(".").to_str().unwrap())
        .args(&["web","-"])
        .expect_failure().stderr;
    // should fail because the socket address is invalid, but not the authorship
    println!("{}", String::from_utf8(out.clone()).unwrap());
    assert!(String::from_utf8(out).unwrap().contains("invalid socket address"));
}

{'repo_name': 'sit-fyi/sit', 'stars': '536', 'repo_language': 'Rust', 'file_name': 'config.rs', 'mime_type': 'text/plain', 'hash': -1641521697474167143, 'source_dataset': 'data'}


// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of the License "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
// f32test\loader\exet.cpp
//
//

#define __INCLUDE_DEPENDENCY_GRAPH

#include <e32svr.h>
#include <f32file.h>
#include "dllt.h"
#include "exetifc.h"
#include "dlltree.h"
#include <d_ldrtst.h>
#include "../mmu/d_memorytest.h"

#ifdef __VC32__
#pragma warning(disable:4706)
#endif

const TInt KMaxHandlesPerDll=4;
const TInt KMaxHandles=KMaxHandlesPerDll*KNumModules;

extern "C" TInt _E32Startup();

extern "C" __MODULE_IMPORT void RegisterConstructorCall(TInt aDllNum);
extern "C" __MODULE_IMPORT void RegisterInitCall(TInt aDllNum);
extern "C" __MODULE_IMPORT void RegisterDestructorCall(TInt aDllNum);

#define PANIC()		ExeTPanic(__LINE__)
#define EXET_ASSERT(c)	((void)((c)||(PANIC(),0)))

static TText GetSpecialDrive(TInt aSpecialDriveNum);

void ExeTPanic(TInt aLine)
	{
	User::Panic(_L("EXET"),aLine);
	}

/******************************************************************************
 * Class Definitions
 ******************************************************************************/
class CDllInfo;
NONSHARABLE_CLASS(TDllList) : public MDllList
	{
public:
	TDllList();
	virtual TBool IsPresent(const SDllInfo& aInfo);
	virtual TInt Add(const SDllInfo& aInfo);
	virtual void MoveToEnd(TInt aPos);
public:
	TInt iCount;
	SDllInfo iInfo[KNumModules];
	};

NONSHARABLE_CLASS(CTestServer) : public CServer2
	{
public:
	CTestServer();
	virtual ~CTestServer();
	virtual CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
	virtual TInt RunError(TInt aError);
public:
	CDllInfo* iInfo;
	};

NONSHARABLE_CLASS(CTestSession) : public CSession2
	{
public:
	virtual ~CTestSession();
	virtual void CreateL();
	virtual void ServiceL(const RMessage2& aMessage);
public:
	TInt GetExeDepList(const RMessage2& aMessage);
	TInt GetCDList(const RMessage2& aMessage);
	TInt LoadDll(const RMessage2& aMessage);
	TInt CloseDll(TInt aHandle);
	TInt CallBlkI(TInt aHandle, TInt aIn);
	TInt CallRBlkI(TInt aHandle, TInt aIn);
public:
	CDllInfo* iInfo;
	RMemoryTestLdd iTestLdd;
	};

NONSHARABLE_CLASS(CDllInfo) : public CBase
	{
public:
	CDllInfo();
	virtual ~CDllInfo();
	TInt Create();
	TInt StoreHandle(TInt aHandle);
	void RemoveHandle(TInt aIndex);
	void SetupCDList();
public:
	void RegisterConstructorCall(TInt aDllNum);
	void RegisterInitCall(TInt aDllNum);
	void RegisterDestructorCall(TInt aDllNum);
public:
	TInt iNextGen;
	TInt iHandleCount;
	TInt iNextHandle;
	TInt iHandles[KMaxHandles];
	TInt iModuleNum[KMaxHandles];
	TDllList iExeDepList;
	TDllList iDllConstructList;
	};

/******************************************************************************
 * Static data
 ******************************************************************************/
#ifdef __MODULE_HAS_DATA
class TExeData
	{
public:
	TExeData();
public:
	TTime iStartTime;
	TTime iInitTime;
	TInt iTest1;
	TFileName iFileName;
	};

TInt Bss[16];
TInt ExeNum=EXENUM;
TInt Generation=0;
TInt InitFlag=0;
TFullName StartThread=RThread().FullName();
TName StartProcess=RProcess().Name();
TExeData TheExeDataObject;

TExeData::TExeData()
	:	iFileName(RProcess().FileName())
	{
	TInt r;
	CHKDEPS(r);		// Check our dependencies are initialised
	if (r!=KErrNone)
		User::Panic(_L("CHKDEPS"),r);
	iStartTime.HomeTime();
	iTest1=299792458;
	RegisterConstructorCall(EXENUM);
	}
#endif

/******************************************************************************
 * Class TDllList
 ******************************************************************************/
TDllList::TDllList()
	{
	iCount=0;
	Mem::Fill(iInfo, KNumModules*sizeof(SDllInfo), 0xff);
	}

TBool TDllList::IsPresent(const SDllInfo& aInfo)
	{
	TInt i;
	for (i=0; i<iCount; ++i)
		{
		if (iInfo[i].iDllNum==aInfo.iDllNum)
			return ETrue;
		}
	return EFalse;
	}

TInt TDllList::Add(const SDllInfo& aInfo)
	{
	EXET_ASSERT(iCount<KNumModules);
	TInt pos=iCount;
	iInfo[iCount++]=aInfo;
	return pos;
	}

void TDllList::MoveToEnd(TInt aPos)
	{
	if (aPos<iCount-1)
		{
		SDllInfo x(iInfo[aPos]);
		Mem::Move(iInfo+aPos, iInfo+aPos+1, (iCount-aPos-1)*sizeof(SDllInfo));
		iInfo[iCount-1]=x;
		}
	}

/******************************************************************************
 * Class CTestSession/CTestServer
 ******************************************************************************/

CTestSession::~CTestSession()
	{
	}

void CTestSession::CreateL()
	{
	User::LeaveIfError(iTestLdd.Open());
	}

void CTestSession::ServiceL(const RMessage2& aMessage)
	{
	TInt r=KErrNotSupported;
	TInt mid=aMessage.Function();
	switch(mid)
		{
		case RLoaderTest::EMsgGetExeDepList:
			r=GetExeDepList(aMessage);
			break;
		case RLoaderTest::EMsgLoadDll:
			r=LoadDll(aMessage);
			break;
		case RLoaderTest::EMsgCallBlkI:
			r=CallBlkI(aMessage.Int0(), aMessage.Int1());
			break;
		case RLoaderTest::EMsgCallRBlkI:
			r=CallRBlkI(aMessage.Int0(), aMessage.Int1());
			break;
		case RLoaderTest::EMsgCloseDll:
			r=CloseDll(aMessage.Int0());
			break;
		case RLoaderTest::EMsgGetCDList:
			r=GetCDList(aMessage);
			break;
		case RLoaderTest::EMsgCheckReadable:
			{
			TUint32 value;
			r = iTestLdd.ReadMemory((TAny*)aMessage.Int0(),value);
			if(r)
				r = KErrGeneral;
			}
			break;
		case RLoaderTest::EMsgExit:
			r=KErrNone;
			CActiveScheduler::Stop();
			break;
		default:
			break;
		}
	aMessage.Complete(r);
	}

TInt CTestSession::GetExeDepList(const RMessage2& aMsg)
	{
	TPtrC8 dep_list_ptr((const TUint8*)&iInfo->iExeDepList.iInfo, KNumModules*sizeof(SDllInfo));
	aMsg.WriteL(0, dep_list_ptr, 0);
	return KErrNone;
	}

TInt CTestSession::GetCDList(const RMessage2& aMsg)
	{
	TPtrC8 list_ptr((const TUint8*)&iInfo->iDllConstructList.iInfo, KNumModules*sizeof(SDllInfo));
	aMsg.WriteL(0, list_ptr, 0);
	return KErrNone;
	}

static void GetDllFileName(const TDesC& aListName, TDes& aTargetName)
/**
	Helper function for CTestSession::LoadDll transforms the supplied
	filename to an absolutely qualified name if it has been copied to a drive.

	@param	aListName		The DLL name.  This will not have a path if it should
							be loaded from the Z drive.  Otherwise it will be fully
							qualified but with a digit for the drive letter.
	@param	aTargetName		Descriptor to populate with target filename.  If the
							DLL should be loaded from Z this is the same as aListName.
							Otherwise, it is the same as aListName but with the correct
							drive letter.
 */
	{
	aTargetName.Copy(aListName);
	if (aListName[1] != ':')
		return;

	TText& targetDrive = aTargetName[0];
	targetDrive = GetSpecialDrive(targetDrive - '0');
	}

TInt CTestSession::LoadDll(const RMessage2& aMsg)
	{
	TInt module=aMsg.Int0();
	TDllList dll_list;
	TPtrC8 dll_list_ptr((const TUint8*)dll_list.iInfo, KNumModules*sizeof(SDllInfo));
	TPtrC dllname0=MODULE_FILENAME(module);
	TFileName dllname;
	GetDllFileName(dllname0, dllname);
	iInfo->SetupCDList();
	RLibrary l;
	TInt r=l.Load(dllname, TUidType());
	if (r>0)
		{
		RDebug::Printf("RLibrary::Load returned 0x%x !",r);
		return -999; // return unexpected error type so test fails.
		}
	if (r!=KErrNone)
		return r;
	TInitFunction f=(TInitFunction)l.Lookup(INIT_ORDINAL);
	EXET_ASSERT(f);
	r=(*f)(dll_list);
	if (r!=KErrNone)
		return r;
	TBlkIFunction bf=(TBlkIFunction)l.Lookup(BLOCK_INC_ORDINAL);
	EXET_ASSERT(bf);
	TInt result=(*bf)(531441);
	EXET_ASSERT(result==BlkIValue(module, 531441));
	TInt h=iInfo->StoreHandle(l.Handle());
	EXET_ASSERT(h>=0);
	iInfo->iModuleNum[h]=module;
	aMsg.WriteL(1, dll_list_ptr, 0);
	return h;
	}

TInt CTestSession::CallBlkI(TInt aHandle, TInt aIn)
	{
	TInt h=iInfo->iHandles[aHandle];
	EXET_ASSERT(h!=0);
	RLibrary l;
	l.SetHandle(h);
	TBlkIFunction bf=(TBlkIFunction)l.Lookup(BLOCK_INC_ORDINAL);
	EXET_ASSERT(bf);
	return (*bf)(aIn);
	}

TInt CTestSession::CallRBlkI(TInt aHandle, TInt aIn)
	{
	TInt h=iInfo->iHandles[aHandle];
	EXET_ASSERT(h!=0);
	RLibrary l;
	l.SetHandle(h);
	TRBlkIFunction rbf=(TRBlkIFunction)l.Lookup(REC_BLOCK_INC_ORDINAL);
	EXET_ASSERT(rbf);
	++iInfo->iNextGen;
	return (*rbf)(aIn,iInfo->iNextGen);
	}

TInt CTestSession::CloseDll(TInt aHandle)
	{
	TInt h=iInfo->iHandles[aHandle];
	TInt m=iInfo->iModuleNum[aHandle];
	EXET_ASSERT(h!=0);
	EXET_ASSERT(m>=0);
	iInfo->iHandles[aHandle]=0;
	iInfo->iModuleNum[aHandle]=-1;
	iInfo->SetupCDList();
	RLibrary l;
	l.SetHandle(h);
	l.Close();
	return KErrNone;
	}

CTestServer::CTestServer()
	: CServer2(0,ESharableSessions)
	{
	}

CTestServer::~CTestServer()
	{
	}

CSession2* CTestServer::NewSessionL(const TVersion& aVersion, const RMessage2& /*aMessage*/) const
	{
	(void)aVersion;
	CTestSession* s = new (ELeave) CTestSession;
	s->iInfo=iInfo;
	return s;
	}

_LIT(KExetErr,"EXETERR");
TInt CTestServer::RunError(TInt aError)
	{
	User::Panic(KExetErr,aError);
	return 0;
	}

/******************************************************************************
 * Class CDllInfo
 ******************************************************************************/
TInt ChkC()
	{
#ifdef __MODULE_HAS_DATA
	TInt init_mark=~((EXENUM+DLLNUMOFFSET)*(EXENUM+DLLNUMOFFSET));
	if (InitFlag==init_mark)
		return KErrNone;
	if (InitFlag!=0)
		return 0x494e4946;
	TInt i;
	TInt x=0;
	for (i=0; i<16; ++i) x|=Bss[i];
	if (x)
		return 0x425353;
	if (ExeNum!=EXENUM)
		return 0x44415441;
	if (Generation!=0)
		return 0x47454e;
	if (StartProcess!=RProcess().Name())
		return 0x535450;
	if (TheExeDataObject.iTest1!=299792458)
		return 0x54455354;
	if (TheExeDataObject.iFileName != RProcess().FileName())
		return 0x464e414d;
	InitFlag=init_mark;
	RDebug::Print(_L("ChkC %S OK"),&TheExeDataObject.iFileName);
#endif
	return KErrNone;
	}

TInt Init(MDllList& aList)
	{
	TInt r=KErrNone;
	SDllInfo info;
	info.iDllNum=DLLNUM;
	info.iEntryPointAddress=((TInt)&_E32Startup);
	RLdrTest ldd;
	ldd.Open();
	info.iModuleHandle=ldd.ModuleHandleFromAddr((TInt)&_E32Startup);
	ldd.Close();
	if (!aList.IsPresent(info))
		{
		TInt pos=aList.Add(info);
		INITDEPS(r,aList);		// Call Init on our dependencies
		aList.MoveToEnd(pos);
#ifdef __MODULE_HAS_DATA
		if (r==KErrNone)
			r=ChkC();		// Check initial values for .data/.bss and check constructors have been called
#endif
		RegisterInitCall(DLLNUM);
		}
	return r;
	}

CDllInfo::CDllInfo()
	{
	Mem::Fill(iModuleNum, sizeof(iModuleNum), 0xff);
	}

CDllInfo::~CDllInfo()
	{
	}

TInt CDllInfo::Create()
	{
	TInt r;
	r=UserSvr::DllSetTls(0, this);
	if (r==KErrNone)
		r=UserSvr::DllSetTls(TLS_INDEX, NULL);
	if (r==KErrNone)
		{
		r=Init(iExeDepList);
		}
	return r;
	}

void CDllInfo::RegisterConstructorCall(TInt aDllNum)
	{
	(void)aDllNum;
	}

void CDllInfo::RegisterInitCall(TInt aDllNum)
	{
	(void)aDllNum;
	}

void CDllInfo::RegisterDestructorCall(TInt aDllNum)
	{
	(void)aDllNum;
	}

TInt CDllInfo::StoreHandle(TInt aHandle)
	{
	if (iHandleCount==KMaxHandles)
		return KErrOverflow;
	TInt i=iNextHandle;
	for (; i<KMaxHandles && iHandles[i]!=0; ++i) {}
	if (i==KMaxHandles)
		{
		for (i=0; i<iNextHandle && iHandles[i]!=0; ++i) {}
		EXET_ASSERT(i!=iNextHandle);
		}
	iNextHandle=i;
	iHandles[i]=aHandle;
	++iHandleCount;
	return i;
	}

void CDllInfo::RemoveHandle(TInt aIndex)
	{
	iHandles[aIndex]=0;
	--iHandleCount;
	}

void CDllInfo::SetupCDList()
	{
	new (&iDllConstructList) TDllList;
	EXET_ASSERT(UserSvr::DllSetTls(TLS_INDEX, &iDllConstructList)==KErrNone);
	}

/******************************************************************************
 * Exports
 ******************************************************************************/
extern "C" __MODULE_EXPORT void RegisterConstructorCall(TInt aDllNum)
	{
	CDllInfo* p=(CDllInfo*)UserSvr::DllTls(0);
	if (p)
		p->RegisterConstructorCall(aDllNum);
	}

extern "C" __MODULE_EXPORT void RegisterInitCall(TInt aDllNum)
	{
	CDllInfo* p=(CDllInfo*)UserSvr::DllTls(0);
	if (p)
		p->RegisterInitCall(aDllNum);
	}

extern "C" __MODULE_EXPORT void RegisterDestructorCall(TInt aDllNum)
	{
	CDllInfo* p=(CDllInfo*)UserSvr::DllTls(0);
	if (p)
		p->RegisterDestructorCall(aDllNum);
	}

static TText GetSpecialDrive(TInt aSpecialDriveNum)
/**
	Work out which physical drive corresponds to the supplied
	logical drive.

	@param	aSpecialDriveNum	Number which identifies which drive to find.
							Zero means internal drive.
	@return					Drive letter.
 */
	{
	RFs fs;
	TInt r = fs.Connect();
	EXET_ASSERT(r == KErrNone);

	// cannot load binaries from emulated removable drives
#ifdef __WINS__
	if (aSpecialDriveNum == 1)
		return 'c';
#endif

	TInt dr = 0;
	for (TInt d = 0; d <= (TInt)sizeof(SpecialDriveList); ++d)
		{
		dr = SpecialDriveList[d];
		TDriveInfo di;
		r = fs.Drive(di, dr);
		EXET_ASSERT(r == KErrNone);
		if (di.iType == EMediaNotPresent)
			continue;

		// drive 0 == internal
		if (aSpecialDriveNum == 0 && (di.iDriveAtt & KDriveAttInternal) != 0)
			break;
		// drive 1 == removable
		if (aSpecialDriveNum == 1 && (di.iDriveAtt & KDriveAttRemovable) != 0)
			break;
		}

	TChar ch0;
	r = RFs::DriveToChar(dr, ch0);
	EXET_ASSERT(r == KErrNone);
	fs.Close();
	return static_cast<TText>(TUint(ch0));
	}

GLDEF_C TInt E32Main()
	{
	CTrapCleanup* cleanup=CTrapCleanup::New();
	EXET_ASSERT(cleanup);
	CActiveScheduler* sched=new CActiveScheduler;
	EXET_ASSERT(sched);
	CActiveScheduler::Install(sched);
	CTestServer* svr=new CTestServer;
	EXET_ASSERT(svr);
	TBuf<16> suffix;
	User::CommandLine(suffix);
	TName svr_name=KServerName();
	if (suffix.Length())
		{
		svr_name.Append('.');
		svr_name+=suffix;
		}
	EXET_ASSERT(svr->Start(svr_name)==KErrNone);
	CDllInfo* dllinfo=new CDllInfo;
	EXET_ASSERT(dllinfo);
	EXET_ASSERT(dllinfo->Create()==KErrNone);
	svr->iInfo=dllinfo;

	CActiveScheduler::Start();

	UserSvr::DllFreeTls(0);
	UserSvr::DllFreeTls(TLS_INDEX);
	delete dllinfo;
	delete svr;
	delete sched;
	delete cleanup;

	return 0;
	}

{'repo_name': 'SymbianSource/oss.FCL.sf.os.kernelhwsrv', 'stars': '101', 'repo_language': 'C++', 'file_name': 'i2s.def', 'mime_type': 'text/plain', 'hash': 8542803510879611172, 'source_dataset': 'data'}


/*
 * Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
 * Copyright (C) 2019 Apple Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 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.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 APPLE INC. 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.
 */

#pragma once

#include "JSObject.h"

namespace JSC {

// %GeneratorPrototype% intrinsic.
// https://tc39.github.io/ecma262/#sec-properties-of-generator-prototype
class GeneratorPrototype final : public JSNonFinalObject {
public:
    using Base = JSNonFinalObject;
    static constexpr unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable;

    template<typename CellType, SubspaceAccess>
    static IsoSubspace* subspaceFor(VM& vm)
    {
        STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(GeneratorPrototype, Base);
        return &vm.plainObjectSpace;
    }

    static GeneratorPrototype* create(VM& vm, JSGlobalObject*, Structure* structure)
    {
        GeneratorPrototype* prototype = new (NotNull, allocateCell<GeneratorPrototype>(vm.heap)) GeneratorPrototype(vm, structure);
        prototype->finishCreation(vm);
        return prototype;
    }

    DECLARE_INFO;

    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
    {
        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
    }

private:
    GeneratorPrototype(VM& vm, Structure* structure)
        : Base(vm, structure)
    {
    }
    void finishCreation(VM&);
};

} // namespace JSC

{'repo_name': 'WebKit/webkit', 'stars': '4806', 'repo_language': 'None', 'file_name': 'audio_encoder_isac.h', 'mime_type': 'text/x-c++', 'hash': 3832048100336178553, 'source_dataset': 'data'}


package org.bukkit.event.server;

import org.bukkit.event.HandlerList;
import org.bukkit.plugin.RegisteredServiceProvider;

/**
 * This event is called when a service is unregistered.
 * <p>
 * Warning: The order in which register and unregister events are called
 * should not be relied upon.
 */
public class ServiceUnregisterEvent extends ServiceEvent {
    private static final HandlerList handlers = new HandlerList();

    public ServiceUnregisterEvent(RegisteredServiceProvider<?> serviceProvider) {
        super(serviceProvider);
    }

    @Override
    public HandlerList getHandlers() {
        return handlers;
    }

    public static HandlerList getHandlerList() {
        return handlers;
    }
}

{'repo_name': 'magmafoundation/Magma', 'stars': '133', 'repo_language': 'Java', 'file_name': '1.12.2-dev.json', 'mime_type': 'text/plain', 'hash': -4895048873988007688, 'source_dataset': 'data'}


#------------------------------------------------------------------------------#
# The main functionality of UtilityBurst
#------------------------------------------------------------------------------#
@include "windows/_RegistryIncludes.dsi";

#------------------------------------------------------------------------------#
sub UtBuHeader(REF string %menu, REF string %params, IN string $key, OUT bool $cont)
{

	echo "Current Configuration:";
	echo "     Driver Name : %params{'driverName'}";

	return true;

}

#------------------------------------------------------------------------------#
sub ChangeDriverName(REF string %menu, REF string %params, IN string $key, REF bool $cont)
{

	echo "Current driver name = '%params{'driverName'}'";
	return GetInput("Enter new driver name", %params{'driverName'});

}

#------------------------------------------------------------------------------#
sub InstallTools(REF string %menu, REF string %params, IN string $key, REF bool $cont)
{

	bool $goodOs=false;
	if (_IsWindowsNt())
	{
		if (_IsWindowsVistaOrGreater())
		{
			# UtBu doesn't work on Vista
		}
		else
		{
			# NT - 2K3 or higher
			$goodOs = true;
		}
	}

	if (!$goodOs)
	{
	    # not a valid OS
	    echo("*** Target system is not a supported OS (NT4 - 2K3) ***", ERROR);
	    echo("", ERROR);
	    echo("    UtilityBurst is not compatible with this system", ERROR);
		return !(<bool>%params{'quiet'});
	}

	if (!_DriverInstall(%params{'project'},
						%params{'driverName'},
						%params{'localName'},
						1,
						1,
						!(<bool>%params{'quiet'})))
	{
	    return !(<bool>%params{'quiet'});
	}

	return true;

}

#------------------------------------------------------------------------------#
sub UninstallTools(REF string %menu, REF string %params, IN string $key, REF bool $cont)
{

	if (!_DriverUninstall(%params{'project'}, %params{'driverName'}, !(<bool>%params{'quiet'})))
	{
		echo("-\n**** UNINSTALL FAILED ****", ERROR);
		return !(<bool>%params{'quiet'});
	}

	echo("-\nUNINSTALL SUCCESS", GOOD);
	return true;

}

#------------------------------------------------------------------------------#
sub LoadDriver(REF string %menu, REF string %params, IN string $key, REF bool $cont)
{

	if (<bool>%params{'quiet'} || prompt("Load the driver (%params{'driverName'})?"))
	{
		if (!defined(%params{'silent'}) || !(<bool>%params{'silent'}))
		{
			@echo on;
		}
		bool $res = `drivers -load %params{'driverName'}`;
		@echo off;
		if (!$res && <bool>%params{'quiet'})
		{
			return false;
		}
	}
	return true;

}

#------------------------------------------------------------------------------#
sub UnloadDriver(REF string %menu, REF string %params, IN string $key, REF bool $cont)
{
	if (<bool>%params{'quiet'} || prompt("Unload the driver (%params{'driverName'})?"))
	{
		if (!defined(%params{'silent'}) || !(<bool>%params{'silent'}))
		{
			@echo on;
		}
		bool $res = `drivers -unload %params{'driverName'}`;
		@echo off;
		if (!$res && <bool>%params{'quiet'})
		{
			return false;
		}
	}
	return true;

}

#------------------------------------------------------------------------------#
sub VerifyInstall(REF string %menu, REF string %params, IN string $key, REF bool $cont)
{

	if (!_DriverVerifyInstall( %params{'driverName'}, 1, 1 ))
	{
		echo("-\n**** UNABLE TO VERIFY INSTALL ****", ERROR);
		return !(<bool>%params{'quiet'});
	}

	echo("-\nVERIFICATION SUCCESSFULL", GOOD);
	return true;
}

#------------------------------------------------------------------------------#
sub VerifyDriverIsRunning(REF string %menu, REF string %params, IN string $key, REF bool $cont)
{
	if (!_DriverVerifyRunning(%params{'driverName'}))
	{
		echo("-\n**** UNABLE TO VERIFY DRIVER IS RUNNING ****", ERROR);
		return !(<bool>%params{'quiet'});
	}

	echo("-\nVERIFICATION SUCCESSFULL", GOOD);
	return true;
}

#------------------------------------------------------------------------------#
sub CheckDriverStatus(REF string %menu, REF string %params, IN string $key, REF bool $cont)
{

	bool $success = true;

	echo "Checking if driver is running";
	@quiet on;
	@echo off;
	bool $rtn = _DriverVerifyRunning(%params{'driverName'});
	@echo on;
	@quiet off;

	if ($rtn)
	{
		echo("    RUNNING", GOOD);
	}
	else
	{
		echo("    NOT RUNNING", WARNING);
	}

	echo "Checking load status";
	string $controlValue;
	if (!_GetRegistryValue("L",
						   "SYSTEM\\CurrentControlSet\\Services\\%params{'driverName'}\\Parameters",
						   "Control",
						   $controlValue))
	{
		echo("    FAILED (unable to get 'Control' value)", ERROR);
		$success = false;
	}
	else
	{
		int $value = <int>$controlValue;
		echo "    Services.exe";
		if (($value == 1) || ($value == 3) || ($value == 5) || ($value == 7))
		{
			echo("        DISABLED", ERROR);
		}
		else
		{
			echo("        ENABLED", GOOD);
		}

		echo "    Lsass.exe";
		if (($value == 2) || ($value == 3) || ($value == 6) || ($value == 7))
		{
			echo("        DISABLED", ERROR);
		}
		else
		{
			echo("        ENABLED", GOOD);
		}

		echo "    Winlogon.exe";
		if (($value == 4) || ($value == 5) || ($value == 6) || ($value == 7))
		{
			echo("        DISABLED", ERROR);
		}
		else
		{
			echo("        ENABLED", GOOD);
		}
	}

	string $loadName;
	echo "Getting load name";
	if (!_GetRegistryValue("L",
						   "SYSTEM\\CurrentControlSet\\Services\\%params{'driverName'}\\Parameters",
						   "Excluded",
						   $loadName))
	{
		echo "    'vldpkg.dll' (value not found -- using default name)";
	}
	else
	{
		echo "    '$loadName'";
	}

	if (!$success && <bool>%params{'quiet'})
	{
		return false;
	}
	return true;

}

#-------------------------------------------------------------------------------------
Sub __ConvertString( IN string $driverName )
{

}	/* end __ConvertString */

{'repo_name': 'misterch0c/shadowbroker', 'stars': '3807', 'repo_language': 'Python', 'file_name': 'Eternalchampion-2.0.0.fb', 'mime_type': 'text/xml', 'hash': 1075583974838451430, 'source_dataset': 'data'}


<?xml version="1.0" encoding="UTF-8"?>

<databaseChangeLog
        xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
    <preConditions>
            <dbms type="mssql"/>
    </preConditions>

    <changeSet id="1" author="nvoxland">
        <createTable tableName="magazine">
            <column name="id" type="int" autoIncrement="true">
                <constraints primaryKey="true" nullable="false"/>
            </column>
            <column name="title" type="varchar(50)"/>
        </createTable>
    </changeSet>
    <changeSet id="2" author="nvoxland">
        <addColumn tableName="magazine">
            <column name="sku" type="varchar(50)">
                <constraints nullable="true"/>
            </column>
        </addColumn>
        <createIndex indexName="idx_magazine_sku" tableName="magazine">
            <column name="sku"/>
        </createIndex>
    </changeSet>
    <changeSet id="3" author="nvoxland">
        <dropNotNullConstraint tableName="magazine" columnName="title" columnDataType="varchar(50)"/>
    </changeSet>
    <changeSet id="4" author="nvoxland">
        <renameColumn tableName="magazine" oldColumnName="sku" newColumnName="isbn"/>
    </changeSet>
    <changeSet id="5" author="nvoxland">
        <renameTable oldTableName="magazine" newTableName="publication"/>
    </changeSet>

    <changeSet id="6" author="nvoxland">
        <comment>
            Refactorings that can't be automatically rolled back can be custom rolled back with a "rollback" tag.
        </comment>
        <insert tableName="publication">
            <column name="title" value="Refactoring Times"/>
            <column name="isbn" value="12981-512712-512"/>
        </insert>
        <insert tableName="publication">
            <column name="title" value="Databases Today"/>
            <column name="isbn" value="51235-632-6232623"/>
        </insert>
        <insert tableName="publication">
            <column name="title" value="Newsweek"/>
            <column name="isbn" value="623-6623-332262"/>
        </insert>
        <rollback>
            delete from publication;
        </rollback>
    </changeSet>

    <changeSet id="7" author="nvoxland">
        <addColumn tableName="publication">
            <column name="pages" type="int"/>
        </addColumn>
    </changeSet>
    <changeSet id="8" author="nvoxland">
        <addNotNullConstraint tableName="publication" columnName="title" columnDataType="varchar(50)" defaultNullValue="-1"/>
    </changeSet>

    <changeSet id="9" author="nvoxland">
        <createView viewName="publicationView">
            select title, isbn from publication
        </createView>
    </changeSet>

    <changeSet id="10" author="nvoxland">
        <renameView oldViewName="publicationView" newViewName="v_publication"/>
    </changeSet>

    <changeSet id="11" author="nvoxland">
        <createTable tableName="article">
            <column name="id" type="int" autoIncrement="true">
                <constraints primaryKey="true" nullable="false"/>
            </column>
            <column name="title" type="varchar(255)"/>
            <column name="publication_id" type="int"/>
        </createTable>
    </changeSet>

    <changeSet id="12" author="nvoxland">
        <addForeignKeyConstraint
                baseTableName="article" baseColumnNames="publication_id"
                constraintName="fk_article_publication"
                referencedTableName="publication" referencedColumnNames="id"
                deleteCascade="true"/>
    </changeSet>

    <changeSet id="13" author="nvoxland">
        <addLookupTable
            existingTableName="publication" existingColumnName="isbn"
            newTableName="isbn" newColumnName="code"
            newColumnDataType="varchar(50)"/>
    </changeSet>

    <changeSet id="14" author="nvoxland">
        <createTable tableName="page">
            <column name="id" type="int">
                <constraints nullable="false"/>
            </column>
            <column name="text" type="text"/>
            <column name="magazine_id" type="int"/>
        </createTable>
    </changeSet>

    <changeSet id="15" author="nvoxland">
        <addPrimaryKey tableName="page" columnNames="id" constraintName="pk_page"/>
    </changeSet>

    <changeSet id="16" author="nvoxland">
        <addUniqueConstraint tableName="publication" columnNames="title" constraintName="uq_publication_title"/>
    </changeSet>

    <changeSet id="20" author="nvoxland">
        <customChange class="liquibase.change.custom.ExampleCustomSqlChange" tableName="page" columnName="magazine_id" newValue="4"/>
    </changeSet>
    <changeSet id="21" author="nvoxland">
        <customChange class="liquibase.change.custom.ExampleCustomTaskChange" helloTo="world"/>
    </changeSet>

</databaseChangeLog>

{'repo_name': 'liquibase/liquibase', 'stars': '2152', 'repo_language': 'Java', 'file_name': 'ExampleExecutor.java', 'mime_type': 'text/html', 'hash': -5006328502820671876, 'source_dataset': 'data'}


CAge* pcage = new CAge(21);  // CAge is derived from CObject.
Age* page = new Age(22);     // Age is NOT derived from CObject.
*(((char*)pcage) - 1) = 99;   // Corrupt preceding guard byte
*(((char*)page) - 1) = 99;    // Corrupt preceding guard byte
AfxCheckMemory();

{'repo_name': 'MicrosoftDocs/cpp-docs', 'stars': '566', 'repo_language': 'PowerShell', 'file_name': 'settings.json', 'mime_type': 'text/plain', 'hash': 6730297908774680126, 'source_dataset': 'data'}