text:
/**
 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
 * @version v25.0.1
 * @link http://www.ag-grid.com/
 * @license MIT
 */
"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../../widgets/component");
var context_1 = require("../../context/context");
var rowNode_1 = require("../../entities/rowNode");
var dragAndDropService_1 = require("../../dragAndDrop/dragAndDropService");
var eventKeys_1 = require("../../eventKeys");
var beanStub_1 = require("../../context/beanStub");
var icon_1 = require("../../utils/icon");
var function_1 = require("../../utils/function");
var RowDragComp = /** @class */ (function (_super) {
    __extends(RowDragComp, _super);
    function RowDragComp(rowNode, column, cellValueFn, beans) {
        var _this = _super.call(this, /* html */ "

") || this;
        _this.rowNode = rowNode;
        _this.column = column;
        _this.cellValueFn = cellValueFn;
        _this.beans = beans;
        return _this;
    }
    RowDragComp.prototype.postConstruct = function () {
        var eGui = this.getGui();
        eGui.appendChild(icon_1.createIconNoSpan('rowDrag', this.beans.gridOptionsWrapper, null));
        this.addDragSource();
        this.checkCompatibility();
        var strategy = this.beans.gridOptionsWrapper.isRowDragManaged() ?
            new ManagedVisibilityStrategy(this, this.beans, this.rowNode, this.column) :
            new NonManagedVisibilityStrategy(this, this.beans, this.rowNode, this.column);
        this.createManagedBean(strategy, this.beans.context);
    };
    RowDragComp.prototype.getSelectedCount = function () {
        var multiRowEnabled = this.beans.gridOptionsWrapper.isEnableMultiRowDragging();
        if (!multiRowEnabled) {
            return 1;
        }
        var selection = this.beans.selectionController.getSelectedNodes();
        return selection.indexOf(this.rowNode) !== -1 ? selection.length : 1;
    };
    // returns true if all compatibility items work out
    RowDragComp.prototype.checkCompatibility = function () {
        var managed = this.beans.gridOptionsWrapper.isRowDragManaged();
        var treeData = this.beans.gridOptionsWrapper.isTreeData();
        if (treeData && managed) {
            function_1.doOnce(function () {
                return console.warn('ag-Grid: If using row drag with tree data, you cannot have rowDragManaged=true');
            }, 'RowDragComp.managedAndTreeData');
        }
    };
    RowDragComp.prototype.addDragSource = function () {
        var _this = this;
        var dragItem = {
            rowNode: this.rowNode,
            columns: [this.column],
            defaultTextValue: this.cellValueFn(),
        };
        var rowDragText = this.column.getColDef().rowDragText;
        var dragSource = {
            type: dragAndDropService_1.DragSourceType.RowDrag,
            eElement: this.getGui(),
            dragItemName: function () {
                var dragItemCount = _this.getSelectedCount();
                if (rowDragText) {
                    return rowDragText(dragItem, dragItemCount);
                }
                return dragItemCount === 1 ? _this.cellValueFn() : dragItemCount + " rows";
            },
            getDragItem: function () { return dragItem; },
            dragStartPixels: 0,
            dragSourceDomDataKey: this.beans.gridOptionsWrapper.getDomDataKey()
        };
        this.beans.dragAndDropService.addDragSource(dragSource, true);
        this.addDestroyFunc(function () { return _this.beans.dragAndDropService.removeDragSource(dragSource); });
    };
    __decorate([
        context_1.PostConstruct
    ], RowDragComp.prototype, "postConstruct", null);
    return RowDragComp;
}(component_1.Component));
exports.RowDragComp = RowDragComp;
var VisibilityStrategy = /** @class */ (function (_super) {
    __extends(VisibilityStrategy, _super);
    function VisibilityStrategy(parent, rowNode, column) {
        var _this = _super.call(this) || this;
        _this.parent = parent;
        _this.column = column;
        _this.rowNode = rowNode;
        return _this;
    }
    VisibilityStrategy.prototype.setDisplayedOrVisible = function (neverDisplayed) {
        if (neverDisplayed) {
            this.parent.setDisplayed(false);
        }
        else {
            var shown = this.column.isRowDrag(this.rowNode);
            var isShownSometimes = function_1.isFunction(this.column.getColDef().rowDrag);
            // if shown sometimes, them some rows can have drag handle while other don't,
            // so we use setVisible to keep the handles horizontally aligned (as setVisible
            // keeps the empty space, whereas setDisplayed looses the space)
            if (isShownSometimes) {
                this.parent.setDisplayed(true);
                this.parent.setVisible(shown);
            }
            else {
                this.parent.setDisplayed(shown);
            }
        }
    };
    return VisibilityStrategy;
}(beanStub_1.BeanStub));
// when non managed, the visibility depends on suppressRowDrag property only
var NonManagedVisibilityStrategy = /** @class */ (function (_super) {
    __extends(NonManagedVisibilityStrategy, _super);
    function NonManagedVisibilityStrategy(parent, beans, rowNode, column) {
        var _this = _super.call(this, parent, rowNode, column) || this;
        _this.beans = beans;
        return _this;
    }
    NonManagedVisibilityStrategy.prototype.postConstruct = function () {
        this.addManagedListener(this.beans.gridOptionsWrapper, 'suppressRowDrag', this.onSuppressRowDrag.bind(this));
        // in case data changes, then we need to update visibility of drag item
        this.addManagedListener(this.rowNode, rowNode_1.RowNode.EVENT_DATA_CHANGED, this.workOutVisibility.bind(this));
        this.addManagedListener(this.rowNode, rowNode_1.RowNode.EVENT_CELL_CHANGED, this.workOutVisibility.bind(this));
        this.workOutVisibility();
    };
    NonManagedVisibilityStrategy.prototype.onSuppressRowDrag = function () {
        this.workOutVisibility();
    };
    NonManagedVisibilityStrategy.prototype.workOutVisibility = function () {
        // only show the drag if both sort and filter are not present
        var neverDisplayed = this.beans.gridOptionsWrapper.isSuppressRowDrag();
        this.setDisplayedOrVisible(neverDisplayed);
    };
    __decorate([
        context_1.PostConstruct
    ], NonManagedVisibilityStrategy.prototype, "postConstruct", null);
    return NonManagedVisibilityStrategy;
}(VisibilityStrategy));
// when managed, the visibility depends on sort, filter and row group, as well as suppressRowDrag property
var ManagedVisibilityStrategy = /** @class */ (function (_super) {
    __extends(ManagedVisibilityStrategy, _super);
    function ManagedVisibilityStrategy(parent, beans, rowNode, column) {
        var _this = _super.call(this, parent, rowNode, column) || this;
        _this.beans = beans;
        return _this;
    }
    ManagedVisibilityStrategy.prototype.postConstruct = function () {
        // we do not show the component if sort, filter or grouping is active
        this.addManagedListener(this.beans.eventService, eventKeys_1.Events.EVENT_SORT_CHANGED, this.workOutVisibility.bind(this));
        this.addManagedListener(this.beans.eventService, eventKeys_1.Events.EVENT_FILTER_CHANGED, this.workOutVisibility.bind(this));
        this.addManagedListener(this.beans.eventService, eventKeys_1.Events.EVENT_COLUMN_ROW_GROUP_CHANGED, this.workOutVisibility.bind(this));
        // in case data changes, then we need to update visibility of drag item
        this.addManagedListener(this.rowNode, rowNode_1.RowNode.EVENT_DATA_CHANGED, this.workOutVisibility.bind(this));
        this.addManagedListener(this.rowNode, rowNode_1.RowNode.EVENT_CELL_CHANGED, this.workOutVisibility.bind(this));
        this.addManagedListener(this.beans.gridOptionsWrapper, 'suppressRowDrag', this.onSuppressRowDrag.bind(this));
        this.workOutVisibility();
    };
    ManagedVisibilityStrategy.prototype.onSuppressRowDrag = function () {
        this.workOutVisibility();
    };
    ManagedVisibilityStrategy.prototype.workOutVisibility = function () {
        // only show the drag if both sort and filter are not present
        var rowDragFeature = this.beans.gridPanel.getRowDragFeature();
        var shouldPreventRowMove = rowDragFeature && rowDragFeature.shouldPreventRowMove();
        var suppressRowDrag = this.beans.gridOptionsWrapper.isSuppressRowDrag();
        var hasExternalDropZones = this.beans.dragAndDropService.hasExternalDropZones();
        var neverDisplayed = (shouldPreventRowMove && !hasExternalDropZones) || suppressRowDrag;
        this.setDisplayedOrVisible(neverDisplayed);
    };
    __decorate([
        context_1.PostConstruct
    ], ManagedVisibilityStrategy.prototype, "postConstruct", null);
    return ManagedVisibilityStrategy;
}(VisibilityStrategy));

//# sourceMappingURL=rowDragComp.js.map


text:
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.build.output;

import com.intellij.build.FilePosition;
import com.intellij.build.events.MessageEvent;
import com.intellij.build.events.impl.FileMessageEventImpl;
import com.intellij.build.events.impl.MessageEventImpl;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.SystemProperties;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.File;
import java.util.List;
import java.util.function.Consumer;

/**
 * Parses javac's output.
 */
public class JavacOutputParser implements BuildOutputParser {
  private static final String COMPILER_MESSAGES_GROUP = "Java compiler";

  private static final char COLON = ':';
  private static final String WARNING_PREFIX = "warning:"; // default value

  public boolean parse(@NotNull String line, @NotNull BuildOutputInstantReader reader, @NotNull Consumer<MessageEvent> messageConsumer) {
    int colonIndex1 = line.indexOf(COLON);
    if (colonIndex1 == 1) { // drive letter
      colonIndex1 = line.indexOf(COLON, colonIndex1 + 1);
    }

    if (colonIndex1 >= 0) { // looks like found something like a file path.
      String part1 = line.substring(0, colonIndex1).trim();
      if (part1.equalsIgnoreCase("error") /* jikes */ || part1.equalsIgnoreCase("Caused by")) {
        // +1 so we don't include the colon
        String text = line.substring(colonIndex1 + 1).trim();
        messageConsumer.accept(new MessageEventImpl(reader.getBuildId(), MessageEvent.Kind.ERROR, COMPILER_MESSAGES_GROUP, text));
        return true;
      }
      if (part1.equalsIgnoreCase("warning")) {
        // +1 so we don't include the colon
        String text = line.substring(colonIndex1 + 1).trim();
        messageConsumer.accept(new MessageEventImpl(reader.getBuildId(), MessageEvent.Kind.WARNING, COMPILER_MESSAGES_GROUP, text));
        return true;
      }
      if (part1.equalsIgnoreCase("javac")) {
        messageConsumer.accept(new MessageEventImpl(reader.getBuildId(), MessageEvent.Kind.ERROR, COMPILER_MESSAGES_GROUP, line));
        return true;
      }

      int colonIndex2 = line.indexOf(COLON, colonIndex1 + 1);
      if (colonIndex2 >= 0) {
        File file = new File(part1);
        if (!file.isFile()) {
          // the part one is not a file path.
          return false;
        }
        try {
          int lineNumber = Integer.parseInt(line.substring(colonIndex1 + 1, colonIndex2).trim()); // 1-based.
          String text = line.substring(colonIndex2 + 1).trim();
          MessageEvent.Kind kind = MessageEvent.Kind.ERROR;

          if (text.startsWith(WARNING_PREFIX)) {
            text = text.substring(WARNING_PREFIX.length()).trim();
            kind = MessageEvent.Kind.WARNING;
          }

          // Only slurp up line pointer (^) information if this is really javac
          if (!file.getPath().endsWith(".java")) {
            // Fall back to the MergingExceptionParser (which handles similar messageEventConsumer in a more general way)
            return false;
          }

          List<String> messageList = ContainerUtil.newArrayList();
          messageList.add(text);
          int column; // 0-based.
          String prevLine = null;
          do {
            String nextLine = reader.readLine();
            if (nextLine == null) {
              return false;
            }
            if (nextLine.trim().equals("^")) {
              column = nextLine.indexOf('^');
              String messageEnd = reader.readLine();

              while (isMessageEnd(messageEnd)) {
                messageList.add(messageEnd.trim());
                messageEnd = reader.readLine();
              }

              if (messageEnd != null) {
                reader.pushBack();
              }
              break;
            }
            if (prevLine != null) {
              messageList.add(prevLine);
            }
            prevLine = nextLine;
          }
          while (true);

          if (column >= 0) {
            messageList = convertMessages(messageList);
            String msgText = StringUtil.join(messageList, SystemProperties.getLineSeparator());
            messageConsumer.accept(new FileMessageEventImpl(reader.getBuildId(), kind, COMPILER_MESSAGES_GROUP, msgText,
                                                            new FilePosition(file, lineNumber - 1, column)));
            return true;
          }
        }
        catch (NumberFormatException ignored) {
        }
      }
    }

    if (line.endsWith("java.lang.OutOfMemoryError")) {
      messageConsumer.accept(new MessageEventImpl(reader.getBuildId(), MessageEvent.Kind.ERROR, COMPILER_MESSAGES_GROUP, "Out of memory."));
      return true;
    }

    return false;
  }

  private static void addMessage(@NotNull MessageEvent message, @NotNull List<MessageEvent> messages) {
    boolean duplicatesPrevious = false;
    int messageCount = messages.size();
    if (messageCount > 0) {
      MessageEvent lastMessage = messages.get(messageCount - 1);
      duplicatesPrevious = lastMessage.equals(message);
    }
    if (!duplicatesPrevious) {
      messages.add(message);
    }
  }

  @Contract("null -> false")
  private static boolean isMessageEnd(@Nullable String line) {
    return line != null && line.length() > 0 && Character.isWhitespace(line.charAt(0));
  }

  @NotNull
  private static List<String> convertMessages(@NotNull List<String> messages) {
    if (messages.size() <= 1) {
      return messages;
    }
    final String line0 = messages.get(0);
    final String line1 = messages.get(1);
    final int colonIndex = line1.indexOf(':');
    if (colonIndex > 0) {
      @NonNls String part1 = line1.substring(0, colonIndex).trim();
      // jikes
      if ("symbol".equals(part1)) {
        String symbol = line1.substring(colonIndex + 1).trim();
        messages.remove(1);
        if (messages.size() >= 2) {
          messages.remove(1);
        }
        messages.set(0, line0 + " " + symbol);
      }
    }
    return messages;
  }
}

redpajama_set_name: RedPajamaGithub


text:
{% import "macros/form.html" as form %}

{% set data = data or {} %}
{% set errors = errors or {} %}

<form class="dataset-form dataset-resource-form form-vertical" method="post" data-module="basic-form">
  {{ h.snippet('package/snippets/stages.html', stages=['complete', 'complete', 'active'], pkg_name=pkg_name) }}
  {{ form.errors(error_summary) }}

  {% snippet 'package/snippets/package_metadata_fields.html', data=data, errors=errors, groups_available=groups_available %}

  <div class="form-actions">
    {# TODO: Go back to previous resource form #}
    <button class="btn" name="save" value="go-resources" type="submit">{{ _('Previous') }}</button>
    <button class="btn btn-primary" name="save" value="finish" type="submit">{{ _('Finish') }}</button>
  </div>

</form>


text:
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>W28512_text</title>
        <link rel="stylesheet" type="text/css" href="style.css" />

                «

    <p class="styleSans1.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans323.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans453.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">FORMATION TOPS _—
Triangle USA Petroleum Corporation 3 Britt 151-102-4-9-3H
NW NE Section 4 T151N R102W McKenzie County, North Dakota

FORMATION

Kibbey Lime Charles/Madison Base of Last Salt
_—A—.

Mission Canyon Lodgepole; Upper Bakken Shai_e_ Middle Bakken

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">17

    <p class="styleSans1.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">


text:
from codemod.position import Position

class Patch(object):
    """
    Represents a range of a file and (optionally) a list of lines with which to
    replace that range.

    >>> p = Patch(2, 4, ['X', 'Y', 'Z'], 'x.php')
    >>> print(p.render_range())
    x.php:2-3
    >>> p.start_position
    Position('x.php', 2)
    >>> l = ['a', 'b', 'c', 'd', 'e', 'f']
    >>> p.apply_to(l)
    >>> l
    ['a', 'b', 'X', 'Y', 'Z', 'e', 'f']
    >>> print(p)
    Patch('x.php', 2, 4, ['X', 'Y', 'Z'])
    """

    def __init__(self, start_line_number, end_line_number=None, new_lines=None,
                 path=None):  # noqa
        """
        Constructs a Patch object.

        @param end_line_number  The line number just *after* the end of
                                the range.
                                Defaults to
                                start_line_number + 1, i.e. a one-line
                                diff.
        @param new_lines        The set of lines with which to
                                replace the range
                                specified, or a newline-delimited string.
                                Omitting this means that
                                this "patch" doesn't actually
                                suggest a change.
        @param path             Path is optional only so that
                                suggestors that have
                                been passed a list of lines
                                don't have to set the
                                path explicitly.
                                (It'll get set by the suggestor's caller.)
        """
        self.path = path
        self.start_line_number = start_line_number
        self.end_line_number = end_line_number
        self.new_lines = new_lines

        if self.end_line_number is None:
            self.end_line_number = self.start_line_number + 1
        if isinstance(self.new_lines, str):
            self.new_lines = self.new_lines.splitlines(True)

    def __repr__(self):
        return 'Patch(%s)' % ', '.join(map(repr, [
            self.path,
            self.start_line_number,
            self.end_line_number,
            self.new_lines
        ]))

    def apply_to(self, lines):
        if self.new_lines is None:
            raise ValueError('Can\'t apply patch without suggested new lines.')
        lines[self.start_line_number:self.end_line_number] = self.new_lines

    def render_range(self):
        path = self.path or '<unknown>'
        if self.start_line_number == self.end_line_number - 1:
            return '%s:%d' % (path, self.start_line_number)
        else:
            return '%s:%d-%d' % (
                path,
                self.start_line_number, self.end_line_number - 1
            )

    def get_start_position(self):
        return Position(self.path, self.start_line_number)
    start_position = property(get_start_position)


text:
'use strict';

// MODULES //

var gapxsumkbn = require( '@stdlib/blas/ext/base/gapxsumkbn' );

// MAIN //

/**
* Adds a constant to each strided array element and computes the sum.
*
* @param {PositiveInteger} N - number of indexed elements
* @param {number} alpha - constant
* @param {NumericArray} x - input array
* @param {integer} stride - stride length
* @returns {number} sum
*
* @example
* var x = [ 1.0, -2.0, 2.0 ];
* var N = x.length;
*
* var v = gapxsum( N, 5.0, x, 1 );
* // returns 16.0
*/
function gapxsum( N, alpha, x, stride ) {
	return gapxsumkbn( N, alpha, x, stride );
}

// EXPORTS //

module.exports = gapxsum;


text:
package api

import (
	"net/http"

	"github.com/codegangsta/negroni"
	"github.com/rs/cors"
)

type MegdHandler struct {
	method string
	path   string
	h      http.Handler
}

var megdHandlerList []MegdHandler

//RegisterHandler inserts a handler on a list of handlers
func RegisterHandler(path string, method string, h http.Handler) {
	var th MegdHandler
	th.path = path
	th.method = method
	th.h = h
	megdHandlerList = append(megdHandlerList, th)
}

// RunServer starts megamd httpd server.
func NewNegHandler() *negroni.Negroni {
	c := cors.New(cors.Options{
		AllowedOrigins: []string{"*"},
	})

	m := &delayedRouter{}
	for _, handler := range megdHandlerList {
		m.Add(handler.method, handler.path, handler.h)
	}

	m.Add("Get", "/", Handler(index))
	m.Add("Get", "/logs", Handler(logs))
	m.Add("Get", "/ping", Handler(ping))
	//we can use this as a single click Terminal launch for docker.
	//m.Add("Get", "/apps/{appname}/shell", websocket.Handler(remoteShellHandler))
	n := negroni.New()
	n.Use(negroni.NewRecovery())
	n.Use(c)
	n.Use(newLoggerMiddleware())
	n.UseHandler(m)
	n.Use(negroni.HandlerFunc(contextClearerMiddleware))
	n.Use(negroni.HandlerFunc(flushingWriterMiddleware))
	n.Use(negroni.HandlerFunc(errorHandlingMiddleware))
	n.Use(negroni.HandlerFunc(authTokenMiddleware))
	n.UseHandler(http.HandlerFunc(runDelayedHandler))
	return n
}


text:
package org.fiware.apps.marketplace.security.entryPoints;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.pac4j.core.client.Client;
import org.pac4j.core.credentials.Credentials;
import org.pac4j.core.profile.UserProfile;
import org.pac4j.springframework.security.web.ClientAuthenticationEntryPoint;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;

/**
 * By default, clients attempts to log in users when they access a protected resource without credentials. However,
 * this behavior is not appropriate when the API is being used, since developers expect a 401 HTTP error when the user
 * is not authenticated. This class changes this behavior to work as expected by developers:
 *

 *
401 is returned when an unauthenticated users attempts to access a protected resource in the API

 *
Users are redirected to the login page when they try to access a protected resource outside the API

 *

 * @author aitor
 *
 */
public class RESTAwareClientAuthenticationEntryPoint implements AuthenticationEntryPoint, InitializingBean {

	private ClientAuthenticationEntryPoint entryPoint = new ClientAuthenticationEntryPoint();

	@Override
	public void afterPropertiesSet() throws Exception {
		entryPoint.afterPropertiesSet();
	}

	@Override
	public void commence(HttpServletRequest request, HttpServletResponse response,
			AuthenticationException authException) throws IOException, ServletException {

		if (request.getServletPath().startsWith("/api/")) {
			response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized");
		} else {
			entryPoint.commence(request, response, authException);
		}

	}

	@SuppressWarnings("unchecked")
	public Client<Credentials, UserProfile> getClient() {
		return entryPoint.getClient();
	}

	public void setClient(final Client<Credentials, UserProfile> client) {
		entryPoint.setClient(client);
	}

}


text:
package com.is2t.demo.showroom.widgets;

import com.is2t.demo.utilities.mosaic.BackgroundImageHelper;
import com.is2t.demo.utilities.mosaic.RatioMosaic;

import ej.microui.io.Display;
import ej.microui.io.GraphicsContext;
import ej.mwt.Panel;
import ej.mwt.Renderable;
import ej.mwt.rendering.Look;
import ej.mwt.rendering.Renderer;

public class PanelRenderer extends Renderer {

	private final BackgroundImageHelper backgroundImageHelper;

	public PanelRenderer(Display display) {
		this.backgroundImageHelper = new BackgroundImageHelper(display, new RatioMosaic(
				new float[] { 0, -0.66f, -0.33f }), "background", "background_tile");
	}

	@Override
	public Class<?> getManagedType() {
		return Panel.class;
	}

	@Override
	public void render(GraphicsContext g, Renderable renderable) {
		this.backgroundImageHelper.drawBackground(g, renderable.getWidth(), renderable.getHeight(), getLook()
				.getProperty(Look.GET_BACKGROUND_COLOR_DEFAULT));
	}

}


text:
import random
import sys

LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

def main() -> None:
    message = input("Enter message: ")
    key = "LFWOAYUISVKMNXPBDCRJTQEGHZ"
    resp = input("Encrypt/Decrypt [e/d]: ")

    checkValidKey(key)

    if resp.lower().startswith("e"):
        mode = "encrypt"
        translated = encryptMessage(key, message)
    elif resp.lower().startswith("d"):
        mode = "decrypt"
        translated = decryptMessage(key, message)

    print(f"\n{mode.title()}ion: \n{translated}")

def checkValidKey(key: str) -> None:
    keyList = list(key)
    lettersList = list(LETTERS)
    keyList.sort()
    lettersList.sort()

    if keyList != lettersList:
        sys.exit("Error in the key or symbol set.")

def encryptMessage(key: str, message: str) -> str:
    """
    >>> encryptMessage('LFWOAYUISVKMNXPBDCRJTQEGHZ', 'Harshil Darji')
    'Ilcrism Olcvs'
    """
    return translateMessage(key, message, "encrypt")

def decryptMessage(key: str, message: str) -> str:
    """
    >>> decryptMessage('LFWOAYUISVKMNXPBDCRJTQEGHZ', 'Ilcrism Olcvs')
    'Harshil Darji'
    """
    return translateMessage(key, message, "decrypt")

def translateMessage(key: str, message: str, mode: str) -> str:
    translated = ""
    charsA = LETTERS
    charsB = key

    if mode == "decrypt":
        charsA, charsB = charsB, charsA

    for symbol in message:
        if symbol.upper() in charsA:
            symIndex = charsA.find(symbol.upper())
            if symbol.isupper():
                translated += charsB[symIndex].upper()
            else:
                translated += charsB[symIndex].lower()
        else:
            translated += symbol

    return translated

def getRandomKey() -> str:
    key = list(LETTERS)
    random.shuffle(key)
    return "".join(key)

if __name__ == "__main__":
    main()


text:
"""
Copyright (c) 2014, Michael Kessler
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
  list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

"""

import ast
import sys
import traceback
import math
import keyword as pythonkeyword
import __builtin__
from threading import Lock

__author__ = "Michael Kessler"
__author_email__ = "mike@toadgrass.com"
__copyright__ = "Copyright 2014, Michael Kessler"
__credits__ = ["Michael Kessler"]
__license__ = "Simplified BSD"
__version__ = "0.1"
__maintainer__ = "Michael Kessler"
__maintainer_email__ = "mike@toadgrass.com"
__module_name__ = "qtterm"
__short_desc__ = "A QT simple python-qt based python terminal"
__status__ = "Planning"
__url__ = 'http://www.github.com/mikepkes/pyqtterm'

try:
    from PySide import QtCore, QtGui
except ImportError:
    from PyQt4 import QtCore, QtGui

# From http://blog.client9.com/2008/10/04/escaping-html-in-python.html
# This is really really ugly.
def html_escape(text):
    text = text.replace('&', '&')
    text = text.replace('"', '"')
    text = text.replace("'", ''')
    text = text.replace(">", '>')
    text = text.replace("<", '<')
    return text

class OutputRedirect(QtCore.QObject):

    output = QtCore.Signal(str)

    def __init__(self, tee=True, parent=None):
        super(OutputRedirect, self).__init__(parent)
        self._handle = None
        self._tee = tee

    def __enter__(self):
        self._handle = sys.stdout
        sys.stdout = self
        return self

    def __exit__(self, type, value, traceback):
        sys.stdout = self._handle

    def write(self, msg):
        self.output.emit(msg)
        if self._tee:
            self._handle.write(msg)

class HighlightRule(object):
    def __init__(self, pattern, format):
        self.pattern = pattern
        self.format = format

class PythonHighlighter(QtGui.QSyntaxHighlighter):
    def __init__(self, parent):
        super(PythonHighlighter, self).__init__(parent)
        self.rules = []

        brush = QtGui.QBrush(QtCore.Qt.darkGreen, QtCore.Qt.SolidPattern)
        builtin = QtGui.QTextCharFormat()
        builtin.setForeground(brush)
        builtin.setFontWeight(QtGui.QFont.Bold)
        builtins = dir(__builtin__)

        for word in builtins:
            pattern = QtCore.QRegExp("\\b{w}\\b".format(w=word))
            rule = HighlightRule(pattern, builtin)
            self.rules.append(rule)

        brush = QtGui.QBrush( QtCore.Qt.darkBlue, QtCore.Qt.SolidPattern)
        keyword = QtGui.QTextCharFormat()
        keyword.setForeground(brush)
        keyword.setFontWeight(QtGui.QFont.Bold)
        keywords = pythonkeyword.kwlist

        for word in keywords:
            pattern = QtCore.QRegExp("\\b{w}\\b".format(w=word))
            rule = HighlightRule(pattern, keyword)
            self.rules.append(rule)

        brush = QtGui.QBrush(QtGui.QColor.fromRgb(255,140,0),QtCore.Qt.SolidPattern)
        pattern = QtCore.QRegExp( "#[^\n]*")
        comment = QtGui.QTextCharFormat()
        comment.setForeground(brush)
        comment.setFontWeight(QtGui.QFont.Light)
        rule = HighlightRule(pattern, comment)
        self.rules.append(rule)

        self.setDocument(parent.document())

    def highlightBlock(self, text):
        for rule in self.rules:
            expression = QtCore.QRegExp(rule.pattern)
            index = expression.indexIn(text)
            while index>=0:
                length = expression.matchedLength()
                self.setFormat(index, length, rule.format)
                index = expression.indexIn(text, index+length)
        self.setCurrentBlockState(0)

class QtTermEntryLineNumberWidget(QtGui.QWidget):
    def __init__(self, parent):
        super(QtTermEntryLineNumberWidget, self).__init__(parent)
        self._editor = parent

    def paintEvent(self, event):
        self._editor.lineNumberAreaPaintEvent(event)

class QtTermEntryWidget(QtGui.QPlainTextEdit):

    traceback = QtCore.Signal(int)
    syntaxError = QtCore.Signal(int)

    def __init__(self, parent=None):
        super(QtTermEntryWidget, self).__init__(parent)

        self._termWidget = parent
        font = QtGui.QFont("Monaco")
        font.setStyleHint(font.TypeWriter, font.PreferDefault)
        self.setFont(font)

        self._lineNumber = QtTermEntryLineNumberWidget(self)
        self._highlighter = PythonHighlighter(self)

        self.blockCountChanged.connect(self.updateLineNumberAreaWidth)
        self.updateRequest.connect(self.updateLineNumberArea)
        self.cursorPositionChanged.connect(self.highlightCurrentLine)

        self.updateLineNumberAreaWidth(0);
        self.highlightCurrentLine();

        self.executeAction = QtGui.QAction('Execute Python', self)
        self.executeAction.setShortcut(QtGui.QKeySequence("Ctrl+Return"))
        self.executeAction.triggered.connect(self.execute)
        self.addAction(self.executeAction)

        self.syntaxError.connect(self.displaySyntaxError)

        self.stdoutRedirect = OutputRedirect()

        self._locals = {}

    def displaySyntaxError(self, line):

        sel = QtGui.QTextEdit.ExtraSelection()
        lineColor = QtGui.QColor(QtCore.Qt.red).lighter(150)
        sel.format.setBackground(QtGui.QBrush(lineColor,QtCore.Qt.SolidPattern))
        sel.format.setProperty(QtGui.QTextFormat.FullWidthSelection, True)
        sel.cursor = QtGui.QTextCursor(self.document())
        sel.cursor.movePosition(sel.cursor.NextBlock, QtGui.QTextCursor.MoveAnchor, line-1)
        sel.cursor.clearSelection()
        extraSelections = [sel]

        self.setExtraSelections(extraSelections)

    def execute(self):
        script = self.toPlainText()

        try:
            script_code = compile(script, '<interactive interpreter>', 'exec')
        except (SyntaxError) as e:
            self.syntaxError.emit(e.lineno)
            return
        with self.stdoutRedirect:
            try:
                exec(script_code, globals(), self._locals)
            except (StandardError) as e: #Which error should this be?
                type_, value_, traceback_ = sys.exc_info()
                tb = traceback.extract_tb(traceback_)

                index = self._termWidget.storeTraceback(tb)
                self.traceback.emit(index)

    def lineNumberAreaPaintEvent(self, event):
        painter = QtGui.QPainter(self._lineNumber)
        painter.fillRect(event.rect(), QtGui.QColor.fromRgb(200,200,200))
        block = self.firstVisibleBlock()
        blockNumber = block.blockNumber()
        top = int(self.blockBoundingGeometry(block).translated(self.contentOffset()).top())
        bottom = top + int(self.blockBoundingRect(block).height())

        while block.isValid() and top <= event.rect().bottom():
            if block.isVisible() and bottom >= event.rect().top():
                number = str(blockNumber+1)
                painter.setPen(QtCore.Qt.black)
                painter.drawText(0, top, self._lineNumber.width(), self.fontMetrics().height(), QtCore.Qt.AlignRight, number)

            block = block.next()
            top = bottom
            bottom = top + int(self.blockBoundingRect(block).height())
            blockNumber += 1

    def highlightCurrentLine(self):

        sel = QtGui.QTextEdit.ExtraSelection()
        lineColor = QtGui.QColor(QtCore.Qt.gray).lighter(150)
        sel.format.setBackground(QtGui.QBrush(lineColor,QtCore.Qt.DiagCrossPattern))
        sel.format.setProperty(QtGui.QTextFormat.FullWidthSelection, True)
        sel.cursor = self.textCursor()
        sel.cursor.clearSelection()
        extraSelections = [sel]

        self.setExtraSelections(extraSelections)

    def updateLineNumberArea(self, area, num):
        if (num):
            self._lineNumber.scroll(0, num)
        else:
            self._lineNumber.update(0, area.y(), self._lineNumber.width(), area.height())

        if area.contains(self.viewport().rect()):
            self.updateLineNumberAreaWidth(0)

    def updateLineNumberAreaWidth(self, num):
        self.setViewportMargins(self.lineNumberAreaWidth(), 0, 0, 0)

    def lineNumberAreaWidth(self):
        digits = math.floor(math.log10(self.blockCount()))+1
        space = 3 + self.fontMetrics().width('9')*digits
        return space

    def resizeEvent(self, event):
        super(QtTermEntryWidget, self).resizeEvent(event)

        cr = self.contentsRect()
        nr = QtCore.QRect(cr.left(), cr.top(), self.lineNumberAreaWidth(), cr.height())
        self._lineNumber.setGeometry(nr)

class QtTermResultsWidget(QtGui.QTextBrowser):
    def __init__(self, parent=None):
        super(QtTermResultsWidget, self).__init__(parent)
        self.setOpenLinks(False)
        self.anchorClicked.connect(self.handleLink)
        cursor = self.textCursor()
        self.setReadOnly(True)

        self._termWidget = parent

        self.writeLock = Lock()

    def handleLink(self, url):
        pass
        #TODO: Implement some sort of traceback display.

    def handleOutput(self, text):
        with self.writeLock:
            self.moveCursor(QtGui.QTextCursor.End)
            self.insertPlainText(text)

    def handleTraceback(self, index):
        with self.writeLock:
            tb = self._termWidget.traceback(index)
            self.moveCursor(QtGui.QTextCursor.End)

            linkName = "Error: {path}".format(path=traceback.format_list(tb)[-1])
            hoverText = ' '.join(traceback.format_list(tb))
            # For some reason the </a> doesn't get closed unless we have something after it, hence the space.
            self.insertHtml("""<a href='traceback:///{index}' title='{hoverText}'>{linkName} </a>&nbsp""".format(
                    linkName=linkName,
                    index=index,
                    hoverText=hoverText,
                )
            )
            self.insertPlainText("\n")

class QtTermWidget(QtGui.QWidget):
    def __init__(self, parent=None):
        super(QtTermWidget, self).__init__(parent)

        layout = QtGui.QVBoxLayout(self)
        self._splitter = QtGui.QSplitter(QtCore.Qt.Vertical, self)
        layout.addWidget(self._splitter)

        self._results = QtTermResultsWidget(self)
        self._splitter.addWidget(self._results)

        self._entry = QtTermEntryWidget(self)
        self._splitter.addWidget(self._entry)

        self.setLayout(layout)

        self._tracebacks = []

        self._entry.traceback.connect(self._results.handleTraceback)

        self._entry.stdoutRedirect.output.connect(self._results.handleOutput)

    def traceback(self, index):
        return self._tracebacks[index]

    def storeTraceback(self, tb):
        self._tracebacks.append(tb)
        return len(self._tracebacks)-1

def main():
    import sys
    app = QtGui.QApplication(sys.argv)
    w = QtTermWidget()
    w.show()
    app.exec_()

if __name__ == "__main__":
    main()


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>OpenNI 2.0: openni::PlaybackControl Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

OpenNI 2.0

Main Page

Namespaces

Classes

Files

Class List

Class Index

Class Members

openni

PlaybackControl

Public Member Functions |
Friends

openni::PlaybackControl Class Reference

#include <OpenNI.h>

List of all members.

Public Member Functions

 	~PlaybackControl ()

int 	getNumberOfFrames (const VideoStream &stream) const

bool 	getRepeatEnabled () const

float 	getSpeed () const

bool 	isValid () const

Status 	seek (const VideoStream &stream, int frameIndex)

Status 	setRepeatEnabled (bool repeat)

Status 	setSpeed (float speed)

Friends

class 	Device

Detailed Description

The PlaybackControl class provides access to a series of specific to playing back a recording from a file device.

When playing a stream back from a recording instead of playing from a live device, it is possible to vary playback speed, change the current time location (ie fast forward / rewind / seek), specify whether the playback should be repeated at the end of the recording, and query the total size of the recording.

Since none of these functions make sense in the context of a physical device, they are split out into a seperate playback control class. To use, simply create your file device, create a PlaybackControl, and then attach the PlaybackControl to the file device.

Constructor & Destructor Documentation

          openni::PlaybackControl::~PlaybackControl
          (
          	)
           [inline]

Deconstructor. Destroys a PlaybackControl class. The deconstructor presently detaches from its recording automatically, but it is considered a best practice for applications to manually detach from any stream that was attached to.

Member Function Documentation

          int openni::PlaybackControl::getNumberOfFrames
          (
          const VideoStream &
          stream	)
           const [inline]

Provides the a count of frames that this recording contains for a given stream. This is useful both to determine the length of the recording, and to ensure that a valid Frame Index is set when using the PlaybackControl::seek() function.

Parameters:

[in]	stream	The video stream to count frames for

Returns:

Number of frames in provided VideoStream, or 0 if the stream is not part of the recording

          bool openni::PlaybackControl::getRepeatEnabled
          (
          	)
           const [inline]

Gets the current repeat setting of the file device.

Returns:

true if repeat is enabled, false if not enabled.

          float openni::PlaybackControl::getSpeed
          (
          	)
           const [inline]

Getter function for the current playback speed of this device.

This value is expressed as a multiple of the speed the original recording was taken at. For example, if the original recording was at 30fps, and playback speed is set to 0.5, then the recording will play at 15fps. If playback speed is set to 2.0, then the recording would playback at 60fps.

In addition, there are two "special" values. A playback speed of 0.0 indicates that the playback should occur as fast as the system is capable of returning frames. This is most useful when testing algorithms on large datasets, as it enables playback to be done at a much higher rate than would otherwise be possible.

A value of -1 indicates that speed is "manual". In this mode, new frames will only become available when an application manually reads them. If used in a polling loop, this setting also enables systems to read and process frames limited only by available processing speeds.

Returns:

Current playback speed of the device, measured as ratio of recording speed.

          bool openni::PlaybackControl::isValid
          (
          	)
           const [inline]

          Status openni::PlaybackControl::seek
          (
          const VideoStream &
          stream,

          int
          frameIndex

          )
          	 [inline]

Seeks within a VideoStream to a given FrameID. Note that when this function is called on one stream, all other streams will also be changed to the corresponding place in the recording. The FrameIDs of different streams may not match, since FrameIDs may differ for streams that are not synchronized, but the recording will set all streams to the same moment in time.

Parameters:

[in]	stream	Stream for which the frameIndex value is valid.

[in]	frameIndex	Frame index to move playback to

Returns:

Status code indicating success or failure of this operation

          Status openni::PlaybackControl::setRepeatEnabled
          (
          bool
          repeat	)
           [inline]

Changes the current repeat mode of the device. If repeat mode is turned on, then the recording will begin playback again at the beginning after the last frame is read. If turned off, no more frames will become available after last frame is read.

Parameters:

[in]	repeat	New value for repeat -- true to enable, false to disable

Returns:

Status code indicating success or failure of this operations.

          Status openni::PlaybackControl::setSpeed
          (
          float
          speed	)
           [inline]

Setter function for the playback speed of the device. For a full explaination of what this value means

See also:

PlaybackControl::getSpeed().

Parameters:

[in]	speed	Desired new value of playback speed, as ratio of original recording.

Returns:

Status code indicating success or failure of this operation.

Friends And Related Function Documentation

          friend class Device [friend]

The documentation for this class was generated from the following file:

OpenNI.h

<address class="footer">
Generated on Wed May 29 2013 13:15:22 for OpenNI 2.0 by

 1.7.6.1
</address>


text:
System Tray
===========

Helper functions to build a cross platform system tray


text:
<?php $this->load->view('head'); ?>

    <form class="form" id="form" action="<?php echo admin_url(); ?>danh-muc-san-pham/add" method="post" enctype="multipart/form-data">
        <fieldset>

                    <img src="<?php echo public_url('admin'); ?>/images/icons/dark/add.png" class="titleIcon" />

Thêm mới Danh mục sản phẩm

                    Tên:*

                        <input name="name" id="param_name" _autocheck="true" value="<?php echo set_value('name'); ?>" type="text" />

<?php echo form_error('name'); ?>

                    Danh mục cha:*

                     <?php if(isset($list) && !empty($list)){ ?>

                            <select name="parent_id" id="param_parent_cat">
                                <option value="0">Danh mục gốc</option>
                                <?php  abc($list); ?>
                            </select>

                         <?php }else{ ?>

                    Hiện tại không có danh mục sản phẩm!

                  <?php } ?>

<?php echo form_error('parent_id'); ?>

                    Thứ tự hiển thị:*

                        <input name="sort_order" id="sort_order_name" placeholder="1, 2, 3, etc." _autocheck="true" value="<?php echo set_value('sort_order'); ?>" type="text" />

<?php echo form_error('sort_order'); ?>

                    <input type="submit" value="Thêm mới" class="redB" />
                    <input type="reset" value="Reset" class="basic" />

        </fieldset>
    </form>


text:
namespace v8 {

namespace base {
class Mutex;
class RecursiveMutex;
class VirtualMemory;
}

namespace internal {

// Determine whether we are running in a simulated environment.
// Setting USE_SIMULATOR explicitly from the build script will force
// the use of a simulated environment.
#if !defined(USE_SIMULATOR)
#if (V8_TARGET_ARCH_ARM64 && !V8_HOST_ARCH_ARM64)
#define USE_SIMULATOR 1
#endif
#if (V8_TARGET_ARCH_ARM && !V8_HOST_ARCH_ARM)
#define USE_SIMULATOR 1
#endif
#if (V8_TARGET_ARCH_PPC && !V8_HOST_ARCH_PPC)
#define USE_SIMULATOR 1
#endif
#if (V8_TARGET_ARCH_MIPS && !V8_HOST_ARCH_MIPS)
#define USE_SIMULATOR 1
#endif
#if (V8_TARGET_ARCH_MIPS64 && !V8_HOST_ARCH_MIPS64)
#define USE_SIMULATOR 1
#endif
#if (V8_TARGET_ARCH_S390 && !V8_HOST_ARCH_S390)
#define USE_SIMULATOR 1
#endif
#endif

// Determine whether the architecture uses an embedded constant pool
// (contiguous constant pool embedded in code object).
#if V8_TARGET_ARCH_PPC
#define V8_EMBEDDED_CONSTANT_POOL 1
#else
#define V8_EMBEDDED_CONSTANT_POOL 0
#endif

#ifdef V8_TARGET_ARCH_ARM
// Set stack limit lower for ARM than for other architectures because
// stack allocating MacroAssembler takes 120K bytes.
// See issue crbug.com/405338
#define V8_DEFAULT_STACK_SIZE_KB 864
#else
// Slightly less than 1MB, since Windows' default stack size for
// the main execution thread is 1MB for both 32 and 64-bit.
#define V8_DEFAULT_STACK_SIZE_KB 984
#endif

// Determine whether double field unboxing feature is enabled.
#if V8_TARGET_ARCH_64_BIT
#define V8_DOUBLE_FIELDS_UNBOXING 1
#else
#define V8_DOUBLE_FIELDS_UNBOXING 0
#endif

typedef uint8_t byte;
typedef byte* Address;

// -----------------------------------------------------------------------------
// Constants

const int KB = 1024;
const int MB = KB * KB;
const int GB = KB * KB * KB;
const int kMaxInt = 0x7FFFFFFF;
const int kMinInt = -kMaxInt - 1;
const int kMaxInt8 = (1 << 7) - 1;
const int kMinInt8 = -(1 << 7);
const int kMaxUInt8 = (1 << 8) - 1;
const int kMinUInt8 = 0;
const int kMaxInt16 = (1 << 15) - 1;
const int kMinInt16 = -(1 << 15);
const int kMaxUInt16 = (1 << 16) - 1;
const int kMinUInt16 = 0;

const uint32_t kMaxUInt32 = 0xFFFFFFFFu;
const int kMinUInt32 = 0;

const int kCharSize = sizeof(char);
const int kShortSize = sizeof(short);  // NOLINT
const int kIntSize = sizeof(int);
const int kInt32Size = sizeof(int32_t);
const int kInt64Size = sizeof(int64_t);
const int kSizetSize = sizeof(size_t);
const int kFloatSize = sizeof(float);
const int kDoubleSize = sizeof(double);
const int kIntptrSize = sizeof(intptr_t);
const int kPointerSize = sizeof(void*);
#if V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT
const int kRegisterSize = kPointerSize + kPointerSize;
#else
const int kRegisterSize = kPointerSize;
#endif
const int kPCOnStackSize = kRegisterSize;
const int kFPOnStackSize = kRegisterSize;

#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87
const int kElidedFrameSlots = kPCOnStackSize / kPointerSize;
#else
const int kElidedFrameSlots = 0;
#endif

const int kDoubleSizeLog2 = 3;

#if V8_HOST_ARCH_64_BIT
const int kPointerSizeLog2 = 3;
const intptr_t kIntptrSignBit = V8_INT64_C(0x8000000000000000);
const uintptr_t kUintptrAllBitsSet = V8_UINT64_C(0xFFFFFFFFFFFFFFFF);
const bool kRequiresCodeRange = true;
#if V8_TARGET_ARCH_MIPS64
// To use pseudo-relative jumps such as j/jal instructions which have 28-bit
// encoded immediate, the addresses have to be in range of 256MB aligned
// region. Used only for large object space.
const size_t kMaximalCodeRangeSize = 256 * MB;
const size_t kCodeRangeAreaAlignment = 256 * MB;
#elif V8_HOST_ARCH_PPC && V8_TARGET_ARCH_PPC && V8_OS_LINUX
const size_t kMaximalCodeRangeSize = 512 * MB;
const size_t kCodeRangeAreaAlignment = 64 * KB;  // OS page on PPC Linux
#else
const size_t kMaximalCodeRangeSize = 512 * MB;
const size_t kCodeRangeAreaAlignment = 4 * KB;  // OS page.
#endif
#if V8_OS_WIN
const size_t kMinimumCodeRangeSize = 4 * MB;
const size_t kReservedCodeRangePages = 1;
#else
const size_t kMinimumCodeRangeSize = 3 * MB;
const size_t kReservedCodeRangePages = 0;
#endif
#else
const int kPointerSizeLog2 = 2;
const intptr_t kIntptrSignBit = 0x80000000;
const uintptr_t kUintptrAllBitsSet = 0xFFFFFFFFu;
#if V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT
// x32 port also requires code range.
const bool kRequiresCodeRange = true;
const size_t kMaximalCodeRangeSize = 256 * MB;
const size_t kMinimumCodeRangeSize = 3 * MB;
const size_t kCodeRangeAreaAlignment = 4 * KB;  // OS page.
#elif V8_HOST_ARCH_PPC && V8_TARGET_ARCH_PPC && V8_OS_LINUX
const bool kRequiresCodeRange = false;
const size_t kMaximalCodeRangeSize = 0 * MB;
const size_t kMinimumCodeRangeSize = 0 * MB;
const size_t kCodeRangeAreaAlignment = 64 * KB;  // OS page on PPC Linux
#else
const bool kRequiresCodeRange = false;
const size_t kMaximalCodeRangeSize = 0 * MB;
const size_t kMinimumCodeRangeSize = 0 * MB;
const size_t kCodeRangeAreaAlignment = 4 * KB;  // OS page.
#endif
const size_t kReservedCodeRangePages = 0;
#endif

// Trigger an incremental GCs once the external memory reaches this limit.
const int kExternalAllocationSoftLimit = 64 * MB;

// Maximum object size that gets allocated into regular pages. Objects larger
// than that size are allocated in large object space and are never moved in
// memory. This also applies to new space allocation, since objects are never
// migrated from new space to large object space. Takes double alignment into
// account.
//
// Current value: Page::kAllocatableMemory (on 32-bit arch) - 512 (slack).
const int kMaxRegularHeapObjectSize = 507136;

STATIC_ASSERT(kPointerSize == (1 << kPointerSizeLog2));

const int kBitsPerByte = 8;
const int kBitsPerByteLog2 = 3;
const int kBitsPerPointer = kPointerSize * kBitsPerByte;
const int kBitsPerInt = kIntSize * kBitsPerByte;

// IEEE 754 single precision floating point number bit layout.
const uint32_t kBinary32SignMask = 0x80000000u;
const uint32_t kBinary32ExponentMask = 0x7f800000u;
const uint32_t kBinary32MantissaMask = 0x007fffffu;
const int kBinary32ExponentBias = 127;
const int kBinary32MaxExponent  = 0xFE;
const int kBinary32MinExponent  = 0x01;
const int kBinary32MantissaBits = 23;
const int kBinary32ExponentShift = 23;

// Quiet NaNs have bits 51 to 62 set, possibly the sign bit, and no
// other bits set.
const uint64_t kQuietNaNMask = static_cast<uint64_t>(0xfff) << 51;

// Latin1/UTF-16 constants
// Code-point values in Unicode 4.0 are 21 bits wide.
// Code units in UTF-16 are 16 bits wide.
typedef uint16_t uc16;
typedef int32_t uc32;
const int kOneByteSize    = kCharSize;
const int kUC16Size     = sizeof(uc16);      // NOLINT

// 128 bit SIMD value size.
const int kSimd128Size = 16;

// Round up n to be a multiple of sz, where sz is a power of 2.
#define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1))

// FUNCTION_ADDR(f) gets the address of a C function f.
#define FUNCTION_ADDR(f)                                        \
  (reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(f)))

// FUNCTION_CAST<F>(addr) casts an address into a function
// of type F. Used to invoke generated code from within C.
template <typename F>
F FUNCTION_CAST(Address addr) {
  return reinterpret_cast<F>(reinterpret_cast<intptr_t>(addr));
}

// Determine whether the architecture uses function descriptors
// which provide a level of indirection between the function pointer
// and the function entrypoint.
#if V8_HOST_ARCH_PPC && \
    (V8_OS_AIX || (V8_TARGET_ARCH_PPC64 && V8_TARGET_BIG_ENDIAN))
#define USES_FUNCTION_DESCRIPTORS 1
#define FUNCTION_ENTRYPOINT_ADDRESS(f)       \
  (reinterpret_cast<v8::internal::Address*>( \
      &(reinterpret_cast<intptr_t*>(f)[0])))
#else
#define USES_FUNCTION_DESCRIPTORS 0
#endif

// -----------------------------------------------------------------------------
// Forward declarations for frequently used classes
// (sorted alphabetically)

class FreeStoreAllocationPolicy;
template <typename T, class P = FreeStoreAllocationPolicy> class List;

// -----------------------------------------------------------------------------
// Declarations for use in both the preparser and the rest of V8.

// The Strict Mode (ECMA-262 5th edition, 4.2.2).

enum LanguageMode : uint32_t { SLOPPY, STRICT, LANGUAGE_END };

inline std::ostream& operator<<(std::ostream& os, const LanguageMode& mode) {
  switch (mode) {
    case SLOPPY: return os << "sloppy";
    case STRICT: return os << "strict";
    default: UNREACHABLE();
  }
  return os;
}

inline bool is_sloppy(LanguageMode language_mode) {
  return language_mode == SLOPPY;
}

inline bool is_strict(LanguageMode language_mode) {
  return language_mode != SLOPPY;
}

inline bool is_valid_language_mode(int language_mode) {
  return language_mode == SLOPPY || language_mode == STRICT;
}

inline LanguageMode construct_language_mode(bool strict_bit) {
  return static_cast<LanguageMode>(strict_bit);
}

enum TypeofMode : int { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF };

// This constant is used as an undefined value when passing source positions.
const int kNoSourcePosition = -1;

// This constant is used to indicate missing deoptimization information.
const int kNoDeoptimizationId = -1;

// Mask for the sign bit in a smi.
const intptr_t kSmiSignMask = kIntptrSignBit;

const int kObjectAlignmentBits = kPointerSizeLog2;
const intptr_t kObjectAlignment = 1 << kObjectAlignmentBits;
const intptr_t kObjectAlignmentMask = kObjectAlignment - 1;

// Desired alignment for pointers.
const intptr_t kPointerAlignment = (1 << kPointerSizeLog2);
const intptr_t kPointerAlignmentMask = kPointerAlignment - 1;

// Desired alignment for double values.
const intptr_t kDoubleAlignment = 8;
const intptr_t kDoubleAlignmentMask = kDoubleAlignment - 1;

// Desired alignment for 128 bit SIMD values.
const intptr_t kSimd128Alignment = 16;
const intptr_t kSimd128AlignmentMask = kSimd128Alignment - 1;

// Desired alignment for generated code is 32 bytes (to improve cache line
// utilization).
const int kCodeAlignmentBits = 5;
const intptr_t kCodeAlignment = 1 << kCodeAlignmentBits;
const intptr_t kCodeAlignmentMask = kCodeAlignment - 1;

// The owner field of a page is tagged with the page header tag. We need that
// to find out if a slot is part of a large object. If we mask out the lower
// 0xfffff bits (1M pages), go to the owner offset, and see that this field
// is tagged with the page header tag, we can just look up the owner.
// Otherwise, we know that we are somewhere (not within the first 1M) in a
// large object.
const int kPageHeaderTag = 3;
const int kPageHeaderTagSize = 2;
const intptr_t kPageHeaderTagMask = (1 << kPageHeaderTagSize) - 1;

// Zap-value: The value used for zapping dead objects.
// Should be a recognizable hex value tagged as a failure.
#ifdef V8_HOST_ARCH_64_BIT
const Address kZapValue =
    reinterpret_cast<Address>(V8_UINT64_C(0xdeadbeedbeadbeef));
const Address kHandleZapValue =
    reinterpret_cast<Address>(V8_UINT64_C(0x1baddead0baddeaf));
const Address kGlobalHandleZapValue =
    reinterpret_cast<Address>(V8_UINT64_C(0x1baffed00baffedf));
const Address kFromSpaceZapValue =
    reinterpret_cast<Address>(V8_UINT64_C(0x1beefdad0beefdaf));
const uint64_t kDebugZapValue = V8_UINT64_C(0xbadbaddbbadbaddb);
const uint64_t kSlotsZapValue = V8_UINT64_C(0xbeefdeadbeefdeef);
const uint64_t kFreeListZapValue = 0xfeed1eaffeed1eaf;
#else
const Address kZapValue = reinterpret_cast<Address>(0xdeadbeef);
const Address kHandleZapValue = reinterpret_cast<Address>(0xbaddeaf);
const Address kGlobalHandleZapValue = reinterpret_cast<Address>(0xbaffedf);
const Address kFromSpaceZapValue = reinterpret_cast<Address>(0xbeefdaf);
const uint32_t kSlotsZapValue = 0xbeefdeef;
const uint32_t kDebugZapValue = 0xbadbaddb;
const uint32_t kFreeListZapValue = 0xfeed1eaf;
#endif

const int kCodeZapValue = 0xbadc0de;
const uint32_t kPhantomReferenceZap = 0xca11bac;

// On Intel architecture, cache line size is 64 bytes.
// On ARM it may be less (32 bytes), but as far this constant is
// used for aligning data, it doesn't hurt to align on a greater value.
#define PROCESSOR_CACHE_LINE_SIZE 64

// Constants relevant to double precision floating point numbers.
// If looking only at the top 32 bits, the QNaN mask is bits 19 to 30.
const uint32_t kQuietNaNHighBitsMask = 0xfff << (51 - 32);

// -----------------------------------------------------------------------------
// Forward declarations for frequently used classes

class AccessorInfo;
class Allocation;
class Arguments;
class Assembler;
class Code;
class CodeGenerator;
class CodeStub;
class Context;
class Debug;
class DebugInfo;
class Descriptor;
class DescriptorArray;
class TransitionArray;
class ExternalReference;
class FixedArray;
class FunctionTemplateInfo;
class MemoryChunk;
class SeededNumberDictionary;
class UnseededNumberDictionary;
class NameDictionary;
class GlobalDictionary;
template <typename T> class MaybeHandle;
template <typename T> class Handle;
class Heap;
class HeapObject;
class IC;
class InterceptorInfo;
class Isolate;
class JSReceiver;
class JSArray;
class JSFunction;
class JSObject;
class LargeObjectSpace;
class MacroAssembler;
class Map;
class MapSpace;
class MarkCompactCollector;
class NewSpace;
class Object;
class OldSpace;
class ParameterCount;
class Foreign;
class Scope;
class DeclarationScope;
class ModuleScope;
class ScopeInfo;
class Script;
class Smi;
template <typename Config, class Allocator = FreeStoreAllocationPolicy>
class SplayTree;
class String;
class Symbol;
class Name;
class Struct;
class TypeFeedbackVector;
class Variable;
class RelocInfo;
class Deserializer;
class MessageLocation;

typedef bool (*WeakSlotCallback)(Object** pointer);

typedef bool (*WeakSlotCallbackWithHeap)(Heap* heap, Object** pointer);

// -----------------------------------------------------------------------------
// Miscellaneous

// NOTE: SpaceIterator depends on AllocationSpace enumeration values being
// consecutive.
// Keep this enum in sync with the ObjectSpace enum in v8.h
enum AllocationSpace {
  NEW_SPACE,   // Semispaces collected with copying collector.
  OLD_SPACE,   // May contain pointers to new space.
  CODE_SPACE,  // No pointers to new space, marked executable.
  MAP_SPACE,   // Only and all map objects.
  LO_SPACE,    // Promoted large objects.

  FIRST_SPACE = NEW_SPACE,
  LAST_SPACE = LO_SPACE,
  FIRST_PAGED_SPACE = OLD_SPACE,
  LAST_PAGED_SPACE = MAP_SPACE
};
const int kSpaceTagSize = 3;
const int kSpaceTagMask = (1 << kSpaceTagSize) - 1;

enum AllocationAlignment {
  kWordAligned,
  kDoubleAligned,
  kDoubleUnaligned,
  kSimd128Unaligned
};

// Possible outcomes for decisions.
enum class Decision : uint8_t { kUnknown, kTrue, kFalse };

inline size_t hash_value(Decision decision) {
  return static_cast<uint8_t>(decision);
}

inline std::ostream& operator<<(std::ostream& os, Decision decision) {
  switch (decision) {
    case Decision::kUnknown:
      return os << "Unknown";
    case Decision::kTrue:
      return os << "True";
    case Decision::kFalse:
      return os << "False";
  }
  UNREACHABLE();
  return os;
}

// Supported write barrier modes.
enum WriteBarrierKind : uint8_t {
  kNoWriteBarrier,
  kMapWriteBarrier,
  kPointerWriteBarrier,
  kFullWriteBarrier
};

inline size_t hash_value(WriteBarrierKind kind) {
  return static_cast<uint8_t>(kind);
}

inline std::ostream& operator<<(std::ostream& os, WriteBarrierKind kind) {
  switch (kind) {
    case kNoWriteBarrier:
      return os << "NoWriteBarrier";
    case kMapWriteBarrier:
      return os << "MapWriteBarrier";
    case kPointerWriteBarrier:
      return os << "PointerWriteBarrier";
    case kFullWriteBarrier:
      return os << "FullWriteBarrier";
  }
  UNREACHABLE();
  return os;
}

// A flag that indicates whether objects should be pretenured when
// allocated (allocated directly into the old generation) or not
// (allocated in the young generation if the object size and type
// allows).
enum PretenureFlag { NOT_TENURED, TENURED };

inline std::ostream& operator<<(std::ostream& os, const PretenureFlag& flag) {
  switch (flag) {
    case NOT_TENURED:
      return os << "NotTenured";
    case TENURED:
      return os << "Tenured";
  }
  UNREACHABLE();
  return os;
}

enum MinimumCapacity {
  USE_DEFAULT_MINIMUM_CAPACITY,
  USE_CUSTOM_MINIMUM_CAPACITY
};

enum GarbageCollector { SCAVENGER, MARK_COMPACTOR, MINOR_MARK_COMPACTOR };

enum Executability { NOT_EXECUTABLE, EXECUTABLE };

enum VisitMode {
  VISIT_ALL,
  VISIT_ALL_IN_SCAVENGE,
  VISIT_ALL_IN_SWEEP_NEWSPACE,
  VISIT_ONLY_STRONG,
  VISIT_ONLY_STRONG_FOR_SERIALIZATION,
  VISIT_ONLY_STRONG_ROOT_LIST,
};

// Flag indicating whether code is built into the VM (one of the natives files).
enum NativesFlag {
  NOT_NATIVES_CODE,
  EXTENSION_CODE,
  NATIVES_CODE,
  INSPECTOR_CODE
};

// JavaScript defines two kinds of 'nil'.
enum NilValue { kNullValue, kUndefinedValue };

// ParseRestriction is used to restrict the set of valid statements in a
// unit of compilation.  Restriction violations cause a syntax error.
enum ParseRestriction {
  NO_PARSE_RESTRICTION,         // All expressions are allowed.
  ONLY_SINGLE_FUNCTION_LITERAL  // Only a single FunctionLiteral expression.
};

// TODO(gsathya): Move this to JSPromise once we create it.
// This should be in sync with the constants in promise.js
enum PromiseStatus {
  kPromisePending,
  kPromiseFulfilled,
  kPromiseRejected,
};

// A CodeDesc describes a buffer holding instructions and relocation
// information. The instructions start at the beginning of the buffer
// and grow forward, the relocation information starts at the end of
// the buffer and grows backward.  A constant pool may exist at the
// end of the instructions.
//
//  |<--------------- buffer_size ----------------------------------->|
//  |<------------- instr_size ---------->|        |<-- reloc_size -->|
//  |               |<- const_pool_size ->|                           |
//  +=====================================+========+==================+
//  |  instructions |        data         |  free  |    reloc info    |
//  +=====================================+========+==================+
//  ^
//  |
//  buffer

struct CodeDesc {
  byte* buffer;
  int buffer_size;
  int instr_size;
  int reloc_size;
  int constant_pool_size;
  byte* unwinding_info;
  int unwinding_info_size;
  Assembler* origin;
};

// Callback function used for checking constraints when copying/relocating
// objects. Returns true if an object can be copied/relocated from its
// old_addr to a new_addr.
typedef bool (*ConstraintCallback)(Address new_addr, Address old_addr);

// Callback function on inline caches, used for iterating over inline caches
// in compiled code.
typedef void (*InlineCacheCallback)(Code* code, Address ic);

// State for inline cache call sites. Aliased as IC::State.
enum InlineCacheState {
  // Has never been executed.
  UNINITIALIZED,
  // Has been executed but monomorhic state has been delayed.
  PREMONOMORPHIC,
  // Has been executed and only one receiver type has been seen.
  MONOMORPHIC,
  // Check failed due to prototype (or map deprecation).
  RECOMPUTE_HANDLER,
  // Multiple receiver types have been seen.
  POLYMORPHIC,
  // Many receiver types have been seen.
  MEGAMORPHIC,
  // A generic handler is installed and no extra typefeedback is recorded.
  GENERIC,
};

enum CacheHolderFlag {
  kCacheOnPrototype,
  kCacheOnPrototypeReceiverIsDictionary,
  kCacheOnPrototypeReceiverIsPrimitive,
  kCacheOnReceiver
};

enum WhereToStart { kStartAtReceiver, kStartAtPrototype };

// The Store Buffer (GC).
typedef enum {
  kStoreBufferFullEvent,
  kStoreBufferStartScanningPagesEvent,
  kStoreBufferScanningPageEvent
} StoreBufferEvent;

typedef void (*StoreBufferCallback)(Heap* heap,
                                    MemoryChunk* page,
                                    StoreBufferEvent event);

// Union used for customized checking of the IEEE double types
// inlined within v8 runtime, rather than going to the underlying
// platform headers and libraries
union IeeeDoubleLittleEndianArchType {
  double d;
  struct {
    unsigned int man_low  :32;
    unsigned int man_high :20;
    unsigned int exp      :11;
    unsigned int sign     :1;
  } bits;
};

union IeeeDoubleBigEndianArchType {
  double d;
  struct {
    unsigned int sign     :1;
    unsigned int exp      :11;
    unsigned int man_high :20;
    unsigned int man_low  :32;
  } bits;
};

#if V8_TARGET_LITTLE_ENDIAN
typedef IeeeDoubleLittleEndianArchType IeeeDoubleArchType;
const int kIeeeDoubleMantissaWordOffset = 0;
const int kIeeeDoubleExponentWordOffset = 4;
#else
typedef IeeeDoubleBigEndianArchType IeeeDoubleArchType;
const int kIeeeDoubleMantissaWordOffset = 4;
const int kIeeeDoubleExponentWordOffset = 0;
#endif

// AccessorCallback
struct AccessorDescriptor {
  Object* (*getter)(Isolate* isolate, Object* object, void* data);
  Object* (*setter)(
      Isolate* isolate, JSObject* object, Object* value, void* data);
  void* data;
};

// -----------------------------------------------------------------------------
// Macros

// Testers for test.

#define HAS_SMI_TAG(value) \
  ((reinterpret_cast<intptr_t>(value) & kSmiTagMask) == kSmiTag)

// OBJECT_POINTER_ALIGN returns the value aligned as a HeapObject pointer
#define OBJECT_POINTER_ALIGN(value)                             \
  (((value) + kObjectAlignmentMask) & ~kObjectAlignmentMask)

// POINTER_SIZE_ALIGN returns the value aligned as a pointer.
#define POINTER_SIZE_ALIGN(value)                               \
  (((value) + kPointerAlignmentMask) & ~kPointerAlignmentMask)

// CODE_POINTER_ALIGN returns the value aligned as a generated code segment.
#define CODE_POINTER_ALIGN(value)                               \
  (((value) + kCodeAlignmentMask) & ~kCodeAlignmentMask)

// DOUBLE_POINTER_ALIGN returns the value algined for double pointers.
#define DOUBLE_POINTER_ALIGN(value) \
  (((value) + kDoubleAlignmentMask) & ~kDoubleAlignmentMask)

// CPU feature flags.
enum CpuFeature {
  // x86
  SSE4_1,
  SSSE3,
  SSE3,
  SAHF,
  AVX,
  FMA3,
  BMI1,
  BMI2,
  LZCNT,
  POPCNT,
  ATOM,
  // ARM
  // - Standard configurations. The baseline is ARMv6+VFPv2.
  ARMv7,        // ARMv7-A + VFPv3-D32 + NEON
  ARMv7_SUDIV,  // ARMv7-A + VFPv4-D32 + NEON + SUDIV
  ARMv8,        // ARMv8-A (+ all of the above)
  // MIPS, MIPS64
  FPU,
  FP64FPU,
  MIPSr1,
  MIPSr2,
  MIPSr6,
  // ARM64
  ALWAYS_ALIGN_CSP,
  // PPC
  FPR_GPR_MOV,
  LWSYNC,
  ISELECT,
  // S390
  DISTINCT_OPS,
  GENERAL_INSTR_EXT,
  FLOATING_POINT_EXT,

  NUMBER_OF_CPU_FEATURES,

  // ARM feature aliases (based on the standard configurations above).
  VFPv3 = ARMv7,
  NEON = ARMv7,
  VFP32DREGS = ARMv7,
  SUDIV = ARMv7_SUDIV
};

// Defines hints about receiver values based on structural knowledge.
enum class ConvertReceiverMode : unsigned {
  kNullOrUndefined,     // Guaranteed to be null or undefined.
  kNotNullOrUndefined,  // Guaranteed to never be null or undefined.
  kAny                  // No specific knowledge about receiver.
};

inline size_t hash_value(ConvertReceiverMode mode) {
  return bit_cast<unsigned>(mode);
}

inline std::ostream& operator<<(std::ostream& os, ConvertReceiverMode mode) {
  switch (mode) {
    case ConvertReceiverMode::kNullOrUndefined:
      return os << "NULL_OR_UNDEFINED";
    case ConvertReceiverMode::kNotNullOrUndefined:
      return os << "NOT_NULL_OR_UNDEFINED";
    case ConvertReceiverMode::kAny:
      return os << "ANY";
  }
  UNREACHABLE();
  return os;
}

// Defines whether tail call optimization is allowed.
enum class TailCallMode : unsigned { kAllow, kDisallow };

inline size_t hash_value(TailCallMode mode) { return bit_cast<unsigned>(mode); }

inline std::ostream& operator<<(std::ostream& os, TailCallMode mode) {
  switch (mode) {
    case TailCallMode::kAllow:
      return os << "ALLOW_TAIL_CALLS";
    case TailCallMode::kDisallow:
      return os << "DISALLOW_TAIL_CALLS";
  }
  UNREACHABLE();
  return os;
}

// Valid hints for the abstract operation OrdinaryToPrimitive,
// implemented according to ES6, section 7.1.1.
enum class OrdinaryToPrimitiveHint { kNumber, kString };

// Valid hints for the abstract operation ToPrimitive,
// implemented according to ES6, section 7.1.1.
enum class ToPrimitiveHint { kDefault, kNumber, kString };

// Defines specifics about arguments object or rest parameter creation.
enum class CreateArgumentsType : uint8_t {
  kMappedArguments,
  kUnmappedArguments,
  kRestParameter
};

inline size_t hash_value(CreateArgumentsType type) {
  return bit_cast<uint8_t>(type);
}

inline std::ostream& operator<<(std::ostream& os, CreateArgumentsType type) {
  switch (type) {
    case CreateArgumentsType::kMappedArguments:
      return os << "MAPPED_ARGUMENTS";
    case CreateArgumentsType::kUnmappedArguments:
      return os << "UNMAPPED_ARGUMENTS";
    case CreateArgumentsType::kRestParameter:
      return os << "REST_PARAMETER";
  }
  UNREACHABLE();
  return os;
}

// Used to specify if a macro instruction must perform a smi check on tagged
// values.
enum SmiCheckType {
  DONT_DO_SMI_CHECK,
  DO_SMI_CHECK
};

enum ScopeType : uint8_t {
  EVAL_SCOPE,      // The top-level scope for an eval source.
  FUNCTION_SCOPE,  // The top-level scope for a function.
  MODULE_SCOPE,    // The scope introduced by a module literal
  SCRIPT_SCOPE,    // The top-level scope for a script or a top-level eval.
  CATCH_SCOPE,     // The scope introduced by catch.
  BLOCK_SCOPE,     // The scope introduced by a new block.
  WITH_SCOPE       // The scope introduced by with.
};

// The mips architecture prior to revision 5 has inverted encoding for sNaN.
// The x87 FPU convert the sNaN to qNaN automatically when loading sNaN from
// memmory.
// Use mips sNaN which is a not used qNaN in x87 port as sNaN to workaround this
// issue
// for some test cases.
#if (V8_TARGET_ARCH_MIPS && !defined(_MIPS_ARCH_MIPS32R6) &&           \
     (!defined(USE_SIMULATOR) || !defined(_MIPS_TARGET_SIMULATOR))) || \
    (V8_TARGET_ARCH_MIPS64 && !defined(_MIPS_ARCH_MIPS64R6) &&         \
     (!defined(USE_SIMULATOR) || !defined(_MIPS_TARGET_SIMULATOR))) || \
    (V8_TARGET_ARCH_X87)
const uint32_t kHoleNanUpper32 = 0xFFFF7FFF;
const uint32_t kHoleNanLower32 = 0xFFFF7FFF;
#else
const uint32_t kHoleNanUpper32 = 0xFFF7FFFF;
const uint32_t kHoleNanLower32 = 0xFFF7FFFF;
#endif

const uint64_t kHoleNanInt64 =
    (static_cast<uint64_t>(kHoleNanUpper32) << 32) | kHoleNanLower32;

// ES6 section 20.1.2.6 Number.MAX_SAFE_INTEGER
const double kMaxSafeInteger = 9007199254740991.0;  // 2^53-1

// The order of this enum has to be kept in sync with the predicates below.
enum VariableMode : uint8_t {
  // User declared variables:
  VAR,  // declared via 'var', and 'function' declarations

  LET,  // declared via 'let' declarations (first lexical)

  CONST,  // declared via 'const' declarations (last lexical)

  // Variables introduced by the compiler:
  TEMPORARY,  // temporary variables (not user-visible), stack-allocated
              // unless the scope as a whole has forced context allocation

  DYNAMIC,  // always require dynamic lookup (we don't know
            // the declaration)

  DYNAMIC_GLOBAL,  // requires dynamic lookup, but we know that the
                   // variable is global unless it has been shadowed
                   // by an eval-introduced variable

  DYNAMIC_LOCAL,  // requires dynamic lookup, but we know that the
                  // variable is local and where it is unless it
                  // has been shadowed by an eval-introduced
                  // variable

  kLastVariableMode = DYNAMIC_LOCAL
};

// Printing support
#ifdef DEBUG
inline const char* VariableMode2String(VariableMode mode) {
  switch (mode) {
    case VAR:
      return "VAR";
    case LET:
      return "LET";
    case CONST:
      return "CONST";
    case DYNAMIC:
      return "DYNAMIC";
    case DYNAMIC_GLOBAL:
      return "DYNAMIC_GLOBAL";
    case DYNAMIC_LOCAL:
      return "DYNAMIC_LOCAL";
    case TEMPORARY:
      return "TEMPORARY";
  }
  UNREACHABLE();
  return NULL;
}
#endif

enum VariableKind : uint8_t {
  NORMAL_VARIABLE,
  FUNCTION_VARIABLE,
  THIS_VARIABLE,
  SLOPPY_FUNCTION_NAME_VARIABLE,
  kLastKind = SLOPPY_FUNCTION_NAME_VARIABLE
};

inline bool IsDynamicVariableMode(VariableMode mode) {
  return mode >= DYNAMIC && mode <= DYNAMIC_LOCAL;
}

inline bool IsDeclaredVariableMode(VariableMode mode) {
  STATIC_ASSERT(VAR == 0);  // Implies that mode >= VAR.
  return mode <= CONST;
}

inline bool IsLexicalVariableMode(VariableMode mode) {
  return mode >= LET && mode <= CONST;
}

enum VariableLocation : uint8_t {
  // Before and during variable allocation, a variable whose location is
  // not yet determined.  After allocation, a variable looked up as a
  // property on the global object (and possibly absent).  name() is the
  // variable name, index() is invalid.
  UNALLOCATED,

  // A slot in the parameter section on the stack.  index() is the
  // parameter index, counting left-to-right.  The receiver is index -1;
  // the first parameter is index 0.
  PARAMETER,

  // A slot in the local section on the stack.  index() is the variable
  // index in the stack frame, starting at 0.
  LOCAL,

  // An indexed slot in a heap context.  index() is the variable index in
  // the context object on the heap, starting at 0.  scope() is the
  // corresponding scope.
  CONTEXT,

  // A named slot in a heap context.  name() is the variable name in the
  // context object on the heap, with lookup starting at the current
  // context.  index() is invalid.
  LOOKUP,

  // A named slot in a module's export table.
  MODULE,

  kLastVariableLocation = MODULE
};

// ES6 Draft Rev3 10.2 specifies declarative environment records with mutable
// and immutable bindings that can be in two states: initialized and
// uninitialized. In ES5 only immutable bindings have these two states. When
// accessing a binding, it needs to be checked for initialization. However in
// the following cases the binding is initialized immediately after creation
// so the initialization check can always be skipped:
// 1. Var declared local variables.
//      var foo;
// 2. A local variable introduced by a function declaration.
//      function foo() {}
// 3. Parameters
//      function x(foo) {}
// 4. Catch bound variables.
//      try {} catch (foo) {}
// 6. Function variables of named function expressions.
//      var x = function foo() {}
// 7. Implicit binding of 'this'.
// 8. Implicit binding of 'arguments' in functions.
//
// ES5 specified object environment records which are introduced by ES elements
// such as Program and WithStatement that associate identifier bindings with the
// properties of some object. In the specification only mutable bindings exist
// (which may be non-writable) and have no distinct initialization step. However
// V8 allows const declarations in global code with distinct creation and
// initialization steps which are represented by non-writable properties in the
// global object. As a result also these bindings need to be checked for
// initialization.
//
// The following enum specifies a flag that indicates if the binding needs a
// distinct initialization step (kNeedsInitialization) or if the binding is
// immediately initialized upon creation (kCreatedInitialized).
enum InitializationFlag : uint8_t { kNeedsInitialization, kCreatedInitialized };

enum class HoleCheckMode { kRequired, kElided };

enum MaybeAssignedFlag : uint8_t { kNotAssigned, kMaybeAssigned };

// Serialized in PreparseData, so numeric values should not be changed.
enum ParseErrorType { kSyntaxError = 0, kReferenceError = 1 };

enum MinusZeroMode {
  TREAT_MINUS_ZERO_AS_ZERO,
  FAIL_ON_MINUS_ZERO
};

enum Signedness { kSigned, kUnsigned };

enum FunctionKind : uint16_t {
  kNormalFunction = 0,
  kArrowFunction = 1 << 0,
  kGeneratorFunction = 1 << 1,
  kConciseMethod = 1 << 2,
  kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod,
  kDefaultConstructor = 1 << 3,
  kSubclassConstructor = 1 << 4,
  kBaseConstructor = 1 << 5,
  kGetterFunction = 1 << 6,
  kSetterFunction = 1 << 7,
  kAsyncFunction = 1 << 8,
  kModule = 1 << 9,
  kAccessorFunction = kGetterFunction | kSetterFunction,
  kDefaultBaseConstructor = kDefaultConstructor | kBaseConstructor,
  kDefaultSubclassConstructor = kDefaultConstructor | kSubclassConstructor,
  kClassConstructor =
      kBaseConstructor | kSubclassConstructor | kDefaultConstructor,
  kAsyncArrowFunction = kArrowFunction | kAsyncFunction,
  kAsyncConciseMethod = kAsyncFunction | kConciseMethod
};

inline bool IsValidFunctionKind(FunctionKind kind) {
  return kind == FunctionKind::kNormalFunction ||
         kind == FunctionKind::kArrowFunction ||
         kind == FunctionKind::kGeneratorFunction ||
         kind == FunctionKind::kModule ||
         kind == FunctionKind::kConciseMethod ||
         kind == FunctionKind::kConciseGeneratorMethod ||
         kind == FunctionKind::kGetterFunction ||
         kind == FunctionKind::kSetterFunction ||
         kind == FunctionKind::kAccessorFunction ||
         kind == FunctionKind::kDefaultBaseConstructor ||
         kind == FunctionKind::kDefaultSubclassConstructor ||
         kind == FunctionKind::kBaseConstructor ||
         kind == FunctionKind::kSubclassConstructor ||
         kind == FunctionKind::kAsyncFunction ||
         kind == FunctionKind::kAsyncArrowFunction ||
         kind == FunctionKind::kAsyncConciseMethod;
}

inline bool IsArrowFunction(FunctionKind kind) {
  DCHECK(IsValidFunctionKind(kind));
  return kind & FunctionKind::kArrowFunction;
}

inline bool IsGeneratorFunction(FunctionKind kind) {
  DCHECK(IsValidFunctionKind(kind));
  return kind & FunctionKind::kGeneratorFunction;
}

inline bool IsModule(FunctionKind kind) {
  DCHECK(IsValidFunctionKind(kind));
  return kind & FunctionKind::kModule;
}

inline bool IsAsyncFunction(FunctionKind kind) {
  DCHECK(IsValidFunctionKind(kind));
  return kind & FunctionKind::kAsyncFunction;
}

inline bool IsResumableFunction(FunctionKind kind) {
  return IsGeneratorFunction(kind) || IsAsyncFunction(kind) || IsModule(kind);
}

inline bool IsConciseMethod(FunctionKind kind) {
  DCHECK(IsValidFunctionKind(kind));
  return kind & FunctionKind::kConciseMethod;
}

inline bool IsGetterFunction(FunctionKind kind) {
  DCHECK(IsValidFunctionKind(kind));
  return kind & FunctionKind::kGetterFunction;
}

inline bool IsSetterFunction(FunctionKind kind) {
  DCHECK(IsValidFunctionKind(kind));
  return kind & FunctionKind::kSetterFunction;
}

inline bool IsAccessorFunction(FunctionKind kind) {
  DCHECK(IsValidFunctionKind(kind));
  return kind & FunctionKind::kAccessorFunction;
}

inline bool IsDefaultConstructor(FunctionKind kind) {
  DCHECK(IsValidFunctionKind(kind));
  return kind & FunctionKind::kDefaultConstructor;
}

inline bool IsBaseConstructor(FunctionKind kind) {
  DCHECK(IsValidFunctionKind(kind));
  return kind & FunctionKind::kBaseConstructor;
}

inline bool IsSubclassConstructor(FunctionKind kind) {
  DCHECK(IsValidFunctionKind(kind));
  return kind & FunctionKind::kSubclassConstructor;
}

inline bool IsClassConstructor(FunctionKind kind) {
  DCHECK(IsValidFunctionKind(kind));
  return kind & FunctionKind::kClassConstructor;
}

inline bool IsConstructable(FunctionKind kind, LanguageMode mode) {
  if (IsAccessorFunction(kind)) return false;
  if (IsConciseMethod(kind)) return false;
  if (IsArrowFunction(kind)) return false;
  if (IsGeneratorFunction(kind)) return false;
  if (IsAsyncFunction(kind)) return false;
  return true;
}

enum class CallableType : unsigned { kJSFunction, kAny };

inline size_t hash_value(CallableType type) { return bit_cast<unsigned>(type); }

inline std::ostream& operator<<(std::ostream& os, CallableType function_type) {
  switch (function_type) {
    case CallableType::kJSFunction:
      return os << "JSFunction";
    case CallableType::kAny:
      return os << "Any";
  }
  UNREACHABLE();
  return os;
}

inline uint32_t ObjectHash(Address address) {
  // All objects are at least pointer aligned, so we can remove the trailing
  // zeros.
  return static_cast<uint32_t>(bit_cast<uintptr_t>(address) >>
                               kPointerSizeLog2);
}

// Type feedback is encoded in such a way that, we can combine the feedback
// at different points by performing an 'OR' operation. Type feedback moves
// to a more generic type when we combine feedback.
// kSignedSmall -> kNumber  -> kNumberOrOddball -> kAny
//                             kString          -> kAny
// TODO(mythria): Remove kNumber type when crankshaft can handle Oddballs
// similar to Numbers. We don't need kNumber feedback for Turbofan. Extra
// information about Number might reduce few instructions but causes more
// deopts. We collect Number only because crankshaft does not handle all
// cases of oddballs.
class BinaryOperationFeedback {
 public:
  enum {
    kNone = 0x0,
    kSignedSmall = 0x1,
    kNumber = 0x3,
    kNumberOrOddball = 0x7,
    kString = 0x8,
    kAny = 0x1F
  };
};

// Type feedback is encoded in such a way that, we can combine the feedback
// at different points by performing an 'OR' operation. Type feedback moves
// to a more generic type when we combine feedback.
// kSignedSmall -> kNumber  -> kAny
//                 kString  -> kAny
// TODO(epertoso): consider unifying this with BinaryOperationFeedback.
class CompareOperationFeedback {
 public:
  enum {
    kNone = 0x00,
    kSignedSmall = 0x01,
    kNumber = 0x3,
    kNumberOrOddball = 0x7,
    kString = 0x8,
    kAny = 0x1F
  };
};

// Describes how exactly a frame has been dropped from stack.
enum LiveEditFrameDropMode {
  // No frame has been dropped.
  LIVE_EDIT_FRAMES_UNTOUCHED,
  // The top JS frame had been calling debug break slot stub. Patch the
  // address this stub jumps to in the end.
  LIVE_EDIT_FRAME_DROPPED_IN_DEBUG_SLOT_CALL,
  // The top JS frame had been calling some C++ function. The return address
  // gets patched automatically.
  LIVE_EDIT_FRAME_DROPPED_IN_DIRECT_CALL,
  LIVE_EDIT_FRAME_DROPPED_IN_RETURN_CALL,
  LIVE_EDIT_CURRENTLY_SET_MODE
};

enum class UnicodeEncoding : uint8_t {
  // Different unicode encodings in a |word32|:
  UTF16,  // hi 16bits -> trailing surrogate or 0, low 16bits -> lead surrogate
  UTF32,  // full UTF32 code unit / Unicode codepoint
};

inline size_t hash_value(UnicodeEncoding encoding) {
  return static_cast<uint8_t>(encoding);
}

inline std::ostream& operator<<(std::ostream& os, UnicodeEncoding encoding) {
  switch (encoding) {
    case UnicodeEncoding::UTF16:
      return os << "UTF16";
    case UnicodeEncoding::UTF32:
      return os << "UTF32";
  }
  UNREACHABLE();
  return os;
}

enum class IterationKind { kKeys, kValues, kEntries };

inline std::ostream& operator<<(std::ostream& os, IterationKind kind) {
  switch (kind) {
    case IterationKind::kKeys:
      return os << "IterationKind::kKeys";
    case IterationKind::kValues:
      return os << "IterationKind::kValues";
    case IterationKind::kEntries:
      return os << "IterationKind::kEntries";
  }
  UNREACHABLE();
  return os;
}

}  // namespace internal
}  // namespace v8

// Used by js-builtin-reducer to identify whether ReduceArrayIterator() is
// reducing a JSArray method, or a JSTypedArray method.
enum class ArrayIteratorKind { kArray, kTypedArray };

namespace i = v8::internal;

#endif  // V8_GLOBALS_H_


text:
"""
    This is a utility function for finding significant p-values in a 3-d brain
    region. Used in genearating scatterplot of correspondence between h
"""
from __future__ import division, print_function
import numpy as np

def stat_region(x1, x2, y1, y2, z1, z2, sig_lv, pgainloss_tst):
    """
    Calculates the number of and mean of all the significant p-values in a 3-d
    brain region of p-values.

    Parameters:
    -----------
    x1, x2: Range of volume x-coordinates (low, high)
    y1, y2: Range of volume y-coordinates (low, high)
    z1, z2: Range of volume z-coordinates (low, high)
    sig_lv: p-value significant cutoff, double
    pgainloss_tst: 3-d array of gain_loss p-value

    Returns:
    --------
    - Number of significant coordinate p-values, double
    - Mean significant p-value of region, double

    """
    cordn2d = np.array(np.where(pgainloss_tst[x1:x2, y1:y2, z1:z2] <= sig_lv)).transpose()
    cordn2d[:, 0] = cordn2d[:, 0] + x1
    cordn2d[:, 1] = cordn2d[:, 1] + y1
    cordn2d[:, 2] = cordn2d[:, 2] + z1
    meansig = np.empty(cordn2d.shape[0])
    # Find significant p-values
    for i in np.arange(cordn2d.shape[0]):
        meansig[i] = pgainloss_tst[cordn2d[i, 0], cordn2d[i, 1], cordn2d[i, 2]]
    return cordn2d.shape[0], np.mean(meansig)


text:
var selectron = {};
selectron.util = {};

selectron.util.has_keys = function has_keys(obj, temp) {
    var obj_keys, temp_keys, matches;
    // get the keys of the target object
    obj_keys = _(obj).keys();
    // get the keys of the template
    temp_keys = _(temp).keys();
    matches = true;

    _(temp_keys).each( function (key) {
        // if the key is not present in the target object, set false and break
        if ( !(_(obj_keys).include(key)) ) {
            matches = false;
            _.breakLoop();
        }
    });
    return matches;
};

selectron.util.object_match = function object_match(object, template) {
    var matches = true;

    if ( selectron.util.has_keys(object, template) ) { // first, see if the object has all the right keys
        // go over all of the temlate properties
        _(template).chain()
        .keys()
        .each( function (key) {
            var value = template[key];
            // if the template property is a function
            if (_.isFunction(value)) {
                // record the function's result
                matches = value(object[key]);
            } else if ( !_.isEqual(value, object[key]) ) { // if the properties aren't equal, set false
                matches = false;
            }

            // if false, then break
            if (!matches) {
                _.breakLoop();
            }
        });
    } else {
        matches = false;
    }
    return matches;
};

selectron.select = function select(collection, template_object) {
    return _(collection).select( function (element) {
        return selectron.util.object_match(element, template_object);
    });
};


text:
// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
// http://github.com/gogo/protobuf
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

/*
The oneofcheck plugin is used to check whether oneof is not used incorrectly.
For instance:
An error is caused if a oneof field:
  - is used in a face
  - is an embedded field

*/
package oneofcheck

import (
	"fmt"
	"github.com/gogo/protobuf/gogoproto"
	"github.com/gogo/protobuf/protoc-gen-gogo/generator"
	"os"
)

type plugin struct {
	*generator.Generator
}

func NewPlugin() *plugin {
	return &plugin{}
}

func (p *plugin) Name() string {
	return "oneofcheck"
}

func (p *plugin) Init(g *generator.Generator) {
	p.Generator = g
}

func (p *plugin) Generate(file *generator.FileDescriptor) {
	for _, msg := range file.Messages() {
		face := gogoproto.IsFace(file.FileDescriptorProto, msg.DescriptorProto)
		for _, field := range msg.GetField() {
			if field.OneofIndex == nil {
				continue
			}
			if face {
				fmt.Fprintf(os.Stderr, "ERROR: field %v.%v cannot be in a face and oneof\n", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name))
				os.Exit(1)
			}
			if gogoproto.IsEmbed(field) {
				fmt.Fprintf(os.Stderr, "ERROR: field %v.%v cannot be in an oneof and an embedded field\n", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name))
				os.Exit(1)
			}
			if !gogoproto.IsNullable(field) {
				fmt.Fprintf(os.Stderr, "ERROR: field %v.%v cannot be in an oneof and a non-nullable field\n", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name))
				os.Exit(1)
			}
			if gogoproto.IsUnion(file.FileDescriptorProto, msg.DescriptorProto) {
				fmt.Fprintf(os.Stderr, "ERROR: field %v.%v cannot be in an oneof and in an union (deprecated)\n", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name))
				os.Exit(1)
			}
		}
	}
}

func (p *plugin) GenerateImports(*generator.FileDescriptor) {}

func init() {
	generator.RegisterPlugin(NewPlugin())
}


text:
#ifndef cmGlobalBorlandMakefileGenerator_h
#define cmGlobalBorlandMakefileGenerator_h

#include "cmGlobalNMakeMakefileGenerator.h"

/** \class cmGlobalBorlandMakefileGenerator
 * \brief Write a Borland makefiles.
 *
 * cmGlobalBorlandMakefileGenerator manages nmake build process for a tree
 */
class cmGlobalBorlandMakefileGenerator : public cmGlobalNMakeMakefileGenerator
{
public:
  cmGlobalBorlandMakefileGenerator();
  static cmGlobalGenerator* New()
    { return new cmGlobalBorlandMakefileGenerator; }

  ///! Get the name for the generator.
  virtual const char* GetName() const {
    return cmGlobalBorlandMakefileGenerator::GetActualName();}
  static const char* GetActualName() {return "Borland Makefiles";}

  /** Get the documentation entry for this generator.  */
  virtual void GetDocumentation(cmDocumentationEntry& entry) const;

  ///! Create a local generator appropriate to this Global Generator
  virtual cmLocalGenerator *CreateLocalGenerator();

  /**
   * Try to determine system infomation such as shared library
   * extension, pthreads, byte order etc.
   */
  virtual void EnableLanguage(std::vector<std::string>const& languages,
                              cmMakefile *, bool optional);
};

#endif


text:
import unittest
import pytest

from selenium.webdriver.common.by import By

class RenderedWebElementTests(unittest.TestCase):

    @pytest.mark.ignore_chrome
    def testShouldPickUpStyleOfAnElement(self):
        self._loadPage("javascriptPage")

        element = self.driver.find_element(by=By.ID, value="green-parent")
        backgroundColour = element.value_of_css_property("background-color")

        self.assertEqual("rgba(0, 128, 0, 1)", backgroundColour)

        element = self.driver.find_element(by=By.ID, value="red-item")
        backgroundColour = element.value_of_css_property("background-color")

        self.assertEqual("rgba(255, 0, 0, 1)", backgroundColour)

    @pytest.mark.ignore_chrome
    def testShouldAllowInheritedStylesToBeUsed(self):
        self._loadPage("javascriptPage")

        element = self.driver.find_element(by=By.ID, value="green-item")
        backgroundColour = element.value_of_css_property("background-color")

        self.assertEqual("transparent", backgroundColour)

    def testShouldCorrectlyIdentifyThatAnElementHasWidth(self):
        self._loadPage("xhtmlTest")

        shrinko =  self.driver.find_element(by=By.ID, value="linkId")
        size = shrinko.size
        self.assertTrue(size["width"] > 0, "Width expected to be greater than 0")
        self.assertTrue(size["height"] > 0, "Height expected to be greater than 0")

    def _pageURL(self, name):
        return self.webserver.where_is(name + '.html')

    def _loadSimplePage(self):
        self._loadPage("simpleTest")

    def _loadPage(self, name):
        self.driver.get(self._pageURL(name))


text:
"""Export the Python grammar and symbols."""

# Python imports
import os

# Local imports
from .pgen2 import token
from .pgen2 import driver
from . import pytree

# The grammar file
_GRAMMAR_FILE = os.path.join(os.path.dirname(__file__), "Grammar.txt")

class Symbols(object):

    def __init__(self, grammar):
        """Initializer.

        Creates an attribute for each grammar symbol (nonterminal),
        whose value is the symbol's type (an int >= 256).
        """
        for name, symbol in grammar.symbol2number.iteritems():
            setattr(self, name, symbol)

python_grammar = driver.load_grammar(_GRAMMAR_FILE)
python_symbols = Symbols(python_grammar)

def parenthesize(node):
    return pytree.Node(python_symbols.atom,
                       (pytree.Leaf(token.LPAR, "("),
                        node,
                        pytree.Leaf(token.RPAR, ")")))


text:
<?xml version="1.0" encoding="UTF-8"?><concept xmlns="http://www.w3.org/2004/02/skos/core#">
      <prefLabel>LONGER TERM CARE MINIMUM DATA SET</prefLabel>
      <definition>Is the core set of screening and assessment elements of the Resident Assessment
         Instrument (RAI). This assessment system provides a comprehensive, accurate, standardized,
         reproducible assessment of each long term care facility resident's functional capabilities
         and helps staff to identify health problems. This assessment is performed on every resident
         in a Medicare and/or Medicaid-certified long term care facility including private
         pay.</definition>
   </concept>


text:
import { LinearScale } from "../../scale/linearScale";
import { ChartAxis } from "../chartAxis";

export class NumberAxis extends ChartAxis {
    static className = 'NumberAxis';
    static type = 'number';

    constructor() {
        super(new LinearScale());
        (this.scale as LinearScale).clamp = true;
    }

    protected _nice: boolean = true;
    set nice(value: boolean) {
        if (this._nice !== value) {
            this._nice = value;
            if (value && this.scale.nice) {
                this.scale.nice(10);
            }
        }
    }
    get nice(): boolean {
        return this._nice;
    }

    set domain(value: number[]) {
        const { min, max } = this;
        value = [
            isNaN(min) ? value[0] : min,
            isNaN(max) ? value[1] : max
        ];
        this.scale.domain = value;
        if (this.nice && this.scale.nice) {
            this.scale.nice(10);
        }
    }
    get domain(): number[] {
        return this.scale.domain;
    }

    protected _min: number = NaN;
    set min(value: number) {
        if (this._min !== value) {
            this._min = value;
            if (!isNaN(value)) {
                this.scale.domain = [value, this.scale.domain[1]];
            }
        }
    }
    get min(): number {
        return this._min;
    }

    protected _max: number = NaN;
    set max(value: number) {
        if (this._max !== value) {
            this._max = value;
            if (!isNaN(value)) {
                this.scale.domain = [this.scale.domain[0], value];
            }
        }
    }
    get max(): number {
        return this._max;
    }
}