text:
Le Spatula Commands
====================

Basic Commands
------------

Basic features and some information about the bot.

 - `about` - Basic bot info, with the link to this repo.
 - `git` - Link to this repo
 - `version` - Bot version
 - `help` - Get a link to this guide
 - `time` - Current time for Bot
 - `uptime` - Time since the last bot restart
 - `seen [user]` - Latest data from an user
 - `alts [user]` - List of known alts of an user (Alts detedted from namechanges)
 - `say [text]` - Force to say something

Chat Plugins
------------

Misc commands for multiple features:

 - `pick [option1], [option2], [...]` - Choose between multiple options
 - `randomanswer` - Gets a random answer
 - `recipe` - Gets a random recipe from the local database
 - `quote` - Gets a random quote from the local database
 - `regdate (username)` - Get the register date of a Pokemon Showdown account
 - `regtime (username)` - Get the age of a Pokemon Showdown account, useful for check if an account is autoconfirmed

Commands for getting pokemon info:

 - `translate [move/item/ability/nature], (source lang), (target lang)` - Command for translating pokemon stuff
 - `poke` or `randompokemon` - Get a random pokemon
 - `gen [poke]` - Get pokemon, item, etc generation
 - `viablemoves [poke]` - Get viable moves from a Pokemon
 - `heavyslam [poke], [poke]` - Get heavyslam base power
 - `priority [poke]` - Get priority moves
 - `boosting [poke]` - Get boosting moves
 - `recovery [poke]` - Get recovery moves
 - `hazards [poke]` - Get hazards moves

Smogon-related commands:

 - `usagelink` - Get a link to Smogon official usage stats
 - `usage [pokemon], (tier)` - Get usage stats of a pokemon
 - `usagedata [pokemon], [moves / items / abilities / spreads / teammates], (tier)` - Get usage data (common moves, items, spreads, etc) of a pokemon
 - `suspect (tier)` - Get information about a suspect test
 - `setsuspect [tier], [pokemon being suspected, ...], [link to Smogon]` - Set suspect information
 - `deftier [tier]` - Set default tier for `usage` and `suspect` commands

Commands for managing the local database of jokes and quotes:

 - `addquote [quote name], [text]` - Add a new quote
 - `delquote [quote name]` - Delete an existing quote
 - `listquotes` - Upload quotes to hastebin
 - `addrecipe [recipe name], [recipe URL]` - Adds a new recipe
 - `delrecipe [recipe name]` - Deletes an existing recipe
 - `listrecipes` - Uploads recipes to hastebin

Administrative Commands
------------

Commands for controlling the bot and command permissions for chat rooms.

 - `custom [text]` - Send something to current room
 - `custom [room] [text]` - Send something to a chat room. Brackets are obligatory if you specify the room. Example of usage: `custom [lobby] Some text here`
 - `pm [user], [text]` - Send a private message
 - `join [room1], [room2], [...]` - Join chat rooms
 - `leave [room1], [room2], [...]` - Leave chat rooms
 - `joinrooms [official/public/all]` - Join all rooms
 - `lang [lang]` - Set the language of the room
 - `settings [cmd], [rank]` - Configure command permissions
 - `battlesettings [permission], [rank]` - Change permissions for battle rooms

Developing Commands
------------

Commands for developing (only for excepted users)

 - `eval` or `js` - Execute arbitrary JavaScript
 - `send` - Send anything to the server
 - `reload [commands/config/features/laguages]` - Hotpatch source files
 - `updategit` - Fast forward from git repo

CommandParser developing commands

 - `ignore [user]` - Bot will ignore an user
 - `unignore [user]` - Stop ignoring an user
 - `sleep [room]` - Change the room status to `Sleeping`, to disable bot commands in a room
 - `wake [room]` - Change the room status to `Ready`, to re-enable bot  commands in a room
 - `status` or `roomstatus [room]` - Show the current status. Abbreviations: [c - chat, b - battle][r - ready, s - sleeping][Bot group][p - public, h - hidden]. Example: crup = chat, ready, user, private

Commands for terminating the process (for restarting the bot)

 - `lockdown` - Set lockdown mode, use `endlockdown` to revert it
 - `kill` - End the process after using lockdown
 - `forcekill` - Kill the process

Moderation
------------

**Mod Settings:** Use `mod (room - optional), [moderation], [on/off]` to enable or disable moderations.

**Moderation Exception:** Use `modex [rank/all]` to change moderation exception for a room.

**Autoban**
 - `ab [user1], [user2], [...]` - Add users to blacklist
 - `unab [user1], [user2], [...]` - Remove users from blacklist
 - `rab [regex]` - Regex ban
 - `unrab [regex]` - Remove a regex ban
 - `vab` - View blacklist

**Zero Tolerance**
 - `0tol [user]` - Checks if an user is in the zero tolerance list
 - `0tol add, [user1]:[level1], [user2]:[level2], [...]` - Add users to zero tolerance list
 - `0tol delete, [user1], [user2], [...]` - Removeusers from zero tolerance list
 - `vzt` - Upload zero tolerance list to hastebin

**Banwords and InapropiateWords:** Saying this words means automute. InapropiateWords requires that words are separated.
 - `banword [phrase]` - Add a banword
 - `unbanword [phrase]` - Remove a banword
 - `vbw` - View banword list
 - `inapword [phrase]` - Add an inappropriate word
 - `uninapword [phrase]` - Remove an inappropriate word
 - `viw` - View inapropiate words list

**Joinphrases:** Configure what phrase Bot says when certain user joins a room. This can be spammable, much caution!
 - `joinphrase [enable/disable]` - Enable or disable joinphrases for a room
 - `joinphrase set, [user], [phrase]` - Set a joinphrase
 - `joinphrase delete, [user]` - Remove a joinphrase
 - `vjf` - View joinphrases list

**Note:** Excepted users can use moderation commands in format `command [roomid]Arguments` to set moderation through PM or other room. Example: `ab [lobby]spammer1, spammer2`

Battle
------------

Commands for battle feature

**Developing**
 - `evalbattle` - Execute arbitrary JavaScript in a battle context
 - `reloadteams` - Hotpatch teams
 - `reloadbattle` - Hotpatch battle modules
 - `move` - Force a custom move

**Challeges**
 - `blockchallenges` - Block Challenges
 - `unblockchallenges` - Stop blocking challenges
 - `chall [user], [format]` - Send a challenge
 - `challme [format]` - Send a challenge to yourself

**Tournaments Joining**
 - `jointours [on/off]` - Enable or disable tour joining
 - `jointour` - Join a tournament
 - `leavetour` - Leave a tournament
 - `checktour` - Check the tournament (If the bot does not challenge or something)

**Ladder**
 - `searchbattle [format]` - Search a battle and returns the link
 - `ladderstart [format]` - Start laddering (checks every 10 seconds)
 - `ladderstop` - Stop laddering

**Teams**
 - `team add, [name], [format], [http://hastebin.com/raw/example]` - Add a team to Bot teams list
 - `team delete, [name]` - Remove a team from Bot teams list
 - `team get, [id]` - Get a team in exportable format
 - `team check, [id], (user)` - Challenge with a specific team
 - `teamslist` - Upload teams list to Hastebin to view it.

Tournaments
------------

Commands for Tournaments feature

 - `tour` - Start a tournament
 - `tour tier=example, timer=30, users=64, dq=1.5, type=elimination` - Start a tournament with custom and optional parameters
  - **tier**: Tournament format / tier
  - **timer**: Max time (in seconds) before starting the tournament
  - **users**: Max number of users (for singups)
  - **dq**: Minutes for autodq
  - **type**: elimination or roundrobin
  - **scout**: set `scout=off` for enabling scout protection
 - `tourhelp` - Help for `tour command`
 - `tourstart` - Force start a tornament
 - `tourend` - Force end a tornament

Commands for leaderboards system

 - `rank (user)` - View users's ranking (points, wins, finals, semifinals, etc)
 - `top` - View the Top5 in the leaderboard
 - `official` - Make a tournament in progress official (to be counted, see config)
 - `unofficial` - Make a tournament in progress unofficial
 - `leaderboards table, [room]` - Upload the leaderboard table to Hastebin
 - `leaderboards reset, [room]` - Reset leaderboards data

Games
------------

General commands for managing games:

 - `game [Game Name], arg1=value1, arg2=value2...` - Start a game
 - `endgame` - Force end a game
 - `reloadgames` - Alias of `reload feature, games`

**Hangman** and **Poke-Hangman**. Arguments: maxfails (max number of allowed fails, 0 or no specify this argument for infinite), lang (optional only for Poke-Hangman to change the language of the pokemon stuff). Commands:

 - `g [word/char]` - To guess words or characters
 - `view` - To view the game status
 - `end` - To force end the game

**Anagrams** and **Poke-Anagrams**. Arguments: games (max number of rounds), points (number of ponts for winning), time (time to answer in seconds), lang (optional only for Poke-Anagrams to change the language of the pokemon stuff). Commands:

 - `g [word]` - To guess the words
 - `view` - To view the game status
 - `end` - To force end the game

**Trivia**. Arguments: games (max number of rounds), points (number of ponts for winning), time (time to answer in seconds). Commands:

 - `ta [answer]` - To answer the questions
 - `view` - To view the game status
 - `end` - To force end the game

**BlackJack**. Arguments: time (time for each turn in seconds), maxplayers (max number of players) Commands:

 - `in` - To join the game. Use `out` to leave
 - `players` - To view the players list
 - `start` - To start the game
 - `hand` - To view your hand
 - `hit` - To get a new card to your hand
 - `stand` - To finish your turn
 - `end` - To force end the game

**Kunc**. Arguments: games (max number of rounds), points (number of ponts for winning), time (time to answer in seconds). Commands:

 - `g [pokemon]` - To guess the pokemon
 - `view` - To view the game status
 - `end` - To force end the game

**Rock, paper, scissors**. Single command game: `rps [rock/paper/scissors]`

**Ambush**. Arguments: roundtime (time per round). Commands:

 - `in` - To join the game. Use `out` to leave
 - `players` - To view the players list
 - `start` - To start the game
 - `fire [user]` - To kill other players
 - `end` - To force end the game

**Pass-The-Bomb**. Arguments: maxplayers (max number of players). Commands:

 - `in` - To join the game. Use `out` to leave
 - `players` - To view the players list
 - `start` - To start the game
 - `pass [user]` - To pass the bomb to another user
 - `end` - To force end the game

Youtube
------------

Commands for Youtube link recognition feature

 - `youtube [on/off]` - Enable / Disable YouTube link recognition


text:
package autodiff.io;

import static java.lang.Math.ceil;
import static multij.tools.Tools.array;

import java.io.Serializable;
import java.util.Random;

import autodiff.nodes.Data;
import autodiff.nodes.Node;

/**
 * @author codistmonk (creation 2016-07-16)
 */
public final class LabeledData implements Serializable {

	private final Node<?> inputs;

	private final Node<?> labels;

	public LabeledData(final int itemCount, final int inputLength) {
		this(new Data().setShape(itemCount, inputLength), new Data().setShape(itemCount));
	}

	public LabeledData(final Node<?> inputs, final Node<?> labels) {
		this.inputs = inputs;
		this.labels = labels;
	}

	public final Node<?> getInputs() {
		return this.inputs;
	}

	public final Node<?> getLabels() {
		return this.labels;
	}

	public final int getItemCount() {
		return this.getLabels().getLength();
	}

	public final int getInputLength() {
		return this.getInputs().getLength() / this.getItemCount();
	}

	public final void shuffle(final Random random) {
		final int n = this.getItemCount();

		for (int i = n; 1 < i; --i) {
			this.swap(i - 1, random.nextInt(i));
		}
	}

	public final void swap(final int i, final int j) {
		final int inputLength = this.getInputLength();
		final int offsetI = i * inputLength;
		final int offsetJ = j * inputLength;

		for (int k = 0; k < inputLength; ++k) {
			swap(this.getInputs(), offsetI + k, offsetJ + k);
		}

		swap(this.getLabels(), i, j);
	}

	public final LabeledData[] split(final double ratio) {
		final int n = this.getItemCount();
		final int m = (int) ceil(n * ratio);

		return array(this.slice(0, m), this.slice(m, n));
	}

	public final LabeledData slice(final int begin, final int end) {
		return new LabeledData(
				slice(this.getInputs(), this.getInputLength(), begin, end),
				slice(this.getLabels(), 1, begin, end));
	}

	public final void copy(final int begin, final int end, final LabeledData target, final int targetBegin) {
		final int inputLength = this.getInputLength();

		copy(this.getInputs(), begin * inputLength, end * inputLength, target.getInputs(), targetBegin * inputLength);
		copy(this.getLabels(), begin, end, target.getLabels(), targetBegin);
	}

	private static final long serialVersionUID = -3272274112365487159L;

	public static final void swap(final Node<?> node, final int i, final int j) {
		final float tmp = node.get(i);
		node.set(i, node.get(j));
		node.set(j, tmp);
	}

	public static final Node<?> slice(final Node<?> node, final int itemLength, final int begin, final int end) {
		final int[] resultShape = node.getShape().clone();
		resultShape[0] = end - begin;
		final Node<?> result = new Data().setShape(resultShape);

		for (int i = begin; i < end; ++i) {
			for (int j = 0; j < itemLength; ++j) {
				result.set(j + itemLength * (i - begin), node.get(j + itemLength * i));
			}
		}

		return result;
	}

	public static final void copy(final Node<?> source, final int begin, final int end, final Node<?> target, final int targetBegin) {
		for (int i = begin; i < end; ++i) {
			target.set(targetBegin + i - begin, source.get(i));
		}
	}

}

redpajama_set_name: RedPajamaGithub


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

/*
| -------------------------------------------------------------------------
| URI ROUTING
| -------------------------------------------------------------------------
| This file lets you re-map URI requests to specific controller functions.
|
| Typically there is a one-to-one relationship between a URL string
| and its corresponding controller class/method. The segments in a
| URL normally follow this pattern:
|
|	example.com/class/method/id/
|
| In some instances, however, you may want to remap this relationship
| so that a different class/function is called than the one
| corresponding to the URL.
|
| Please see the user guide for complete details:
|
|	https://codeigniter.com/user_guide/general/routing.html
|
| -------------------------------------------------------------------------
| RESERVED ROUTES
| -------------------------------------------------------------------------
|
| There are three reserved routes:
|
|	$route['default_controller'] = 'welcome';
|
| This route indicates which controller class should be loaded if the
| URI contains no data. In the above example, the "welcome" class
| would be loaded.
|
|	$route['404_override'] = 'errors/page_missing';
|
| This route will tell the Router which controller/method to use if those
| provided in the URL cannot be matched to a valid route.
|
|	$route['translate_uri_dashes'] = FALSE;
|
| This is not exactly a route, but allows you to automatically route
| controller and method names that contain dashes. '-' isn't a valid
| class or method name character, so it requires translation.
| When you set this option to TRUE, it will replace ALL dashes in the
| controller and method URI segments.
|
| Examples:	my-controller/index	-> my_controller/index
|		my-controller/my-method	-> my_controller/my_method
*/

$route['default_controller'] = 'main';
$route['404_override'] = '';

$route[config_item('uri_segment_admin') . '/preview/adminshow/(.+)'] = "$1";

if (config_item('uri_segment_admin') !== 'admin') {
    $route['admin'] = '_show404notfounderrorpage';
    $route[config_item('uri_segment_admin')] = 'admin';

    $route['admin/(.+)'] = '_show404notfounderrorpage';
    $route[config_item('uri_segment_admin') . '/(.+)'] = "admin/$1";
}

$route[config_item('uri_segment_board') . '/([a-zA-Z0-9_-]+)'] = "board_post/lists/$1";
if (strtoupper(config_item('uri_segment_post_type')) === 'B') {
    $route['([a-zA-Z0-9_-]+)/' . config_item('uri_segment_post') . '/([0-9]+)'] = "board_post/post/$2";
} else if (strtoupper(config_item('uri_segment_post_type')) === 'C') {
    $route[config_item('uri_segment_post') . '/([a-zA-Z0-9_-]+)/([0-9]+)'] = "board_post/post/$2";
} else {
    $route[config_item('uri_segment_post') . '/([0-9]+)'] = "board_post/post/$1";
}
$route[config_item('uri_segment_write') . '/([a-zA-Z0-9_-]+)'] = "board_write/write/$1";
$route[config_item('uri_segment_reply') . '/([0-9]+)'] = "board_write/reply/$1";
$route[config_item('uri_segment_modify') . '/([0-9]+)'] = "board_write/modify/$1";
$route[config_item('uri_segment_rss') . '/([a-zA-Z0-9_-]+)'] = "rss/index/$1";
$route[config_item('uri_segment_group') . '/([a-zA-Z0-9_-]+)'] = "group/index/$1";
$route[config_item('uri_segment_document') . '/([a-zA-Z0-9_-]+)'] = "document/index/$1";
$route[config_item('uri_segment_faq') . '/([a-zA-Z0-9_-]+)'] = "faq/index/$1";
$route['profile/([a-zA-Z0-9_-]+)'] = "profile/index/$1";
$route['print/([0-9]+)'] = "board_post/post/$1/print";
$route['sitemap\.xml'] = "sitemap";
$route['sitemap_([0-9_-]+)\.xml'] = "sitemap/board/$1";

$route[config_item('uri_segment_cmall_item') . '/([a-zA-Z0-9_-]+)'] = "cmall/item/$1";


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>ClustererAssignmentsPlotInstances</title>
<meta name="date" content="2015-09-10">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

weka.gui.explorer

Class ClustererAssignmentsPlotInstances

java.lang.Object

weka.gui.explorer.AbstractPlotInstances

weka.gui.explorer.ClustererAssignmentsPlotInstances

All Implemented Interfaces:

java.io.Serializable, OptionHandler

public class ClustererAssignmentsPlotInstances
extends AbstractPlotInstances

A class for generating plottable cluster assignments.

 Example usage:

 Instances train = ... // from somewhere
 Instances test = ... // from somewhere
 Clusterer cls = ... // from somewhere
 // build and evaluate clusterer
 cls.buildClusterer(train);
 ClusterEvaluation eval = new ClusterEvaluation();
 eval.setClusterer(cls);
 eval.evaluateClusterer(test);
 // generate plot instances
 ClustererPlotInstances plotInstances = new ClustererPlotInstances();
 plotInstances.setClusterer(cls);
 plotInstances.setInstances(test);
 plotInstances.setClusterer(cls);
 plotInstances.setClusterEvaluation(eval);
 plotInstances.setUp();
 // generate visualization
 VisualizePanel visPanel = new VisualizePanel();
 visPanel.addPlot(plotInstances.getPlotData("plot name"));
 // clean up
 plotInstances.cleanUp();

Version:

$Revision: 10222 $

Author:

fracpete (fracpete at waikato dot ac dot nz)

See Also:

Serialized Form

Constructor Summary

Constructors

Constructor and Description

ClustererAssignmentsPlotInstances()

Method Summary

Methods

Modifier and Type
Method and Description

void
cleanUp()

For freeing up memory.

Clusterer
getClusterer()

Returns the currently set clusterer.

ClusterEvaluation
getClusterEvaluation()

Returns the cluster evaluation object in use.

void
setClusterer(Clusterer value)

Sets the classifier used for making the predictions.

void
setClusterEvaluation(ClusterEvaluation value)

Sets the cluster evaluation object to use.

Methods inherited from class weka.gui.explorer.AbstractPlotInstances

canPlot, getInstances, getOptions, getPlotData, getPlotInstances, listOptions, setInstances, setOptions, setUp

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

ClustererAssignmentsPlotInstances

public ClustererAssignmentsPlotInstances()

Method Detail

setClusterer

public void setClusterer(Clusterer value)

Sets the classifier used for making the predictions.

Parameters:

value - the clusterer to use

getClusterer

public Clusterer getClusterer()

Returns the currently set clusterer.

Returns:

the clusterer in use

setClusterEvaluation

public void setClusterEvaluation(ClusterEvaluation value)

Sets the cluster evaluation object to use.

Parameters:

value - the evaluation object

getClusterEvaluation

public ClusterEvaluation getClusterEvaluation()

Returns the cluster evaluation object in use.

Returns:

the evaluation object

cleanUp

public void cleanUp()

For freeing up memory. Plot data cannot be generated after this call!

Overrides:

cleanUp in class AbstractPlotInstances

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>

    <meta charset="utf-8">
    <title>Test Chợ tốt</title>

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"
          integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

Page rendered in {elapsed_time}
    seconds. <?php echo (ENVIRONMENT === 'development') ? 'CodeIgniter Version ' . CI_VERSION . '' : '' ?>


text:
Installing plugins
======================

It's as easy as drag-and-drop! Just follow the instructions!

## Installing plugins
1. Just drag it into the plugins folder!

## Creating Plugin
1.  Create folder
2. Create your `index.js` inside the folder
3. `cd` to the folder and type `npm init` and follow instructions
4. `index.js` should return in module.exports. player, server, or entity. All are optional
5.
  * If you don't have config/settings.json, create it and copy everything from config/default-settings.json inside.
  * Add into plugins `"plugin_name": {}`. Add any options you'd like.

## Publish plugin

Use `npm init` and `npm publish` and follow the given instructions.


text:
module OneApp
  class JobManager
    def initialize
      @ready_list = Redis::List.new('job:ready')
      @pending_set = Redis::SortedSet.new("job:pending")
    end

    def ready(limit = 1, offset = 0)
      @ready_list.range(offset, offset + limit).map do |item|
        Job.from_json(item)
      end
    end

    def create(job)
      @ready_list << job.to_json
    end

    def pick(options = {})
      size = (options[:size] || 1).to_i
      jobs = []

      timeout_at = Time.now.to_i + 10 * 60

      size.times do
        if json = @ready_list.shift
          job = Job.from_json(json)
          job.timeout_at = timeout_at
          jobs << job
          @pending_set[job.to_json] = timeout_at
        end
      end

      jobs
    end

    def delete(hash)
      @pending_set.delete(MultiJson.encode(hash))
    end

    def pending
      @pending_set.rangebyscore('-inf', '+inf').map do |json|
        Job.from_json(json)
      end
    end

    def retry_expired(options = {})
      limit = options[:limit] || 10
      score = Time.now.to_i
      @pending_set.rangebyscore('-inf', score, limit: limit, offset: 0).each do |j|
        job = Job.from_json(j)
        job.retry_times += 1
        create(job)
      end
    end
  end
end


text:
/* @file
 * Device model for Intel's I/O Acceleration Technology (I/OAT).
 * A DMA asyncronous copy engine
 */

#ifndef __DEV_COPY_ENGINE_HH__
#define __DEV_COPY_ENGINE_HH__

#include <vector>

#include "base/statistics.hh"
#include "dev/copy_engine_defs.hh"
#include "dev/pcidev.hh"
#include "params/CopyEngine.hh"
#include "sim/eventq.hh"

class CopyEngine : public PciDev
{
    class CopyEngineChannel
    {
      private:
        DmaPort *cePort;
        CopyEngine *ce;
        CopyEngineReg::ChanRegs  cr;
        int channelId;
        CopyEngineReg::DmaDesc *curDmaDesc;
        uint8_t *copyBuffer;

        bool busy;
        bool underReset;
        bool refreshNext;
        Addr lastDescriptorAddr;
        Addr fetchAddress;

        Tick latBeforeBegin;
        Tick latAfterCompletion;

        uint64_t completionDataReg;

        enum ChannelState {
            Idle,
            AddressFetch,
            DescriptorFetch,
            DMARead,
            DMAWrite,
            CompletionWrite
        };

        ChannelState nextState;

        Event *drainEvent;
      public:
        CopyEngineChannel(CopyEngine *_ce, int cid);
        virtual ~CopyEngineChannel();
        void init();

        std::string name() { assert(ce); return ce->name() + csprintf("-chan%d", channelId); }
        virtual void addressRanges(AddrRangeList &range_list) { range_list.clear(); }
        virtual Tick read(PacketPtr pkt)
                        { panic("CopyEngineChannel has no I/O access\n");}
        virtual Tick write(PacketPtr pkt)
                        { panic("CopyEngineChannel has no I/O access\n"); }

        void channelRead(PacketPtr pkt, Addr daddr, int size);
        void channelWrite(PacketPtr pkt, Addr daddr, int size);

        unsigned int drain(Event *de);
        void resume();
        void serialize(std::ostream &os);
        void unserialize(Checkpoint *cp, const std::string &section);

      private:
        void fetchDescriptor(Addr address);
        void fetchDescComplete();
        EventWrapper<CopyEngineChannel, &CopyEngineChannel::fetchDescComplete>
            fetchCompleteEvent;

        void fetchNextAddr(Addr address);
        void fetchAddrComplete();
        EventWrapper<CopyEngineChannel, &CopyEngineChannel::fetchAddrComplete>
            addrCompleteEvent;

        void readCopyBytes();
        void readCopyBytesComplete();
        EventWrapper<CopyEngineChannel, &CopyEngineChannel::readCopyBytesComplete>
            readCompleteEvent;

        void writeCopyBytes();
        void writeCopyBytesComplete();
        EventWrapper <CopyEngineChannel, &CopyEngineChannel::writeCopyBytesComplete>
            writeCompleteEvent;

        void writeCompletionStatus();
        void writeStatusComplete();
        EventWrapper <CopyEngineChannel, &CopyEngineChannel::writeStatusComplete>
            statusCompleteEvent;

        void continueProcessing();
        void recvCommand();
        bool inDrain();
        void restartStateMachine();
        inline void anBegin(const char *s)
        {
            CPA::cpa()->hwBegin(CPA::FL_NONE, ce->sys,
                         channelId, "CopyEngine", s);
        }

        inline void anWait()
        {
            CPA::cpa()->hwWe(CPA::FL_NONE, ce->sys,
                     channelId, "CopyEngine", "DMAUnusedDescQ", channelId);
        }

        inline void anDq()
        {
            CPA::cpa()->hwDq(CPA::FL_NONE, ce->sys,
                      channelId, "CopyEngine", "DMAUnusedDescQ", channelId);
        }

        inline void anPq()
        {
            CPA::cpa()->hwDq(CPA::FL_NONE, ce->sys,
                      channelId, "CopyEngine", "DMAUnusedDescQ", channelId);
        }

        inline void anQ(const char * s, uint64_t id, int size = 1)
        {
            CPA::cpa()->hwQ(CPA::FL_NONE, ce->sys, channelId,
                    "CopyEngine", s, id, NULL, size);
        }

    };

  private:

    Stats::Vector bytesCopied;
    Stats::Vector copiesProcessed;

    // device registers
    CopyEngineReg::Regs regs;

    // Array of channels each one with regs/dma port/etc
    std::vector<CopyEngineChannel*> chan;

  public:
    typedef CopyEngineParams Params;
    const Params *
    params() const
    {
        return dynamic_cast<const Params *>(_params);
    }
    CopyEngine(const Params *params);
    ~CopyEngine();

    void regStats();
    void init();

    virtual Tick read(PacketPtr pkt);
    virtual Tick write(PacketPtr pkt);

    virtual void serialize(std::ostream &os);
    virtual void unserialize(Checkpoint *cp, const std::string &section);
    virtual unsigned int drain(Event *de);
    virtual void resume();
};

#endif //__DEV_COPY_ENGINE_HH__


text:
/**
 * Created by victor on 26/01/17.
 */

(function () {
    var app = angular.module('appAdmin');
    app.controller("LoginController", LoginController);
    LoginController.$inject = ['$state', '$window', '$scope', 'firebaseService'];
    function LoginController($state, $window, $scope, firebaseService) {
        var ctrl = this;
        this.loading = false;
        this.email = "";
        this.password = "";
        this.message = "";
        this.doLogin = doLogin;

        firebaseService.onAuthStateChanged(function() {
           if (firebaseService.isLogged()) {
               $state.go('admin');
           }
        });

        function doLogin() {
            ctrl.loading = true;
            firebaseService.doLogin(ctrl.email, ctrl.password).then(function() {
                $state.go('admin');
            }).catch(function(error) {
                ctrl.message = error.message;
            }).then(function() {
                ctrl.loading = false;
                $scope.$digest();
            });
        }

    };

})();


text:
/* Changelog
Version 0.1, January 2000
-initial release (Hans de Goede)
*/
#include <stdlib.h>
#include <string.h>
#include "plugin_manager.h"
#include "plugin_manager_priv.h"
#include "misc.h"

/* private methods */
static int plugin_manager_add(struct plugin_manager_struct *manager,
   struct plugin_manager_data *data)
{
   int i;

   /* does the plugin have the correct type? */
   if(strcmp(data->plugin->type, manager->type))
   {
      fprintf(stderr,
         "error: trying to add \"%s\" type plugin, to \"%s\" type plugin manager\n",
         data->plugin->type, manager->type);
      return -1;
   }

   for(i=0; i < manager->data_size; i++)
      if(!manager->data[i].plugin)
         break;

   if(i == manager->data_size)
   {
      struct plugin_manager_data *tmp;

      if(!(tmp=realloc(manager->data, (manager->data_size+BUF_SIZE) *
         sizeof(struct plugin_manager_data))))
      {
         fprintf(stderr, "error reallocating plugin data\n");
         return -1;
      }
      manager->data = tmp;
      memset(manager->data + manager->data_size, 0,
         sizeof(struct plugin_manager_data) * BUF_SIZE);
      manager->data_size += BUF_SIZE;
   }

   if (manager->rc && data->plugin->opts &&
      rc_register(manager->rc, data->plugin->opts))
      return -1;

   if (data->plugin->priority > manager->highest_priority)
      manager->highest_priority = data->plugin->priority;

   manager->data[i] = *data;

   return 0;
}

static void plugin_manager_remove(struct plugin_manager_struct *manager,
   int id)
{
   if(manager->rc && manager->data[id].plugin->opts)
      rc_unregister(manager->rc, manager->data[id].plugin->opts);

   if(manager->data[id].initialised && manager->data[id].plugin->exit)
      manager->data[id].plugin->exit();

   if(manager->data[id].plugin_handle)
   {
      /* TODO implement dlclose */
   }
   memset(manager->data + id, 0, sizeof(struct plugin_manager_data));
}

/* public methods (in plugin_manager.h) */
struct plugin_manager_struct *plugin_manager_create(const char *type,
   struct rc_struct *rc)
{
   struct plugin_manager_struct *manager = NULL;

   /* allocate the plugin_manager struct */
   if (!(manager = calloc(1, sizeof(struct plugin_manager_struct))))
   {
      fprintf(stderr,
         "error malloc failed for struct plugin_manager_struct\n");
      return NULL;
   }
   manager->type = type;
   manager->rc   = rc;
   return manager;
}

void plugin_manager_destroy(struct plugin_manager_struct *manager)
{
   plugin_manager_unload(manager, NULL);
   free(manager);
}

int plugin_manager_register(struct plugin_manager_struct *manager,
   const struct plugin_struct *plugin[])
{
   int i;
   struct plugin_manager_data data = { NULL, NULL, 0 };

   for(i=0; plugin[i]; i++)
   {
      data.plugin = plugin[i];
      if(plugin_manager_add(manager, &data))
         return -1;
   }
   return 0;
}

void plugin_manager_unregister(struct plugin_manager_struct *manager,
   const struct plugin_struct *plugin[])
{
   int i, j;

   /* remove all */
   if (!plugin)
   {
      plugin_manager_unload(manager, NULL);
      return;
   }

   for(i=0; plugin[i]; i++)
   {
      for(j=0; j < manager->data_size; j++)
      {
         if(manager->data[j].plugin == plugin[i])
         {
            plugin_manager_remove(manager, j);
            break;
         }
      }
   }
}

int plugin_manager_load(struct plugin_manager_struct *manager,
   const char *path, const char *name)
{
   /* TODO: implement me */
   return 0;
}

void plugin_manager_unload(struct plugin_manager_struct *manager,
   const char *name)
{
   int i;

   for(i=0; i < manager->data_size; i++)
   {
      if(manager->data[i].plugin &&
         (!name || !strcmp(name, manager->data[i].plugin->name)))
      {
         plugin_manager_remove(manager, i);
      }
   }
}

static void *plugin_manager_init_and_or_create(
   struct plugin_manager_struct *manager, const char *name, int load,
   void *flags)
{
   int i, priority;
   void *result = NULL;

   for(priority=manager->highest_priority; priority>=0; priority--)
   {
      for(i=0; i<manager->data_size; i++)
      {
         if(manager->data[i].plugin &&
            (manager->data[i].plugin->priority == priority) &&
            (!name || !strcmp(name, manager->data[i].plugin->name)) )
         {
            if(!manager->data[i].initialised &&
               manager->data[i].plugin->init &&
               manager->data[i].plugin->init())
            {  /* init failed */
               plugin_manager_remove(manager, i);
               continue;
            }
            /* no init needed, or init successfull */
            manager->data[i].initialised = 1;
            if (load)
            {
               if((result = manager->data[i].plugin->create(flags)))
               {
                  /* if no name was given tell them which plugin we're
                     using */
                  if(!name)
                     fprintf(stderr, "info: %s: using %s plugin\n",
                        manager->type, manager->data[i].plugin->name);
                  return result;
               }
            }
            else
               result = (void *)-1;
         }
      }
   }
   return result;
}

int plugin_manager_init_plugin(struct plugin_manager_struct *manager,
   const char *name)
{
   if(!plugin_manager_init_and_or_create(manager, name, 0, NULL))
      return -1;

   return 0;
}

void *plugin_manager_create_instance(struct plugin_manager_struct *manager,
   const char *name, void *flags)
{
   return plugin_manager_init_and_or_create(manager, name, 1, flags);
}

void plugin_manager_list_plugins(struct plugin_manager_struct *manager,
   FILE *f)
{
   int i;

   for(i=0; i < manager->data_size; i++)
      if(manager->data[i].plugin)
         fprint_columns(f, manager->data[i].plugin->name,
            manager->data[i].plugin->description);
}


text:
set -o errexit -o nounset

if [ "$TRAVIS_BRANCH" != "master" ]
then
  echo "This commit was made against the $TRAVIS_BRANCH and not the master! No deploy!"
  exit 0
fi

rev=$(git rev-parse --short HEAD)

cd website/build

git init
git config user.name "Luke Baker"
git config user.email "lukebaker@gmail.com"

git remote add upstream "https://$GH_TOKEN@github.com/open-review-toolkit/open-review-toolkit.git"
git fetch upstream
git reset upstream/gh-pages

echo "sample.openreviewtoolkit.org" > CNAME

touch .

git add -A .
git commit -m "rebuild pages at ${rev}"
git push -q upstream HEAD:gh-pages


text:
package Imager::Font::Type1;
use strict;
use Imager::Font::T1;
use vars qw(@ISA $VERSION);
@ISA = qw(Imager::Font::FT2);

$VERSION = "1.012";

1;

__END__

=head1 NAME

  Imager::Font::Type1 - low-level functions for T1Lib text output

=head1 DESCRIPTION

This is a simple wrapper around Imager::Font::T1 for backwards
compatibility.

=head1 AUTHOR

Tony Cook <tonyc@cpan.org>

=cut


text:
- Added support for watchOS 2 (@staminajim)
- Add a way to listen for events from any object of a specified class
  (@staminajim)
- Fixed a bug with [when: does: doWithContext:] (@staminajim)
- Added the ability to perform actions "onAnyOf" a list of triggers
  (@staminajim)
- Renamed block declaractions to avoid clashes (@edwardvalentini)
- Added the ability to watch for changes on multiple key paths with one action
  block (@staminajim)

## 1.0.0

Initial release.


text:
var puppy1 = require('url!./image/puppy.jpg'); // インラインイメージ
document.getElementById('puppy1').src = puppy1;

var puppy2 = require('url?limit=1000!./image/puppy.jpg'); // 外部ファイル(ハッシュがファイル名)
document.getElementById('puppy2').src = puppy2;

var puppy3 = require('url?limit=1000&name=picture.png!./image/puppy.jpg'); // 外部ファイル(ファイル名を指定)
document.getElementById('puppy3').src = puppy3;


text:
class Circle::Role < ActiveRecord::Base
  belongs_to :circle
  belongs_to :user

  enum role_type: %w[
    circle.admin
    circle.official
    circle.custom
    circle.volunteer
    circle.helpee
  ]

  LEADERSHIP_TYPES = %w(circle.admin circle.official circle.custom)
  ORGANIZER_TYPES  = %w(circle.admin)
  ORGANIZER_TYPE_IDS  = ORGANIZER_TYPES.map {|id| Circle::Role.role_types[id] }

  scope :leadership, ->{ where(role_type: LEADERSHIP_TYPES.map{|id| Circle::Role.role_types[id] }) }
  scope :for_circle, ->(circle) { where(circle: circle ) }

  validates :user_id, uniqueness: { scope: [:role_type, :circle_id] }

  def self.role_types_with_names
    self.role_types.keys.map do |role_type|
      [I18n.t!("roles.name.#{role_type}"), role_type]
    end
  end

  def self.leadership_role_types_with_names
    role_types_with_names.select do |(_, type)|
      LEADERSHIP_TYPES.include? type
    end
  end

  def name
    return self[:name] if self[:name].present?
    I18n.t!("roles.name.#{self.role_type}")
  end
end


text:
<?php

declare(strict_types=1);

namespace Nelmio\SecurityBundle\Tests\Listener;

use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;

abstract class ListenerTestCase extends TestCase
{
    protected function createRequestEventWithKernel(
        HttpKernelInterface $httpKernel,
        Request $request,
        bool $mainRequest
    ): RequestEvent {
        return new RequestEvent(
            $httpKernel,
            $request,
            $this->getRequestType($mainRequest),
        );
    }

    protected function createRequestEvent(
        Request $request,
        bool $mainRequest
    ): RequestEvent {
        return new RequestEvent(
            $this->createStub(HttpKernelInterface::class),
            $request,
            $this->getRequestType($mainRequest),
        );
    }

    protected function createResponseEventWithKernel(
        HttpKernelInterface $httpKernel,
        Request $request,
        bool $mainRequest,
        Response $response
    ): ResponseEvent {
        return new ResponseEvent(
            $httpKernel,
            $request,
            $this->getRequestType($mainRequest),
            $response
        );
    }

    protected function createResponseEvent(
        Request $request,
        bool $mainRequest,
        Response $response
    ): ResponseEvent {
        return new ResponseEvent(
            $this->createStub(HttpKernelInterface::class),
            $request,
            $this->getRequestType($mainRequest),
            $response
        );
    }

    private function getRequestType(bool $mainRequest): int
    {
        if (!$mainRequest) {
            return HttpKernelInterface::SUB_REQUEST;
        }

        return \defined(HttpKernelInterface::class.'::MAIN_REQUEST')
            ? HttpKernelInterface::MAIN_REQUEST
            : HttpKernelInterface::MASTER_REQUEST
        ;
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
Uses of Class ca.ualberta.cs.team5geotopics.InspectOtherProfilesActivity
</TITLE>

<META NAME="date" CONTENT="2014-04-07">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Class
ca.ualberta.cs.team5geotopics.InspectOtherProfilesActivity

Packages that use InspectOtherProfilesActivity

ca.ualberta.cs.team5geotopics

Uses of InspectOtherProfilesActivity in ca.ualberta.cs.team5geotopics

Methods in ca.ualberta.cs.team5geotopics with parameters of type InspectOtherProfilesActivity

 java.lang.Thread
ProfileSearch.pullProfile(java.lang.String profileID,
            InspectOtherProfilesActivity ProfileActivity)

          This will pull a specific profile ID from the Internet and then push it to the activity that requested it.

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes


text:
'use strict';

const gulp = require('gulp');
const json = require('gulp-json-editor');
const buffer = require('gulp-buffer');
const filter = require('gulp-filter');
const es = require('event-stream');
const util = require('./lib/util');
const remote = require('gulp-remote-src');
const zip = require('gulp-vinyl-zip');
const assign = require('object-assign');
const pkg = require('../package.json');

gulp.task('mixin', function () {
	const repo = process.env['VSCODE_MIXIN_REPO'];

	if (!repo) {
		console.log('Missing VSCODE_MIXIN_REPO, skipping mixin');
		return;
	}

	const quality = process.env['VSCODE_QUALITY'];

	if (!quality) {
		console.log('Missing VSCODE_QUALITY, skipping mixin');
		return;
	}

	const url = `https://github.com/${ repo }/archive/${ pkg.distro }.zip`;
	const opts = { base: '' };
	const username = process.env['VSCODE_MIXIN_USERNAME'];
	const password = process.env['VSCODE_MIXIN_PASSWORD'];

	if (username || password) {
		opts.auth = { user: username || '', pass: password || '' };
	}

	console.log('Mixing in sources from \'' + url + '\':');

	let all = remote(url, opts)
		.pipe(zip.src())
		.pipe(filter(function (f) { return !f.isDirectory(); }))
		.pipe(util.rebase(1));

	if (quality) {
		const build = all.pipe(filter('build/**'));
		const productJsonFilter = filter('product.json', { restore: true });

		const mixin = all
			.pipe(filter('quality/' + quality + '/**'))
			.pipe(util.rebase(2))
			.pipe(productJsonFilter)
			.pipe(buffer())
			.pipe(json(function (patch) {
				const original = require('../product.json');
				return assign(original, patch);
			}))
			.pipe(productJsonFilter.restore);

		all = es.merge(build, mixin);
	}

	return all
		.pipe(es.mapSync(function (f) {
			console.log(f.relative);
			return f;
		}))
		.pipe(gulp.dest('.'));
});


text:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Collections.Generic;
using System.Diagnostics.Contracts;
using Microsoft.Cci.UtilityDataStructures;
using Microsoft.Cci.MutableCodeModel;

namespace Microsoft.Cci.Optimization {

  /// <summary>
  ///
  /// </summary>
  public class AssemblyMerger : ModuleMerger {

    /// <summary>
    ///
    /// </summary>
    /// <param name="host"></param>
    /// <param name="result"></param>
    /// <param name="modulesToMerge"></param>
    public AssemblyMerger(IMetadataHost host, Assembly result, params Module[] modulesToMerge)
      : base(host, result, modulesToMerge) {
      Contract.Requires(host != null);
      Contract.Requires(result != null);
      Contract.Requires(modulesToMerge != null);

      this.result = result;
    }

    Assembly result;

    [ContractInvariantMethod]
    private void ObjectInvariant() {
      Contract.Invariant(this.result != null);
    }

    /// <summary>
    ///
    /// </summary>
    public override void Merge() {
      base.Merge();
      this.result.AssemblyAttributes = this.Concatenate((a) => ((a as Assembly)??Dummy.Assembly).AssemblyAttributes);
      this.result.ExportedTypes = this.Concatenate((a) => ((a as Assembly)??Dummy.Assembly).ExportedTypes);
      this.result.Files = this.Concatenate((a) => ((a as Assembly)??Dummy.Assembly).Files);
      this.result.MemberModules = this.Concatenate((a) => ((a as Assembly)??Dummy.Assembly).MemberModules);
      this.result.Resources = this.Concatenate((a) => ((a as Assembly)??Dummy.Assembly).Resources);
      this.result.SecurityAttributes = this.Concatenate((a) => ((a as Assembly)??Dummy.Assembly).SecurityAttributes);

      this.MergeAttributes(this.result.Attributes);
      this.ReparentFilesAndDealWithDuplicates();
      this.ReparentMemberModulesAndDealWithDuplicates();
      this.ReparentResourcesAndDealWithDuplicates();
      this.MergeSecurityAttributes();
    }

    private void ReparentFilesAndDealWithDuplicates() {
      var files = this.result.Files;
      if (files == null) return;
      var fileRefFor = new Hashtable<FileReference>();
      for (int i = 0; i < files.Count; i++) {
        var fileRef = files[i] as FileReference;
        if (fileRef == null) { files.RemoveAt(i); continue; } //TODO: error
        var key = (uint)fileRef.FileName.UniqueKey;
        if (fileRefFor[key] != null) { files.RemoveAt(i); continue; }; //TODO: check that hash values match
        fileRef.ContainingAssembly = this.result;
        fileRefFor[key] = fileRef;
      }
      files.TrimExcess();
    }

    private void ReparentMemberModulesAndDealWithDuplicates() {
      var memberModules = this.result.MemberModules;
      if (memberModules == null) return;
      var memberModuleFor = new Dictionary<ModuleIdentity, Module>();
      for (int i = 0; i < memberModules.Count; i++) {
        var memberModule = memberModules[i] as Module;
        if (memberModule == null) { memberModules.RemoveAt(i); continue; } //TODO: error
        if (memberModuleFor.ContainsKey(memberModule.ModuleIdentity)) { memberModules.RemoveAt(i); continue; }
        memberModule.ContainingAssembly = this.result;
        memberModuleFor[memberModule.ModuleIdentity] = memberModule;
      }
      memberModules.TrimExcess();
    }

    private void ReparentResourcesAndDealWithDuplicates() {
      var resources = this.result.Resources;
      if (resources == null) return;
      var resourceFor = new Hashtable<Resource>();
      for (int i = 0; i < resources.Count; i++) {
        var resource = resources[i] as Resource;
        if (resource == null) { resources.RemoveAt(i); continue; } //TODO: error
        var key = (uint)resource.Name.UniqueKey;
        if (resourceFor[key] != null) { resources.RemoveAt(i); continue; }
        resource.DefiningAssembly = this.result;
        resourceFor[key] = resource;
      }
      resources.TrimExcess();
    }

    private void MergeSecurityAttributes() {
      var secAttrs = this.result.SecurityAttributes;
      if (secAttrs == null) return;
      for (int i = 0; i < secAttrs.Count; i++) {
        var attr = secAttrs[i];
        Contract.Assume(attr != null);
        var mutableSecAttr = attr as SecurityAttribute;
        for (int j = i+1; j < secAttrs.Count; j++) {
          var laterAttr = secAttrs[j];
          Contract.Assume(laterAttr != null);
          if (attr.Action == laterAttr.Action) {
            if (mutableSecAttr == null) {
              mutableSecAttr = new SecurityAttribute() { Action = attr.Action, Attributes = new List<ICustomAttribute>(attr.Attributes) };
              secAttrs[i] = mutableSecAttr;
            }
            Contract.Assume(mutableSecAttr.Attributes != null);
            if (laterAttr.Attributes != null)
              mutableSecAttr.Attributes.AddRange(laterAttr.Attributes);
            secAttrs.RemoveAt(j);
          }
        }
        if (mutableSecAttr != null)
          this.MergeAttributes(mutableSecAttr.Attributes);
      }
    }

  }

  /// <summary>
  ///
  /// </summary>
  public class ModuleMerger {

    /// <summary>
    ///
    /// </summary>
    /// <param name="host"></param>
    /// <param name="result"></param>
    /// <param name="modulesToMerge"></param>
    public ModuleMerger(IMetadataHost host, Module result, params Module[] modulesToMerge) {
      Contract.Requires(host != null);
      Contract.Requires(result != null);
      Contract.Requires(modulesToMerge != null);

      this.result = result;
      this.resultModuleType = new NamespaceTypeDefinition();
      this.rootNamespace = new RootUnitNamespace() { Unit = result };
      this.modulesToMerge = modulesToMerge;
      this.assemblyReferenceFor = new Dictionary<AssemblyIdentity, IAssemblyReference>();
      this.host = host;
    }

    Module result;
    NamespaceTypeDefinition resultModuleType; //result.AllTypes[0]
    RootUnitNamespace rootNamespace;
    Module[] modulesToMerge;
    Dictionary<AssemblyIdentity, IAssemblyReference> assemblyReferenceFor;
    IMetadataHost host;

    [ContractInvariantMethod]
    private void ObjectInvariant() {
      Contract.Invariant(this.result != null);
      Contract.Invariant(this.resultModuleType != null);
      Contract.Invariant(this.rootNamespace != null);
      Contract.Invariant(this.modulesToMerge != null);
      Contract.Invariant(this.host != null);
      Contract.Invariant(this.assemblyReferenceFor != null);
    }

    /// <summary>
    ///
    /// </summary>
    public virtual void Merge() {
      this.MergeModuleTypes();
      this.ConcatenateOtherTypes();
      this.result.ModuleAttributes = this.Concatenate((a) => a.ModuleAttributes);
      this.result.ModuleReferences = this.Concatenate((a) => a.ModuleReferences);
      this.result.UninterpretedSections = this.Concatenate((a) => a.UninterpretedSections);

      this.MergeUnitNamespaceRoots();
      this.MergeAssemblyReferences();
      this.ReparentMembersAndDealWithDuplicates(this.rootNamespace);
      this.MergeAttributes(this.result.ModuleAttributes);
      this.ReparentModuleReferencesAndDealWithDuplicates();
      this.DealWithDuplicateUninterpretedSections();
    }

    private void MergeModuleTypes() {
      this.resultModuleType.Name = host.NameTable.GetNameFor("<Module>");
      this.resultModuleType.ContainingUnitNamespace = this.result.UnitNamespaceRoot;
      this.resultModuleType.InternFactory = this.host.InternFactory;
      this.result.AllTypes.Add(this.resultModuleType);
      this.resultModuleType.Fields = new List<IFieldDefinition>();
      this.resultModuleType.Methods = new List<IMethodDefinition>();
      for (int i = 0, n = this.modulesToMerge.Length; i < n; i++) {
        var assemToMerge = this.modulesToMerge[i];
        Contract.Assume(assemToMerge != null);
        if (assemToMerge.AllTypes.Count == 0) continue;
        var moduleTypeToMerge = assemToMerge.AllTypes[0];
        Contract.Assume(moduleTypeToMerge != null);
        Contract.Assume(this.resultModuleType.Fields != null);
        if (moduleTypeToMerge.Fields != null)
          this.resultModuleType.Fields.AddRange(moduleTypeToMerge.Fields);
        Contract.Assume(this.resultModuleType.Methods != null);
        if (moduleTypeToMerge.Methods != null)
          this.resultModuleType.Methods.AddRange(moduleTypeToMerge.Methods);
      }
      Contract.Assume(this.resultModuleType.Fields != null);
      if (this.resultModuleType.Fields.Count == 0)
        this.resultModuleType.Fields = null;
      else
        this.resultModuleType.Fields.TrimExcess();
      Contract.Assume(this.resultModuleType.Methods != null);
      if (this.resultModuleType.Methods.Count == 0)
        this.resultModuleType.Methods = null;
      else
        this.resultModuleType.Methods.TrimExcess();
    }

    private void ConcatenateOtherTypes() {
      var resultTypes = this.result.AllTypes;
      for (int i = 0, n = this.modulesToMerge.Length; i < n; i++) {
        var assemToMerge = this.modulesToMerge[i];
        Contract.Assume(assemToMerge != null);
        if (assemToMerge.AllTypes.Count < 1) continue;
        for (int j = 0, m = assemToMerge.AllTypes.Count; j < m; j++) {
          var typeToMerge = assemToMerge.AllTypes[j];
          Contract.Assume(typeToMerge != null);
          resultTypes.Add(typeToMerge);
        }
      }
      resultTypes.TrimExcess();
    }

    internal delegate IEnumerable<ElementType> GetCollection<ElementType>(IModule module);

    internal List<ElementType>/*?*/ Concatenate<ElementType>(GetCollection<ElementType> getCollectionFrom) {
      Contract.Requires(getCollectionFrom != null);

      var result = new List<ElementType>();
      for (int i = 0, n = this.modulesToMerge.Length; i < n; i++) {
        var moduleToMerge = this.modulesToMerge[i];
        Contract.Assume(moduleToMerge != null);
        var collection = getCollectionFrom(moduleToMerge);
        Contract.Assume(collection != null);
        result.AddRange(collection);
      }
      if (result.Count == 0) return null;
      result.TrimExcess();
      return result;
    }

    private void MergeUnitNamespaceRoots() {
      this.result.UnitNamespaceRoot = this.rootNamespace;
      for (int i = 0; i < this.modulesToMerge.Length; i++) {
        var assemblyToMerge = this.modulesToMerge[i];
        Contract.Assume(assemblyToMerge != null);
        this.MergeNamespaces(this.rootNamespace, assemblyToMerge.UnitNamespaceRoot);
      }
    }

    private void MergeNamespaces(UnitNamespace result, IUnitNamespace namespaceToMerge) {
      Contract.Requires(result != null);
      Contract.Requires(namespaceToMerge != null);

      foreach (var member in namespaceToMerge.Members) {
        var nestedNs = member as NestedUnitNamespace;
        if (nestedNs != null) {
          UnitNamespace nestedResult = null;
          foreach (var rmember in result.Members) {
            Contract.Assume(rmember != null);
            if (rmember.Name != nestedNs.Name) continue;
            nestedResult = rmember as UnitNamespace;
            if (nestedResult != null) break;
          }
          if (nestedResult == null)
            nestedResult = new NestedUnitNamespace() { ContainingUnitNamespace = result, Name = nestedNs.Name };
          this.MergeNamespaces(nestedResult, nestedNs);
          continue;
        }
        result.Members.Add(member);
      }
    }

    /// <summary>
    /// Fixes up all references in this.result that would resolve to definitions in one of the assemblies to merge
    /// so that instead they will resolve to the (reparented) definition in the merged assembly. Consolidates
    /// the other assembly references so that there is a single instance for each referenced assembly.
    /// Also replaces all references to definitions in the merged assembly, with the actual definitions.
    /// </summary>
    private void MergeAssemblyReferences() {
      for (int i = 0, n = this.modulesToMerge.Length; i < n; i++) {
        var moduleToMerge = this.modulesToMerge[i];
        Contract.Assume(moduleToMerge != null);
      }
      var referenceMerger = new AssemblyReferenceMerger(this.host, this.result, this.assemblyReferenceFor);
      referenceMerger.Rewrite(this.result);
      var nonSelfReferences = new List<IAssemblyReference>(this.assemblyReferenceFor.Count-1);
      this.result.AssemblyReferences = nonSelfReferences;
      foreach (var assemRef in this.assemblyReferenceFor.Values) {
        if (assemRef == this.result) continue;
        nonSelfReferences.Add(assemRef);
      }
    }

    private void ReparentMembersAndDealWithDuplicates(UnitNamespace unitNamespace) {
      Contract.Requires(unitNamespace != null);

      var members = unitNamespace.Members;
      for (int i = 0, n = members.Count; i < n; i++) {
        var member = members[i];
        var nsType = member as NamespaceTypeDefinition;
        if (nsType != null) {
          nsType.ContainingUnitNamespace = unitNamespace;
          for (int j = i+1; j < n; j++) {
            var laterNsType = members[j] as NamespaceTypeDefinition;
            if (laterNsType == null || laterNsType.Name != nsType.Name) continue;
            if (nsType.MangleName != laterNsType.MangleName) continue;
            if (nsType.MangleName && nsType.GenericParameterCount != laterNsType.GenericParameterCount) continue;
            this.ReportNameCollisionAndRename(nsType, laterNsType, j);
          }
          continue;
        }
        var globalField = member as GlobalFieldDefinition;
        if (globalField != null) {
          globalField.ContainingTypeDefinition = this.resultModuleType;
          for (int j = i+1; j < n; j++) {
            var laterField = members[j] as GlobalFieldDefinition;
            if (laterField == null || laterField.Name != globalField.Name) continue;
            if (!TypeHelper.TypesAreEquivalent(globalField.Type, laterField.Type)) continue;
            //TODO: check custom modifiers
            this.ReportNameCollisionAndRename(globalField, laterField, j);
          }
          continue;
        }
        var globalMethod = member as GlobalMethodDefinition;
        if (globalMethod != null) {
          globalMethod.ContainingTypeDefinition = this.resultModuleType;
          for (int j = i+1; j < n; j++) {
            var laterMethod = members[j] as GlobalMethodDefinition;
            if (laterMethod == null || laterMethod.Name != globalMethod.Name) continue;
            if (!MemberHelper.SignaturesAreEqual(globalMethod, laterMethod, resolveTypes: false)) continue;
            this.ReportNameCollisionAndRename(globalMethod, laterMethod, j);
          }
          continue;
        }
        var alias = member as NamespaceAliasForType;
        if (alias != null) {
          alias.ContainingNamespace = unitNamespace;
          for (int j = i+1; j < n; j++) {
            var laterAlias = members[j] as NamespaceAliasForType;
            if (laterAlias == null || laterAlias.Name != alias.Name || laterAlias.GenericParameterCount != alias.GenericParameterCount) continue; //Note: these names are not unmangled
            this.ReportNameCollision(alias, laterAlias, j);
          }
          continue;
        }
      }
    }

    private void ReportNameCollision(NamespaceAliasForType alias, NamespaceAliasForType laterAlias, int position) {
      Contract.Requires(alias != null);
      Contract.Requires(laterAlias != null);

      this.host.ReportError(new ErrorMessage() {
        Code = 1, ErrorReporter = this, Error = MergeError.DuplicateAlias,
        MessageParameter = TypeHelper.GetTypeName(alias.AliasedType)
      });
    }

    private void ReportNameCollisionAndRename(GlobalFieldDefinition globalField, GlobalFieldDefinition laterField, int position) {
      Contract.Requires(globalField != null);
      Contract.Requires(laterField != null);

      laterField.Name = this.host.NameTable.GetNameFor(laterField.Name.Value+"``"+position);
      this.host.ReportError(new ErrorMessage() {
        Code = 2, ErrorReporter = this, Error = MergeError.DuplicateGlobalField,
        MessageParameter = MemberHelper.GetMemberSignature(globalField, NameFormattingOptions.Signature),
      });
    }

    private void ReportNameCollisionAndRename(GlobalMethodDefinition globalMethod, GlobalMethodDefinition laterMethod, int position) {
      Contract.Requires(globalMethod != null);
      Contract.Requires(laterMethod != null);

      laterMethod.Name = this.host.NameTable.GetNameFor(laterMethod.Name.Value+"``"+position);
      this.host.ReportError(new ErrorMessage() {
        Code = 3, ErrorReporter = this, Error = MergeError.DuplicateGlobalMethod,
        MessageParameter = MemberHelper.GetMethodSignature(globalMethod, NameFormattingOptions.ReturnType|NameFormattingOptions.Signature),
      });
    }

    private void ReportNameCollisionAndRename(NamespaceTypeDefinition nsType, NamespaceTypeDefinition laterNsType, int position) {
      Contract.Requires(nsType != null);
      Contract.Requires(laterNsType != null);
      laterNsType.Name = this.host.NameTable.GetNameFor(laterNsType.Name.Value+"``"+position);
      this.host.ReportError(new ErrorMessage() {
        Code = 4, ErrorReporter = this, Error = MergeError.DuplicateGlobalField,
        MessageParameter = TypeHelper.GetTypeName(nsType),
      });
    }

    internal void MergeAttributes(List<ICustomAttribute> attrs) {
      if (attrs == null) return;
      for (int i = 0; i < attrs.Count; i++) {
        var attr = attrs[i];
        Contract.Assume(attr != null);
        for (int j = i+1; j < attrs.Count; j++) {
          var laterAttr = attrs[j];
          Contract.Assume(laterAttr != null);
          if (TypeHelper.TypesAreEquivalent(attr.Type, laterAttr.Type))
            attrs.RemoveAt(j);
        }
      }
    }

    [ContractVerification(false)] //moduleRef.ModuleIdentity = .... reports requires unproven: !this.IsFrozen
    private void ReparentModuleReferencesAndDealWithDuplicates() {
      var moduleReferences = this.result.ModuleReferences;
      if (moduleReferences == null) return;
      var moduleRefFor = new Hashtable<ModuleReference>();
      for (int i = 0; i < moduleReferences.Count; i++) {
        var moduleRef = moduleReferences[i] as ModuleReference;
        if (moduleRef == null || moduleRef.IsFrozen) { moduleReferences.RemoveAt(i); continue; }; //TODO: error
        var modId = moduleRef.ModuleIdentity;
        var key = (uint)modId.Name.UniqueKey;
        if (moduleRefFor[key] != null) { moduleReferences.RemoveAt(i); continue; };
        moduleRef.ContainingAssembly = this.result as IAssembly;
        moduleRef.ModuleIdentity = new ModuleIdentity(modId.Name, modId.Location, this.result.ModuleIdentity as AssemblyIdentity);
        moduleRefFor[key] = moduleRef;
      }
      moduleReferences.TrimExcess();
    }

    private void DealWithDuplicateUninterpretedSections() {
      var uninterpretedSections = this.result.UninterpretedSections;
      if (uninterpretedSections == null) return;
      var uninterpretedSectionFor = new Hashtable<PESection>();
      for (int i = 0; i < uninterpretedSections.Count; i++) {
        var uninterpretedSection = uninterpretedSections[i] as PESection;
        if (uninterpretedSection == null) { uninterpretedSections.RemoveAt(i); continue; } //TODO: error
        var key = (uint)uninterpretedSection.SectionName.UniqueKey;
        if (uninterpretedSectionFor[key] != null) { uninterpretedSections.RemoveAt(i); continue; } //TODO: error
        uninterpretedSectionFor[key] = uninterpretedSection;
      }
    }

  }

  internal class AssemblyReferenceMerger : MetadataRewriter {

    internal AssemblyReferenceMerger(IMetadataHost host, Module mergedModule, Dictionary<AssemblyIdentity, IAssemblyReference> assemblyReferenceFor)
      : base(host) {
      Contract.Requires(host != null);
      Contract.Requires(mergedModule != null);
      Contract.Requires(assemblyReferenceFor != null);

      this.mergedModule = mergedModule;
      this.assemblyReferenceFor = assemblyReferenceFor;
    }

    Module mergedModule;
    Dictionary<AssemblyIdentity, IAssemblyReference> assemblyReferenceFor;

    [ContractInvariantMethod]
    private void ObjectInvariant() {
      Contract.Invariant(this.mergedModule != null);
      Contract.Invariant(this.assemblyReferenceFor != null);
    }

    public override IAssemblyReference Rewrite(IAssemblyReference assemblyReference) {
      IAssemblyReference result;
      if (!this.assemblyReferenceFor.TryGetValue(assemblyReference.AssemblyIdentity, out result))
        this.assemblyReferenceFor[assemblyReference.AssemblyIdentity] = result = assemblyReference;
      Contract.Assume(result != null);
      return result;
    }

    public override INamespaceTypeReference Rewrite(INamespaceTypeReference namespaceTypeReference) {
      namespaceTypeReference = base.Rewrite(namespaceTypeReference);
      var unit = TypeHelper.GetDefiningUnitReference(namespaceTypeReference);
      if (unit == this.mergedModule) {
        var resolvedType = namespaceTypeReference.ResolvedType;
        Contract.Assume(!(resolvedType is Dummy));
        return resolvedType;
      }
      return namespaceTypeReference;
    }

    public override INestedTypeReference Rewrite(INestedTypeReference nestedTypeReference) {
      nestedTypeReference = base.Rewrite(nestedTypeReference);
      var unit = TypeHelper.GetDefiningUnitReference(nestedTypeReference);
      if (unit == this.mergedModule) {
        var resolvedType = nestedTypeReference.ResolvedType;
        Contract.Assume(!(resolvedType is Dummy));
        return resolvedType;
      }
      return nestedTypeReference;
    }

  }

  /// <summary>
  /// Information about an error that occurred during an assembly merge operation.
  /// </summary>
  public sealed class ErrorMessage : IErrorMessage {

    /// <summary>
    /// The object reporting the error. This can be used to filter out errors coming from non interesting sources.
    /// </summary>
    public object ErrorReporter { get; internal set; }

    /// <summary>
    /// A short identifier for the reporter of the error, suitable for use in human interfaces. For example "CS" in the case of a C# language error.
    /// </summary>
    public string ErrorReporterIdentifier {
      get { return "Merger"; }
    }

    /// <summary>
    /// The error this message pertains to.
    /// </summary>
    public MergeError Error { get; internal set; }

    /// <summary>
    /// A code that corresponds to this error. This code is the same for all cultures.
    /// </summary>
    public long Code { get; internal set; }

    /// <summary>
    /// True if the error message should be treated as an informational warning rather than as an indication that the associated
    /// merge has failed and no useful executable output has been generated.
    /// </summary>
    public bool IsWarning {
      get { return true; }
    }

    /// <summary>
    /// A description of the error suitable for user interaction. Localized to the current culture.
    /// </summary>
    public string Message {
      get {
        System.Resources.ResourceManager resourceManager = new System.Resources.ResourceManager("Microsoft.Cci.Optimization.AssemblyMerger.ErrorMessages", typeof(ErrorMessage).Assembly);
        string messageKey = this.Error.ToString();
        string/*?*/ localizedString = null;
        try {
          localizedString = resourceManager.GetString(messageKey);
        } catch (System.Resources.MissingManifestResourceException) {
        }
        try {
          if (localizedString == null) {
            localizedString = resourceManager.GetString(messageKey, System.Globalization.CultureInfo.InvariantCulture);
          }
        } catch (System.Resources.MissingManifestResourceException) {
        }
        if (localizedString == null)
          localizedString = messageKey;
        else if (this.MessageParameter != null)
          localizedString = string.Format(localizedString, this.MessageParameter);
        return localizedString;
      }
    }

    /// <summary>
    /// If not null, this strings parameterizes the error message.
    /// </summary>
    public string/*?*/ MessageParameter { get; internal set; }

    /// <summary>
    /// The location of the error.
    /// </summary>
    public ILocation Location { get { return Dummy.Location; } }

    /// <summary>
    /// Zero ore more locations that are related to this error.
    /// </summary>
    public IEnumerable<ILocation> RelatedLocations { get { return Enumerable<ILocation>.Empty; } }
  }

  /// <summary>
  /// An enumeration of errors that can occur during assembly merging.
  /// </summary>
  public enum MergeError {
    /// <summary>
    /// Type {0} is exported from more than one of the merged assemblies. A rename was done to prevent the merged assembly from being invalid.
    /// </summary>
    DuplicateAlias,
    /// <summary>
    /// Global method {0} is exported from more than one of the merged assemblies. A rename was done to prevent the merged assembly from being invalid.
    /// </summary>
    DuplicateGlobalMethod,
    /// <summary>
    /// Global field {0} is exported from more than one of the merged assemblies. A rename was done to prevent the merged assembly from being invalid.
    /// </summary>
    DuplicateGlobalField,
    /// <summary>
    /// Namespace type {0} is exported from more than one of the merged assemblies. A rename was done to prevent the merged assembly from being invalid.
    /// </summary>
    DuplicateType,
  }

}


text:
namespace Azure.ResourceManager.ContainerService.Models
{
    /// <summary> See [AKS custom node configuration](https://docs.microsoft.com/azure/aks/custom-node-configuration) for more details. </summary>
    public partial class LinuxOSConfig
    {
        /// <summary> Initializes a new instance of LinuxOSConfig. </summary>
        public LinuxOSConfig()
        {
        }

        /// <summary> Initializes a new instance of LinuxOSConfig. </summary>
        /// <param name="sysctls"> Sysctl settings for Linux agent nodes. </param>
        /// <param name="transparentHugePageEnabled"> Valid values are 'always', 'madvise', and 'never'. The default is 'always'. For more information see [Transparent Hugepages](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge). </param>
        /// <param name="transparentHugePageDefrag"> Valid values are 'always', 'defer', 'defer+madvise', 'madvise' and 'never'. The default is 'madvise'. For more information see [Transparent Hugepages](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge). </param>
        /// <param name="swapFileSizeInMB"> The size in MB of a swap file that will be created on each node. </param>
        internal LinuxOSConfig(SysctlConfig sysctls, string transparentHugePageEnabled, string transparentHugePageDefrag, int? swapFileSizeInMB)
        {
            Sysctls = sysctls;
            TransparentHugePageEnabled = transparentHugePageEnabled;
            TransparentHugePageDefrag = transparentHugePageDefrag;
            SwapFileSizeInMB = swapFileSizeInMB;
        }

        /// <summary> Sysctl settings for Linux agent nodes. </summary>
        public SysctlConfig Sysctls { get; set; }
        /// <summary> Valid values are 'always', 'madvise', and 'never'. The default is 'always'. For more information see [Transparent Hugepages](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge). </summary>
        public string TransparentHugePageEnabled { get; set; }
        /// <summary> Valid values are 'always', 'defer', 'defer+madvise', 'madvise' and 'never'. The default is 'madvise'. For more information see [Transparent Hugepages](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge). </summary>
        public string TransparentHugePageDefrag { get; set; }
        /// <summary> The size in MB of a swap file that will be created on each node. </summary>
        public int? SwapFileSizeInMB { get; set; }
    }
}


text:
typedef struct list_head list_head_t;

struct list_head {
    list_head_t *prev, *next;
};

#define list_entry(ptr, type, member) containerof(ptr, type, member)
#define list_first(ptr, type, member) list_entry((ptr)->next, type, member)

#define list_is_last(pos, head, member) (&(pos)->member == (head))

#define list_next_unsafe(pos, head, member) list_entry((pos)->member.next, typeof(*pos), member)
#define list_next(pos, head, member) \
  ((pos)->member.next == (head) ? NULL : list_next_unsafe(pos, head, member))

static inline void list_init(list_head_t *entry) {
    entry->next = entry;
    entry->prev = entry;
}

static inline bool list_empty(const list_head_t *head) {
    return head->next == head;
}

static inline bool list_is_singular(const list_head_t *head) {
    return !list_empty(head) && (head->next == head->prev);
}

static inline void list_insert(list_head_t *new, list_head_t *prev, list_head_t *next) {
    next->prev = new;
    new->next = next;
    new->prev = prev;
    prev->next = new;
}

static inline void list_add(list_head_t *new, list_head_t *old) {
    list_insert(new, old, old->next);
}

static inline void list_add_before(list_head_t *new, list_head_t *old) {
    list_insert(new, old->prev, old);
}

static inline void list_join(list_head_t *first, list_head_t *second) {
    first->next = second;
    second->prev = first;
}

static inline void list_replace(list_head_t *old, list_head_t *new) {
    new->next = old->next;
    new->next->prev = new;
    new->prev = old->prev;
    new->prev->next = new;
}

static inline void list_rm(list_head_t *entry) {
    list_join(entry->prev, entry->next);
}

static inline void list_move(list_head_t *entry, list_head_t *head) {
    list_rm(entry);
    list_add(entry, head);
}

static inline void list_move_before(list_head_t *entry, list_head_t *head) {
    list_rm(entry);
    list_add_before(entry, head);
}

static inline void list_rotate_left(list_head_t *head) {
    if (!list_empty(head)) {
        list_move_before(head->next, head);
    }
}

#define LIST_HEAD(name) { &(name), &(name) }
#define DEFINE_LIST(name) list_head_t name = LIST_HEAD(name)

#define LIST_FOR_EACH(pos, head) \
    for (pos = (head)->next; pos != (head); pos = pos->next)
#define LIST_FOR_EACH_ENTRY(pos, head, member) \
    for (pos = list_first(head, typeof(*pos), member); \
        !list_is_last(pos, head, member);              \
        pos = list_next_unsafe(pos, head, member))

typedef struct chain_node chain_node_t;

struct chain_node {
    chain_node_t *next, **pprev;
};

typedef struct chain_head_t {
    chain_node_t *first;
} chain_head_t;

#define chain_entry(ptr, type, member) containerof(ptr,type,member)
#define chain_entry_safe(ptr, type, member) \
    ({ typeof(ptr) ____ptr = (ptr);                         \
       ____ptr ? chain_entry(____ptr, type, member) : NULL; \
    })

static inline void chain_init(chain_head_t *head) {
    head->first = NULL;
}

static inline void chain_init_node(chain_node_t *h) {
    h->next = NULL;
    h->pprev = NULL;
}

static inline bool chain_unhashed(const chain_node_t *h) {
    return !h->pprev;
}

static inline bool chain_empty(const chain_head_t *h) {
    return !h->first;
}

static inline void chain_join(chain_node_t **pprev, chain_node_t *next) {
    *pprev = next;
    if(next) {
        next->pprev = pprev;
    }
}

static inline void chain_rm(chain_node_t *n) {
    chain_join(n->pprev, n->next);
    n->next = NULL;
    n->pprev = NULL;
}

static inline void chain_add_head(chain_node_t *n, chain_head_t *h) {
    chain_node_t *first = h->first;
    n->next = first;
    if(first) {
        first->pprev = &n->next;
    }
    h->first = n;
    n->pprev = &h->first;
}

static inline void chain_add_before(chain_node_t *n, chain_node_t *next) {
    n->pprev = next->pprev;
    n->next = next;
    next->pprev = &n->next;
    *(n->pprev) = n;
}

static inline void chain_add_after(chain_node_t *n, chain_node_t *next) {
    next->next = n->next;
    n->next = next;
    next->pprev = &n->next;

    if(next->next) {
        next->next->pprev = &next->next;
    }
}

static inline void chain_move_list(chain_head_t *old, chain_head_t *new) {
    new->first = old->first;
    if(new->first) {
        new->first->pprev = &new->first;
    }
    old->first = NULL;
}

#define CHAIN_HEAD { .first = NULL }
#define DEFINE_CHAIN(name) chain_head_t name = {  .first = NULL }

#define CHAIN_FOR_EACH(pos, head) \
    for (pos = (head)->first; pos ; pos = pos->next)
#define CHAIN_FOR_EACH_ENTRY(pos, head, member) \
    for (pos = chain_entry_safe((head)->first, typeof(*(pos)), member);      \
         pos;                                                                \
         pos = chain_entry_safe((pos)->member.next, typeof(*(pos)), member))

#endif


text:
<?php

namespace Fisharebest\Webtrees\Census;

/**
 * Definitions for a census
 */
class CensusOfScotland1911 extends CensusOfScotland implements CensusInterface {
	/**
	 * When did this census occur.
	 *
	 * @return string
	 */
	public function censusDate() {
		return '02 APR 1911';
	}

	/**
	 * The columns of the census.
	 *
	 * @return CensusColumnInterface[]
	 */
	public function columns() {
		return array(
			new CensusColumnFullName($this, 'Name', 'Name and surname'),
			new CensusColumnRelationToHead($this, 'Relation', 'Relation to head of household'),
			new CensusColumnAgeMale($this, 'AgeM', 'Age (males)'),
			new CensusColumnAgeFemale($this, 'AgeF', 'Age (females)'),
			new CensusColumnNull($this, 'Lang', 'Language spoken'),
			new CensusColumnConditionEnglish($this, 'Condition', 'Condition'),
			new CensusColumnYearsMarried($this, 'YrM', 'Years married'),
			new CensusColumnChildrenBornAlive($this, 'ChA', 'Children born alive'),
			new CensusColumnChildrenLiving($this, 'ChL', 'Children who are still alive'),
			new CensusColumnChildrenDied($this, 'ChD', 'Children who have died'),
			new CensusColumnOccupation($this, 'Occupation', 'Rank, profession or occupation'),
			new CensusColumnNull($this, 'Ind', 'Industry'),
			new CensusColumnNull($this, 'Emp', 'Employer, worker or own account'),
			new CensusColumnNull($this, 'Home', 'Working at home'),
			new CensusColumnBirthPlace($this, 'Birthplace', 'Where born'),
			new CensusColumnNationality($this, 'Nat', 'Nationality'),
			new CensusColumnNull($this, 'Infirm', 'Infirmity'),
		);
	}
}


text:
<?php

namespace Vct\VpnBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
// use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class TUserNewType extends AbstractType {
	public function buildForm(FormBuilderInterface $builder, array $options) {
		// TODO: Auto-generated method stub
		$builder->add('vpnServerId', 'text');
		$builder->add('email', 'email');
		$builder->add('password', 'password');
// 		$builder->add('registerDate', 'date');
// 		$builder->add('paidDate', 'date');
		$builder->add('paidFee', 'integer');
// 		$builder->add('expireDate', 'date');
// 		$builder->add('expireFlag', 'checkbox');
// 		$builder->add('createTime', 'date');
// 		$builder->add('updateTime', 'date');
	}

	public function getName() {
		// TODO: Auto-generated method stub
		return 'TUserNewType';
	}

	public function setDefaultOptions(OptionsResolverInterface $resolver) {
		$resolver
				->setDefaults(
						array('data_class' => 'Vct\VpnBundle\Entity\TUser',
								'validation_groups' => array('registration')));
	}

}


text:
/*
 * DO NOT EDIT.  THIS FILE IS GENERATED FROM /builds/slave/rel-m-rel-xr-osx64-bld/build/xpcom/components/nsIServiceManager.idl
 */

#ifndef __gen_nsIServiceManager_h__
#define __gen_nsIServiceManager_h__

#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif

/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif

/* starting interface:    nsIServiceManager */
#define NS_ISERVICEMANAGER_IID_STR "8bb35ed9-e332-462d-9155-4a002ab5c958"

#define NS_ISERVICEMANAGER_IID \
  {0x8bb35ed9, 0xe332, 0x462d, \
    { 0x91, 0x55, 0x4a, 0x00, 0x2a, 0xb5, 0xc9, 0x58 }}

class NS_NO_VTABLE NS_SCRIPTABLE nsIServiceManager : public nsISupports {
 public:

  NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISERVICEMANAGER_IID)

  /* void getService (in nsCIDRef aClass, in nsIIDRef aIID, [iid_is (aIID), retval] out nsQIResult result); */
  NS_SCRIPTABLE NS_IMETHOD GetService(const nsCID & aClass, const nsIID & aIID, void **result NS_OUTPARAM) = 0;

  /* void getServiceByContractID (in string aContractID, in nsIIDRef aIID, [iid_is (aIID), retval] out nsQIResult result); */
  NS_SCRIPTABLE NS_IMETHOD GetServiceByContractID(const char * aContractID, const nsIID & aIID, void **result NS_OUTPARAM) = 0;

  /* boolean isServiceInstantiated (in nsCIDRef aClass, in nsIIDRef aIID); */
  NS_SCRIPTABLE NS_IMETHOD IsServiceInstantiated(const nsCID & aClass, const nsIID & aIID, PRBool *_retval NS_OUTPARAM) = 0;

  /* boolean isServiceInstantiatedByContractID (in string aContractID, in nsIIDRef aIID); */
  NS_SCRIPTABLE NS_IMETHOD IsServiceInstantiatedByContractID(const char * aContractID, const nsIID & aIID, PRBool *_retval NS_OUTPARAM) = 0;

};

  NS_DEFINE_STATIC_IID_ACCESSOR(nsIServiceManager, NS_ISERVICEMANAGER_IID)

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSISERVICEMANAGER \
  NS_SCRIPTABLE NS_IMETHOD GetService(const nsCID & aClass, const nsIID & aIID, void **result NS_OUTPARAM); \
  NS_SCRIPTABLE NS_IMETHOD GetServiceByContractID(const char * aContractID, const nsIID & aIID, void **result NS_OUTPARAM); \
  NS_SCRIPTABLE NS_IMETHOD IsServiceInstantiated(const nsCID & aClass, const nsIID & aIID, PRBool *_retval NS_OUTPARAM); \
  NS_SCRIPTABLE NS_IMETHOD IsServiceInstantiatedByContractID(const char * aContractID, const nsIID & aIID, PRBool *_retval NS_OUTPARAM);

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSISERVICEMANAGER(_to) \
  NS_SCRIPTABLE NS_IMETHOD GetService(const nsCID & aClass, const nsIID & aIID, void **result NS_OUTPARAM) { return _to GetService(aClass, aIID, result); } \
  NS_SCRIPTABLE NS_IMETHOD GetServiceByContractID(const char * aContractID, const nsIID & aIID, void **result NS_OUTPARAM) { return _to GetServiceByContractID(aContractID, aIID, result); } \
  NS_SCRIPTABLE NS_IMETHOD IsServiceInstantiated(const nsCID & aClass, const nsIID & aIID, PRBool *_retval NS_OUTPARAM) { return _to IsServiceInstantiated(aClass, aIID, _retval); } \
  NS_SCRIPTABLE NS_IMETHOD IsServiceInstantiatedByContractID(const char * aContractID, const nsIID & aIID, PRBool *_retval NS_OUTPARAM) { return _to IsServiceInstantiatedByContractID(aContractID, aIID, _retval); }

/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSISERVICEMANAGER(_to) \
  NS_SCRIPTABLE NS_IMETHOD GetService(const nsCID & aClass, const nsIID & aIID, void **result NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetService(aClass, aIID, result); } \
  NS_SCRIPTABLE NS_IMETHOD GetServiceByContractID(const char * aContractID, const nsIID & aIID, void **result NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetServiceByContractID(aContractID, aIID, result); } \
  NS_SCRIPTABLE NS_IMETHOD IsServiceInstantiated(const nsCID & aClass, const nsIID & aIID, PRBool *_retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->IsServiceInstantiated(aClass, aIID, _retval); } \
  NS_SCRIPTABLE NS_IMETHOD IsServiceInstantiatedByContractID(const char * aContractID, const nsIID & aIID, PRBool *_retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->IsServiceInstantiatedByContractID(aContractID, aIID, _retval); }

#if 0
/* Use the code below as a template for the implementation class for this interface. */

/* Header file */
class nsServiceManager : public nsIServiceManager
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSISERVICEMANAGER

  nsServiceManager();

private:
  ~nsServiceManager();

protected:
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS1(nsServiceManager, nsIServiceManager)

nsServiceManager::nsServiceManager()
{
  /* member initializers and constructor code */
}

nsServiceManager::~nsServiceManager()
{
  /* destructor code */
}

/* void getService (in nsCIDRef aClass, in nsIIDRef aIID, [iid_is (aIID), retval] out nsQIResult result); */
NS_IMETHODIMP nsServiceManager::GetService(const nsCID & aClass, const nsIID & aIID, void **result NS_OUTPARAM)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void getServiceByContractID (in string aContractID, in nsIIDRef aIID, [iid_is (aIID), retval] out nsQIResult result); */
NS_IMETHODIMP nsServiceManager::GetServiceByContractID(const char * aContractID, const nsIID & aIID, void **result NS_OUTPARAM)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* boolean isServiceInstantiated (in nsCIDRef aClass, in nsIIDRef aIID); */
NS_IMETHODIMP nsServiceManager::IsServiceInstantiated(const nsCID & aClass, const nsIID & aIID, PRBool *_retval NS_OUTPARAM)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* boolean isServiceInstantiatedByContractID (in string aContractID, in nsIIDRef aIID); */
NS_IMETHODIMP nsServiceManager::IsServiceInstantiatedByContractID(const char * aContractID, const nsIID & aIID, PRBool *_retval NS_OUTPARAM)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* End of implementation class template. */
#endif

#define NS_ERROR_SERVICE_NOT_AVAILABLE  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XPCOM, 22)
/**
 * @status DEPRECATED
 */
#define NS_ERROR_SERVICE_NOT_FOUND      NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_XPCOM, 22)
/**
 * @status DEPRECATED
 */
#define NS_ERROR_SERVICE_IN_USE         NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_XPCOM, 23)
// Observing xpcom autoregistration.  Topics will be 'start' and 'stop'.
#define NS_XPCOM_AUTOREGISTRATION_OBSERVER_ID "xpcom-autoregistration"
#ifdef MOZILLA_INTERNAL_API
#include "nsXPCOM.h"
#include "nsComponentManagerUtils.h"
#include "nsServiceManagerUtils.h"
#endif

#endif /* __gen_nsIServiceManager_h__ */


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

    Copyright (c) 1997, 2019 Oracle and/or its affiliates. All rights reserved.

    This program and the accompanying materials are made available under the
    terms of the Eclipse Distribution License v. 1.0, which is available at
    http://www.eclipse.org/org/documents/edl-v10.php.

    SPDX-License-Identifier: BSD-3-Clause

-->

<descriptor since="2.2.6" uses="ri">
    <description>ServerMgr NPE issue for 0.0.0.0 IP dress, #941</description>

</descriptor>