text:
#define pr_fmt(fmt) "AXI: %s(): " fmt, __func__

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/clk.h>
#include <linux/radix-tree.h>
#include "msm_bus_core.h"

enum {
	DISABLE,
	ENABLE,
};

/**
 * msm_bus_fabric_add_node() - Add a node to the fabric structure
 * @fabric: Fabric device to which the node should be added
 * @info: The node to be added
 */
static int msm_bus_fabric_add_node(struct msm_bus_fabric *fabric,
	struct msm_bus_inode_info *info)
{
	int status = -ENOMEM, ctx;
	MSM_BUS_DBG("msm_bus_fabric_add_node: ID %d Gw: %d\n",
		info->node_info->priv_id, info->node_info->gateway);
	status = radix_tree_preload(GFP_ATOMIC);
	if (status)
		goto out;

	status = radix_tree_insert(&fabric->fab_tree, info->node_info->priv_id,
			info);
	radix_tree_preload_end();
	if (IS_SLAVE(info->node_info->priv_id))
		radix_tree_tag_set(&fabric->fab_tree, info->node_info->priv_id,
			SLAVE_NODE);

	for (ctx = 0; ctx < NUM_CTX; ctx++) {
		if (info->node_info->slaveclk[ctx]) {
			radix_tree_tag_set(&fabric->fab_tree,
				info->node_info->priv_id, CLK_NODE);
			break;
		}

		info->nodeclk[ctx].enable = false;
		info->nodeclk[ctx].dirty = false;
	}

	if (info->node_info->nr_lim) {
		int iid = msm_bus_board_get_iid(info->node_info->id);
		struct msm_bus_fabric_device *fabdev =
			msm_bus_get_fabric_device(GET_FABID(iid));

		if (!fabdev)
			BUG_ON(1);

		radix_tree_tag_set(&fabric->fab_tree,
			info->node_info->priv_id, MASTER_NODE);

		fabdev->num_nr_lim++;
		MSM_BUS_ERR("%s: Adding %d There are %d nodes", __func__,
				info->node_info->id, fabdev->num_nr_lim);
	}
out:
	return status;
}

/**
 * msm_bus_add_fab() - Add a fabric (gateway) to the current fabric
 * @fabric: Fabric device to which the gateway info should be added
 * @info: Gateway node to be added to the fabric
 */
static int msm_bus_fabric_add_fab(struct msm_bus_fabric *fabric,
	struct msm_bus_inode_info *info)
{
	struct msm_bus_fabnodeinfo *fabnodeinfo;
	MSM_BUS_DBG("msm_bus_fabric_add_fab: ID %d Gw: %d\n",
		info->node_info->priv_id, info->node_info->gateway);
	fabnodeinfo = kzalloc(sizeof(struct msm_bus_fabnodeinfo), GFP_KERNEL);
	if (fabnodeinfo == NULL) {
		MSM_FAB_ERR("msm_bus_fabric_add_fab: "
			"No Node Info\n");
		MSM_FAB_ERR("axi: Cannot register fabric!\n");
		return -ENOMEM;
	}

	fabnodeinfo->info = info;
	fabnodeinfo->info->num_pnodes = -1;
	list_add_tail(&fabnodeinfo->list, &fabric->gateways);
	return 0;
}

/**
 * register_fabric_info() - Create the internal fabric structure and
 * build the topology tree from platform specific data
 * @pdev: Platform device for getting base addresses
 * @fabric: Fabric to which the gateways, nodes should be added
 *
 * This function is called from probe. Iterates over the platform data,
 * and builds the topology
 */
static int register_fabric_info(struct platform_device *pdev,
	struct msm_bus_fabric *fabric)
{
	int i = 0, ret = 0, err = 0;

	MSM_BUS_DBG("id:%d pdata-id: %d len: %d\n", fabric->fabdev.id,
		fabric->pdata->id, fabric->pdata->len);
	fabric->hw_data = fabric->fabdev.hw_algo.allocate_hw_data(pdev,
		fabric->pdata);
	if (ZERO_OR_NULL_PTR(fabric->hw_data) && fabric->pdata->ahb == 0) {
		MSM_BUS_ERR("Couldn't allocate hw_data for fab: %d\n",
			fabric->fabdev.id);
		goto error;
	}

	for (i = 0; i < fabric->pdata->len; i++) {
		struct msm_bus_inode_info *info;
		int ctx, j;

		info = kzalloc(sizeof(struct msm_bus_inode_info), GFP_KERNEL);
		if (info == NULL) {
			MSM_BUS_ERR("Error allocating info\n");
			return -ENOMEM;
		}

		info->node_info = fabric->pdata->info + i;
		info->commit_index = -1;
		info->num_pnodes = -1;

		for (ctx = 0; ctx < NUM_CTX; ctx++) {
			if (info->node_info->slaveclk[ctx]) {
				info->nodeclk[ctx].clk = clk_get_sys("msm_bus",
					info->node_info->slaveclk[ctx]);
				if (IS_ERR(info->nodeclk[ctx].clk)) {
					MSM_BUS_ERR("Couldn't get clk %s\n",
						info->node_info->slaveclk[ctx]);
					err = -EINVAL;
				}
				info->nodeclk[ctx].enable = false;
				info->nodeclk[ctx].dirty = false;
			}

			if (info->node_info->memclk[ctx]) {
				info->memclk[ctx].clk = clk_get_sys("msm_bus",
						info->node_info->memclk[ctx]);
				if (IS_ERR(info->memclk[ctx].clk)) {
					MSM_BUS_ERR("Couldn't get clk %s\n",
						info->node_info->memclk[ctx]);
					err = -EINVAL;
				}
				info->memclk[ctx].enable = false;
				info->memclk[ctx].dirty = false;
			}
		}

		if (info->node_info->iface_clk_node) {
			info->iface_clk.clk = clk_get_sys(info->node_info->
				iface_clk_node, "iface_clk");
			if (IS_ERR(info->iface_clk.clk)) {
				MSM_BUS_ERR("ERR: Couldn't get clk %s\n",
					info->node_info->iface_clk_node);
			}
		}

		ret = info->node_info->gateway ?
			msm_bus_fabric_add_fab(fabric, info) :
			msm_bus_fabric_add_node(fabric, info);
		if (ret) {
			MSM_BUS_ERR("Unable to add node info, ret: %d\n", ret);
			kfree(info);
			goto error;
		}

		if (fabric->fabdev.hw_algo.node_init == NULL)
			continue;

		if (info->iface_clk.clk) {
			MSM_BUS_DBG("Enabled iface clock for node init: %d\n",
				info->node_info->priv_id);
			clk_prepare_enable(info->iface_clk.clk);
		}

		for (j = 0; j < NUM_CTX; j++)
			clk_prepare_enable(fabric->info.nodeclk[j].clk);

		fabric->fabdev.hw_algo.node_init(fabric->hw_data, info);
		if (ret) {
			MSM_BUS_ERR("Unable to init node info, ret: %d\n", ret);
			kfree(info);
		}

		for (j = 0; j < NUM_CTX; j++)
			clk_disable_unprepare(fabric->info.nodeclk[j].clk);

		if (info->iface_clk.clk) {
			MSM_BUS_DBG("Disable iface_clk after node init: %d\n",
				info->node_info->priv_id);
			clk_disable_unprepare(info->iface_clk.clk);
		}

	}

	MSM_BUS_DBG("Fabric: %d nmasters: %d nslaves: %d\n"
		" ntieredslaves: %d, rpm_enabled: %d\n",
		fabric->fabdev.id, fabric->pdata->nmasters,
		fabric->pdata->nslaves, fabric->pdata->ntieredslaves,
		fabric->pdata->rpm_enabled);
	MSM_BUS_DBG("msm_bus_register_fabric_info i: %d\n", i);
	fabric->num_nodes = fabric->pdata->len;
error:
	fabric->num_nodes = i;
	msm_bus_dbg_commit_data(fabric->fabdev.name, NULL, 0, 0, 0,
		MSM_BUS_DBG_REGISTER);
	return ret | err;
}

/**
 * msm_bus_fabric_update_clks() - Set the clocks for fabrics and slaves
 * @fabric: Fabric for which the clocks need to be updated
 * @slave: The node for which the clocks need to be updated
 * @index: The index for which the current clocks are set
 * @curr_clk_hz:Current clock value
 * @req_clk_hz: Requested clock value
 * @bwsum: Bandwidth Sum
 * @clk_flag: Flag determining whether fabric clock or the slave clock has to
 * be set. If clk_flag is set, fabric clock is set, else slave clock is set.
 */
static int msm_bus_fabric_update_clks(struct msm_bus_fabric_device *fabdev,
		struct msm_bus_inode_info *slave, int index,
		uint64_t curr_clk_hz, uint64_t req_clk_hz,
		uint64_t bwsum_hz, int clk_flag, int ctx,
		unsigned int cl_active_flag)
{
	int i, status = 0;
	uint64_t max_pclk = 0, rate;
	uint64_t *pclk = NULL;
	struct msm_bus_fabric *fabric = to_msm_bus_fabric(fabdev);
	struct nodeclk *nodeclk;

	/**
	 * Integration for clock rates is not required if context is not
	 * same as client's active-only flag
	 */
	if (ctx != cl_active_flag)
		goto skip_set_clks;

	/* Maximum for this gateway */
	for (i = 0; i <= slave->num_pnodes; i++) {
		if (i == index && (req_clk_hz < curr_clk_hz))
			continue;
		slave->pnode[i].sel_clk = &slave->pnode[i].clk[ctx];
		max_pclk = max(max_pclk, *slave->pnode[i].sel_clk);
	}

	*slave->link_info.sel_clk =
		max(max_pclk, max(bwsum_hz, req_clk_hz));
	/* Is this gateway or slave? */
	if (clk_flag && (!fabric->ahb)) {
		struct msm_bus_fabnodeinfo *fabgw = NULL;
		struct msm_bus_inode_info *info = NULL;
		/* Maximum of all gateways set at fabric */
		list_for_each_entry(fabgw, &fabric->gateways, list) {
			info = fabgw->info;
			if (!info)
				continue;
			info->link_info.sel_clk = &info->link_info.clk[ctx];
			max_pclk = max(max_pclk, *info->link_info.sel_clk);
		}
		MSM_BUS_DBG("max_pclk from gateways: %llu\n", max_pclk);

		/* Maximum of all slave clocks. */

		for (i = 0; i < fabric->pdata->len; i++) {
			if (fabric->pdata->info[i].gateway ||
				(fabric->pdata->info[i].id < SLAVE_ID_KEY))
				continue;
			info = radix_tree_lookup(&fabric->fab_tree,
				fabric->pdata->info[i].priv_id);
			if (!info)
				continue;
			info->link_info.sel_clk = &info->link_info.clk[ctx];
			max_pclk = max(max_pclk, *info->link_info.sel_clk);
		}

		MSM_BUS_DBG("max_pclk from slaves & gws: %llu\n", max_pclk);
		fabric->info.link_info.sel_clk =
			&fabric->info.link_info.clk[ctx];
		pclk = fabric->info.link_info.sel_clk;
	} else {
		slave->link_info.sel_clk = &slave->link_info.clk[ctx];
		pclk = slave->link_info.sel_clk;
	}

	*pclk = max(max_pclk, max(bwsum_hz, req_clk_hz));

	if (!fabric->pdata->rpm_enabled)
		goto skip_set_clks;

	if (clk_flag) {
		nodeclk = &fabric->info.nodeclk[ctx];
		if (nodeclk->clk) {
			MSM_BUS_DBG("clks: id: %d set-clk: %llu bws_hz:%llu\n",
			fabric->fabdev.id, *pclk, bwsum_hz);
			if (nodeclk->rate != *pclk) {
				nodeclk->dirty = true;
				nodeclk->rate = *pclk;
			}
			fabric->clk_dirty = true;
		}
	} else {
		nodeclk = &slave->nodeclk[ctx];
		if (nodeclk->clk) {
			rate = *pclk;
			MSM_BUS_DBG("clks: id: %d set-clk: %llu bws_hz: %llu\n",
				slave->node_info->priv_id, rate,
			bwsum_hz);
			if (nodeclk->rate != rate) {
				nodeclk->dirty = true;
				nodeclk->rate = rate;
			}
		}
		if (!status && slave->memclk[ctx].clk) {
			rate = *slave->link_info.sel_clk;
			if (slave->memclk[ctx].rate != rate) {
				slave->memclk[ctx].rate = rate;
				slave->memclk[ctx].dirty = true;
			}
			slave->memclk[ctx].rate = rate;
			fabric->clk_dirty = true;
		}
	}
skip_set_clks:
	return status;
}

void msm_bus_fabric_update_bw(struct msm_bus_fabric_device *fabdev,
	struct msm_bus_inode_info *hop, struct msm_bus_inode_info *info,
	int64_t add_bw, int *master_tiers, int ctx)
{
	struct msm_bus_fabric *fabric = to_msm_bus_fabric(fabdev);
	void *sel_cdata;
	long rounded_rate, cur_rate;

	sel_cdata = fabric->cdata[ctx];

	/* If it's an ahb fabric, don't calculate arb values */
	if (fabric->ahb) {
		MSM_BUS_DBG("AHB fabric, skipping bw calculation\n");
		return;
	}
	if (!add_bw) {
		MSM_BUS_DBG("No bandwidth delta. Skipping commit\n");
		return;
	}

	/* Enable clocks before accessing QoS registers */
	if (fabric->info.nodeclk[DUAL_CTX].clk) {
		if (fabric->info.nodeclk[DUAL_CTX].rate == 0) {
			cur_rate = clk_get_rate(
					fabric->info.nodeclk[DUAL_CTX].clk);
			rounded_rate = clk_round_rate(
					fabric->info.nodeclk[DUAL_CTX].clk,
					cur_rate ? cur_rate : 1);
		if (clk_set_rate(fabric->info.nodeclk[DUAL_CTX].clk,
				rounded_rate))
			MSM_BUS_ERR("Error: clk: en: Node: %d rate: %ld",
				fabric->fabdev.id, rounded_rate);

		clk_prepare_enable(fabric->info.nodeclk[DUAL_CTX].clk);
		}
	}

	if (info->iface_clk.clk)
		clk_prepare_enable(info->iface_clk.clk);

	if (hop->iface_clk.clk)
		clk_prepare_enable(hop->iface_clk.clk);

	fabdev->hw_algo.update_bw(hop, info, fabric->pdata, sel_cdata,
		master_tiers, add_bw);

	/* Disable clocks after accessing QoS registers */
	if (fabric->info.nodeclk[DUAL_CTX].clk &&
			fabric->info.nodeclk[DUAL_CTX].rate == 0)
		clk_disable_unprepare(fabric->info.nodeclk[DUAL_CTX].clk);

	if (info->iface_clk.clk) {
		MSM_BUS_DBG("Commented: Will disable clock for info: %d\n",
			info->node_info->priv_id);
		clk_disable_unprepare(info->iface_clk.clk);
	}

	if (hop->iface_clk.clk) {
		MSM_BUS_DBG("Commented Will disable clock for hop: %d\n",
			hop->node_info->priv_id);
		clk_disable_unprepare(hop->iface_clk.clk);
	}

	fabric->arb_dirty = true;
}

static int msm_bus_fabric_clk_set(int enable, struct msm_bus_inode_info *info)
{
	int i, status = 0;
	long rounded_rate;

	for (i = 0; i < NUM_CTX; i++) {
		if (info->nodeclk[i].dirty) {
			if (info->nodeclk[i].rate != 0) {
				rounded_rate = clk_round_rate(info->
					nodeclk[i].clk, info->nodeclk[i].rate);
				status = clk_set_rate(info->nodeclk[i].clk,
					rounded_rate);
				MSM_BUS_DBG("AXI: node: %d set_rate: %ld\n",
					info->node_info->id, rounded_rate);
			}

			if (enable && !(info->nodeclk[i].enable)) {
				clk_prepare_enable(info->nodeclk[i].clk);
				info->nodeclk[i].dirty = false;
				info->nodeclk[i].enable = true;
			} else if ((info->nodeclk[i].rate == 0) && (!enable)
				&& (info->nodeclk[i].enable)) {
				clk_disable_unprepare(info->nodeclk[i].clk);
				info->nodeclk[i].dirty = false;
				info->nodeclk[i].enable = false;
			}
		}

		if (info->memclk[i].dirty) {
			if (info->nodeclk[i].rate != 0) {
				rounded_rate = clk_round_rate(info->
					memclk[i].clk, info->memclk[i].rate);
				status = clk_set_rate(info->memclk[i].clk,
					rounded_rate);
				MSM_BUS_DBG("AXI: node: %d set_rate: %ld\n",
					info->node_info->id, rounded_rate);
			}

			if (enable && !(info->memclk[i].enable)) {
				clk_prepare_enable(info->memclk[i].clk);
				info->memclk[i].dirty = false;
				info->memclk[i].enable = true;
			} else if (info->memclk[i].rate == 0 && (!enable) &&
				(info->memclk[i].enable)) {
				clk_disable_unprepare(info->memclk[i].clk);
				info->memclk[i].dirty = false;
				info->memclk[i].enable = false;
			}
		}
	}

	return status;
}

/**
 * msm_bus_fabric_clk_commit() - Call clock enable and update clock
 * values.
*/
static int msm_bus_fabric_clk_commit(int enable, struct msm_bus_fabric *fabric)
{
	unsigned int i, nfound = 0, status = 0;
	struct msm_bus_inode_info *info[fabric->pdata->nslaves];

	if (fabric->clk_dirty == true)
		status = msm_bus_fabric_clk_set(enable, &fabric->info);

	if (status)
		MSM_BUS_WARN("Error setting clocks on fabric: %d\n",
			fabric->fabdev.id);

	nfound = radix_tree_gang_lookup_tag(&fabric->fab_tree, (void **)&info,
		fabric->fabdev.id, fabric->pdata->nslaves, CLK_NODE);
	if (nfound == 0) {
		MSM_BUS_DBG("No clock nodes found for fabric: %d\n",
			fabric->fabdev.id);
		goto out;
	}

	for (i = 0; i < nfound; i++) {
		status = msm_bus_fabric_clk_set(enable, info[i]);
		if (status)
			MSM_BUS_WARN("Error setting clocks for node: %d\n",
				info[i]->node_info->id);
	}

out:
	return status;
}

static void msm_bus_fabric_config_limiter(
	struct msm_bus_fabric_device *fabdev,
	struct msm_bus_inode_info *info)
{
	struct msm_bus_fabric *fabric = to_msm_bus_fabric(fabdev);
	long rounded_rate, cur_rate;

	if (fabdev->hw_algo.config_limiter == NULL)
		return;

	/* Enable clocks before accessing QoS registers */
	if (fabric->info.nodeclk[DUAL_CTX].clk) {
		if (fabric->info.nodeclk[DUAL_CTX].rate == 0) {
			cur_rate = clk_get_rate(
					fabric->info.nodeclk[DUAL_CTX].clk);
			rounded_rate = clk_round_rate(
					fabric->info.nodeclk[DUAL_CTX].clk,
					cur_rate ? cur_rate : 1);
		if (clk_set_rate(fabric->info.nodeclk[DUAL_CTX].clk,
				rounded_rate))
			MSM_BUS_ERR("Error: clk: en: Node: %d rate: %ld",
				fabric->fabdev.id, rounded_rate);

		clk_prepare_enable(fabric->info.nodeclk[DUAL_CTX].clk);
		}
	}

	if (info->iface_clk.clk)
		clk_prepare_enable(info->iface_clk.clk);

	fabdev->hw_algo.config_limiter(fabric->pdata, info);

	/* Disable clocks after accessing QoS registers */
	if (fabric->info.nodeclk[DUAL_CTX].clk &&
			fabric->info.nodeclk[DUAL_CTX].rate == 0)
		clk_disable_unprepare(fabric->info.nodeclk[DUAL_CTX].clk);

	if (info->iface_clk.clk) {
		MSM_BUS_DBG("Commented: Will disable clock for info: %d\n",
			info->node_info->priv_id);
		clk_disable_unprepare(info->iface_clk.clk);
	}
}

static void msm_bus_fabric_config_master(
	struct msm_bus_fabric_device *fabdev,
	struct msm_bus_inode_info *info, uint64_t req_clk, uint64_t req_bw)
{
	struct msm_bus_fabric *fabric = to_msm_bus_fabric(fabdev);
	long rounded_rate, cur_rate;

	if (fabdev->hw_algo.config_master == NULL)
		return;

	/* Enable clocks before accessing QoS registers */
	if (fabric->info.nodeclk[DUAL_CTX].clk) {
		if (fabric->info.nodeclk[DUAL_CTX].rate == 0) {
			cur_rate = clk_get_rate(
					fabric->info.nodeclk[DUAL_CTX].clk);
			rounded_rate = clk_round_rate(
					fabric->info.nodeclk[DUAL_CTX].clk,
					cur_rate ? cur_rate : 1);
		if (clk_set_rate(fabric->info.nodeclk[DUAL_CTX].clk,
				rounded_rate))
			MSM_BUS_ERR("Error: clk: en: Node: %d rate: %ld",
				fabric->fabdev.id, rounded_rate);

		clk_prepare_enable(fabric->info.nodeclk[DUAL_CTX].clk);
		}
	}

	if (info->iface_clk.clk)
		clk_prepare_enable(info->iface_clk.clk);

	fabdev->hw_algo.config_master(fabric->pdata, info, req_clk, req_bw);

	/* Disable clocks after accessing QoS registers */
	if (fabric->info.nodeclk[DUAL_CTX].clk &&
			fabric->info.nodeclk[DUAL_CTX].rate == 0)
		clk_disable_unprepare(fabric->info.nodeclk[DUAL_CTX].clk);

	if (info->iface_clk.clk) {
		MSM_BUS_DBG("Commented: Will disable clock for info: %d\n",
			info->node_info->priv_id);
		clk_disable_unprepare(info->iface_clk.clk);
	}
}

/**
 * msm_bus_fabric_hw_commit() - Commit the arbitration data to Hardware.
 * @fabric: Fabric for which the data should be committed
 * */
static int msm_bus_fabric_hw_commit(struct msm_bus_fabric_device *fabdev)
{
	int status = 0;
	struct msm_bus_fabric *fabric = to_msm_bus_fabric(fabdev);

	/*
	 * For a non-zero bandwidth request, clocks should be enabled before
	 * sending the arbitration data to RPM, but should be disabled only
	 * after commiting the data.
	 */
	status = msm_bus_fabric_clk_commit(ENABLE, fabric);
	if (status)
		MSM_BUS_DBG("Error setting clocks on fabric: %d\n",
			fabric->fabdev.id);

	if (!fabric->arb_dirty) {
		MSM_BUS_DBG("Not committing as fabric not arb_dirty\n");
		goto skip_arb;
	}

	status = fabdev->hw_algo.commit(fabric->pdata, fabric->hw_data,
		(void **)fabric->cdata);
	if (status)
		MSM_BUS_DBG("Error committing arb data for fabric: %d\n",
			fabric->fabdev.id);

	fabric->arb_dirty = false;
skip_arb:
	/*
	 * If the bandwidth request is 0 for a fabric, the clocks
	 * should be disabled after arbitration data is committed.
	 */
	status = msm_bus_fabric_clk_commit(DISABLE, fabric);
	if (status)
		MSM_BUS_WARN("Error disabling clocks on fabric: %d\n",
			fabric->fabdev.id);
	fabric->clk_dirty = false;
	return status;
}

/**
 * msm_bus_fabric_port_halt() - Used to halt a master port
 * @fabric: Fabric on which the current master node is present
 * @portid: Port id of the master
 */
int msm_bus_fabric_port_halt(struct msm_bus_fabric_device *fabdev, int iid)
{
	struct msm_bus_inode_info *info = NULL;
	uint8_t mport;
	uint32_t haltid = 0;
	struct msm_bus_fabric *fabric = to_msm_bus_fabric(fabdev);

	info = fabdev->algo->find_node(fabdev, iid);
	if (!info) {
		MSM_BUS_ERR("Error: Info not found for id: %u", iid);
		return -EINVAL;
	}

	haltid = fabric->pdata->haltid;
	mport = info->node_info->masterp[0];

	return fabdev->hw_algo.port_halt(haltid, mport);
}

/**
 * msm_bus_fabric_port_unhalt() - Used to unhalt a master port
 * @fabric: Fabric on which the current master node is present
 * @portid: Port id of the master
 */
int msm_bus_fabric_port_unhalt(struct msm_bus_fabric_device *fabdev, int iid)
{
	struct msm_bus_inode_info *info = NULL;
	uint8_t mport;
	uint32_t haltid = 0;
	struct msm_bus_fabric *fabric = to_msm_bus_fabric(fabdev);

	info = fabdev->algo->find_node(fabdev, iid);
	if (!info) {
		MSM_BUS_ERR("Error: Info not found for id: %u", iid);
		return -EINVAL;
	}

	haltid = fabric->pdata->haltid;
	mport = info->node_info->masterp[0];
	return fabdev->hw_algo.port_unhalt(haltid, mport);
}

/**
 * msm_bus_fabric_find_gw_node() - This function finds the gateway node
 * attached on a given fabric
 * @id:       ID of the gateway node
 * @fabric:   Fabric to find the gateway node on
 * Function returns: Pointer to the gateway node
 */
static struct msm_bus_inode_info *msm_bus_fabric_find_gw_node(struct
	msm_bus_fabric_device * fabdev, int id)
{
	struct msm_bus_inode_info *info = NULL;
	struct msm_bus_fabnodeinfo *fab;
	struct msm_bus_fabric *fabric;
	if (!fabdev) {
		MSM_BUS_ERR("No fabric device found!\n");
		return NULL;
	}

	fabric = to_msm_bus_fabric(fabdev);
	if (!fabric || IS_ERR(fabric)) {
		MSM_BUS_ERR("No fabric type found!\n");
		return NULL;
	}
	list_for_each_entry(fab, &fabric->gateways, list) {
		if (fab->info->node_info->priv_id == id) {
			info = fab->info;
			break;
		}
	}

	return info;
}

static struct msm_bus_inode_info *msm_bus_fabric_find_node(struct
	msm_bus_fabric_device * fabdev, int id)
{
	struct msm_bus_inode_info *info = NULL;
	struct msm_bus_fabric *fabric = to_msm_bus_fabric(fabdev);
	info = radix_tree_lookup(&fabric->fab_tree, id);
	if (!info)
		MSM_BUS_ERR("Null info found for id %d\n", id);
	return info;
}

static struct list_head *msm_bus_fabric_get_gw_list(struct msm_bus_fabric_device
	*fabdev)
{
	struct msm_bus_fabric *fabric = to_msm_bus_fabric(fabdev);
	if (!fabric || IS_ERR(fabric)) {
		MSM_BUS_ERR("No fabric found from fabdev\n");
		return NULL;
	}
	return &fabric->gateways;

}
static struct msm_bus_fab_algorithm msm_bus_algo = {
	.update_clks = msm_bus_fabric_update_clks,
	.update_bw = msm_bus_fabric_update_bw,
	.port_halt = msm_bus_fabric_port_halt,
	.port_unhalt = msm_bus_fabric_port_unhalt,
	.commit = msm_bus_fabric_hw_commit,
	.find_node = msm_bus_fabric_find_node,
	.find_gw_node = msm_bus_fabric_find_gw_node,
	.get_gw_list = msm_bus_fabric_get_gw_list,
	.config_master = msm_bus_fabric_config_master,
	.config_limiter = msm_bus_fabric_config_limiter,
};

static int msm_bus_fabric_hw_init(struct msm_bus_fabric_registration *pdata,
	struct msm_bus_hw_algorithm *hw_algo)
{
	int ret = 0;

	switch (pdata->hw_sel) {
	case MSM_BUS_NOC:
		msm_bus_noc_hw_init(pdata, hw_algo);
		break;
	case MSM_BUS_BIMC:
		msm_bus_bimc_hw_init(pdata, hw_algo);
		break;
	default:
		ret = msm_bus_rpm_hw_init(pdata, hw_algo);
		if (ret) {
			MSM_BUS_ERR("RPM initialization failed\n");
			ret = -EINVAL;
		}
		break;
	}
	return ret;
}

static int msm_bus_fabric_probe(struct platform_device *pdev)
{
	int ctx, ret = 0;
	struct msm_bus_fabric *fabric;
	struct msm_bus_fabric_registration *pdata;

	fabric = kzalloc(sizeof(struct msm_bus_fabric), GFP_KERNEL);
	if (!fabric) {
		MSM_BUS_ERR("Fabric alloc failed\n");
		return -ENOMEM;
	}

	INIT_LIST_HEAD(&fabric->gateways);
	INIT_RADIX_TREE(&fabric->fab_tree, GFP_ATOMIC);
	fabric->num_nodes = 0;
	fabric->fabdev.visited = false;

	fabric->info.node_info = kzalloc(sizeof(struct msm_bus_node_info),
				GFP_KERNEL);
	if (ZERO_OR_NULL_PTR(fabric->info.node_info)) {
		MSM_BUS_ERR("Fabric node info alloc failed\n");
		kfree(fabric);
		return -ENOMEM;
	}

	fabric->info.num_pnodes = -1;
	fabric->info.link_info.clk[DUAL_CTX] = 0;
	fabric->info.link_info.bw[DUAL_CTX] = 0;
	fabric->info.link_info.clk[ACTIVE_CTX] = 0;
	fabric->info.link_info.bw[ACTIVE_CTX] = 0;

	/* If possible, get pdata from device-tree */
	if (pdev->dev.of_node) {
		pdata = msm_bus_of_get_fab_data(pdev);
		if (IS_ERR(pdata) || ZERO_OR_NULL_PTR(pdata)) {
			pr_err("Null platform data\n");
			kfree(fabric->info.node_info);
			kfree(fabric);
			return PTR_ERR(pdata);
		}
		msm_bus_board_init(pdata);
		fabric->fabdev.id = pdata->id;
		msm_bus_of_get_nfab(pdev, pdata);
	} else {
		pdata = (struct msm_bus_fabric_registration *)pdev->
			dev.platform_data;
		fabric->fabdev.id = pdev->id;
	}

	fabric->fabdev.name = pdata->name;
	fabric->fabdev.nr_lim_thresh = pdata->nr_lim_thresh;
	fabric->fabdev.eff_fact = pdata->eff_fact;
	fabric->fabdev.algo = &msm_bus_algo;
	fabric->info.node_info->priv_id = fabric->fabdev.id;
	fabric->info.node_info->id = fabric->fabdev.id;
	ret = msm_bus_fabric_hw_init(pdata, &fabric->fabdev.hw_algo);
	if (ret) {
		MSM_BUS_ERR("Error initializing hardware for fabric: %d\n",
			fabric->fabdev.id);
		goto err;
	}

	fabric->ahb = pdata->ahb;
	fabric->pdata = pdata;
	fabric->pdata->board_algo->assign_iids(fabric->pdata,
		fabric->fabdev.id);
	fabric->fabdev.board_algo = fabric->pdata->board_algo;

	/*
	 * clk and bw for fabric->info will contain the max bw and clk
	 * it will allow. This info will come from the boards file.
	 */
	ret = msm_bus_fabric_device_register(&fabric->fabdev);
	if (ret) {
		MSM_BUS_ERR("Error registering fabric %d ret %d\n",
			fabric->fabdev.id, ret);
		goto err;
	}

	for (ctx = 0; ctx < NUM_CTX; ctx++) {
		if (pdata->fabclk[ctx]) {
			fabric->info.nodeclk[ctx].clk = clk_get(
				&fabric->fabdev.dev, pdata->fabclk[ctx]);
			if (IS_ERR(fabric->info.nodeclk[ctx].clk)) {
				MSM_BUS_ERR("Couldn't get clock %s\n",
					pdata->fabclk[ctx]);
				ret = -EINVAL;
				goto err;
			}
			fabric->info.nodeclk[ctx].enable = false;
			fabric->info.nodeclk[ctx].dirty = false;
		}
	}

	/* Find num. of slaves, masters, populate gateways, radix tree */
	ret = register_fabric_info(pdev, fabric);
	if (ret) {
		MSM_BUS_ERR("Could not register fabric %d info, ret: %d\n",
			fabric->fabdev.id, ret);
		goto err;
	}
	if (!fabric->ahb) {
		/* Allocate memory for commit data */
		for (ctx = 0; ctx < NUM_CTX; ctx++) {
			ret = fabric->fabdev.hw_algo.allocate_commit_data(
				fabric->pdata, &fabric->cdata[ctx], ctx);
			if (ret) {
				MSM_BUS_ERR("Failed to alloc commit data for "
					"fab: %d, ret = %d\n",
					fabric->fabdev.id, ret);
				goto err;
			}
		}
	}

	if (msmbus_coresight_init(pdev))
		pr_warn("Coresight support absent for bus: %d\n", pdata->id);

	return ret;
err:
	kfree(fabric->info.node_info);
	kfree(fabric);
	return ret;
}

static int msm_bus_fabric_remove(struct platform_device *pdev)
{
	struct msm_bus_fabric_device *fabdev = NULL;
	struct msm_bus_fabric *fabric;
	int i;
	int ret = 0;

	fabdev = platform_get_drvdata(pdev);
	msmbus_coresight_remove(pdev);
	msm_bus_fabric_device_unregister(fabdev);
	fabric = to_msm_bus_fabric(fabdev);
	msm_bus_dbg_commit_data(fabric->fabdev.name, NULL, 0, 0, 0,
		MSM_BUS_DBG_UNREGISTER);
	for (i = 0; i < fabric->pdata->nmasters; i++)
		radix_tree_delete(&fabric->fab_tree, fabric->fabdev.id + i);
	for (i = (fabric->fabdev.id + SLAVE_ID_KEY); i <
		fabric->pdata->nslaves; i++)
		radix_tree_delete(&fabric->fab_tree, i);
	if (!fabric->ahb) {
		fabdev->hw_algo.free_commit_data(fabric->cdata[DUAL_CTX]);
		fabdev->hw_algo.free_commit_data(fabric->cdata[ACTIVE_CTX]);
	}

	kfree(fabric->info.node_info);
	kfree(fabric->hw_data);
	kfree(fabric);
	return ret;
}

static struct of_device_id fabric_match[] = {
	{.compatible = "msm-bus-fabric"},
	{}
};

static struct platform_driver msm_bus_fabric_driver = {
	.probe = msm_bus_fabric_probe,
	.remove = msm_bus_fabric_remove,
	.driver = {
		.name = "msm_bus_fabric",
		.owner = THIS_MODULE,
		.of_match_table = fabric_match,
	},
};

int __init msm_bus_fabric_init_driver(void)
{
	static bool initialized;

	if (initialized)
		return 0;
	else
		initialized = true;

	MSM_BUS_ERR("msm_bus_fabric_init_driver\n");
	msm_bus_arb_setops_legacy(&arb_ops);
	return platform_driver_register(&msm_bus_fabric_driver);
}
EXPORT_SYMBOL(msm_bus_fabric_init_driver);
subsys_initcall(msm_bus_fabric_init_driver);


text:
'use strict'

// This file should be ignored because it is in a middleware directory and has a star suffix
module.exports = function(app, middlewares, routeMiddlewares) {
	return function(req, res, next) {
		res.locals.stack.push('get ^auth/*')
		next()
	}
}

redpajama_set_name: RedPajamaGithub


text:
FOUNDATION_EXPORT double SACodedTextFieldVersionNumber;

//! Project version string for SACodedTextField.
FOUNDATION_EXPORT const unsigned char SACodedTextFieldVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <SACodedTextField/PublicHeader.h>


text:
namespace Vulcan.Core.Auth.Models.Enums
{
    public enum ApiUserType
    {
        Internal = 0,
        External = 1
    }
}


text:
'''
Created by auto_sdk on 2016.01.05
'''
from top.api.base import RestApi
class TbkItemInfoGetRequest(RestApi):
	def __init__(self,domain='gw.api.taobao.com',port=80):
		RestApi.__init__(self,domain, port)
		self.fields = None
		self.num_iids = None
		self.platform = None

	def getapiname(self):
		return 'taobao.tbk.item.info.get'


text:
<?php

namespace xtracode\image\behaviors;

use xtracode\image\models\Image;
use Imagine\Image\Box;
use Imagine\Image\Point;
use yii;
use yii\base\Behavior;
use yii\db\ActiveRecord;
use yii\helpers\Inflector;

class ImageBehavior extends Behavior
{
    /**
     * Single image file
     * @var
     */
    public $image;

    /**
     * Multiple image file
     * @var
     */
    public $images;

    /**
     * Crop image info
     * @var
     */
    public $crop_info;

    /**
     * All thumb image sizes
     * @var array
     */
    public $thumb_sizes = [];

    /**
     * Directory for uploaded files
     * @var
     */
    private $dir;

    /**
     * Default dir
     * @var string
     */
    public $default_dir = 'i';

    /**
     * Update previous image
     * @var bool
     */
    public $update_image = false;

    /**
     * Image URL
     * @var
     */
    public $image_url;

//    public function events()
//    {
//        return [
//            ActiveRecord::EVENT_BEFORE_VALIDATE => 'getSlug'
//        ];
//    }

    public function attach($owner)
    {
        parent::attach($owner);

//        $owner->attributeLabels(['image' => \Yii::t('app', 'Image')]);
//        array_merge($owner->attributeLabels(), [
//            // add additional translations
//            'image' => \Yii::t('app', 'Image'),
//        ]);
//        yii\helpers\VarDumper::dump($owner->attributeLabels(), 10, true);
//        exit();

//        if (in_array($owner->scenario, $this->scenarios))
//        {
//            $fileValidator = \yii\validators\Validator::createValidator('file', $this->owner, $this->attributeName, ['types' => $this->fileTypes]);
//            $owner->validators[] = $fileValidator;
//        }
    }

    /**
     * Multiple image upload
     *
     * @param null $dir
     */
    public function uploadImages($dir = null)
    {
        // Upload multiple images
        $this->owner->images = \yii\web\UploadedFile::getInstances($this->owner, 'images');

        foreach ($this->owner->images as $image) {
            $this->uploadImage($dir, $image);
        }
    }

    /**
     * Upload single image with previous image update
     *
     * @param null $dir
     */
    public function uploadSingleImage($dir = null)
    {
        $this->update_image = true;

        // Upload multiple images
        $image = \yii\web\UploadedFile::getInstance($this->owner, 'image');

        if (!empty($image)) {
            $this->uploadImage($dir, $image);
        }
    }

    /**
     * Single image upload
     *
     * @param null $dir
     * @param null $image
     * @param null $type
     */
    public function uploadImage($dir = null, $image = null, $type = null)
    {
        if (empty($dir)) {
            $this->dir = $this->default_dir;
        } else {
            $this->dir = $dir;
        }

        // Upload single images
        if (empty($image)) {
            $this->owner->image = \yii\web\UploadedFile::getInstance($this->owner, 'image');
        } else {
            $this->owner->image = $image;
        }

        // Get info about owner class
        $class = new \ReflectionClass($this->owner);

        if ($this->owner->validate()) {
            // Delete previous model image if necessary
            if ($this->update_image) {
                Image::deleteModelImages($class->getShortName(), $this->owner->id);
            }

            // Original image
            $file = new Image;
            $file->model = $class->getShortName();
            $file->model_id = $this->owner->id;
            $file->image = $this->owner->image;
            $file->dir = $this->dir;
            $image_saved = $file->uploadImage($this->owner->image, $file->model_id, null, null, $file->dir);
            if ($image_saved) {
                $file->create_time = date('Y-m-d H:i:s');
                $file->save();
            }

            $original_file = $file;

            // Save thumb images
            foreach ($this->thumb_sizes as $size) {
                if (!empty($original_file) && !empty($size['width']) && !empty($size['height'])) {
                    $file = new Image;
                    $file->model = $class->getShortName();
                    $file->pid = $original_file->id;
                    $file->model_id = $this->owner->id;
                    $file->image = $this->owner->image;
                    $file->dir = $this->dir;
                    $image_saved = $file->uploadImage($this->owner->image, $file->model_id, $size['width'], $size['height'], $file->dir);
                    if ($image_saved) {
                        $file->create_time = date('Y-m-d H:i:s');
                        $file->save();
                    }
                }
            }

            // Rendering information about crop of ONE option
            if (!empty($this->owner->crop_info)) {
                $cropInfo = yii\helpers\Json::decode($this->owner->crop_info)[0];
                $cropInfo['dw'] = (int)$cropInfo['dw']; //new width image
                $cropInfo['dh'] = (int)$cropInfo['dh']; //new height image
                $cropInfo['x'] = abs($cropInfo['x']); //begin position of frame crop by X
                $cropInfo['y'] = abs($cropInfo['y']); //begin position of frame crop by Y
                $cropInfo['w'] = (int)$cropInfo['w']; //width of cropped image
                $cropInfo['h'] = (int)$cropInfo['h']; //height of cropped image

//                yii\helpers\VarDumper::dump($cropInfo, 10, true);
//                $modelImage::$thumb_sizes[] = [
//                    'width' => $cropInfo['w'],
//                    'height' => $cropInfo['h'],
//                ];
//                yii\helpers\VarDumper::dump($modelImage::$thumb_sizes, 10, true);
//                exit();

                // Saving crop thumbnail
                $image = yii\imagine\Image::getImagine()->open($this->owner->image->tempName);
                $newSizeThumb = new Box($cropInfo['dw'], $cropInfo['dh']);
                $cropSizeThumb = new Box($cropInfo['w'], $cropInfo['h']); //frame size of crop
                $cropPointThumb = new Point($cropInfo['x'], $cropInfo['y']);

                $sub_dirs = substr(md5(time() + rand()), 0, 2) . '/' . substr(md5(time() + rand()), 0, 2) . '/' . substr(md5(time() + rand()), 0, 2) . '/' . substr(md5(time() + rand()), 0, 2);
                $dir = $this->dir . '/' . $sub_dirs;
                $dir_path = Yii::getAlias('@frontend/web/upload/') . $dir;
                if (!is_dir($dir_path)) {
                    @mkdir($dir_path, 0777, true);
                }

                $file_name = $this->owner->id . '_' . md5(time() + rand()) . '.' . $this->owner->image->getExtension();
                $pathThumbImage = $dir_path . '/' . $file_name;

                $image_saved = $image->resize($newSizeThumb)
                    ->crop($cropPointThumb, $cropSizeThumb)
                    ->save($pathThumbImage, ['quality' => 100]);

                $file = new Image;
                $file->model = $class->getShortName();
                $file->pid = $original_file->id;
                $file->model_id = $this->owner->id;
                $file->dir = $dir;
                $file->file_name = $file_name;
                $file->width = $cropInfo['w'];
                $file->height = $cropInfo['h'];
                if ($image_saved) {
                    $file->create_time = date('Y-m-d H:i:s');
                    $file->save();
                }
            }

        } else {
            yii\helpers\VarDumper::dump($this->owner->getErrors(), 10, true);
            exit();
        }
    }

    /**
     * Upload single image without any manipulations (cropping, resizing and etc)
     *
     * @param null $dir
     * @return bool
     */
    public function uploadFile($dir = null)
    {
        $image = yii\imagine\Image::getImagine()->open($this->owner->image->tempName);

        if (empty($dir)) {
            $this->dir = $this->default_dir;
        }

        $sub_dirs = substr(md5(time() + rand()), 0, 2) . '/' . substr(md5(time() + rand()), 0, 2) . '/' . substr(md5(time() + rand()), 0, 2) . '/' . substr(md5(time() + rand()), 0, 2);
        $dir = $this->dir . '/' . $sub_dirs;
        $dir_path = Yii::getAlias('@frontend/web/upload/') . $dir;
        if (!is_dir($dir_path)) {
            @mkdir($dir_path, 0777, true);
        }

        $image_saved = $image->save($dir_path . '/' . $this->file_name);

        if ($image_saved) {
            return true;
        } else {
            return false;
        }
    }

    /**
     * All models images
     *
     * @return array|bool
     */
    public static function getAllModelImages()
    {
        $models = self::find()->where(['model' => 'Article'])->all();

        if (!empty($models)) {
            $images = [];
            foreach ($models as $model) {
                if (!empty($model->width) && !empty($model->height)) {
                    $images[$model->model_id][$model->pid][$model->width . 'x' . $model->height] = $model->file_name;
                } else {
                    $images[$model->model_id][$model->id]['original'] = $model->file_name;
                }
            }

            return $images;
        } else {
            return false;
        }
    }

    /**
     * All images of the model
     *
     * @param $model_id
     * @param bool $main
     * @param bool $single_image
     * @return array|bool
     */
    public function getModelImages($model_id, $main = false, $single_image = false)
    {
        // Get info about owner class
        $class = new \ReflectionClass($this->owner);

        // Get all images of the model
        $models = Image::find()->where(['model' => $class->getShortName(), 'model_id' => $model_id])->all();

        $images = [];
        if (!empty($models)) {
            foreach ($models as $model) {
                if (!empty($model->width) && !empty($model->height)) {
                    if ($single_image) {
                        $images[$model->width . 'x' . $model->height] = $model->dir . '/' . $model->file_name;
                    } else {
                        $images[$model->pid][$model->width . 'x' . $model->height] = $model->dir . '/' . $model->file_name;
                    }
                } else {
                    if ($single_image) {
                        $images['original'] = $model->dir . '/' . $model->file_name;
                    } else {
                        $images[$model->id]['original'] = $model->dir . '/' . $model->file_name;
                    }
                }
            }

            return $images;
        } else {
            return false;
        }
    }

    /**
     * Thumb image of model
     *
     * @param null $width
     * @param null $height
     * @return array|null|ActiveRecord
     */
    public function getThumbImage($width = null, $height = null)
    {
        // Get info about owner class
        $class = new \ReflectionClass($this->owner);

        $model = Image::find()->where([
            'model_id' => $this->owner->id,
            'model' => $class->getShortName(),
            'width' => !empty($width) ? $width : $this->thumb_sizes[0]['width'],
            'height' => !empty($height) ? $height : $this->thumb_sizes[0]['height'],
        ])->one();

        if (empty($model) && !empty($width) && !empty($height)) {
            $model = $this->getResizedImage($width, $height);
        }

        return $model;
    }

    /**
     * Image thumb sizes
     *
     * @return string
     */
    public function getThumbImageSize()
    {
        return $this->thumb_sizes[0]['width'] . 'x' . $this->thumb_sizes[0]['height'];
    }

    /**
     * Get main model image
     *
     * @param $model_id
     * @return array|bool|null|ActiveRecord
     */
    public function getMainModelImage($model_id)
    {
        // Get info about owner class
        $class = new \ReflectionClass($this->owner);

        // Get main model image
        $model = Image::find()->where(['model' => $class->getShortName(), 'model_id' => $model_id, 'main' => 1, 'pid' => null])->one();

        if (!empty($model)) {
            return $model;
        } else {
            return false;
        }
    }

    /**
     * Grid images
     *
     * @param null $width
     * @param null $height
     * @return null
     */
    public function getGridImage($width = null, $height = null)
    {
        $models = $this->getModelImages($this->owner->id, false, true);

        if (empty($width) || empty($height)) {
            $thumb_size = $this->getThumbImageSize();
        }

        if (!empty($models)) {
            $images['original'] = $models['original'];
            $images['thumb'] = $models[$thumb_size];
        } else {
            $images = null;
        }

        return $images;
    }

    /**
     * Save images from URL
     *
     * @return string
     */
    public function getImagesFromUrl()
    {
        // Settings and info for tmp file
        $tmp_dir = 'tmp';
        $dir_path = Yii::getAlias('@frontend/web/upload/') . $tmp_dir;

        $pathinfo = pathinfo($this->owner->image_url);
        $ext = $pathinfo['extension'];

        $file_name = md5(time());
        $file = $dir_path . '/' . $file_name . '.' . $ext;

        // Save file from url via curl
        $ch = curl_init($this->owner->image_url);
        $fp = fopen($file, 'wb');
        curl_setopt($ch, CURLOPT_FILE, $fp);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_exec($ch);
        curl_close($ch);
        fclose($fp);

        // Get info about owner class
        $class = new \ReflectionClass($this->owner);
        $class_name = $class->getShortName();

        // Fill FILES array with images data
        $_FILES[$class_name]['name']['images'][] = $file_name;
        $_FILES[$class_name]['type']['images'][] = 'image/jpeg';
        $_FILES[$class_name]['tmp_name']['images'][] = $file;
        $_FILES[$class_name]['error']['images'][] = UPLOAD_ERR_OK;
        $_FILES[$class_name]['size']['images'][] = filesize($file);

        return $file;
    }

    /**
     * Make resize on the fly
     *
     * @param $width
     * @param $height
     * @return array|bool|null|ActiveRecord
     */
    public function getResizedImage($width, $height)
    {
        // Get info about owner class
        $class = new \ReflectionClass($this->owner);

        // Check if the thumb image doesn't exist to create new
        $model = Image::find()->where([
            'model' => $class->getShortName(),
            'model_id' => $this->owner->id,
            'width' => $width,
            'height' => $height,
        ])->one();

        if (empty($model)) {
            // Get original model image
            $original_image_model = Image::find()->where([
                'model' => $class->getShortName(),
                'model_id' => $this->owner->id,
                'pid' => null,
            ])->one();

            $original_image = Yii::getAlias('@frontend/web/upload/') . $original_image_model->dir . '/' . $original_image_model->file_name;

            if (!file_exists($original_image)) {
                return false;
            }

            // Saving crop thumbnail
            $image = yii\imagine\Image::getImagine()->open($original_image);

            $newSizeThumb = new Box($width, $height);
//            $cropSizeThumb = new Box($width, $height); //frame size of crop
//            $cropPointThumb = new Point($cropInfo['x'], $cropInfo['y']);

            $sub_dirs = substr(md5(time() + rand()), 0, 2) . '/' . substr(md5(time() + rand()), 0, 2) . '/' . substr(md5(time() + rand()), 0, 2) . '/' . substr(md5(time() + rand()), 0, 2);
            $dir = $this->default_dir . '/' . $sub_dirs;
            $dir_path = Yii::getAlias('@frontend/web/upload/') . $dir;

            if (!is_dir($dir_path)) {
                @mkdir($dir_path, 0777, true);
            }

            $pathinfo = pathinfo($original_image);
            $ext = $pathinfo['extension'];

            $file_name = $this->owner->id . '_' . md5(time() + rand()) . '.' . $ext;
            $pathThumbImage = $dir_path . '/' . $file_name;

            $image_saved = $image->resize($newSizeThumb)
                ->save($pathThumbImage, ['quality' => 100]);

//            yii\helpers\VarDumper::dump($pathThumbImage, 10, true);
//            yii\helpers\VarDumper::dump($image_saved, 10, true);
//            exit();

            // Save new thumb image to DB
            $new_thumb_image = new Image;
            $new_thumb_image->model = $class->getShortName();
            $new_thumb_image->pid = $original_image_model->id;
            $new_thumb_image->model_id = $this->owner->id;
            $new_thumb_image->dir = $dir;
            $new_thumb_image->file_name = $file_name;
            $new_thumb_image->width = $width;
            $new_thumb_image->height = $height;
            if ($image_saved) {
                $new_thumb_image->create_time = date('Y-m-d H:i:s');
                $new_thumb_image->save();

//                $new_thumb_image_file = $dir_path . '/' . $file_name;
            }

            return !empty($new_thumb_image) ? $new_thumb_image : null;
        } else {
            return false;
        }
    }
}


text:
/* MACHINE GENERATED FILE, DO NOT EDIT */

package org.lwjgl.opengl;

import org.lwjgl.*;
import java.nio.*;

public final class NVTextureMultisample {

	/**
	 * Accepted by the <pname> parameter of GetTexLevelParameter:
	 */
	public static final int GL_TEXTURE_COVERAGE_SAMPLES_NV = 0x9045,
		GL_TEXTURE_COLOR_SAMPLES_NV = 0x9046;

	private NVTextureMultisample() {}

	public static void glTexImage2DMultisampleCoverageNV(int target, int coverageSamples, int colorSamples, int internalFormat, int width, int height, boolean fixedSampleLocations) {
		ContextCapabilities caps = GLContext.getCapabilities();
		long function_pointer = caps.glTexImage2DMultisampleCoverageNV;
		BufferChecks.checkFunctionAddress(function_pointer);
		nglTexImage2DMultisampleCoverageNV(target, coverageSamples, colorSamples, internalFormat, width, height, fixedSampleLocations, function_pointer);
	}
	static native void nglTexImage2DMultisampleCoverageNV(int target, int coverageSamples, int colorSamples, int internalFormat, int width, int height, boolean fixedSampleLocations, long function_pointer);

	public static void glTexImage3DMultisampleCoverageNV(int target, int coverageSamples, int colorSamples, int internalFormat, int width, int height, int depth, boolean fixedSampleLocations) {
		ContextCapabilities caps = GLContext.getCapabilities();
		long function_pointer = caps.glTexImage3DMultisampleCoverageNV;
		BufferChecks.checkFunctionAddress(function_pointer);
		nglTexImage3DMultisampleCoverageNV(target, coverageSamples, colorSamples, internalFormat, width, height, depth, fixedSampleLocations, function_pointer);
	}
	static native void nglTexImage3DMultisampleCoverageNV(int target, int coverageSamples, int colorSamples, int internalFormat, int width, int height, int depth, boolean fixedSampleLocations, long function_pointer);

	public static void glTextureImage2DMultisampleNV(int texture, int target, int samples, int internalFormat, int width, int height, boolean fixedSampleLocations) {
		ContextCapabilities caps = GLContext.getCapabilities();
		long function_pointer = caps.glTextureImage2DMultisampleNV;
		BufferChecks.checkFunctionAddress(function_pointer);
		nglTextureImage2DMultisampleNV(texture, target, samples, internalFormat, width, height, fixedSampleLocations, function_pointer);
	}
	static native void nglTextureImage2DMultisampleNV(int texture, int target, int samples, int internalFormat, int width, int height, boolean fixedSampleLocations, long function_pointer);

	public static void glTextureImage3DMultisampleNV(int texture, int target, int samples, int internalFormat, int width, int height, int depth, boolean fixedSampleLocations) {
		ContextCapabilities caps = GLContext.getCapabilities();
		long function_pointer = caps.glTextureImage3DMultisampleNV;
		BufferChecks.checkFunctionAddress(function_pointer);
		nglTextureImage3DMultisampleNV(texture, target, samples, internalFormat, width, height, depth, fixedSampleLocations, function_pointer);
	}
	static native void nglTextureImage3DMultisampleNV(int texture, int target, int samples, int internalFormat, int width, int height, int depth, boolean fixedSampleLocations, long function_pointer);

	public static void glTextureImage2DMultisampleCoverageNV(int texture, int target, int coverageSamples, int colorSamples, int internalFormat, int width, int height, boolean fixedSampleLocations) {
		ContextCapabilities caps = GLContext.getCapabilities();
		long function_pointer = caps.glTextureImage2DMultisampleCoverageNV;
		BufferChecks.checkFunctionAddress(function_pointer);
		nglTextureImage2DMultisampleCoverageNV(texture, target, coverageSamples, colorSamples, internalFormat, width, height, fixedSampleLocations, function_pointer);
	}
	static native void nglTextureImage2DMultisampleCoverageNV(int texture, int target, int coverageSamples, int colorSamples, int internalFormat, int width, int height, boolean fixedSampleLocations, long function_pointer);

	public static void glTextureImage3DMultisampleCoverageNV(int texture, int target, int coverageSamples, int colorSamples, int internalFormat, int width, int height, int depth, boolean fixedSampleLocations) {
		ContextCapabilities caps = GLContext.getCapabilities();
		long function_pointer = caps.glTextureImage3DMultisampleCoverageNV;
		BufferChecks.checkFunctionAddress(function_pointer);
		nglTextureImage3DMultisampleCoverageNV(texture, target, coverageSamples, colorSamples, internalFormat, width, height, depth, fixedSampleLocations, function_pointer);
	}
	static native void nglTextureImage3DMultisampleCoverageNV(int texture, int target, int coverageSamples, int colorSamples, int internalFormat, int width, int height, int depth, boolean fixedSampleLocations, long function_pointer);
}


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

<!--

 This file is part of the Sylius package.

 (c) Paweł Jędrzejewski

 For the full copyright and license information, please view the LICENSE
 file that was distributed with this source code.

-->

<container xmlns="http://symfony.com/schema/dic/services"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"
>
    <services>
        <defaults public="false" />

        <service
            id="sylius_api.serializer_context_builder.channel"
            class="Sylius\Bundle\ApiBundle\SerializerContextBuilder\ChannelContextBuilder"
            decorates="api_platform.serializer.context_builder"
            decoration-priority="64"
        >
            <argument type="service" id="sylius_api.serializer_context_builder.channel.inner" />
            <argument type="service" id="sylius.context.channel" />
        </service>

        <service
            id="sylius_api.serializer_context_builder.locale"
            class="Sylius\Bundle\ApiBundle\SerializerContextBuilder\LocaleContextBuilder"
            decorates="api_platform.serializer.context_builder"
            decoration-priority="64"
        >
            <argument type="service" id="sylius_api.serializer_context_builder.locale.inner" />
            <argument type="service" id="sylius.context.locale" />
        </service>

        <service
            id="sylius_api.serializer_context_builder.http_request_method_type"
            class="Sylius\Bundle\ApiBundle\SerializerContextBuilder\HttpRequestMethodTypeContextBuilder"
            decorates="api_platform.serializer.context_builder"
            decoration-priority="64"
        >
            <argument type="service" id="sylius_api.serializer_context_builder.http_request_method_type.inner" />
        </service>
    </services>
</container>


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

<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>
Uses of Interface org.springframework.security.AccessDecisionManager (Spring Security 2.0.4 API)
</TITLE>

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

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

Spring Security Framework

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Interface
org.springframework.security.AccessDecisionManager

Packages that use AccessDecisionManager

org.springframework.security.intercept
Actually enforces the security and ties the whole security system together.

org.springframework.security.vote
Implements a vote-based approach to authorization decisions.

Uses of AccessDecisionManager in org.springframework.security.intercept

Methods in org.springframework.security.intercept that return AccessDecisionManager

 AccessDecisionManager
AbstractSecurityInterceptor.getAccessDecisionManager()

Methods in org.springframework.security.intercept with parameters of type AccessDecisionManager

 void
AbstractSecurityInterceptor.setAccessDecisionManager(AccessDecisionManager accessDecisionManager)

Uses of AccessDecisionManager in org.springframework.security.vote

Classes in org.springframework.security.vote that implement AccessDecisionManager

 class
AbstractAccessDecisionManager

          Abstract implementation of AccessDecisionManager.

 class
AffirmativeBased

          Simple concrete implementation of  AccessDecisionManager that grants access if any
 AccessDecisionVoter returns an affirmative response.

 class
ConsensusBased

          Simple concrete implementation of  AccessDecisionManager that uses a  consensus-based
 approach.

 class
UnanimousBased

          Simple concrete implementation of  AccessDecisionManager that  requires all voters to
 abstain or grant access.

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

Spring Security Framework

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Copyright © 2004-2008 SpringSource, Inc. All Rights Reserved.


text:
/* Lzma2DecMt.h -- LZMA2 Decoder Multi-thread
2018-02-17 : Igor Pavlov : Public domain */

#ifndef __LZMA2_DEC_MT_H
#define __LZMA2_DEC_MT_H

#include "7zTypes.h"

EXTERN_C_BEGIN

typedef struct
{
  size_t inBufSize_ST;
  size_t outStep_ST;

  #ifndef _7ZIP_ST
  unsigned numThreads;
  size_t inBufSize_MT;
  size_t outBlockMax;
  size_t inBlockMax;
  #endif
} CLzma2DecMtProps;

/* init to single-thread mode */
void Lzma2DecMtProps_Init(CLzma2DecMtProps *p);

/* ---------- CLzma2DecMtHandle Interface ---------- */

/* Lzma2DecMt_ * functions can return the following exit codes:
SRes:
  SZ_OK           - OK
  SZ_ERROR_MEM    - Memory allocation error
  SZ_ERROR_PARAM  - Incorrect paramater in props
  SZ_ERROR_WRITE  - ISeqOutStream write callback error
  // SZ_ERROR_OUTPUT_EOF - output buffer overflow - version with (Byte *) output
  SZ_ERROR_PROGRESS - some break from progress callback
  SZ_ERROR_THREAD - error in multithreading functions (only for Mt version)
*/

typedef void * CLzma2DecMtHandle;

CLzma2DecMtHandle Lzma2DecMt_Create(ISzAllocPtr alloc, ISzAllocPtr allocMid);
void Lzma2DecMt_Destroy(CLzma2DecMtHandle p);

SRes Lzma2DecMt_Decode(CLzma2DecMtHandle p,
    Byte prop,
    const CLzma2DecMtProps *props,
    ISeqOutStream *outStream,
    const UInt64 *outDataSize, // NULL means undefined
    int finishMode,            // 0 - partial unpacking is allowed, 1 - if lzma2 stream must be finished
    // Byte *outBuf, size_t *outBufSize,
    ISeqInStream *inStream,
    // const Byte *inData, size_t inDataSize,

    // out variables:
    UInt64 *inProcessed,
    int *isMT,  /* out: (*isMT == 0), if single thread decoding was used */

    // UInt64 *outProcessed,
    ICompressProgress *progress);

/* ---------- Read from CLzma2DecMtHandle Interface ---------- */

SRes Lzma2DecMt_Init(CLzma2DecMtHandle pp,
    Byte prop,
    const CLzma2DecMtProps *props,
    const UInt64 *outDataSize, int finishMode,
    ISeqInStream *inStream);

SRes Lzma2DecMt_Read(CLzma2DecMtHandle pp,
    Byte *data, size_t *outSize,
    UInt64 *inStreamProcessed);

EXTERN_C_END

#endif


text:
bytemares
=========

### To hack
bundle exec jekyll serve [resource](https://docs.github.com/en/github/working-with-github-pages/testing-your-github-pages-site-locally-with-jekyll#keeping-your-site-up-to-date-with-the-github-pages-gem)

### Resources

Site is using dbyll theme:
Open source stylish, minimalistic theme for jekyll.

* [Download dbyll](https://github.com/dbtek/dbyll/archive/master.zip)

Good upgrade instructions

* [Upgrade from 3.x to 4.x)](https://learn.siteleaf.com/themes/upgrading-from-jekyll-3-to-4/)


text:
@implementation EndGameScene

-(id)initWithSize:(CGSize)size{
    if (self = [super initWithSize:size]) {
        // stars
        SKSpriteNode *star = [SKSpriteNode spriteNodeWithImageNamed:@"Star"];
        star.position = CGPointMake(25, self.size.height - 30);
        [self addChild:star];

        SKLabelNode *lblStars = [SKLabelNode labelNodeWithFontNamed:@"ChalkboardSE-Bold"];
        lblStars.fontSize = 30;
        lblStars.fontColor = [SKColor whiteColor];
        lblStars.position = CGPointMake(50, self.size.height-40);
        lblStars.horizontalAlignmentMode = SKLabelHorizontalAlignmentModeLeft;
        [lblStars setText:[NSString stringWithFormat:@"X %d", [GameState sharedInstance].stars]];
        [self addChild:lblStars];

        // Score
        SKLabelNode *lblScore = [SKLabelNode labelNodeWithFontNamed:@"ChalkboardSE-Bold"];
        lblScore.fontSize = 60;
        lblScore.fontColor = [SKColor whiteColor];
        lblScore.position = CGPointMake(160, 300);
        lblScore.horizontalAlignmentMode = SKLabelHorizontalAlignmentModeCenter;
        [lblScore setText:[NSString stringWithFormat:@"%d", [GameState sharedInstance].score]];
        [self addChild:lblScore];

        // High Score
        SKLabelNode *lblHighScore = [SKLabelNode labelNodeWithFontNamed:@"ChalkboardSE-Bold"];
        lblHighScore.fontSize = 30;
        lblHighScore.fontColor = [SKColor cyanColor];
        lblHighScore.position = CGPointMake(160, 150);
        lblHighScore.horizontalAlignmentMode = SKLabelHorizontalAlignmentModeCenter;
        [lblHighScore setText:[NSString stringWithFormat:@"High Score: %d", [GameState sharedInstance].highScore]];
        [self addChild:lblHighScore];

        // Try again
        SKLabelNode *lblTryAgain = [SKLabelNode labelNodeWithFontNamed:@"ChalkboardSE-Bold"];
        lblTryAgain.fontSize = 30;
        lblTryAgain.fontColor = [SKColor whiteColor];
        lblTryAgain.position = CGPointMake(160, 50);
        lblTryAgain.horizontalAlignmentMode = SKLabelHorizontalAlignmentModeCenter;
        [lblTryAgain setText:@"Tap To Try Again"];
        [self addChild:lblTryAgain];
    }

    return self;
}

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    // transition back to the game
    SKScene *scene = [[GameScene alloc] initWithSize:self.size];
    SKTransition *reveal = [SKTransition fadeWithDuration:0.5];
    [self.view presentScene:scene transition:reveal];
}

@end


text:
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993] for details.
// All other rights reserved.

using System.Collections;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Windows;
using System.Windows.Automation.Peers;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;

namespace GitHub.UI
{
    /// <summary>
    /// Represents the selection adapter contained in the drop-down portion of
    /// an <see cref="T:Chat.AutoCompleteBox" /> control.
    /// </summary>
    /// <QualityBand>Stable</QualityBand>
    public class SelectorSelectionAdapter : ISelectionAdapter
    {
        /// <summary>
        /// The Selector instance.
        /// </summary>
        private Selector selector;

        /// <summary>
        /// Gets or sets a value indicating whether the selection change event
        /// should not be fired.
        /// </summary>
        private bool IgnoringSelectionChanged { get; set; }

        /// <summary>
        /// Gets or sets the underlying <see cref="T:System.Windows.Controls.Primitives.Selector" /> control.
        /// </summary>
        /// <value>The underlying <see cref="T:System.Windows.Controls.Primitives.Selector" /> control.</value>
        [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0",
            Justification = "We do validate the parameter. Code Analysis just doesn't see it.")]
        public Selector SelectorControl
        {
            get { return selector; }

            set
            {
                if (selector != null)
                {
                    selector.SelectionChanged -= OnSelectionChanged;
                    selector.MouseLeftButtonUp -= OnSelectorMouseLeftButtonUp;
                }

                selector = value;

                if (selector != null)
                {
                    selector.SelectionChanged += OnSelectionChanged;
                    selector.MouseLeftButtonUp += OnSelectorMouseLeftButtonUp;
                }
            }
        }

        /// <summary>
        /// Occurs when the <see cref="SelectorSelectionAdapter.SelectedItem" /> property value changes.
        /// </summary>
        public event SelectionChangedEventHandler SelectionChanged;

        /// <summary>
        /// Occurs when an item is selected and is committed to the underlying
        /// <see cref="System.Windows.Controls.Primitives.Selector" /> control.
        /// </summary>
        public event RoutedEventHandler Commit;

        /// <summary>
        /// Occurs when a selection is canceled before it is committed.
        /// </summary>
        public event RoutedEventHandler Cancel;

        /// <summary>
        /// Initializes a new instance of the <see cref="T:Chat.SelectorSelectionAdapter" /> class.
        /// </summary>
        public SelectorSelectionAdapter()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="T:Chat.SelectorSelectionAdapter" /> class with the specified
        /// <see cref="T:System.Windows.Controls.Primitives.Selector" />
        /// control.
        /// </summary>
        /// <param name="selector">The
        /// <see cref="T:System.Windows.Controls.Primitives.Selector" /> control
        /// to wrap as a
        /// <see cref="T:Chat.SelectorSelectionAdapter" />.</param>
        public SelectorSelectionAdapter(Selector selector)
        {
            SelectorControl = selector;
        }

        /// <summary>
        /// Gets or sets the selected item of the selection adapter.
        /// </summary>
        /// <value>The selected item of the underlying selection adapter.</value>
        public object SelectedItem
        {
            get
            {
                return SelectorControl == null ? null : SelectorControl.SelectedItem;
            }

            set
            {
                IgnoringSelectionChanged = true;
                if (SelectorControl != null)
                {
                    SelectorControl.SelectedItem = value;
                }

                // Attempt to reset the scroll viewer's position
                if (value == null)
                {
                    ResetScrollViewer();
                }

                IgnoringSelectionChanged = false;
            }
        }

        /// <summary>
        /// Gets or sets a collection that is used to generate the content of
        /// the selection adapter.
        /// </summary>
        /// <value>The collection used to generate content for the selection
        /// adapter.</value>
        public IEnumerable ItemsSource
        {
            get
            {
                return SelectorControl == null ? null : SelectorControl.ItemsSource;
            }
            set
            {
                if (SelectorControl != null)
                {
                    SelectorControl.ItemsSource = value;
                }
            }
        }

        /// <summary>
        /// If the control contains a ScrollViewer, this will reset the viewer
        /// to be scrolled to the top.
        /// </summary>
        private void ResetScrollViewer()
        {
            if (SelectorControl != null)
            {
                var sv = SelectorControl.GetLogicalChildrenBreadthFirst().OfType<ScrollViewer>().FirstOrDefault();
                if (sv != null)
                {
                    sv.ScrollToTop();
                }
            }
        }

        /// <summary>
        /// Handles the mouse left button up event on the selector control.
        /// </summary>
        /// <param name="sender">The source object.</param>
        /// <param name="e">The event data.</param>
        private void OnSelectorMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            OnCommit();
        }

        /// <summary>
        /// Handles the SelectionChanged event on the Selector control.
        /// </summary>
        /// <param name="sender">The source object.</param>
        /// <param name="e">The selection changed event data.</param>
        private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (IgnoringSelectionChanged)
            {
                return;
            }

            var handler = SelectionChanged;
            if (handler != null)
            {
                handler(sender, e);
            }
        }

        /// <summary>
        /// Increments the
        /// <see cref="Selector.SelectedIndex" />
        /// property of the underlying
        /// <see cref="Selector" />
        /// control.
        /// </summary>
        protected void SelectedIndexIncrement()
        {
            if (SelectorControl != null)
            {
                SelectorControl.SelectedIndex =
                    SelectorControl.SelectedIndex + 1 >= SelectorControl.Items.Count
                    ? SelectorControl.Items.Count - 1
                    : SelectorControl.SelectedIndex + 1;
            }
        }

        /// <summary>
        /// Decrements the
        /// <see cref="Selector.SelectedIndex" />
        /// property of the underlying
        /// <see cref="Selector" />
        /// control.
        /// </summary>
        protected void SelectedIndexDecrement()
        {
            if (SelectorControl != null)
            {
                int index = SelectorControl.SelectedIndex;
                if (index >= 1)
                {
                    SelectorControl.SelectedIndex--;
                }
                else
                {
                    SelectorControl.SelectedIndex = 0;
                }
            }
        }

        /// <summary>
        /// Provides handling for the
        /// <see cref="E:System.Windows.UIElement.KeyDown" /> event that occurs
        /// when a key is pressed while the drop-down portion of the
        /// <see cref="T:Chat.AutoCompleteBox" /> has focus.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.Input.KeyEventArgs" />
        /// that contains data about the
        /// <see cref="E:System.Windows.UIElement.KeyDown" /> event.</param>
        public void HandleKeyDown(KeyEventArgs e)
        {
            switch (e.Key)
            {
                case Key.Enter:
                case Key.Tab:
                case Key.Right:
                    OnCommit();
                    e.Handled = true;
                    break;

                case Key.Up:
                    SelectedIndexDecrement();
                    e.Handled = true;
                    break;

                case Key.Down:
                    if ((ModifierKeys.Alt & Keyboard.Modifiers) == ModifierKeys.None)
                    {
                        SelectedIndexIncrement();
                        e.Handled = true;
                    }
                    break;

                case Key.Escape:
                    OnCancel();
                    e.Handled = true;
                    break;
            }
        }

        /// <summary>
        /// Raises the
        /// <see cref="E:Chat.SelectorSelectionAdapter.Commit" />
        /// event.
        /// </summary>
        protected virtual void OnCommit()
        {
            OnCommit(this, new RoutedEventArgs());
        }

        /// <summary>
        /// Fires the Commit event.
        /// </summary>
        /// <param name="sender">The source object.</param>
        /// <param name="e">The event data.</param>
        private void OnCommit(object sender, RoutedEventArgs e)
        {
            RoutedEventHandler handler = Commit;
            if (handler != null)
            {
                handler(sender, e);
            }

            AfterAdapterAction();
        }

        /// <summary>
        /// Raises the
        /// <see cref="E:Chat.SelectorSelectionAdapter.Cancel" />
        /// event.
        /// </summary>
        protected virtual void OnCancel()
        {
            OnCancel(this, new RoutedEventArgs());
        }

        /// <summary>
        /// Fires the Cancel event.
        /// </summary>
        /// <param name="sender">The source object.</param>
        /// <param name="e">The event data.</param>
        private void OnCancel(object sender, RoutedEventArgs e)
        {
            var handler = Cancel;
            if (handler != null)
            {
                handler(sender, e);
            }

            AfterAdapterAction();
        }

        /// <summary>
        /// Change the selection after the actions are complete.
        /// </summary>
        private void AfterAdapterAction()
        {
            IgnoringSelectionChanged = true;
            if (SelectorControl != null)
            {
                SelectorControl.SelectedItem = null;
                SelectorControl.SelectedIndex = -1;
            }
            IgnoringSelectionChanged = false;
        }

        /// <summary>
        /// Returns an automation peer for the underlying
        /// <see cref="T:System.Windows.Controls.Primitives.Selector" />
        /// control, for use by the Silverlight automation infrastructure.
        /// </summary>
        /// <returns>An automation peer for use by the Silverlight automation
        /// infrastructure.</returns>
        public AutomationPeer CreateAutomationPeer()
        {
            return selector != null ? UIElementAutomationPeer.CreatePeerForElement(selector) : null;
        }
    }
}


text:
<!DOCTYPE html>
<html <?php language_attributes(); ?>>

  <meta charset="<?php bloginfo('charset'); ?>">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width">
  <meta name="theme-color" content="#6d9aea">

  <?php wp_head(); ?>

  <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">

<body <?php body_class(); ?>>

                    <img style="max-width: 120px;" src="<?= get_template_directory_uri(); ?>/assets/images/logo-jesuitas.jpg" alt="jesuitasbrasil.com" />

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#main-navigation-collapse">
                    Navegação

                </button>

                    <img class="logo" src="<?= get_template_directory_uri(); ?>/assets/images/logo-fya.png" alt="Fé e Alegria" />

                <?php

                    $menuName = (is_front_page())? 'home': 'primary';

                    wp_nav_menu(array(
                        'menu' => $menuName,
                        'theme_location' => 'primary',
                        'depth' => 2,
                        'menu_class' => 'nav navbar-nav navbar-left',
                        'fallback_cb' => 'wp_bootstrap_navwalker::fallback',
                        'walker' => new wp_bootstrap_navwalker()
                    ));
                ?>

                                <?php get_template_part('searchform'); ?>

                                    Doe Agora


text:
import flux, {Dispatcher} from 'flux'
import assign from 'object-assign'

/**
 * A component to greet users
 */
const AppDispatcher = assign(new Dispatcher(), {

  /**
   * A bridge function between the views and the dispatcher, marking the action
   * as a view action.  Another variant here could be handleServerAction.
   * @param  {object} action The data coming from the view.
   */
  handleViewAction: function(action) {
    this.dispatch({
      source: 'VIEW_ACTION',
      action: action
    });
  }
});

export default AppDispatcher


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
  license agreements. See the NOTICE file distributed with this work for additional
  information regarding copyright ownership. The ASF licenses this file to
  you under the Apache License, Version 2.0 (the "License"); you may not use
  this file except in compliance with the License. You may obtain a copy of
  the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
  by applicable law or agreed to in writing, software distributed under the
  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
  OF ANY KIND, either express or implied. See the License for the specific
  language governing permissions and limitations under the License. -->
<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"
	Version="4.0">
  <edmx:Reference Uri="http://docs.oasis-open.org/odata/odata/v4.0/os/vocabularies/Org.OData.Core.V1.xml">
    <edmx:Include Alias="Core" Namespace="Org.OData.Core.V1" />
  </edmx:Reference>
	<edmx:DataServices>
		<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm"
			Namespace="Org.OData.AnnoatationTest" Alias="test">

			<Annotation Term="Core.Description">
				<String>Core terms needed to write vocabularies</String>
			</Annotation>

			<Annotation Term="org.example.display.Thumbnail">
				<Binary>T0RhdGE</Binary>
			</Annotation>

			<Annotation Term="org.example.display.ReadOnly">
				<Bool>true</Bool>
			</Annotation>

			<Annotation Term="org.example.display.LastUpdated"
				DateTimeOffset="2000-01-01T16:00:00.000-09:00" />

			<Annotation Term="UI.ReferenceFacet" AnnotationPath="Product/Supplier/@UI.LineItem" />

			<Annotation Term="UI.CollectionFacet" Qualifier="Contacts">
				<Collection>
					<AnnotationPath>Supplier/@Communication.Contact</AnnotationPath>
					<AnnotationPath>Customer/@Communication.Contact</AnnotationPath>
				</Collection>
			</Annotation>

			<Annotation Term="org.example.display.DisplayNameApply">
				<Apply Function="odata.concat">
					<String>Product: </String>
					<Path>ProductName</Path>
					<String> (</String>
					<Path>Available/Quantity</Path>
					<String>
					</String>
					<Path>Available/Unit</Path>
					<String> available)</String>
				</Apply>
			</Annotation>

			<Annotation Term="org.example.display.Threshold">
				<Cast Type="Edm.Decimal">
					<Path>Average</Path>
				</Cast>
			</Annotation>
			<Annotation Term="org.example.seo.SeoTerms">
				<Collection>
					<String>Product</String>
					<String>Supplier</String>
					<String>Customer</String>
				</Collection>
			</Annotation>

			<Annotation Term="org.example.person.Gender">
				<If>
					<Path>IsFemale</Path>
					<String>Female</String>
					<String>Male</String>
				</If>
			</Annotation>

			<Annotation Term="Self.IsPreferredCustomer">
				<IsOf Type="Self.PreferredCustomer">
					<Path>Customer</Path>
				</IsOf>
			</Annotation>

			<Annotation Term="org.example.display.DisplayNameLabel">
				<LabeledElement Name="CustomerFirstName">
					<Path>FirstName</Path>
				</LabeledElement>
			</Annotation>

			<Annotation Term="org.example.display.DisplayNameLabelReference">
				<LabeledElementReference>Model.CustomerFirstName
				</LabeledElementReference>
			</Annotation>

			<Annotation Term="org.example.display.DisplayNameNull">
				<Null />
			</Annotation>

			<Annotation Term="Capabilities.UpdateRestrictions">
				<Record>
					<PropertyValue Property="NonUpdatableNavigationProperties">
						<Collection>
							<NavigationPropertyPath>Supplier</NavigationPropertyPath>
							<NavigationPropertyPath>Category</NavigationPropertyPath>
						</Collection>
					</PropertyValue>
				</Record>
			</Annotation>

			<Annotation Term="org.example.display.DisplayNamePath">
				<Path>@vCard.Address#work/FullName</Path>
			</Annotation>

			<Term Name="IsURI" Type="Core.Tag" DefaultValue="true"
				AppliesTo="Property PropertyPath">
				<Annotation Term="Core.Description">
					<String>
						Properties and terms annotated with this term MUST contain a valid URI
					</String>
				</Annotation>
				<Annotation Term="Core.RequiresType" String="Edm.String" />
			</Term>

			<Annotation Term="org.example.person.Employee">
				<Record>
					<PropertyValue Property="GivenName" Path="FirstName" />
					<PropertyValue Property="Surname" Path="LastName" />
					<PropertyValue Property="Manager" Path="DirectSupervisor" />
					<PropertyValue Property="CostCenter">
						<UrlRef>
							<Apply Function="odata.fillUriTemplate">
								<String>http://host/anotherservice/CostCenters('{ccid}')
								</String>
								<LabeledElement Name="ccid" Path="CostCenterID" />
							</Apply>
						</UrlRef>
					</PropertyValue>
				</Record>
			</Annotation>

			<Annotation Term="Vocab.Supplier">
				<UrlRef>
					<Apply Function="odata.fillUriTemplate">
						<String>http://host/service/Suppliers({suppID})</String>
						<LabeledElement Name="suppID">
							<Apply Function="odata.uriEncode">
								<Path>SupplierId</Path>
							</Apply>
						</LabeledElement>
					</Apply>
				</UrlRef>
			</Annotation>
      <TypeDefinition Name="TagX" UnderlyingType="Edm.Boolean">
        <Annotation Term="Core.Description" String="This is the type to use for all tagging terms" />
      </TypeDefinition>
      <Annotations
        Target="Org.OData.AnnoatationTest.TagX">
        <Annotation Term="Org.OData.Core.V1.DereferenceableIDs"
          Bool="true" />
        <Annotation Term="Org.OData.Core.V1.ConventionalIDs"
          Bool="true" />
        <Annotation Term="Org.OData.Capabilities.V1.ConformanceLevel">
          <EnumMember>Org.OData.Capabilities.V1.ConformanceLevelType/Advanced
          </EnumMember>
        </Annotation>
      </Annotations>
		</Schema>
	</edmx:DataServices>
</edmx:Edmx>