diff --git "a/train/github-08-87726403.jsonl" "b/train/github-08-87726403.jsonl" new file mode 100644--- /dev/null +++ "b/train/github-08-87726403.jsonl" @@ -0,0 +1,1382 @@ +{"text": "pragma solidity ^0.6.0;\n\nimport \"../../GSN/Context.sol\";\nimport \"./IERC777.sol\";\nimport \"./IERC777Recipient.sol\";\nimport \"./IERC777Sender.sol\";\nimport \"../../token/ERC20/IERC20.sol\";\nimport \"../../math/SafeMath.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../introspection/IERC1820Registry.sol\";\nimport \"../../Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC777} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * Support for ERC20 is included in this contract, as specified by the EIP: both\n * the ERC777 and ERC20 interfaces can be safely used when interacting with it.\n * Both {IERC777-Sent} and {IERC20-Transfer} events are emitted on token\n * movements.\n *\n * Additionally, the {IERC777-granularity} value is hard-coded to `1`, meaning that there\n * are no special restrictions in the amount of tokens that created, moved, or\n * destroyed. This makes integration with ERC20 applications seamless.\n */\ncontract ERC777UpgradeSafe is Initializable, ContextUpgradeSafe, IERC777, IERC20 {\n using SafeMath for uint256;\n using Address for address;\n\n IERC1820Registry constant internal _ERC1820_REGISTRY = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);\n\n mapping(address => uint256) private _balances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n // We inline the result of the following hashes because Solidity doesn't resolve them at compile time.\n // See https://github.com/ethereum/solidity/issues/4024.\n\n // keccak256(\"ERC777TokensSender\")\n bytes32 constant private _TOKENS_SENDER_INTERFACE_HASH =\n 0x29ddb589b1fb5fc7cf394961c1adf5f8c6454761adf795e67fe149f658abe895;\n\n // keccak256(\"ERC777TokensRecipient\")\n bytes32 constant private _TOKENS_RECIPIENT_INTERFACE_HASH =\n 0xb281fc8c12954d22544db45de3159a39272895b169a852b314f9cc762e44c53b;\n\n // This isn't ever read from - it's only used to respond to the defaultOperators query.\n address[] private _defaultOperatorsArray;\n\n // Immutable, but accounts may revoke them (tracked in __revokedDefaultOperators).\n mapping(address => bool) private _defaultOperators;\n\n // For each account, a mapping of its operators and revoked default operators.\n mapping(address => mapping(address => bool)) private _operators;\n mapping(address => mapping(address => bool)) private _revokedDefaultOperators;\n\n // ERC20-allowances\n mapping (address => mapping (address => uint256)) private _allowances;\n\n /**\n * @dev `defaultOperators` may be an empty array.\n */\n\n function __ERC777_init(\n string memory name,\n string memory symbol,\n address[] memory defaultOperators\n ) internal initializer {\n __Context_init_unchained();\n __ERC777_init_unchained(name, symbol, defaultOperators);\n }\n\n function __ERC777_init_unchained(\n string memory name,\n string memory symbol,\n address[] memory defaultOperators\n ) internal initializer {\n\n\n _name = name;\n _symbol = symbol;\n\n _defaultOperatorsArray = defaultOperators;\n for (uint256 i = 0; i < _defaultOperatorsArray.length; i++) {\n _defaultOperators[_defaultOperatorsArray[i]] = true;\n }\n\n // register interfaces\n _ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256(\"ERC777Token\"), address(this));\n _ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256(\"ERC20Token\"), address(this));\n\n }\n\n\n /**\n * @dev See {IERC777-name}.\n */\n function name() public view override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC777-symbol}.\n */\n function symbol() public view override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {ERC20-decimals}.\n *\n * Always returns 18, as per the\n * [ERC777 EIP](https://eips.ethereum.org/EIPS/eip-777#backward-compatibility).\n */\n function decimals() public pure returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC777-granularity}.\n *\n * This implementation always returns `1`.\n */\n function granularity() public view override returns (uint256) {\n return 1;\n }\n\n /**\n * @dev See {IERC777-totalSupply}.\n */\n function totalSupply() public view override(IERC20, IERC777) returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev Returns the amount of tokens owned by an account (`tokenHolder`).\n */\n function balanceOf(address tokenHolder) public view override(IERC20, IERC777) returns (uint256) {\n return _balances[tokenHolder];\n }\n\n /**\n * @dev See {IERC777-send}.\n *\n * Also emits a {IERC20-Transfer} event for ERC20 compatibility.\n */\n function send(address recipient, uint256 amount, bytes memory data) public override {\n _send(_msgSender(), recipient, amount, data, \"\", true);\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Unlike `send`, `recipient` is _not_ required to implement the {IERC777Recipient}\n * interface if it is a contract.\n *\n * Also emits a {Sent} event.\n */\n function transfer(address recipient, uint256 amount) public override returns (bool) {\n require(recipient != address(0), \"ERC777: transfer to the zero address\");\n\n address from = _msgSender();\n\n _callTokensToSend(from, from, recipient, amount, \"\", \"\");\n\n _move(from, from, recipient, amount, \"\", \"\");\n\n _callTokensReceived(from, from, recipient, amount, \"\", \"\", false);\n\n return true;\n }\n\n /**\n * @dev See {IERC777-burn}.\n *\n * Also emits a {IERC20-Transfer} event for ERC20 compatibility.\n */\n function burn(uint256 amount, bytes memory data) public override {\n _burn(_msgSender(), amount, data, \"\");\n }\n\n /**\n * @dev See {IERC777-isOperatorFor}.\n */\n function isOperatorFor(\n address operator,\n address tokenHolder\n ) public view override returns (bool) {\n return operator == tokenHolder ||\n (_defaultOperators[operator] && !_revokedDefaultOperators[tokenHolder][operator]) ||\n _operators[tokenHolder][operator];\n }\n\n /**\n * @dev See {IERC777-authorizeOperator}.\n */\n function authorizeOperator(address operator) public override {\n require(_msgSender() != operator, \"ERC777: authorizing self as operator\");\n\n if (_defaultOperators[operator]) {\n delete _revokedDefaultOperators[_msgSender()][operator];\n } else {\n _operators[_msgSender()][operator] = true;\n }\n\n emit AuthorizedOperator(operator, _msgSender());\n }\n\n /**\n * @dev See {IERC777-revokeOperator}.\n */\n function revokeOperator(address operator) public override {\n require(operator != _msgSender(), \"ERC777: revoking self as operator\");\n\n if (_defaultOperators[operator]) {\n _revokedDefaultOperators[_msgSender()][operator] = true;\n } else {\n delete _operators[_msgSender()][operator];\n }\n\n emit RevokedOperator(operator, _msgSender());\n }\n\n /**\n * @dev See {IERC777-defaultOperators}.\n */\n function defaultOperators() public view override returns (address[] memory) {\n return _defaultOperatorsArray;\n }\n\n /**\n * @dev See {IERC777-operatorSend}.\n *\n * Emits {Sent} and {IERC20-Transfer} events.\n */\n function operatorSend(\n address sender,\n address recipient,\n uint256 amount,\n bytes memory data,\n bytes memory operatorData\n )\n public override\n {\n require(isOperatorFor(_msgSender(), sender), \"ERC777: caller is not an operator for holder\");\n _send(sender, recipient, amount, data, operatorData, true);\n }\n\n /**\n * @dev See {IERC777-operatorBurn}.\n *\n * Emits {Burned} and {IERC20-Transfer} events.\n */\n function operatorBurn(address account, uint256 amount, bytes memory data, bytes memory operatorData) public override {\n require(isOperatorFor(_msgSender(), account), \"ERC777: caller is not an operator for holder\");\n _burn(account, amount, data, operatorData);\n }\n\n /**\n * @dev See {IERC20-allowance}.\n *\n * Note that operator and allowance concepts are orthogonal: operators may\n * not have allowance, and accounts with allowance may not be operators\n * themselves.\n */\n function allowance(address holder, address spender) public view override returns (uint256) {\n return _allowances[holder][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Note that accounts cannot have allowance issued by their operators.\n */\n function approve(address spender, uint256 value) public override returns (bool) {\n address holder = _msgSender();\n _approve(holder, spender, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Note that operator and allowance concepts are orthogonal: operators cannot\n * call `transferFrom` (unless they have allowance), and accounts with\n * allowance cannot call `operatorSend` (unless they are operators).\n *\n * Emits {Sent}, {IERC20-Transfer} and {IERC20-Approval} events.\n */\n function transferFrom(address holder, address recipient, uint256 amount) public override returns (bool) {\n require(recipient != address(0), \"ERC777: transfer to the zero address\");\n require(holder != address(0), \"ERC777: transfer from the zero address\");\n\n address spender = _msgSender();\n\n _callTokensToSend(spender, holder, recipient, amount, \"\", \"\");\n\n _move(spender, holder, recipient, amount, \"\", \"\");\n _approve(holder, spender, _allowances[holder][spender].sub(amount, \"ERC777: transfer amount exceeds allowance\"));\n\n _callTokensReceived(spender, holder, recipient, amount, \"\", \"\", false);\n\n return true;\n }\n\n /**\n * @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * If a send hook is registered for `account`, the corresponding function\n * will be called with `operator`, `data` and `operatorData`.\n *\n * See {IERC777Sender} and {IERC777Recipient}.\n *\n * Emits {Minted} and {IERC20-Transfer} events.\n *\n * Requirements\n *\n * - `account` cannot be the zero address.\n * - if `account` is a contract, it must implement the {IERC777Recipient}\n * interface.\n */\n function _mint(\n address account,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData\n )\n internal virtual\n {\n require(account != address(0), \"ERC777: mint to the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, address(0), account, amount);\n\n // Update state variables\n _totalSupply = _totalSupply.add(amount);\n _balances[account] = _balances[account].add(amount);\n\n _callTokensReceived(operator, address(0), account, amount, userData, operatorData, true);\n\n emit Minted(operator, account, amount, userData, operatorData);\n emit Transfer(address(0), account, amount);\n }\n\n /**\n * @dev Send tokens\n * @param from address token holder address\n * @param to address recipient address\n * @param amount uint256 amount of tokens to transfer\n * @param userData bytes extra information provided by the token holder (if any)\n * @param operatorData bytes extra information provided by the operator (if any)\n * @param requireReceptionAck if true, contract recipients are required to implement ERC777TokensRecipient\n */\n function _send(\n address from,\n address to,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData,\n bool requireReceptionAck\n )\n internal\n {\n require(from != address(0), \"ERC777: send from the zero address\");\n require(to != address(0), \"ERC777: send to the zero address\");\n\n address operator = _msgSender();\n\n _callTokensToSend(operator, from, to, amount, userData, operatorData);\n\n _move(operator, from, to, amount, userData, operatorData);\n\n _callTokensReceived(operator, from, to, amount, userData, operatorData, requireReceptionAck);\n }\n\n /**\n * @dev Burn tokens\n * @param from address token holder address\n * @param amount uint256 amount of tokens to burn\n * @param data bytes extra information provided by the token holder\n * @param operatorData bytes extra information provided by the operator (if any)\n */\n function _burn(\n address from,\n uint256 amount,\n bytes memory data,\n bytes memory operatorData\n )\n internal virtual\n {\n require(from != address(0), \"ERC777: burn from the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, address(0), amount);\n\n _callTokensToSend(operator, from, address(0), amount, data, operatorData);\n\n // Update state variables\n _balances[from] = _balances[from].sub(amount, \"ERC777: burn amount exceeds balance\");\n _totalSupply = _totalSupply.sub(amount);\n\n emit Burned(operator, from, amount, data, operatorData);\n emit Transfer(from, address(0), amount);\n }\n\n function _move(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData\n )\n private\n {\n _beforeTokenTransfer(operator, from, to, amount);\n\n _balances[from] = _balances[from].sub(amount, \"ERC777: transfer amount exceeds balance\");\n _balances[to] = _balances[to].add(amount);\n\n emit Sent(operator, from, to, amount, userData, operatorData);\n emit Transfer(from, to, amount);\n }\n\n function _approve(address holder, address spender, uint256 value) internal {\n // TODO: restore this require statement if this function becomes internal, or is called at a new callsite. It is\n // currently unnecessary.\n //require(holder != address(0), \"ERC777: approve from the zero address\");\n require(spender != address(0), \"ERC777: approve to the zero address\");\n\n _allowances[holder][spender] = value;\n emit Approval(holder, spender, value);\n }\n\n /**\n * @dev Call from.tokensToSend() if the interface is registered\n * @param operator address operator requesting the transfer\n * @param from address token holder address\n * @param to address recipient address\n * @param amount uint256 amount of tokens to transfer\n * @param userData bytes extra information provided by the token holder (if any)\n * @param operatorData bytes extra information provided by the operator (if any)\n */\n function _callTokensToSend(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData\n )\n private\n {\n address implementer = _ERC1820_REGISTRY.getInterfaceImplementer(from, _TOKENS_SENDER_INTERFACE_HASH);\n if (implementer != address(0)) {\n IERC777Sender(implementer).tokensToSend(operator, from, to, amount, userData, operatorData);\n }\n }\n\n /**\n * @dev Call to.tokensReceived() if the interface is registered. Reverts if the recipient is a contract but\n * tokensReceived() was not registered for the recipient\n * @param operator address operator requesting the transfer\n * @param from address token holder address\n * @param to address recipient address\n * @param amount uint256 amount of tokens to transfer\n * @param userData bytes extra information provided by the token holder (if any)\n * @param operatorData bytes extra information provided by the operator (if any)\n * @param requireReceptionAck if true, contract recipients are required to implement ERC777TokensRecipient\n */\n function _callTokensReceived(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes memory userData,\n bytes memory operatorData,\n bool requireReceptionAck\n )\n private\n {\n address implementer = _ERC1820_REGISTRY.getInterfaceImplementer(to, _TOKENS_RECIPIENT_INTERFACE_HASH);\n if (implementer != address(0)) {\n IERC777Recipient(implementer).tokensReceived(operator, from, to, amount, userData, operatorData);\n } else if (requireReceptionAck) {\n require(!to.isContract(), \"ERC777: token recipient contract has no implementer for ERC777TokensRecipient\");\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes\n * calls to {send}, {transfer}, {operatorSend}, minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - when `from` is zero, `tokenId` will be minted for `to`.\n * - when `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address operator, address from, address to, uint256 tokenId) internal virtual { }\n\n uint256[41] private __gap;\n}\n"} +{"text": "[{ \"address\": \"tccq8en43nfkkpjxn534gccpqejzhmx75lx2sxkyj6u\", \"password\": \"\" }]\n"} +{"text": "-- first some tests of basic functionality\nCREATE EXTENSION plpython2u;\n-- really stupid function just to get the module loaded\nCREATE FUNCTION stupid() RETURNS text AS 'return \"zarkon\"' LANGUAGE plpythonu;\nselect stupid();\n stupid \n--------\n zarkon\n(1 row)\n\n-- check 2/3 versioning\nCREATE FUNCTION stupidn() RETURNS text AS 'return \"zarkon\"' LANGUAGE plpython2u;\nselect stupidn();\n stupidn \n---------\n zarkon\n(1 row)\n\n-- test multiple arguments and odd characters in function name\nCREATE FUNCTION \"Argument test #1\"(u users, a1 text, a2 text) RETURNS text\n\tAS\n'keys = list(u.keys())\nkeys.sort()\nout = []\nfor key in keys:\n out.append(\"%s: %s\" % (key, u[key]))\nwords = a1 + \" \" + a2 + \" => {\" + \", \".join(out) + \"}\"\nreturn words'\n\tLANGUAGE plpythonu;\nselect \"Argument test #1\"(users, fname, lname) from users where lname = 'doe' order by 1;\n Argument test #1 \n-----------------------------------------------------------------------\n jane doe => {fname: jane, lname: doe, userid: 1, username: j_doe}\n john doe => {fname: john, lname: doe, userid: 2, username: johnd}\n willem doe => {fname: willem, lname: doe, userid: 3, username: w_doe}\n(3 rows)\n\n-- check module contents\nCREATE FUNCTION module_contents() RETURNS SETOF text AS\n$$\ncontents = list(filter(lambda x: not x.startswith(\"__\"), dir(plpy)))\ncontents.sort()\nreturn contents\n$$ LANGUAGE plpythonu;\nselect module_contents();\n module_contents \n-----------------\n Error\n Fatal\n SPIError\n cursor\n debug\n error\n execute\n fatal\n info\n log\n notice\n prepare\n quote_ident\n quote_literal\n quote_nullable\n spiexceptions\n subtransaction\n warning\n(18 rows)\n\nCREATE FUNCTION elog_test_basic() RETURNS void\nAS $$\nplpy.debug('debug')\nplpy.log('log')\nplpy.info('info')\nplpy.info(37)\nplpy.info()\nplpy.info('info', 37, [1, 2, 3])\nplpy.notice('notice')\nplpy.warning('warning')\nplpy.error('error')\n$$ LANGUAGE plpythonu;\nSELECT elog_test_basic();\nINFO: info\nINFO: 37\nINFO: ()\nINFO: ('info', 37, [1, 2, 3])\nNOTICE: notice\nWARNING: warning\nERROR: plpy.Error: error\nCONTEXT: Traceback (most recent call last):\n PL/Python function \"elog_test_basic\", line 10, in \n plpy.error('error')\nPL/Python function \"elog_test_basic\"\n"} +{"text": "pool:\n vmImage: 'vs2017-win2016'\n\nsteps:\n - task: NodeTool@0\n inputs:\n versionSpec: '8.x'\n displayName: 'Install Node.js'\n\n - script: |\n npm install\n displayName: 'npm install'\n - script: |\n npm run lint\n displayName: 'Runs linting checks'\n\n - script: |\n npm run import:samples\n condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/dev'))\n displayName: 'Imports samples'\n\n - script: |\n npm test\n displayName: 'Runs tests'\n\n - script: |\n npm run import:loc-strings\n condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/dev'))\n displayName: 'Imports loc-strings'\n\n - script: |\n npm run build:prod\n condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/dev'))\n displayName: 'Runs a production build'\n\n\n - task: AzureFileCopy@2\n inputs:\n sourcePath: 'dist'\n azureConnectionType: 'ConnectedServiceNameARM'\n azureSubscription: 'arm-connection'\n destination: 'azureBlob'\n storage: 'graphstagingblobstorage'\n containerName: 'staging/vendor/bower_components/explorer/dist'\n condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/dev'))\n displayName: 'Stage'\n\n"} +{"text": "/*\n * split-include.c\n *\n * Copyright abandoned, Michael Chastain, .\n * This is a C version of syncdep.pl by Werner Almesberger.\n *\n * This program takes autoconf.h as input and outputs a directory full\n * of one-line include files, merging onto the old values.\n *\n * Think of the configuration options as key-value pairs. Then there\n * are five cases:\n *\n * key old value new value action\n *\n * KEY-1 VALUE-1 VALUE-1 leave file alone\n * KEY-2 VALUE-2A VALUE-2B write VALUE-2B into file\n * KEY-3 - VALUE-3 write VALUE-3 into file\n * KEY-4 VALUE-4 - write an empty file\n * KEY-5 (empty) - leave old empty file alone\n */\n\n#include \n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define ERROR_EXIT(strExit)\t\t\t\t\t\t\\\n {\t\t\t\t\t\t\t\t\t\\\n\tconst int errnoSave = errno;\t\t\t\t\t\\\n\tfprintf(stderr, \"%s: \", str_my_name);\t\t\t\t\\\n\terrno = errnoSave;\t\t\t\t\t\t\\\n\tperror((strExit));\t\t\t\t\t\t\\\n\texit(1);\t\t\t\t\t\t\t\\\n }\n\n\n\nint main(int argc, const char * argv [])\n{\n const char * str_my_name;\n const char * str_file_autoconf;\n const char * str_dir_config;\n\n FILE * fp_config;\n FILE * fp_target;\n FILE * fp_find;\n\n int buffer_size;\n\n char * line;\n char * old_line;\n char * list_target;\n char * ptarget;\n\n struct stat stat_buf;\n\n /* Check arg count. */\n if (argc != 3)\n {\n\tfprintf(stderr, \"%s: wrong number of arguments.\\n\", argv[0]);\n\texit(1);\n }\n\n str_my_name = argv[0];\n str_file_autoconf = argv[1];\n str_dir_config = argv[2];\n\n /* Find a buffer size. */\n if (stat(str_file_autoconf, &stat_buf) != 0)\n\tERROR_EXIT(str_file_autoconf);\n buffer_size = 2 * stat_buf.st_size + 4096;\n\n /* Allocate buffers. */\n if ( (line = malloc(buffer_size)) == NULL\n || (old_line = malloc(buffer_size)) == NULL\n || (list_target = malloc(buffer_size)) == NULL )\n\tERROR_EXIT(str_file_autoconf);\n\n /* Open autoconfig file. */\n if ((fp_config = fopen(str_file_autoconf, \"r\")) == NULL)\n\tERROR_EXIT(str_file_autoconf);\n\n /* Make output directory if needed. */\n if (stat(str_dir_config, &stat_buf) != 0)\n {\n\tif (mkdir(str_dir_config, 0755) != 0)\n\t ERROR_EXIT(str_dir_config);\n }\n\n /* Change to output directory. */\n if (chdir(str_dir_config) != 0)\n\tERROR_EXIT(str_dir_config);\n\n /* Put initial separator into target list. */\n ptarget = list_target;\n *ptarget++ = '\\n';\n\n /* Read config lines. */\n while (fgets(line, buffer_size, fp_config))\n {\n\tconst char * str_config;\n\tint is_same;\n\tint itarget;\n\n\tif (line[0] != '#')\n\t continue;\n\tif ((str_config = strstr(line, \" CONFIG_\")) == NULL)\n\t continue;\n\n\t/* We found #define CONFIG_foo or #undef CONFIG_foo.\n\t * Make the output file name. */\n\tstr_config += sizeof(\" CONFIG_\") - 1;\n\tfor (itarget = 0; !isspace(str_config[itarget]); itarget++)\n\t{\n\t int c = (unsigned char) str_config[itarget];\n\t if (isupper(c)) c = tolower(c);\n\t if (c == '_') c = '/';\n\t ptarget[itarget] = c;\n\t}\n\tptarget[itarget++] = '.';\n\tptarget[itarget++] = 'h';\n\tptarget[itarget++] = '\\0';\n\n\t/* Check for existing file. */\n\tis_same = 0;\n\tif ((fp_target = fopen(ptarget, \"r\")) != NULL)\n\t{\n\t fgets(old_line, buffer_size, fp_target);\n\t if (fclose(fp_target) != 0)\n\t\tERROR_EXIT(ptarget);\n\t if (!strcmp(line, old_line))\n\t\tis_same = 1;\n\t}\n\n\tif (!is_same)\n\t{\n\t /* Auto-create directories. */\n\t int islash;\n\t for (islash = 0; islash < itarget; islash++)\n\t {\n\t\tif (ptarget[islash] == '/')\n\t\t{\n\t\t ptarget[islash] = '\\0';\n\t\t if (stat(ptarget, &stat_buf) != 0\n\t\t && mkdir(ptarget, 0755) != 0)\n\t\t\tERROR_EXIT( ptarget );\n\t\t ptarget[islash] = '/';\n\t\t}\n\t }\n\n\t /* Write the file. */\n\t if ((fp_target = fopen(ptarget, \"w\")) == NULL)\n\t\tERROR_EXIT(ptarget);\n\t fputs(line, fp_target);\n\t if (ferror(fp_target) || fclose(fp_target) != 0)\n\t\tERROR_EXIT(ptarget);\n\t}\n\n\t/* Update target list */\n\tptarget += itarget;\n\t*(ptarget-1) = '\\n';\n }\n\n /*\n * Close autoconfig file.\n * Terminate the target list.\n */\n if (fclose(fp_config) != 0)\n\tERROR_EXIT(str_file_autoconf);\n *ptarget = '\\0';\n\n /*\n * Fix up existing files which have no new value.\n * This is Case 4 and Case 5.\n *\n * I re-read the tree and filter it against list_target.\n * This is crude. But it avoids data copies. Also, list_target\n * is compact and contiguous, so it easily fits into cache.\n *\n * Notice that list_target contains strings separated by \\n,\n * with a \\n before the first string and after the last.\n * fgets gives the incoming names a terminating \\n.\n * So by having an initial \\n, strstr will find exact matches.\n */\n\n fp_find = popen(\"find * -type f -name \\\"*.h\\\" -print\", \"r\");\n if (fp_find == 0)\n\tERROR_EXIT( \"find\" );\n\n line[0] = '\\n';\n while (fgets(line+1, buffer_size, fp_find))\n {\n\tif (strstr(list_target, line) == NULL)\n\t{\n\t /*\n\t * This is an old file with no CONFIG_* flag in autoconf.h.\n\t */\n\n\t /* First strip the \\n. */\n\t line[strlen(line)-1] = '\\0';\n\n\t /* Grab size. */\n\t if (stat(line+1, &stat_buf) != 0)\n\t\tERROR_EXIT(line);\n\n\t /* If file is not empty, make it empty and give it a fresh date. */\n\t if (stat_buf.st_size != 0)\n\t {\n\t\tif ((fp_target = fopen(line+1, \"w\")) == NULL)\n\t\t ERROR_EXIT(line);\n\t\tif (fclose(fp_target) != 0)\n\t\t ERROR_EXIT(line);\n\t }\n\t}\n }\n\n if (pclose(fp_find) != 0)\n\tERROR_EXIT(\"find\");\n\n return 0;\n}\n"} +{"text": "// SPDX-License-Identifier: GPL-2.0+\n/*\n * Video driver for Marvell Armada XP SoC\n *\n * Initialization of LCD interface and setup of SPLASH screen image\n */\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define MVEBU_LCD_WIN_CONTROL(w)\t(0xf000 + ((w) << 4))\n#define MVEBU_LCD_WIN_BASE(w)\t\t(0xf004 + ((w) << 4))\n#define MVEBU_LCD_WIN_REMAP(w)\t\t(0xf00c + ((w) << 4))\n\n#define MVEBU_LCD_CFG_DMA_START_ADDR_0\t0x00cc\n#define MVEBU_LCD_CFG_DMA_START_ADDR_1\t0x00dc\n\n#define MVEBU_LCD_CFG_GRA_START_ADDR0\t0x00f4\n#define MVEBU_LCD_CFG_GRA_START_ADDR1\t0x00f8\n#define MVEBU_LCD_CFG_GRA_PITCH\t\t0x00fc\n#define MVEBU_LCD_SPU_GRA_OVSA_HPXL_VLN\t0x0100\n#define MVEBU_LCD_SPU_GRA_HPXL_VLN\t0x0104\n#define MVEBU_LCD_SPU_GZM_HPXL_VLN\t0x0108\n#define MVEBU_LCD_SPU_HWC_OVSA_HPXL_VLN\t0x010c\n#define MVEBU_LCD_SPU_HWC_HPXL_VLN\t0x0110\n#define MVEBU_LCD_SPUT_V_H_TOTAL\t0x0114\n#define MVEBU_LCD_SPU_V_H_ACTIVE\t0x0118\n#define MVEBU_LCD_SPU_H_PORCH\t\t0x011c\n#define MVEBU_LCD_SPU_V_PORCH\t\t0x0120\n#define MVEBU_LCD_SPU_BLANKCOLOR\t0x0124\n#define MVEBU_LCD_SPU_ALPHA_COLOR1\t0x0128\n#define MVEBU_LCD_SPU_ALPHA_COLOR2\t0x012c\n#define MVEBU_LCD_SPU_COLORKEY_Y\t0x0130\n#define MVEBU_LCD_SPU_COLORKEY_U\t0x0134\n#define MVEBU_LCD_SPU_COLORKEY_V\t0x0138\n#define MVEBU_LCD_CFG_RDREG4F\t\t0x013c\n#define MVEBU_LCD_SPU_SPI_RXDATA\t0x0140\n#define MVEBU_LCD_SPU_ISA_RXDATA\t0x0144\n#define MVEBU_LCD_SPU_DBG_ISA\t\t0x0148\n\n#define MVEBU_LCD_SPU_HWC_RDDAT\t\t0x0158\n#define MVEBU_LCD_SPU_GAMMA_RDDAT\t0x015c\n#define MVEBU_LCD_SPU_PALETTE_RDDAT\t0x0160\n#define MVEBU_LCD_SPU_IOPAD_IN\t\t0x0178\n#define MVEBU_LCD_FRAME_COUNT\t\t0x017c\n#define MVEBU_LCD_SPU_DMA_CTRL0\t\t0x0190\n#define MVEBU_LCD_SPU_DMA_CTRL1\t\t0x0194\n#define MVEBU_LCD_SPU_SRAM_CTRL\t\t0x0198\n#define MVEBU_LCD_SPU_SRAM_WRDAT\t0x019c\n#define MVEBU_LCD_SPU_SRAM_PARA0\t0x01a0\n#define MVEBU_LCD_SPU_SRAM_PARA1\t0x01a4\n#define MVEBU_LCD_CFG_SCLK_DIV\t\t0x01a8\n#define MVEBU_LCD_SPU_CONTRAST\t\t0x01ac\n#define MVEBU_LCD_SPU_SATURATION\t0x01b0\n#define MVEBU_LCD_SPU_CBSH_HUE\t\t0x01b4\n#define MVEBU_LCD_SPU_DUMB_CTRL\t\t0x01b8\n#define MVEBU_LCD_SPU_IOPAD_CONTROL\t0x01bc\n#define MVEBU_LCD_SPU_IRQ_ENA_2\t\t0x01d8\n#define MVEBU_LCD_SPU_IRQ_ISR_2\t\t0x01dc\n#define MVEBU_LCD_SPU_IRQ_ENA\t\t0x01c0\n#define MVEBU_LCD_SPU_IRQ_ISR\t\t0x01c4\n#define MVEBU_LCD_ADLL_CTRL\t\t0x01c8\n#define MVEBU_LCD_CLK_DIS\t\t0x01cc\n#define MVEBU_LCD_VGA_HVSYNC_DELAY\t0x01d4\n#define MVEBU_LCD_CLK_CFG_0\t\t0xf0a0\n#define MVEBU_LCD_CLK_CFG_1\t\t0xf0a4\n#define MVEBU_LCD_LVDS_CLK_CFG\t\t0xf0ac\n\n#define MVEBU_LVDS_PADS_REG\t\t(MVEBU_SYSTEM_REG_BASE + 0xf0)\n\nenum {\n\t/* Maximum LCD size we support */\n\tLCD_MAX_WIDTH\t\t= 640,\n\tLCD_MAX_HEIGHT\t\t= 480,\n\tLCD_MAX_LOG2_BPP\t= VIDEO_BPP16,\n};\n\nstruct mvebu_lcd_info {\n\tu32 fb_base;\n\tint x_res;\n\tint y_res;\n\tint x_fp;\n\tint y_fp;\n\tint x_bp;\n\tint y_bp;\n};\n\nstruct mvebu_video_priv {\n\tuintptr_t regs;\n};\n\n/* Setup Mbus Bridge Windows for LCD */\nstatic void mvebu_lcd_conf_mbus_registers(uintptr_t regs)\n{\n\tconst struct mbus_dram_target_info *dram;\n\tint i;\n\n\tdram = mvebu_mbus_dram_info();\n\n\t/* Disable windows, set size/base/remap to 0 */\n\tfor (i = 0; i < 6; i++) {\n\t\twritel(0, regs + MVEBU_LCD_WIN_CONTROL(i));\n\t\twritel(0, regs + MVEBU_LCD_WIN_BASE(i));\n\t\twritel(0, regs + MVEBU_LCD_WIN_REMAP(i));\n\t}\n\n\t/* Write LCD bridge window registers */\n\tfor (i = 0; i < dram->num_cs; i++) {\n\t\tconst struct mbus_dram_window *cs = dram->cs + i;\n\t\twritel(((cs->size - 1) & 0xffff0000) | (cs->mbus_attr << 8) |\n\t\t (dram->mbus_dram_target_id << 4) | 1,\n\t\t regs + MVEBU_LCD_WIN_CONTROL(i));\n\n\t\twritel(cs->base & 0xffff0000, regs + MVEBU_LCD_WIN_BASE(i));\n\t}\n}\n\n/* Initialize LCD registers */\nstatic void mvebu_lcd_register_init(struct mvebu_lcd_info *lcd_info,\n\t\t\t\t uintptr_t regs)\n{\n\t/* Local variable for easier handling */\n\tint x = lcd_info->x_res;\n\tint y = lcd_info->y_res;\n\tu32 val;\n\n\t/* Setup Mbus Bridge Windows */\n\tmvebu_lcd_conf_mbus_registers(regs);\n\n\t/*\n\t * Set LVDS Pads Control Register\n\t * wr 0 182F0 FFE00000\n\t */\n\tclrbits_le32(MVEBU_LVDS_PADS_REG, 0x1f << 16);\n\n\t/*\n\t * Set the LCD_CFG_GRA_START_ADDR0/1 Registers\n\t * This is supposed to point to the \"physical\" memory at memory\n\t * end (currently 1GB-64MB but also may be 2GB-64MB).\n\t * See also the Window 0 settings!\n\t */\n\twritel(lcd_info->fb_base, regs + MVEBU_LCD_CFG_GRA_START_ADDR0);\n\twritel(lcd_info->fb_base, regs + MVEBU_LCD_CFG_GRA_START_ADDR1);\n\n\t/*\n\t * Set the LCD_CFG_GRA_PITCH Register\n\t * Bits 31-28: Duty Cycle of Backlight. value/16=High (0x8=Mid Setting)\n\t * Bits 25-16: Backlight divider from 32kHz Clock\n\t * (here 16=0x10 for 1kHz)\n\t * Bits 15-00: Line Length in Bytes\n\t * 240*2 (for RGB1555)=480=0x1E0\n\t */\n\twritel(0x80100000 + 2 * x, regs + MVEBU_LCD_CFG_GRA_PITCH);\n\n\t/*\n\t * Set the LCD_SPU_GRA_OVSA_HPXL_VLN Register\n\t * Bits 31-16: Vertical start of graphical overlay on screen\n\t * Bits 15-00: Horizontal start of graphical overlay on screen\n\t */\n\twritel(0x00000000, regs + MVEBU_LCD_SPU_GRA_OVSA_HPXL_VLN);\n\n\t/*\n\t * Set the LCD_SPU_GRA_HPXL_VLN Register\n\t * Bits 31-16: Vertical size of graphical overlay 320=0x140\n\t * Bits 15-00: Horizontal size of graphical overlay 240=0xF0\n\t * Values before zooming\n\t */\n\twritel((y << 16) | x, regs + MVEBU_LCD_SPU_GRA_HPXL_VLN);\n\n\t/*\n\t * Set the LCD_SPU_GZM_HPXL_VLN Register\n\t * Bits 31-16: Vertical size of graphical overlay 320=0x140\n\t * Bits 15-00: Horizontal size of graphical overlay 240=0xF0\n\t * Values after zooming\n\t */\n\twritel((y << 16) | x, regs + MVEBU_LCD_SPU_GZM_HPXL_VLN);\n\n\t/*\n\t * Set the LCD_SPU_HWC_OVSA_HPXL_VLN Register\n\t * Bits 31-16: Vertical position of HW Cursor 320=0x140\n\t * Bits 15-00: Horizontal position of HW Cursor 240=0xF0\n\t */\n\twritel((y << 16) | x, regs + MVEBU_LCD_SPU_HWC_OVSA_HPXL_VLN);\n\n\t/*\n\t * Set the LCD_SPU_HWC_OVSA_HPXL_VLN Register\n\t * Bits 31-16: Vertical size of HW Cursor\n\t * Bits 15-00: Horizontal size of HW Cursor\n\t */\n\twritel(0x00000000, regs + MVEBU_LCD_SPU_HWC_HPXL_VLN);\n\n\t/*\n\t * Set the LCD_SPU_HWC_OVSA_HPXL_VLN Register\n\t * Bits 31-16: Screen total vertical lines:\n\t * VSYNC = 1\n\t * Vertical Front Porch = 2\n\t * Vertical Lines = 320\n\t * Vertical Back Porch = 2\n\t * SUM = 325 = 0x0145\n\t * Bits 15-00: Screen total horizontal pixels:\n\t * HSYNC = 1\n\t * Horizontal Front Porch = 44\n\t * Horizontal Lines = 240\n\t * Horizontal Back Porch = 2\n\t * SUM = 287 = 0x011F\n\t * Note: For the display the backporch is between SYNC and\n\t * the start of the pixels.\n\t * This is not certain for the Marvell (!?)\n\t */\n\tval = ((y + lcd_info->y_fp + lcd_info->y_bp + 1) << 16) |\n\t\t(x + lcd_info->x_fp + lcd_info->x_bp + 1);\n\twritel(val, regs + MVEBU_LCD_SPUT_V_H_TOTAL);\n\n\t/*\n\t * Set the LCD_SPU_V_H_ACTIVE Register\n\t * Bits 31-16: Screen active vertical lines 320=0x140\n\t * Bits 15-00: Screen active horizontakl pixels 240=0x00F0\n\t */\n\twritel((y << 16) | x, regs + MVEBU_LCD_SPU_V_H_ACTIVE);\n\n\t/*\n\t * Set the LCD_SPU_H_PORCH Register\n\t * Bits 31-16: Screen horizontal backporch 44=0x2c\n\t * Bits 15-00: Screen horizontal frontporch 2=0x02\n\t * Note: The terms \"front\" and \"back\" for the Marvell seem to be\n\t * exactly opposite to the display.\n\t */\n\twritel((lcd_info->x_fp << 16) | lcd_info->x_bp,\n\t regs + MVEBU_LCD_SPU_H_PORCH);\n\n\t/*\n\t * Set the LCD_SPU_V_PORCH Register\n\t * Bits 31-16: Screen vertical backporch 2=0x02\n\t * Bits 15-00: Screen vertical frontporch 2=0x02\n\t * Note: The terms \"front\" and \"back\" for the Marvell seem to be exactly\n\t * opposite to the display.\n\t */\n\twritel((lcd_info->y_fp << 16) | lcd_info->y_bp,\n\t regs + MVEBU_LCD_SPU_V_PORCH);\n\n\t/*\n\t * Set the LCD_SPU_BLANKCOLOR Register\n\t * This should be black = 0\n\t * For tests this is magenta=00FF00FF\n\t */\n\twritel(0x00FF00FF, regs + MVEBU_LCD_SPU_BLANKCOLOR);\n\n\t/*\n\t * Registers in the range of 0x0128 to 0x012C are colors for the cursor\n\t * Registers in the range of 0x0130 to 0x0138 are colors for video\n\t * color keying\n\t */\n\n\t/*\n\t * Set the LCD_SPU_RDREG4F Register\n\t * Bits 31-12: Reservd\n\t * Bit 11: SRAM Wait\n\t * Bit 10: Smart display fast TX (must be 1)\n\t * Bit 9: DMA Arbitration Video/Graphics overlay: 0=interleaved\n\t * Bit 8: FIFO watermark for DMA: 0=disable\n\t * Bits 07-00: Empty 8B FIFO entries to trigger DMA, default=0x80\n\t */\n\twritel(0x00000780, regs + MVEBU_LCD_CFG_RDREG4F);\n\n\t/*\n\t * Set the LCD_SPU_DMACTRL 0 Register\n\t * Bit 31: Disable overlay blending 1=disable\n\t * Bit 30: Gamma correction enable, 0=disable\n\t * Bit 29: Video Contrast/Saturation/Hue Adjust enable, 0=disable\n\t * Bit 28: Color palette enable, 0=disable\n\t * Bit 27: DMA AXI Arbiter, 1=default\n\t * Bit 26: HW Cursor 1-bit mode\n\t * Bit 25: HW Cursor or 1- or 2-bit mode\n\t * Bit 24: HW Cursor enabled, 0=disable\n\t * Bits 23-20: Graphics Memory Color Format: 0x1=RGB1555\n\t * Bits 19-16: Video Memory Color Format: 0x1=RGB1555\n\t * Bit 15: Memory Toggle between frame 0 and 1: 0=disable\n\t * Bit 14: Graphics horizontal scaling enable: 0=disable\n\t * Bit 13: Graphics test mode: 0=disable\n\t * Bit 12: Graphics SWAP R and B: 0=disable\n\t * Bit 11: Graphics SWAP U and V: 0=disable\n\t * Bit 10: Graphics SWAP Y and U/V: 0=disable\n\t * Bit 09: Graphic YUV to RGB Conversion: 0=disable\n\t * Bit 08: Graphic Transfer: 1=enable\n\t * Bit 07: Memory Toggle: 0=disable\n\t * Bit 06: Video horizontal scaling enable: 0=disable\n\t * Bit 05: Video test mode: 0=disable\n\t * Bit 04: Video SWAP R and B: 0=disable\n\t * Bit 03: Video SWAP U and V: 0=disable\n\t * Bit 02: Video SWAP Y and U/V: 0=disable\n\t * Bit 01: Video YUV to RGB Conversion: 0=disable\n\t * Bit 00: Video Transfer: 0=disable\n\t */\n\twritel(0x88111100, regs + MVEBU_LCD_SPU_DMA_CTRL0);\n\n\t/*\n\t * Set the LCD_SPU_DMA_CTRL1 Register\n\t * Bit 31: Manual DMA Trigger = 0\n\t * Bits 30-28: DMA Trigger Source: 0x2 VSYNC\n\t * Bit 28: VSYNC_INV: 0=Rising Edge, 1=Falling Edge\n\t * Bits 26-24: Color Key Mode: 0=disable\n\t * Bit 23: Fill low bits: 0=fill with zeroes\n\t * Bit 22: Reserved\n\t * Bit 21: Gated Clock: 0=disable\n\t * Bit 20: Power Save enable: 0=disable\n\t * Bits 19-18: Reserved\n\t * Bits 17-16: Configure Video/Graphic Path: 0x1: Graphic path alpha.\n\t * Bits 15-08: Configure Alpha: 0x00.\n\t * Bits 07-00: Reserved.\n\t */\n\twritel(0x20010000, regs + MVEBU_LCD_SPU_DMA_CTRL1);\n\n\t/*\n\t * Set the LCD_SPU_SRAM_CTRL Register\n\t * Reset to default = 0000C000\n\t * Bits 15-14: SRAM control: init=0x3, Read=0, Write=2\n\t * Bits 11-08: SRAM address ID: 0=gamma_yr, 1=gammy_ug, 2=gamma_vb,\n\t * 3=palette, 15=cursor\n\t */\n\twritel(0x0000C000, regs + MVEBU_LCD_SPU_SRAM_CTRL);\n\n\t/*\n\t * LCD_SPU_SRAM_WRDAT register: 019C\n\t * LCD_SPU_SRAM_PARA0 register: 01A0\n\t * LCD_SPU_SRAM_PARA1 register: 01A4 - Cursor control/Power settings\n\t */\n\twritel(0x00000000, regs + MVEBU_LCD_SPU_SRAM_PARA1);\n\n\n\t/* Clock settings in the at 01A8 and in the range F0A0 see below */\n\n\t/*\n\t * Set LCD_SPU_CONTRAST\n\t * Bits 31-16: Brightness sign ext. 8-bit value +255 to -255: default=0\n\t * Bits 15-00: Contrast sign ext. 8-bit value +255 to -255: default=0\n\t */\n\twritel(0x00000000, regs + MVEBU_LCD_SPU_CONTRAST);\n\n\t/*\n\t * Set LCD_SPU_SATURATION\n\t * Bits 31-16: Multiplier signed 4.12 fixed point value\n\t * Bits 15-00: Saturation signed 4.12 fixed point value\n\t */\n\twritel(0x10001000, regs + MVEBU_LCD_SPU_SATURATION);\n\n\t/*\n\t * Set LCD_SPU_HUE\n\t * Bits 31-16: Sine signed 2.14 fixed point value\n\t * Bits 15-00: Cosine signed 2.14 fixed point value\n\t */\n\twritel(0x00000000, regs + MVEBU_LCD_SPU_CBSH_HUE);\n\n\t/*\n\t * Set LCD_SPU_DUMB_CTRL\n\t * Bits 31-28: LCD Type: 3=18 bit RGB | 6=24 bit RGB888\n\t * Bits 27-12: Reserved\n\t * Bit 11: LCD DMA Pipeline Enable: 1=Enable\n\t * Bits 10-09: Reserved\n\t * Bit 8: LCD GPIO pin (??)\n\t * Bit 7: Reverse RGB\n\t * Bit 6: Invert composite blank signal DE/EN (??)\n\t * Bit 5: Invert composite sync signal\n\t * Bit 4: Invert Pixel Valid Enable DE/EN (??)\n\t * Bit 3: Invert VSYNC\n\t * Bit 2: Invert HSYNC\n\t * Bit 1: Invert Pixel Clock\n\t * Bit 0: Enable LCD Panel: 1=Enable\n\t * Question: Do we have to disable Smart and Dumb LCD\n\t * and separately enable LVDS?\n\t */\n\twritel(0x6000080F, regs + MVEBU_LCD_SPU_DUMB_CTRL);\n\n\t/*\n\t * Set LCD_SPU_IOPAD_CTRL\n\t * Bits 31-20: Reserved\n\t * Bits 19-18: Vertical Interpolation: 0=Disable\n\t * Bits 17-16: Reserved\n\t * Bit 15: Graphics Vertical Mirror enable: 0=disable\n\t * Bit 14: Reserved\n\t * Bit 13: Video Vertical Mirror enable: 0=disable\n\t * Bit 12: Reserved\n\t * Bit 11: Command Vertical Mirror enable: 0=disable\n\t * Bit 10: Reserved\n\t * Bits 09-08: YUV to RGB Color space conversion: 0 (Not used)\n\t * Bits 07-04: AXI Bus Master: 0x4: no crossing of 4k boundary,\n\t * 128 Bytes burst\n\t * Bits 03-00: LCD pins: ??? 0=24-bit Dump panel ??\n\t */\n\twritel(0x000000C0, regs + MVEBU_LCD_SPU_IOPAD_CONTROL);\n\n\t/*\n\t * Set SUP_IRQ_ENA_2: Disable all interrupts\n\t */\n\twritel(0x00000000, regs + MVEBU_LCD_SPU_IRQ_ENA_2);\n\n\t/*\n\t * Set SUP_IRQ_ENA: Disable all interrupts.\n\t */\n\twritel(0x00000000, regs + MVEBU_LCD_SPU_IRQ_ENA);\n\n\t/*\n\t * Set up ADDL Control Register\n\t * Bits 31-29: 0x0 = Fastest Delay Line (default)\n\t * 0x3 = Slowest Delay Line (default)\n\t * Bit 28: Calibration done status.\n\t * Bit 27: Reserved\n\t * Bit 26: Set Pixel Clock to ADDL output\n\t * Bit 25: Reduce CAL Enable\n\t * Bits 24-22: Manual calibration value.\n\t * Bit 21: Manual calibration enable.\n\t * Bit 20: Restart Auto Cal\n\t * Bits 19-16: Calibration Threshold voltage, default= 0x2\n\t * Bite 15-14: Reserved\n\t * Bits 13-11: Divisor for ADDL Clock: 0x1=/2, 0x3=/8, 0x5=/16\n\t * Bit 10: Power Down ADDL module, default = 1!\n\t * Bits 09-08: Test point configuration: 0x2=Bias, 0x3=High-z\n\t * Bit 07: Reset ADDL\n\t * Bit 06: Invert ADLL Clock\n\t * Bits 05-00: Delay taps, 0x3F=Half Cycle, 0x00=No delay\n\t * Note: ADLL is used for a VGA interface with DAC - not used here\n\t */\n\twritel(0x00000000, regs + MVEBU_LCD_ADLL_CTRL);\n\n\t/*\n\t * Set the LCD_CLK_DIS Register:\n\t * Bits 3 and 4 must be 1\n\t */\n\twritel(0x00000018, regs + MVEBU_LCD_CLK_DIS);\n\n\t/*\n\t * Set the LCD_VGA_HSYNC/VSYNC Delay Register:\n\t * Bits 03-00: Sets the delay for the HSYNC and VSYNC signals\n\t */\n\twritel(0x00000000, regs + MVEBU_LCD_VGA_HVSYNC_DELAY);\n\n\t/*\n\t * Clock registers\n\t * See page 475 in the functional spec.\n\t */\n\n\t/* Step 1 and 2: Disable the PLL */\n\n\t/*\n\t * Disable PLL, see \"LCD Clock Configuration 1 Register\" below\n\t */\n\twritel(0x8FF40007, regs + MVEBU_LCD_CLK_CFG_1);\n\n\t/*\n\t * Powerdown, see \"LCD Clock Configuration 0 Register\" below\n\t */\n\twritel(0x94000174, regs + MVEBU_LCD_CLK_CFG_0);\n\n\t/*\n\t * Set the LCD_CFG_SCLK_DIV Register\n\t * This is set fix to 0x40000001 for the LVDS output:\n\t * Bits 31-30: SCLCK Source: 0=AXIBus, 1=AHBus, 2=PLLDivider0\n\t * Bits 15-01: Clock Divider: Bypass for LVDS=0x0001\n\t * See page 475 in section 28.5.\n\t */\n\twritel(0x80000001, regs + MVEBU_LCD_CFG_SCLK_DIV);\n\n\t/*\n\t * Set the LCD Clock Configuration 0 Register:\n\t * Bit 31: Powerdown: 0=Power up\n\t * Bits 30-29: Reserved\n\t * Bits 28-26: PLL_KDIV: This encodes K\n\t * K=16 => 0x5\n\t * Bits 25-17: PLL_MDIV: This is M-1:\n\t * M=1 => 0x0\n\t * Bits 16-13: VCO band: 0x1 for 700-920MHz\n\t * Bits 12-04: PLL_NDIV: This is N-1 and corresponds to R1_CTRL!\n\t * N=28=0x1C => 0x1B\n\t * Bits 03-00: R1_CTRL (for N=28 => 0x4)\n\t */\n\twritel(0x940021B4, regs + MVEBU_LCD_CLK_CFG_0);\n\n\t/*\n\t * Set the LCD Clock Configuration 1 Register:\n\t * Bits 31-19: Reserved\n\t * Bit 18: Select PLL: Core PLL, 1=Dedicated PPL\n\t * Bit 17: Clock Output Enable: 0=disable, 1=enable\n\t * Bit 16: Select RefClk: 0=RefClk (25MHz), 1=External\n\t * Bit 15: Half-Div, Device Clock by DIV+0.5*Half-Dev\n\t * Bits 14-13: Reserved\n\t * Bits 12-00: PLL Full Divider [Note: Assumed to be the Post-Divider\n\t * M' for LVDS=7!]\n\t */\n\twritel(0x8FF40007, regs + MVEBU_LCD_CLK_CFG_1);\n\n\t/*\n\t * Set the LVDS Clock Configuration Register:\n\t * Bit 31: Clock Gating for the input clock to the LVDS\n\t * Bit 30: LVDS Serializer enable: 1=Enabled\n\t * Bits 29-11: Reserved\n\t * Bit 11-08: LVDS Clock delay: 0x02 (default): by 2 pixel clock/7\n\t * Bits 07-02: Reserved\n\t * Bit 01: 24bbp Option: 0=Option_1,1=Option2\n\t * Bit 00: 1=24bbp Panel: 0=18bpp Panel\n\t * Note: Bits 0 and must be verified with the help of the\n\t * Interface/display\n\t */\n\twritel(0xC0000201, regs + MVEBU_LCD_LVDS_CLK_CFG);\n\n\t/*\n\t * Power up PLL (Clock Config 0)\n\t */\n\twritel(0x140021B4, regs + MVEBU_LCD_CLK_CFG_0);\n\n\t/* wait 10 ms */\n\tmdelay(10);\n\n\t/*\n\t * Enable PLL (Clock Config 1)\n\t */\n\twritel(0x8FF60007, regs + MVEBU_LCD_CLK_CFG_1);\n}\n\nstatic int mvebu_video_probe(struct udevice *dev)\n{\n\tstruct video_uc_platdata *plat = dev_get_uclass_platdata(dev);\n\tstruct video_priv *uc_priv = dev_get_uclass_priv(dev);\n\tstruct mvebu_video_priv *priv = dev_get_priv(dev);\n\tstruct mvebu_lcd_info lcd_info;\n\tstruct display_timing timings;\n\tu32 fb_start, fb_end;\n\tint ret;\n\n\tpriv->regs = dev_read_addr(dev);\n\tif (priv->regs == FDT_ADDR_T_NONE) {\n\t\tdev_err(dev, \"failed to get LCD address\\n\");\n\t\treturn -ENXIO;\n\t}\n\n\tret = ofnode_decode_display_timing(dev_ofnode(dev), 0, &timings);\n\tif (ret) {\n\t\tdev_err(dev, \"failed to get any display timings\\n\");\n\t\treturn -EINVAL;\n\t}\n\n\t/* Use DT timing (resolution) in internal info struct */\n\tlcd_info.fb_base = plat->base;\n\tlcd_info.x_res = timings.hactive.typ;\n\tlcd_info.x_fp = timings.hfront_porch.typ;\n\tlcd_info.x_bp = timings.hback_porch.typ;\n\tlcd_info.y_res = timings.vactive.typ;\n\tlcd_info.y_fp = timings.vfront_porch.typ;\n\tlcd_info.y_bp = timings.vback_porch.typ;\n\n\t/* Initialize the LCD controller */\n\tmvebu_lcd_register_init(&lcd_info, priv->regs);\n\n\t/* Enable dcache for the frame buffer */\n\tfb_start = plat->base & ~(MMU_SECTION_SIZE - 1);\n\tfb_end = plat->base + plat->size;\n\tfb_end = ALIGN(fb_end, 1 << MMU_SECTION_SHIFT);\n\tmmu_set_region_dcache_behaviour(fb_start, fb_end - fb_start,\n\t\t\t\t\tDCACHE_WRITEBACK);\n\tvideo_set_flush_dcache(dev, true);\n\n\tuc_priv->xsize = lcd_info.x_res;\n\tuc_priv->ysize = lcd_info.y_res;\n\tuc_priv->bpix = VIDEO_BPP16;\t/* Uses RGB555 format */\n\n\treturn 0;\n}\n\nstatic int mvebu_video_bind(struct udevice *dev)\n{\n\tstruct video_uc_platdata *plat = dev_get_uclass_platdata(dev);\n\n\tplat->size = LCD_MAX_WIDTH * LCD_MAX_HEIGHT *\n\t\t(1 << LCD_MAX_LOG2_BPP) / 8;\n\n\treturn 0;\n}\n\nstatic const struct udevice_id mvebu_video_ids[] = {\n\t{ .compatible = \"marvell,armada-xp-lcd\" },\n\t{ }\n};\n\nU_BOOT_DRIVER(mvebu_video) = {\n\t.name\t= \"mvebu_video\",\n\t.id\t= UCLASS_VIDEO,\n\t.of_match = mvebu_video_ids,\n\t.bind\t= mvebu_video_bind,\n\t.probe\t= mvebu_video_probe,\n\t.priv_auto_alloc_size = sizeof(struct mvebu_video_priv),\n};\n"} +{"text": "script: \"/def-3456/def-3456.gui_script\"\nbackground_color {\n x: 0.0\n y: 0.0\n z: 0.0\n w: 1.0\n}\nnodes {\n position {\n x: 0.0\n y: 0.0\n z: 0.0\n w: 1.0\n }\n rotation {\n x: 0.0\n y: 0.0\n z: 0.0\n w: 1.0\n }\n scale {\n x: 1.0\n y: 1.0\n z: 1.0\n w: 1.0\n }\n size {\n x: 1.0\n y: 1.0\n z: 0.0\n w: 1.0\n }\n color {\n x: 1.0\n y: 1.0\n z: 1.0\n w: 1.0\n }\n type: TYPE_SPINE\n blend_mode: BLEND_MODE_ALPHA\n id: \"spine\"\n xanchor: XANCHOR_NONE\n yanchor: YANCHOR_NONE\n pivot: PIVOT_CENTER\n adjust_mode: ADJUST_MODE_FIT\n layer: \"\"\n inherit_alpha: true\n clipping_mode: CLIPPING_MODE_NONE\n clipping_visible: true\n clipping_inverted: false\n alpha: 1.0\n template_node_child: false\n size_mode: SIZE_MODE_AUTO\n spine_scene: \"def-3456\"\n spine_default_animation: \"animation\"\n}\nspine_scenes {\n name: \"def-3456\"\n spine_scene: \"/def-3456/def-3456.spinescene\"\n}\n"} +{"text": "{\n \"description\": \"ConfigMap holds configuration data for pods to consume.\",\n \"properties\": {\n \"apiVersion\": {\n \"description\": \"APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources\",\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"data\": {\n \"description\": \"Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'.\",\n \"type\": \"object\",\n \"additionalProperties\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"kind\": {\n \"description\": \"Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds\",\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"enum\": [\n \"ConfigMap\"\n ]\n },\n \"metadata\": {\n \"description\": \"ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.\",\n \"properties\": {\n \"annotations\": {\n \"description\": \"Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations\",\n \"type\": \"object\",\n \"additionalProperties\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"clusterName\": {\n \"description\": \"The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.\",\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"creationTimestamp\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"format\": \"date-time\"\n },\n \"deletionGracePeriodSeconds\": {\n \"description\": \"Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.\",\n \"type\": \"integer\",\n \"format\": \"int64\"\n },\n \"deletionTimestamp\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"format\": \"date-time\"\n },\n \"finalizers\": {\n \"description\": \"Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed.\",\n \"type\": [\n \"array\",\n \"null\"\n ],\n \"items\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"x-kubernetes-patch-strategy\": \"merge\"\n },\n \"generateName\": {\n \"description\": \"GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\\n\\nIf this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header).\\n\\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#idempotency\",\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"generation\": {\n \"description\": \"A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.\",\n \"type\": \"integer\",\n \"format\": \"int64\"\n },\n \"initializers\": {\n \"description\": \"Initializers tracks the progress of initialization.\",\n \"required\": [\n \"pending\"\n ],\n \"properties\": {\n \"pending\": {\n \"description\": \"Pending is a list of initializers that must execute in order before this object is visible. When the last pending initializer is removed, and no failing result is set, the initializers struct will be set to nil and the object is considered as initialized and visible to all clients.\",\n \"type\": \"array\",\n \"items\": {\n \"description\": \"Initializer is information about an initializer that has not yet completed.\",\n \"required\": [\n \"name\"\n ],\n \"properties\": {\n \"name\": {\n \"description\": \"name of the process that is responsible for initializing this object.\",\n \"type\": \"string\"\n }\n }\n },\n \"x-kubernetes-patch-merge-key\": \"name\",\n \"x-kubernetes-patch-strategy\": \"merge\"\n },\n \"result\": {\n \"description\": \"Status is a return value for calls that don't return other objects.\",\n \"properties\": {\n \"apiVersion\": {\n \"description\": \"APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources\",\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"code\": {\n \"description\": \"Suggested HTTP return code for this status, 0 if not set.\",\n \"type\": \"integer\",\n \"format\": \"int32\"\n },\n \"details\": {\n \"description\": \"StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.\",\n \"properties\": {\n \"causes\": {\n \"description\": \"The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.\",\n \"type\": [\n \"array\",\n \"null\"\n ],\n \"items\": {\n \"description\": \"StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.\",\n \"properties\": {\n \"field\": {\n \"description\": \"The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.\\n\\nExamples:\\n \\\"name\\\" - the field \\\"name\\\" on the current resource\\n \\\"items[0].name\\\" - the field \\\"name\\\" on the first array entry in \\\"items\\\"\",\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"message\": {\n \"description\": \"A human-readable description of the cause of the error. This field may be presented as-is to a reader.\",\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"reason\": {\n \"description\": \"A machine-readable description of the cause of the error. If this value is empty there is no information available.\",\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n }\n }\n },\n \"group\": {\n \"description\": \"The group attribute of the resource associated with the status StatusReason.\",\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"kind\": {\n \"description\": \"The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds\",\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"name\": {\n \"description\": \"The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).\",\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"retryAfterSeconds\": {\n \"description\": \"If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.\",\n \"type\": \"integer\",\n \"format\": \"int32\"\n },\n \"uid\": {\n \"description\": \"UID of the resource. (when there is a single resource which can be described). More info: http://kubernetes.io/docs/user-guide/identifiers#uids\",\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n }\n },\n \"kind\": {\n \"description\": \"Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds\",\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"enum\": [\n \"Status\"\n ]\n },\n \"message\": {\n \"description\": \"A human-readable description of the status of this operation.\",\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"metadata\": {\n \"description\": \"ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.\",\n \"properties\": {\n \"continue\": {\n \"description\": \"continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response.\",\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"resourceVersion\": {\n \"description\": \"String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency\",\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"selfLink\": {\n \"description\": \"selfLink is a URL representing this object. Populated by the system. Read-only.\",\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n }\n },\n \"reason\": {\n \"description\": \"A machine-readable description of why this operation is in the \\\"Failure\\\" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.\",\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"status\": {\n \"description\": \"Status of the operation. One of: \\\"Success\\\" or \\\"Failure\\\". More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status\",\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"x-kubernetes-group-version-kind\": [\n {\n \"group\": \"\",\n \"kind\": \"Status\",\n \"version\": \"v1\"\n }\n ]\n }\n }\n },\n \"labels\": {\n \"description\": \"Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels\",\n \"type\": \"object\",\n \"additionalProperties\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"name\": {\n \"description\": \"Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names\",\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"namespace\": {\n \"description\": \"Namespace defines the space within each name must be unique. An empty namespace is equivalent to the \\\"default\\\" namespace, but \\\"default\\\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\\n\\nMust be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces\",\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"ownerReferences\": {\n \"description\": \"List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.\",\n \"type\": [\n \"array\",\n \"null\"\n ],\n \"items\": {\n \"description\": \"OwnerReference contains enough information to let you identify an owning object. Currently, an owning object must be in the same namespace, so there is no namespace field.\",\n \"required\": [\n \"apiVersion\",\n \"kind\",\n \"name\",\n \"uid\"\n ],\n \"properties\": {\n \"apiVersion\": {\n \"description\": \"API version of the referent.\",\n \"type\": \"string\"\n },\n \"blockOwnerDeletion\": {\n \"description\": \"If true, AND if the owner has the \\\"foregroundDeletion\\\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. Defaults to false. To set this field, a user needs \\\"delete\\\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.\",\n \"type\": \"boolean\"\n },\n \"controller\": {\n \"description\": \"If true, this reference points to the managing controller.\",\n \"type\": \"boolean\"\n },\n \"kind\": {\n \"description\": \"Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds\",\n \"type\": \"string\"\n },\n \"name\": {\n \"description\": \"Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names\",\n \"type\": \"string\"\n },\n \"uid\": {\n \"description\": \"UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids\",\n \"type\": \"string\"\n }\n }\n },\n \"x-kubernetes-patch-merge-key\": \"uid\",\n \"x-kubernetes-patch-strategy\": \"merge\"\n },\n \"resourceVersion\": {\n \"description\": \"An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\\n\\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency\",\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"selfLink\": {\n \"description\": \"SelfLink is a URL representing this object. Populated by the system. Read-only.\",\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"uid\": {\n \"description\": \"UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\\n\\nPopulated by the system. Read-only. More info: http://kubernetes.io/docs/user-guide/identifiers#uids\",\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n }\n }\n },\n \"x-kubernetes-group-version-kind\": [\n {\n \"group\": \"\",\n \"kind\": \"ConfigMap\",\n \"version\": \"v1\"\n }\n ],\n \"$schema\": \"http://json-schema.org/schema#\",\n \"type\": \"object\"\n}"} +{"text": "/*******************************************************************************\n* KindEditor - WYSIWYG HTML Editor for Internet\n* Copyright (C) 2006-2011 kindsoft.net\n*\n* @author Roddy \n* @site http://www.kindsoft.net/\n* @licence http://www.kindsoft.net/license.php\n*******************************************************************************/\n\nKindEditor.plugin('insertfile', function(K) {\n\tvar self = this, name = 'insertfile',\n\t\tallowFileUpload = K.undef(self.allowFileUpload, true),\n\t\tallowFileManager = K.undef(self.allowFileManager, false),\n\t\tformatUploadUrl = K.undef(self.formatUploadUrl, true),\n\t\tuploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'),\n\t\textraParams = K.undef(self.extraFileUploadParams, {}),\n\t\tfilePostName = K.undef(self.filePostName, 'imgFile'),\n\t\tlang = self.lang(name + '.');\n\tself.plugin.fileDialog = function(options) {\n\t\tvar fileUrl = K.undef(options.fileUrl, 'http://'),\n\t\t\tfileTitle = K.undef(options.fileTitle, ''),\n\t\t\tclickFn = options.clickFn;\n\t\tvar html = [\n\t\t\t'
',\n\t\t\t'
',\n\t\t\t'',\n\t\t\t'  ',\n\t\t\t'  ',\n\t\t\t'',\n\t\t\t'',\n\t\t\t'',\n\t\t\t'
',\n\t\t\t//title\n\t\t\t'
',\n\t\t\t'',\n\t\t\t'
',\n\t\t\t'
',\n\t\t\t//form end\n\t\t\t'',\n\t\t\t''\n\t\t\t].join('');\n\t\tvar dialog = self.createDialog({\n\t\t\tname : name,\n\t\t\twidth : 450,\n\t\t\ttitle : self.lang(name),\n\t\t\tbody : html,\n\t\t\tyesBtn : {\n\t\t\t\tname : self.lang('yes'),\n\t\t\t\tclick : function(e) {\n\t\t\t\t\tvar url = K.trim(urlBox.val()),\n\t\t\t\t\t\ttitle = titleBox.val();\n\t\t\t\t\tif (url == 'http://' || K.invalidUrl(url)) {\n\t\t\t\t\t\talert(self.lang('invalidUrl'));\n\t\t\t\t\t\turlBox[0].focus();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (K.trim(title) === '') {\n\t\t\t\t\t\ttitle = url;\n\t\t\t\t\t}\n\t\t\t\t\tclickFn.call(self, url, title);\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t\tdiv = dialog.div;\n\n\t\tvar urlBox = K('[name=\"url\"]', div),\n\t\t\tviewServerBtn = K('[name=\"viewServer\"]', div),\n\t\t\ttitleBox = K('[name=\"title\"]', div);\n\n\t\tif (allowFileUpload) {\n\t\t\tvar uploadbutton = K.uploadbutton({\n\t\t\t\tbutton : K('.ke-upload-button', div)[0],\n\t\t\t\tfieldName : filePostName,\n\t\t\t\turl : K.addParam(uploadJson, 'dir=file'),\n\t\t\t\textraParams : extraParams,\n\t\t\t\tafterUpload : function(data) {\n\t\t\t\t\tdialog.hideLoading();\n\t\t\t\t\tif (data.error === 0) {\n\t\t\t\t\t\tvar url = data.url;\n\t\t\t\t\t\tif (formatUploadUrl) {\n\t\t\t\t\t\t\turl = K.formatUrl(url, 'absolute');\n\t\t\t\t\t\t}\n\t\t\t\t\t\turlBox.val(url);\n\t\t\t\t\t\tif (self.afterUpload) {\n\t\t\t\t\t\t\tself.afterUpload.call(self, url, data, name);\n\t\t\t\t\t\t}\n\t\t\t\t\t\talert(self.lang('uploadSuccess'));\n\t\t\t\t\t} else {\n\t\t\t\t\t\talert(data.message);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tafterError : function(html) {\n\t\t\t\t\tdialog.hideLoading();\n\t\t\t\t\tself.errorDialog(html);\n\t\t\t\t}\n\t\t\t});\n\t\t\tuploadbutton.fileBox.change(function(e) {\n\t\t\t\tdialog.showLoading(self.lang('uploadLoading'));\n\t\t\t\tuploadbutton.submit();\n\t\t\t});\n\t\t} else {\n\t\t\tK('.ke-upload-button', div).hide();\n\t\t}\n\t\tif (allowFileManager) {\n\t\t\tviewServerBtn.click(function(e) {\n\t\t\t\tself.loadPlugin('filemanager', function() {\n\t\t\t\t\tself.plugin.filemanagerDialog({\n\t\t\t\t\t\tviewType : 'LIST',\n\t\t\t\t\t\tdirName : 'file',\n\t\t\t\t\t\tclickFn : function(url, title) {\n\t\t\t\t\t\t\tif (self.dialogs.length > 1) {\n\t\t\t\t\t\t\t\tK('[name=\"url\"]', div).val(url);\n\t\t\t\t\t\t\t\tif (self.afterSelectFile) {\n\t\t\t\t\t\t\t\t\tself.afterSelectFile.call(self, url);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tself.hideDialog();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\t} else {\n\t\t\tviewServerBtn.hide();\n\t\t}\n\t\turlBox.val(fileUrl);\n\t\ttitleBox.val(fileTitle);\n\t\turlBox[0].focus();\n\t\turlBox[0].select();\n\t};\n\tself.clickToolbar(name, function() {\n\t\tself.plugin.fileDialog({\n\t\t\tclickFn : function(url, title) {\n\t\t\t\tvar html = '' + title + '';\n\t\t\t\tself.insertHtml(html).hideDialog().focus();\n\t\t\t}\n\t\t});\n\t});\n});\n"} +{"text": "// Copyright 2010 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris\n\n// Unix environment variables.\n\npackage unix\n\nimport \"syscall\"\n\nfunc Getenv(key string) (value string, found bool) {\n\treturn syscall.Getenv(key)\n}\n\nfunc Setenv(key, value string) error {\n\treturn syscall.Setenv(key, value)\n}\n\nfunc Clearenv() {\n\tsyscall.Clearenv()\n}\n\nfunc Environ() []string {\n\treturn syscall.Environ()\n}\n\nfunc Unsetenv(key string) error {\n\treturn syscall.Unsetenv(key)\n}\n"} +{"text": "---\nword: customized\nmeaning: 定制的,个性化的\ncorrect: /ˈkʌstəmaɪzd/\nnote:\ncategory: 形容词\n---\n"} +{"text": "package trust\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"encoding/base64\"\n\t\"encoding/json\"\n\t\"io/ioutil\"\n\t\"os\"\n\t\"os/exec\"\n\t\"path/filepath\"\n\t\"strings\"\n\n\t\"github.com/containers/image/v5/types\"\n\t\"github.com/ghodss/yaml\"\n\t\"github.com/pkg/errors\"\n\t\"github.com/sirupsen/logrus\"\n)\n\n// PolicyContent struct for policy.json file\ntype PolicyContent struct {\n\tDefault []RepoContent `json:\"default\"`\n\tTransports TransportsContent `json:\"transports\"`\n}\n\n// RepoContent struct used under each repo\ntype RepoContent struct {\n\tType string `json:\"type\"`\n\tKeyType string `json:\"keyType,omitempty\"`\n\tKeyPath string `json:\"keyPath,omitempty\"`\n\tKeyData string `json:\"keyData,omitempty\"`\n\tSignedIdentity json.RawMessage `json:\"signedIdentity,omitempty\"`\n}\n\n// RepoMap map repo name to policycontent for each repo\ntype RepoMap map[string][]RepoContent\n\n// TransportsContent struct for content under \"transports\"\ntype TransportsContent map[string]RepoMap\n\n// RegistryConfiguration is one of the files in registriesDirPath configuring lookaside locations, or the result of merging them all.\n// NOTE: Keep this in sync with docs/registries.d.md!\ntype RegistryConfiguration struct {\n\tDefaultDocker *RegistryNamespace `json:\"default-docker\"`\n\t// The key is a namespace, using fully-expanded Docker reference format or parent namespaces (per dockerReference.PolicyConfiguration*),\n\tDocker map[string]RegistryNamespace `json:\"docker\"`\n}\n\n// RegistryNamespace defines lookaside locations for a single namespace.\ntype RegistryNamespace struct {\n\tSigStore string `json:\"sigstore\"` // For reading, and if SigStoreStaging is not present, for writing.\n\tSigStoreStaging string `json:\"sigstore-staging\"` // For writing only.\n}\n\n// ShowOutput keep the fields for image trust show command\ntype ShowOutput struct {\n\tRepo string\n\tTrusttype string\n\tGPGid string\n\tSigstore string\n}\n\n// DefaultPolicyPath returns a path to the default policy of the system.\nfunc DefaultPolicyPath(sys *types.SystemContext) string {\n\tsystemDefaultPolicyPath := \"/etc/containers/policy.json\"\n\tif sys != nil {\n\t\tif sys.SignaturePolicyPath != \"\" {\n\t\t\treturn sys.SignaturePolicyPath\n\t\t}\n\t\tif sys.RootForImplicitAbsolutePaths != \"\" {\n\t\t\treturn filepath.Join(sys.RootForImplicitAbsolutePaths, systemDefaultPolicyPath)\n\t\t}\n\t}\n\treturn systemDefaultPolicyPath\n}\n\n// RegistriesDirPath returns a path to registries.d\nfunc RegistriesDirPath(sys *types.SystemContext) string {\n\tsystemRegistriesDirPath := \"/etc/containers/registries.d\"\n\tif sys != nil {\n\t\tif sys.RegistriesDirPath != \"\" {\n\t\t\treturn sys.RegistriesDirPath\n\t\t}\n\t\tif sys.RootForImplicitAbsolutePaths != \"\" {\n\t\t\treturn filepath.Join(sys.RootForImplicitAbsolutePaths, systemRegistriesDirPath)\n\t\t}\n\t}\n\treturn systemRegistriesDirPath\n}\n\n// LoadAndMergeConfig loads configuration files in dirPath\nfunc LoadAndMergeConfig(dirPath string) (*RegistryConfiguration, error) {\n\tmergedConfig := RegistryConfiguration{Docker: map[string]RegistryNamespace{}}\n\tdockerDefaultMergedFrom := \"\"\n\tnsMergedFrom := map[string]string{}\n\n\tdir, err := os.Open(dirPath)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn &mergedConfig, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\tconfigNames, err := dir.Readdirnames(0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, configName := range configNames {\n\t\tif !strings.HasSuffix(configName, \".yaml\") {\n\t\t\tcontinue\n\t\t}\n\t\tconfigPath := filepath.Join(dirPath, configName)\n\t\tconfigBytes, err := ioutil.ReadFile(configPath)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvar config RegistryConfiguration\n\t\terr = yaml.Unmarshal(configBytes, &config)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"Error parsing %s\", configPath)\n\t\t}\n\t\tif config.DefaultDocker != nil {\n\t\t\tif mergedConfig.DefaultDocker != nil {\n\t\t\t\treturn nil, errors.Errorf(`Error parsing signature storage configuration: \"default-docker\" defined both in \"%s\" and \"%s\"`,\n\t\t\t\t\tdockerDefaultMergedFrom, configPath)\n\t\t\t}\n\t\t\tmergedConfig.DefaultDocker = config.DefaultDocker\n\t\t\tdockerDefaultMergedFrom = configPath\n\t\t}\n\t\tfor nsName, nsConfig := range config.Docker { // includes config.Docker == nil\n\t\t\tif _, ok := mergedConfig.Docker[nsName]; ok {\n\t\t\t\treturn nil, errors.Errorf(`Error parsing signature storage configuration: \"docker\" namespace \"%s\" defined both in \"%s\" and \"%s\"`,\n\t\t\t\t\tnsName, nsMergedFrom[nsName], configPath)\n\t\t\t}\n\t\t\tmergedConfig.Docker[nsName] = nsConfig\n\t\t\tnsMergedFrom[nsName] = configPath\n\t\t}\n\t}\n\treturn &mergedConfig, nil\n}\n\n// HaveMatchRegistry checks if trust settings for the registry have been configured in yaml file\nfunc HaveMatchRegistry(key string, registryConfigs *RegistryConfiguration) *RegistryNamespace {\n\tsearchKey := key\n\tif !strings.Contains(searchKey, \"/\") {\n\t\tval, exists := registryConfigs.Docker[searchKey]\n\t\tif exists {\n\t\t\treturn &val\n\t\t}\n\t}\n\tfor range strings.Split(key, \"/\") {\n\t\tval, exists := registryConfigs.Docker[searchKey]\n\t\tif exists {\n\t\t\treturn &val\n\t\t}\n\t\tif strings.Contains(searchKey, \"/\") {\n\t\t\tsearchKey = searchKey[:strings.LastIndex(searchKey, \"/\")]\n\t\t}\n\t}\n\treturn registryConfigs.DefaultDocker\n}\n\n// CreateTmpFile creates a temp file under dir and writes the content into it\nfunc CreateTmpFile(dir, pattern string, content []byte) (string, error) {\n\ttmpfile, err := ioutil.TempFile(dir, pattern)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer tmpfile.Close()\n\n\tif _, err := tmpfile.Write(content); err != nil {\n\t\treturn \"\", err\n\n\t}\n\treturn tmpfile.Name(), nil\n}\n\n// GetGPGIdFromKeyPath return user keyring from key path\nfunc GetGPGIdFromKeyPath(path string) []string {\n\tcmd := exec.Command(\"gpg2\", \"--with-colons\", path)\n\tresults, err := cmd.Output()\n\tif err != nil {\n\t\tlogrus.Errorf(\"error getting key identity: %s\", err)\n\t\treturn nil\n\t}\n\treturn parseUids(results)\n}\n\n// GetGPGIdFromKeyData return user keyring from keydata\nfunc GetGPGIdFromKeyData(key string) []string {\n\tdecodeKey, err := base64.StdEncoding.DecodeString(key)\n\tif err != nil {\n\t\tlogrus.Errorf(\"%s, error decoding key data\", err)\n\t\treturn nil\n\t}\n\ttmpfileName, err := CreateTmpFile(\"\", \"\", decodeKey)\n\tif err != nil {\n\t\tlogrus.Errorf(\"error creating key date temp file %s\", err)\n\t}\n\tdefer os.Remove(tmpfileName)\n\treturn GetGPGIdFromKeyPath(tmpfileName)\n}\n\nfunc parseUids(colonDelimitKeys []byte) []string {\n\tvar parseduids []string\n\tscanner := bufio.NewScanner(bytes.NewReader(colonDelimitKeys))\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tif strings.HasPrefix(line, \"uid:\") || strings.HasPrefix(line, \"pub:\") {\n\t\t\tuid := strings.Split(line, \":\")[9]\n\t\t\tif uid == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tparseduid := uid\n\t\t\tif strings.Contains(uid, \"<\") && strings.Contains(uid, \">\") {\n\t\t\t\tparseduid = strings.SplitN(strings.SplitAfterN(uid, \"<\", 2)[1], \">\", 2)[0]\n\t\t\t}\n\t\t\tparseduids = append(parseduids, parseduid)\n\t\t}\n\t}\n\treturn parseduids\n}\n\n// GetPolicy parse policy.json into PolicyContent struct\nfunc GetPolicy(policyPath string) (PolicyContent, error) {\n\tvar policyContentStruct PolicyContent\n\tpolicyContent, err := ioutil.ReadFile(policyPath)\n\tif err != nil {\n\t\treturn policyContentStruct, errors.Wrapf(err, \"unable to read policy file %s\", policyPath)\n\t}\n\tif err := json.Unmarshal(policyContent, &policyContentStruct); err != nil {\n\t\treturn policyContentStruct, errors.Wrapf(err, \"could not parse trust policies\")\n\t}\n\treturn policyContentStruct, nil\n}\n"} +{"text": "import * as React from 'react';\nimport { useStep, useForm } from 'react-hooks-helper';\n\nexport const ReactHooksHelperTest: React.FunctionComponent = () => {\n const { index, navigation } = useStep({ steps: 3 });\n const [formData, setForm] = useForm({ name: '', city: '' });\n\n return (\n <>\n
\n Step: {index}\n \n \n
\n
\n Step: {index}\n \n \n
\n {JSON.stringify(formData)}\n \n );\n};\n"} +{"text": "/**************************************************************************\n * Copyright © 2014-2015 VMware, Inc., Palo Alto, CA., USA\n * All Rights Reserved.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sub license, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:\n *\n * The above copyright notice and this permission notice (including the\n * next paragraph) shall be included in all copies or substantial portions\n * of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL\n * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,\n * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n * USE OR OTHER DEALINGS IN THE SOFTWARE.\n *\n **************************************************************************/\n\n#include \"vmwgfx_drv.h\"\n#include \"vmwgfx_resource_priv.h\"\n#include \"vmwgfx_so.h\"\n#include \"vmwgfx_binding.h\"\n\n/*\n * The currently only reason we need to keep track of views is that if we\n * destroy a hardware surface, all views pointing to it must also be destroyed,\n * otherwise the device will error.\n * So in particuar if a surface is evicted, we must destroy all views pointing\n * to it, and all context bindings of that view. Similarly we must restore\n * the view bindings, views and surfaces pointed to by the views when a\n * context is referenced in the command stream.\n */\n\n/**\n * struct vmw_view - view metadata\n *\n * @res: The struct vmw_resource we derive from\n * @ctx: Non-refcounted pointer to the context this view belongs to.\n * @srf: Refcounted pointer to the surface pointed to by this view.\n * @cotable: Refcounted pointer to the cotable holding this view.\n * @srf_head: List head for the surface-to-view list.\n * @cotable_head: List head for the cotable-to_view list.\n * @view_type: View type.\n * @view_id: User-space per context view id. Currently used also as per\n * context device view id.\n * @cmd_size: Size of the SVGA3D define view command that we've copied from the\n * command stream.\n * @committed: Whether the view is actually created or pending creation at the\n * device level.\n * @cmd: The SVGA3D define view command copied from the command stream.\n */\nstruct vmw_view {\n\tstruct rcu_head rcu;\n\tstruct vmw_resource res;\n\tstruct vmw_resource *ctx; /* Immutable */\n\tstruct vmw_resource *srf; /* Immutable */\n\tstruct vmw_resource *cotable; /* Immutable */\n\tstruct list_head srf_head; /* Protected by binding_mutex */\n\tstruct list_head cotable_head; /* Protected by binding_mutex */\n\tunsigned view_type; /* Immutable */\n\tunsigned view_id; /* Immutable */\n\tu32 cmd_size; /* Immutable */\n\tbool committed; /* Protected by binding_mutex */\n\tu32 cmd[1]; /* Immutable */\n};\n\nstatic int vmw_view_create(struct vmw_resource *res);\nstatic int vmw_view_destroy(struct vmw_resource *res);\nstatic void vmw_hw_view_destroy(struct vmw_resource *res);\nstatic void vmw_view_commit_notify(struct vmw_resource *res,\n\t\t\t\t enum vmw_cmdbuf_res_state state);\n\nstatic const struct vmw_res_func vmw_view_func = {\n\t.res_type = vmw_res_view,\n\t.needs_backup = false,\n\t.may_evict = false,\n\t.type_name = \"DX view\",\n\t.backup_placement = NULL,\n\t.create = vmw_view_create,\n\t.commit_notify = vmw_view_commit_notify,\n};\n\n/**\n * struct vmw_view - view define command body stub\n *\n * @view_id: The device id of the view being defined\n * @sid: The surface id of the view being defined\n *\n * This generic struct is used by the code to change @view_id and @sid of a\n * saved view define command.\n */\nstruct vmw_view_define {\n\tuint32 view_id;\n\tuint32 sid;\n};\n\n/**\n * vmw_view - Convert a struct vmw_resource to a struct vmw_view\n *\n * @res: Pointer to the resource to convert.\n *\n * Returns a pointer to a struct vmw_view.\n */\nstatic struct vmw_view *vmw_view(struct vmw_resource *res)\n{\n\treturn container_of(res, struct vmw_view, res);\n}\n\n/**\n * vmw_view_commit_notify - Notify that a view operation has been committed to\n * hardware from a user-supplied command stream.\n *\n * @res: Pointer to the view resource.\n * @state: Indicating whether a creation or removal has been committed.\n *\n */\nstatic void vmw_view_commit_notify(struct vmw_resource *res,\n\t\t\t\t enum vmw_cmdbuf_res_state state)\n{\n\tstruct vmw_view *view = vmw_view(res);\n\tstruct vmw_private *dev_priv = res->dev_priv;\n\n\tmutex_lock(&dev_priv->binding_mutex);\n\tif (state == VMW_CMDBUF_RES_ADD) {\n\t\tstruct vmw_surface *srf = vmw_res_to_srf(view->srf);\n\n\t\tlist_add_tail(&view->srf_head, &srf->view_list);\n\t\tvmw_cotable_add_resource(view->cotable, &view->cotable_head);\n\t\tview->committed = true;\n\t\tres->id = view->view_id;\n\n\t} else {\n\t\tlist_del_init(&view->cotable_head);\n\t\tlist_del_init(&view->srf_head);\n\t\tview->committed = false;\n\t\tres->id = -1;\n\t}\n\tmutex_unlock(&dev_priv->binding_mutex);\n}\n\n/**\n * vmw_view_create - Create a hardware view.\n *\n * @res: Pointer to the view resource.\n *\n * Create a hardware view. Typically used if that view has previously been\n * destroyed by an eviction operation.\n */\nstatic int vmw_view_create(struct vmw_resource *res)\n{\n\tstruct vmw_view *view = vmw_view(res);\n\tstruct vmw_surface *srf = vmw_res_to_srf(view->srf);\n\tstruct vmw_private *dev_priv = res->dev_priv;\n\tstruct {\n\t\tSVGA3dCmdHeader header;\n\t\tstruct vmw_view_define body;\n\t} *cmd;\n\n\tmutex_lock(&dev_priv->binding_mutex);\n\tif (!view->committed) {\n\t\tmutex_unlock(&dev_priv->binding_mutex);\n\t\treturn 0;\n\t}\n\n\tcmd = vmw_fifo_reserve_dx(res->dev_priv, view->cmd_size,\n\t\t\t\t view->ctx->id);\n\tif (!cmd) {\n\t\tDRM_ERROR(\"Failed reserving FIFO space for view creation.\\n\");\n\t\tmutex_unlock(&dev_priv->binding_mutex);\n\t\treturn -ENOMEM;\n\t}\n\tmemcpy(cmd, &view->cmd, view->cmd_size);\n\tWARN_ON(cmd->body.view_id != view->view_id);\n\t/* Sid may have changed due to surface eviction. */\n\tWARN_ON(view->srf->id == SVGA3D_INVALID_ID);\n\tcmd->body.sid = view->srf->id;\n\tvmw_fifo_commit(res->dev_priv, view->cmd_size);\n\tres->id = view->view_id;\n\tlist_add_tail(&view->srf_head, &srf->view_list);\n\tvmw_cotable_add_resource(view->cotable, &view->cotable_head);\n\tmutex_unlock(&dev_priv->binding_mutex);\n\n\treturn 0;\n}\n\n/**\n * vmw_view_destroy - Destroy a hardware view.\n *\n * @res: Pointer to the view resource.\n *\n * Destroy a hardware view. Typically used on unexpected termination of the\n * owning process or if the surface the view is pointing to is destroyed.\n */\nstatic int vmw_view_destroy(struct vmw_resource *res)\n{\n\tstruct vmw_private *dev_priv = res->dev_priv;\n\tstruct vmw_view *view = vmw_view(res);\n\tstruct {\n\t\tSVGA3dCmdHeader header;\n\t\tunion vmw_view_destroy body;\n\t} *cmd;\n\n\tWARN_ON_ONCE(!mutex_is_locked(&dev_priv->binding_mutex));\n\tvmw_binding_res_list_scrub(&res->binding_head);\n\n\tif (!view->committed || res->id == -1)\n\t\treturn 0;\n\n\tcmd = vmw_fifo_reserve_dx(dev_priv, sizeof(*cmd), view->ctx->id);\n\tif (!cmd) {\n\t\tDRM_ERROR(\"Failed reserving FIFO space for view \"\n\t\t\t \"destruction.\\n\");\n\t\treturn -ENOMEM;\n\t}\n\n\tcmd->header.id = vmw_view_destroy_cmds[view->view_type];\n\tcmd->header.size = sizeof(cmd->body);\n\tcmd->body.view_id = view->view_id;\n\tvmw_fifo_commit(dev_priv, sizeof(*cmd));\n\tres->id = -1;\n\tlist_del_init(&view->cotable_head);\n\tlist_del_init(&view->srf_head);\n\n\treturn 0;\n}\n\n/**\n * vmw_hw_view_destroy - Destroy a hardware view as part of resource cleanup.\n *\n * @res: Pointer to the view resource.\n *\n * Destroy a hardware view if it's still present.\n */\nstatic void vmw_hw_view_destroy(struct vmw_resource *res)\n{\n\tstruct vmw_private *dev_priv = res->dev_priv;\n\n\tmutex_lock(&dev_priv->binding_mutex);\n\tWARN_ON(vmw_view_destroy(res));\n\tres->id = -1;\n\tmutex_unlock(&dev_priv->binding_mutex);\n}\n\n/**\n * vmw_view_key - Compute a view key suitable for the cmdbuf resource manager\n *\n * @user_key: The user-space id used for the view.\n * @view_type: The view type.\n *\n * Destroy a hardware view if it's still present.\n */\nstatic u32 vmw_view_key(u32 user_key, enum vmw_view_type view_type)\n{\n\treturn user_key | (view_type << 20);\n}\n\n/**\n * vmw_view_id_ok - Basic view id and type range checks.\n *\n * @user_key: The user-space id used for the view.\n * @view_type: The view type.\n *\n * Checks that the view id and type (typically provided by user-space) is\n * valid.\n */\nstatic bool vmw_view_id_ok(u32 user_key, enum vmw_view_type view_type)\n{\n\treturn (user_key < SVGA_COTABLE_MAX_IDS &&\n\t\tview_type < vmw_view_max);\n}\n\n/**\n * vmw_view_res_free - resource res_free callback for view resources\n *\n * @res: Pointer to a struct vmw_resource\n *\n * Frees memory and memory accounting held by a struct vmw_view.\n */\nstatic void vmw_view_res_free(struct vmw_resource *res)\n{\n\tstruct vmw_view *view = vmw_view(res);\n\tsize_t size = offsetof(struct vmw_view, cmd) + view->cmd_size;\n\tstruct vmw_private *dev_priv = res->dev_priv;\n\n\tvmw_resource_unreference(&view->cotable);\n\tvmw_resource_unreference(&view->srf);\n\tkfree_rcu(view, rcu);\n\tttm_mem_global_free(vmw_mem_glob(dev_priv), size);\n}\n\n/**\n * vmw_view_add - Create a view resource and stage it for addition\n * as a command buffer managed resource.\n *\n * @man: Pointer to the compat shader manager identifying the shader namespace.\n * @ctx: Pointer to a struct vmw_resource identifying the active context.\n * @srf: Pointer to a struct vmw_resource identifying the surface the view\n * points to.\n * @view_type: The view type deduced from the view create command.\n * @user_key: The key that is used to identify the shader. The key is\n * unique to the view type and to the context.\n * @cmd: Pointer to the view create command in the command stream.\n * @cmd_size: Size of the view create command in the command stream.\n * @list: Caller's list of staged command buffer resource actions.\n */\nint vmw_view_add(struct vmw_cmdbuf_res_manager *man,\n\t\t struct vmw_resource *ctx,\n\t\t struct vmw_resource *srf,\n\t\t enum vmw_view_type view_type,\n\t\t u32 user_key,\n\t\t const void *cmd,\n\t\t size_t cmd_size,\n\t\t struct list_head *list)\n{\n\tstatic const size_t vmw_view_define_sizes[] = {\n\t\t[vmw_view_sr] = sizeof(SVGA3dCmdDXDefineShaderResourceView),\n\t\t[vmw_view_rt] = sizeof(SVGA3dCmdDXDefineRenderTargetView),\n\t\t[vmw_view_ds] = sizeof(SVGA3dCmdDXDefineDepthStencilView)\n\t};\n\n\tstruct vmw_private *dev_priv = ctx->dev_priv;\n\tstruct vmw_resource *res;\n\tstruct vmw_view *view;\n\tstruct ttm_operation_ctx ttm_opt_ctx = {\n\t\t.interruptible = true,\n\t\t.no_wait_gpu = false\n\t};\n\tsize_t size;\n\tint ret;\n\n\tif (cmd_size != vmw_view_define_sizes[view_type] +\n\t sizeof(SVGA3dCmdHeader)) {\n\t\tDRM_ERROR(\"Illegal view create command size.\\n\");\n\t\treturn -EINVAL;\n\t}\n\n\tif (!vmw_view_id_ok(user_key, view_type)) {\n\t\tDRM_ERROR(\"Illegal view add view id.\\n\");\n\t\treturn -EINVAL;\n\t}\n\n\tsize = offsetof(struct vmw_view, cmd) + cmd_size;\n\n\tret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv), size, &ttm_opt_ctx);\n\tif (ret) {\n\t\tif (ret != -ERESTARTSYS)\n\t\t\tDRM_ERROR(\"Out of graphics memory for view\"\n\t\t\t\t \" creation.\\n\");\n\t\treturn ret;\n\t}\n\n\tview = kmalloc(size, GFP_KERNEL);\n\tif (!view) {\n\t\tttm_mem_global_free(vmw_mem_glob(dev_priv), size);\n\t\treturn -ENOMEM;\n\t}\n\n\tres = &view->res;\n\tview->ctx = ctx;\n\tview->srf = vmw_resource_reference(srf);\n\tview->cotable = vmw_context_cotable(ctx, vmw_view_cotables[view_type]);\n\tview->view_type = view_type;\n\tview->view_id = user_key;\n\tview->cmd_size = cmd_size;\n\tview->committed = false;\n\tINIT_LIST_HEAD(&view->srf_head);\n\tINIT_LIST_HEAD(&view->cotable_head);\n\tmemcpy(&view->cmd, cmd, cmd_size);\n\tret = vmw_resource_init(dev_priv, res, true,\n\t\t\t\tvmw_view_res_free, &vmw_view_func);\n\tif (ret)\n\t\tgoto out_resource_init;\n\n\tret = vmw_cmdbuf_res_add(man, vmw_cmdbuf_res_view,\n\t\t\t\t vmw_view_key(user_key, view_type),\n\t\t\t\t res, list);\n\tif (ret)\n\t\tgoto out_resource_init;\n\n\tres->id = view->view_id;\n\tvmw_resource_activate(res, vmw_hw_view_destroy);\n\nout_resource_init:\n\tvmw_resource_unreference(&res);\n\n\treturn ret;\n}\n\n/**\n * vmw_view_remove - Stage a view for removal.\n *\n * @man: Pointer to the view manager identifying the shader namespace.\n * @user_key: The key that is used to identify the view. The key is\n * unique to the view type.\n * @view_type: View type\n * @list: Caller's list of staged command buffer resource actions.\n * @res_p: If the resource is in an already committed state, points to the\n * struct vmw_resource on successful return. The pointer will be\n * non ref-counted.\n */\nint vmw_view_remove(struct vmw_cmdbuf_res_manager *man,\n\t\t u32 user_key, enum vmw_view_type view_type,\n\t\t struct list_head *list,\n\t\t struct vmw_resource **res_p)\n{\n\tif (!vmw_view_id_ok(user_key, view_type)) {\n\t\tDRM_ERROR(\"Illegal view remove view id.\\n\");\n\t\treturn -EINVAL;\n\t}\n\n\treturn vmw_cmdbuf_res_remove(man, vmw_cmdbuf_res_view,\n\t\t\t\t vmw_view_key(user_key, view_type),\n\t\t\t\t list, res_p);\n}\n\n/**\n * vmw_view_cotable_list_destroy - Evict all views belonging to a cotable.\n *\n * @dev_priv: Pointer to a device private struct.\n * @list: List of views belonging to a cotable.\n * @readback: Unused. Needed for function interface only.\n *\n * This function evicts all views belonging to a cotable.\n * It must be called with the binding_mutex held, and the caller must hold\n * a reference to the view resource. This is typically called before the\n * cotable is paged out.\n */\nvoid vmw_view_cotable_list_destroy(struct vmw_private *dev_priv,\n\t\t\t\t struct list_head *list,\n\t\t\t\t bool readback)\n{\n\tstruct vmw_view *entry, *next;\n\n\tWARN_ON_ONCE(!mutex_is_locked(&dev_priv->binding_mutex));\n\n\tlist_for_each_entry_safe(entry, next, list, cotable_head)\n\t\tWARN_ON(vmw_view_destroy(&entry->res));\n}\n\n/**\n * vmw_view_surface_list_destroy - Evict all views pointing to a surface\n *\n * @dev_priv: Pointer to a device private struct.\n * @list: List of views pointing to a surface.\n *\n * This function evicts all views pointing to a surface. This is typically\n * called before the surface is evicted.\n */\nvoid vmw_view_surface_list_destroy(struct vmw_private *dev_priv,\n\t\t\t\t struct list_head *list)\n{\n\tstruct vmw_view *entry, *next;\n\n\tWARN_ON_ONCE(!mutex_is_locked(&dev_priv->binding_mutex));\n\n\tlist_for_each_entry_safe(entry, next, list, srf_head)\n\t\tWARN_ON(vmw_view_destroy(&entry->res));\n}\n\n/**\n * vmw_view_srf - Return a non-refcounted pointer to the surface a view is\n * pointing to.\n *\n * @res: pointer to a view resource.\n *\n * Note that the view itself is holding a reference, so as long\n * the view resource is alive, the surface resource will be.\n */\nstruct vmw_resource *vmw_view_srf(struct vmw_resource *res)\n{\n\treturn vmw_view(res)->srf;\n}\n\n/**\n * vmw_view_lookup - Look up a view.\n *\n * @man: The context's cmdbuf ref manager.\n * @view_type: The view type.\n * @user_key: The view user id.\n *\n * returns a refcounted pointer to a view or an error pointer if not found.\n */\nstruct vmw_resource *vmw_view_lookup(struct vmw_cmdbuf_res_manager *man,\n\t\t\t\t enum vmw_view_type view_type,\n\t\t\t\t u32 user_key)\n{\n\treturn vmw_cmdbuf_res_lookup(man, vmw_cmdbuf_res_view,\n\t\t\t\t vmw_view_key(user_key, view_type));\n}\n\nconst u32 vmw_view_destroy_cmds[] = {\n\t[vmw_view_sr] = SVGA_3D_CMD_DX_DESTROY_SHADERRESOURCE_VIEW,\n\t[vmw_view_rt] = SVGA_3D_CMD_DX_DESTROY_RENDERTARGET_VIEW,\n\t[vmw_view_ds] = SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_VIEW,\n};\n\nconst SVGACOTableType vmw_view_cotables[] = {\n\t[vmw_view_sr] = SVGA_COTABLE_SRVIEW,\n\t[vmw_view_rt] = SVGA_COTABLE_RTVIEW,\n\t[vmw_view_ds] = SVGA_COTABLE_DSVIEW,\n};\n\nconst SVGACOTableType vmw_so_cotables[] = {\n\t[vmw_so_el] = SVGA_COTABLE_ELEMENTLAYOUT,\n\t[vmw_so_bs] = SVGA_COTABLE_BLENDSTATE,\n\t[vmw_so_ds] = SVGA_COTABLE_DEPTHSTENCIL,\n\t[vmw_so_rs] = SVGA_COTABLE_RASTERIZERSTATE,\n\t[vmw_so_ss] = SVGA_COTABLE_SAMPLER,\n\t[vmw_so_so] = SVGA_COTABLE_STREAMOUTPUT\n};\n\n\n/* To remove unused function warning */\nstatic void vmw_so_build_asserts(void) __attribute__((used));\n\n\n/*\n * This function is unused at run-time, and only used to dump various build\n * asserts important for code optimization assumptions.\n */\nstatic void vmw_so_build_asserts(void)\n{\n\t/* Assert that our vmw_view_cmd_to_type() function is correct. */\n\tBUILD_BUG_ON(SVGA_3D_CMD_DX_DESTROY_SHADERRESOURCE_VIEW !=\n\t\t SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW + 1);\n\tBUILD_BUG_ON(SVGA_3D_CMD_DX_DEFINE_RENDERTARGET_VIEW !=\n\t\t SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW + 2);\n\tBUILD_BUG_ON(SVGA_3D_CMD_DX_DESTROY_RENDERTARGET_VIEW !=\n\t\t SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW + 3);\n\tBUILD_BUG_ON(SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW !=\n\t\t SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW + 4);\n\tBUILD_BUG_ON(SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_VIEW !=\n\t\t SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW + 5);\n\n\t/* Assert that our \"one body fits all\" assumption is valid */\n\tBUILD_BUG_ON(sizeof(union vmw_view_destroy) != sizeof(u32));\n\n\t/* Assert that the view key space can hold all view ids. */\n\tBUILD_BUG_ON(SVGA_COTABLE_MAX_IDS >= ((1 << 20) - 1));\n\n\t/*\n\t * Assert that the offset of sid in all view define commands\n\t * is what we assume it to be.\n\t */\n\tBUILD_BUG_ON(offsetof(struct vmw_view_define, sid) !=\n\t\t offsetof(SVGA3dCmdDXDefineShaderResourceView, sid));\n\tBUILD_BUG_ON(offsetof(struct vmw_view_define, sid) !=\n\t\t offsetof(SVGA3dCmdDXDefineRenderTargetView, sid));\n\tBUILD_BUG_ON(offsetof(struct vmw_view_define, sid) !=\n\t\t offsetof(SVGA3dCmdDXDefineDepthStencilView, sid));\n}\n"} +{"text": "\n\n\n\n\tCFBundleDevelopmentRegion\n\tEnglish\n\tCFBundleExecutable\n\t${EXECUTABLE_NAME}\n\tCFBundleIconFile\n\t\n\tCFBundleIdentifier\n\t$(PRODUCT_BUNDLE_IDENTIFIER)\n\tCFBundleInfoDictionaryVersion\n\t6.0\n\tCFBundleName\n\t${PRODUCT_NAME}\n\tCFBundlePackageType\n\tBNDL\n\tCFBundleSignature\n\t????\n\tCFBundleVersion\n\t1.0\n\tNSPrincipalClass\n\t\n\n\n"} +{"text": "\n"} +{"text": "/**\r\n * jQuery EasyUI 1.4.2\r\n * \r\n * Copyright (c) 2009-2015 www.jeasyui.com. All rights reserved.\r\n *\r\n * Licensed under the GPL license: http://www.gnu.org/licenses/gpl.txt\r\n * To use it on other terms please contact us at info@jeasyui.com\r\n *\r\n */\r\n(function($){\r\nfunction _1(_2){\r\nvar _3=$.data(_2,\"menubutton\").options;\r\nvar _4=$(_2);\r\n_4.linkbutton(_3);\r\nif(_3.hasDownArrow){\r\n_4.removeClass(_3.cls.btn1+\" \"+_3.cls.btn2).addClass(\"m-btn\");\r\n_4.removeClass(\"m-btn-small m-btn-medium m-btn-large\").addClass(\"m-btn-\"+_3.size);\r\nvar _5=_4.find(\".l-btn-left\");\r\n$(\"\").addClass(_3.cls.arrow).appendTo(_5);\r\n$(\"\").addClass(\"m-btn-line\").appendTo(_5);\r\n}\r\n$(_2).menubutton(\"resize\");\r\nif(_3.menu){\r\n$(_3.menu).menu({duration:_3.duration});\r\nvar _6=$(_3.menu).menu(\"options\");\r\nvar _7=_6.onShow;\r\nvar _8=_6.onHide;\r\n$.extend(_6,{onShow:function(){\r\nvar _9=$(this).menu(\"options\");\r\nvar _a=$(_9.alignTo);\r\nvar _b=_a.menubutton(\"options\");\r\n_a.addClass((_b.plain==true)?_b.cls.btn2:_b.cls.btn1);\r\n_7.call(this);\r\n},onHide:function(){\r\nvar _c=$(this).menu(\"options\");\r\nvar _d=$(_c.alignTo);\r\nvar _e=_d.menubutton(\"options\");\r\n_d.removeClass((_e.plain==true)?_e.cls.btn2:_e.cls.btn1);\r\n_8.call(this);\r\n}});\r\n}\r\n};\r\nfunction _f(_10){\r\nvar _11=$.data(_10,\"menubutton\").options;\r\nvar btn=$(_10);\r\nvar t=btn.find(\".\"+_11.cls.trigger);\r\nif(!t.length){\r\nt=btn;\r\n}\r\nt.unbind(\".menubutton\");\r\nvar _12=null;\r\nt.bind(\"click.menubutton\",function(){\r\nif(!_13()){\r\n_14(_10);\r\nreturn false;\r\n}\r\n}).bind(\"mouseenter.menubutton\",function(){\r\nif(!_13()){\r\n_12=setTimeout(function(){\r\n_14(_10);\r\n},_11.duration);\r\nreturn false;\r\n}\r\n}).bind(\"mouseleave.menubutton\",function(){\r\nif(_12){\r\nclearTimeout(_12);\r\n}\r\n$(_11.menu).triggerHandler(\"mouseleave\");\r\n});\r\nfunction _13(){\r\nreturn $(_10).linkbutton(\"options\").disabled;\r\n};\r\n};\r\nfunction _14(_15){\r\nvar _16=$(_15).menubutton(\"options\");\r\nif(_16.disabled||!_16.menu){\r\nreturn;\r\n}\r\n$(\"body>div.menu-top\").menu(\"hide\");\r\nvar btn=$(_15);\r\nvar mm=$(_16.menu);\r\nif(mm.length){\r\nmm.menu(\"options\").alignTo=btn;\r\nmm.menu(\"show\",{alignTo:btn,align:_16.menuAlign});\r\n}\r\nbtn.blur();\r\n};\r\n$.fn.menubutton=function(_17,_18){\r\nif(typeof _17==\"string\"){\r\nvar _19=$.fn.menubutton.methods[_17];\r\nif(_19){\r\nreturn _19(this,_18);\r\n}else{\r\nreturn this.linkbutton(_17,_18);\r\n}\r\n}\r\n_17=_17||{};\r\nreturn this.each(function(){\r\nvar _1a=$.data(this,\"menubutton\");\r\nif(_1a){\r\n$.extend(_1a.options,_17);\r\n}else{\r\n$.data(this,\"menubutton\",{options:$.extend({},$.fn.menubutton.defaults,$.fn.menubutton.parseOptions(this),_17)});\r\n$(this).removeAttr(\"disabled\");\r\n}\r\n_1(this);\r\n_f(this);\r\n});\r\n};\r\n$.fn.menubutton.methods={options:function(jq){\r\nvar _1b=jq.linkbutton(\"options\");\r\nreturn $.extend($.data(jq[0],\"menubutton\").options,{toggle:_1b.toggle,selected:_1b.selected,disabled:_1b.disabled});\r\n},destroy:function(jq){\r\nreturn jq.each(function(){\r\nvar _1c=$(this).menubutton(\"options\");\r\nif(_1c.menu){\r\n$(_1c.menu).menu(\"destroy\");\r\n}\r\n$(this).remove();\r\n});\r\n}};\r\n$.fn.menubutton.parseOptions=function(_1d){\r\nvar t=$(_1d);\r\nreturn $.extend({},$.fn.linkbutton.parseOptions(_1d),$.parser.parseOptions(_1d,[\"menu\",{plain:\"boolean\",hasDownArrow:\"boolean\",duration:\"number\"}]));\r\n};\r\n$.fn.menubutton.defaults=$.extend({},$.fn.linkbutton.defaults,{plain:true,hasDownArrow:true,menu:null,menuAlign:\"left\",duration:100,cls:{btn1:\"m-btn-active\",btn2:\"m-btn-plain-active\",arrow:\"m-btn-downarrow\",trigger:\"m-btn\"}});\r\n})(jQuery);\r\n\r\n"} +{"text": "# encoding=UTF-8\n\n# Copyright © 2015-2017 Jakub Wilk \n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the “Software”), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n# SOFTWARE.\n\nimport afl\n\nfrom .tools import (\n assert_equal,\n)\n\ndef test_hash():\n h = afl._hash # pylint: disable=protected-access\n assert_equal(h('', 0), 2166136261)\n assert_equal(h('', 42), 789356349)\n assert_equal(h('moo', 23), 3934561083)\n assert_equal(h('moo', 37), 3162790609)\n assert_equal(h('wół', 23), 2298935884)\n assert_equal(h('wół', 37), 3137816834)\n\n# vim:ts=4 sts=4 sw=4 et\n"} +{"text": "const createConfig = require(\"./createConfig\");\n\nmodule.exports = createConfig({\n isMinified: false,\n});\n"} +{"text": "var searchData=\n[\n ['mail_20queue_20management',['Mail Queue Management',['../group___c_m_s_i_s___r_t_o_s___mail.html',1,'']]],\n ['message_20queue_20management',['Message Queue Management',['../group___c_m_s_i_s___r_t_o_s___message.html',1,'']]],\n ['mutex_20management',['Mutex Management',['../group___c_m_s_i_s___r_t_o_s___mutex_mgmt.html',1,'']]],\n ['memory_20pool_20management',['Memory Pool Management',['../group___c_m_s_i_s___r_t_o_s___pool_mgmt.html',1,'']]],\n ['mail_5fid',['mail_id',['../group___c_m_s_i_s___r_t_o_s___definitions.html#ac86175a4b1706bee596f3018322df26e',1,'osEvent']]],\n ['message_5fid',['message_id',['../group___c_m_s_i_s___r_t_o_s___definitions.html#af394cbe21dde7377974e63af38cd87b0',1,'osEvent']]]\n];\n"} +{"text": "{\n \"images\" : [\n {\n \"idiom\" : \"universal\",\n \"scale\" : \"2x\",\n \"filename\" : \"center_default_category@2x.png\"\n },\n {\n \"idiom\" : \"universal\",\n \"scale\" : \"3x\",\n \"filename\" : \"center_default_category@3x.png\"\n }\n ],\n \"info\" : {\n \"version\" : 1,\n \"author\" : \"xcode\"\n }\n}"} +{"text": "name=Scourge of the Nobilis\nimage=https://magiccards.info/scans/en/eve/146.jpg\nvalue=4.068\nrarity=C\ntype=Enchantment\nsubtype=Aura\ncost={2}{R/W}\nability=Enchant creature;\\\n As long as enchanted creature is red, enchanted creature gets +1/+1 and has \"{R/W}: This creature gets +1/+0 until end of turn.\";\\\n As long as enchanted creature is white, enchanted creature gets +1/+1 and has lifelink.\ntiming=aura\nenchant=pump,pos creature\noracle=Enchant creature\\nAs long as enchanted creature is red, it gets +1/+1 and has \"{R/W}: This creature gets +1/+0 until end of turn.\"\\nAs long as enchanted creature is white, it gets +1/+1 and has lifelink.\n"} +{"text": "# create_autonomy\n\n[ROS](http://ros.org) driver for iRobot [Create 1 and 2](http://www.irobot.com/About-iRobot/STEM/Create-2.aspx).\nThis package wraps the C++ library [libcreate][libcreate], which uses iRobot's [Open Interface Specification][oi_spec].\n\n\n* ROS wiki page: http://wiki.ros.org/create_autonomy\n* Support: [ROS Answers (tag: create_autonomy)](http://answers.ros.org/questions/scope:all/sort:activity-desc/tags:create_autonomy/page:1/)\n* Author: [Jacob Perron](http://jacobperron.ca) ([Autonomy Lab](http://autonomylab.org), [Simon Fraser University](http://www.sfu.ca))\n\n## Build Status\n\nTravisCI (Ubuntu _Trusty_, ROS _Indigo_ and _Jade_) \n![Build Status](https://api.travis-ci.org/AutonomyLab/create_autonomy.svg?branch=indigo-devel)\n\n## Supported Robots\n\n| Model | Support |\n|-----------|------------|\n| Create 1 | Yes |\n| Create 2 _(firmware >= 3.2.6)_ | Yes |\n| Roomba Original Series | No |\n| Roomba 400 Series | Yes |\n| Roomba 500 Series | Yes * |\n| Roomba 600 Series | Yes * |\n| Roomba 700 Series | Yes + |\n| Roomba 800 Series | Yes + |\n| Roomba 900 Series | No * |\n\n_+ Verified by third-party. Please note [Odometry Issue #28](https://github.com/AutonomyLab/create_autonomy/issues/32)_ \n_* Not verified. Anyone who is able to verify that this driver works or not is encouraged to contact [Jacob](https://jacobperron.ca) with their findings or open an issue._\n\n## Features\n\n| Feature | Status |\n|-------------------|---------------|\n| Odometry | Available |\n| Safe mode | Planned [#13](https://github.com/AutonomyLab/create_autonomy/issues/13) |\n| Clean demo | Planned [#14](https://github.com/AutonomyLab/create_autonomy/issues/14) |\n| Dock demo | Available |\n| Drive wheels | N/A |\n| Drive (v,w) | Available |\n| Brush motors | Planned [#15](https://github.com/AutonomyLab/create_autonomy/issues/15) |\n| LEDs | Available |\n| Digit LEDs | Available |\n| Sound | Available |\n| Wheeldrop | Available |\n| Bumpers | Available |\n| Cliff sensor | Planned [#22](https://github.com/AutonomyLab/create_autonomy/issues/22) |\n| Dirt detect | N/A |\n| Omni IR sensor | Available |\n| Left IR sensor | N/A |\n| Right IR sensor | N/A |\n| Battery info | Available |\n| Light sensors | Available |\n| **_Diagnostics_** | |\n| Corrupt packets | Planned |\n| Physical tests | Planned |\n| Overcurrent info | Planned |\n\n## Install\n\n#### Prerequisites\n\n* Internet connection\n* [ROS](http://wiki.ros.org/ROS/Installation) _Indigo_ or _Jade_\n* Ubuntu packages: `python-rosdep`, `python-catkin-tools`\n\n``` bash\n$ sudo apt-get install python-rosdep python-catkin-tools\n```\n\n#### Compiling\n\n1. Create a catkin workspace \n ``` bash\n $ cd ~\n $ mkdir -p create_ws/src \n $ cd create_ws \n $ catkin init \n ```\n\n2. Clone this repo \n ``` bash\n $ cd ~/create_ws/src\n $ git clone https://github.com/AutonomyLab/create_autonomy.git \n ```\n \n3. Install dependencies \n ``` bash\n $ cd ~/create_ws\n $ rosdep update \n $ rosdep install --from-paths src -i \n ```\n\n4. Build \n ``` bash\n $ cd ~/create_ws\n $ catkin build\n ```\n#### USB Permissions\n5. In order to connect to Create over USB, ensure your user is in the dialout group\n ``` bash\n $ sudo usermod -a -G dialout $USER\n ```\n\n6. Logout and login for permission to take effect\n\n## Running the driver\n\n### Setup\n\n1. After compiling from source, don't forget to source your workspace: \n ``` bash\n $ source ~/create_ws/devel/setup.bash\n ```\n\n2. Connect computer to Create's 7-pin serial port\n - If using Create 1, ensure that nothing is connected to Create's DB-25 port\n\n3. Launch one of the existing launch files or adapt them to create your own.\n\n### Launch files\n\nFor Create 2 (Roomba 600/700 series):\n``` bash\n$ roslaunch ca_driver create_2.launch\n```\n\nFor Create 1 (Roomba 500 series):\n``` bash\n$ roslaunch ca_driver create_1.launch\n```\n\nFor Roomba 400 series:\n``` bash\n$ roslaunch ca_driver roomba_400.launch\n```\n\n#### Launch file arguments\n\n* **config** - Absolute path to a configuration file (YAML). Default: `ca_driver/config/default.yaml`\n* **desc** - Enable robot description (URDF/mesh). Default: `true`\n\nFor example, if you would like to disable the robot description and provide a custom configuration file:\n\n```bash\n$ roslaunch ca_driver create_2.launch config:=/abs/path/to/config.yaml desc:=false\n```\n\n### Parameters\n\n Name | Description | Default\n--------------|--------------|----------\n`dev` | Device path of robot | `/dev/ttyUSB0`\n`base_frame` | The robot's base frame ID | `base_footprint`\n`odom_frame` | The robot's odometry frame ID | `odom`\n`latch_cmd_duration` | If this many seconds passes without receiving a velocity command the robot stops | `0.2`\n`loop_hz` | Frequency of internal update loop | `10.0`\n`publish_tf` | Publish the transform from `odom_frame` to `base_frame` | `true` \n`robot_model` | The type of robot being controlled (supported values: `ROOMBA_400`, `CREATE_1` and `CREATE_2`) | `CREATE_2`\n`baud` | Serial baud rate | Inferred based on robot model, but is overwritten upon providing a value\n\n### Publishers\n\n Topic | Description | Type\n-------------|--------------|------\n `battery/capacity` | The estimated charge capacity of the robot's battery (Ah) | [std_msgs/Float32][float32]\n `battery/charge` | The current charge of the robot's battery (Ah) | [std_msgs/Float32][float32]\n `battery/charge_ratio` | Charge / capacity | [std_msgs/Float32][float32]\n `battery/charging_state` | The chargins state of the battery | [ca_msgs/ChargingState][chargingstate_msg]\n `battery/current` | Current flowing through the robot's battery (A). Positive current implies charging | [std_msgs/Float32][float32]\n `battery/temperature` | The temperature of the robot's battery (degrees Celsius) | [std_msgs/Int16][int16]\n `battery/voltage` | Voltage of the robot's battery (V) | [std_msgs/Float32][float32]\n `bumper` | Bumper state message (including light sensors on bumpers) | [ca_msgs/Bumper][bumper_msg]\n `clean_button` | 'clean' button is pressed ('play' button for Create 1) | [std_msgs/Empty][empty]\n `day_button` | 'day' button is pressed | [std_msgs/Empty][empty]\n `hour_button` | 'hour' button is pressed | [std_msgs/Empty][empty]\n `minute_button` | 'minute' button is pressed | [std_msgs/Empty][empty]\n `dock_button` | 'dock' button is pressed ('advance' button for Create 1) | [std_msgs/Empty][empty]\n `spot_button` | 'spot' button is pressed | [std_msgs/Empty][empty]\n `ir_omni` | The IR character currently being read by the omnidirectional receiver. Value 0 means no character is being received | [std_msgs/UInt16][uint16]\n `joint_states` | The states (position, velocity) of the drive wheel joints | [sensor_msgs/JointState][jointstate_msg]\n `mode` | The current mode of the robot (See [OI Spec][oi_spec] for details)| [ca_msgs/Mode][mode_msg]\n `odom` | Robot odometry according to wheel encoders | [nav_msgs/Odometry][odometry]\n `wheeldrop` | At least one of the drive wheels has dropped | [std_msgs/Empty][empty]\n `/tf` | The transform from the `odom` frame to `base_footprint`. Only if the parameter `publish_tf` is `true` | [tf2_msgs/TFMessage](http://docs.ros.org/jade/api/tf2_msgs/html/msg/TFMessage.html)\n\n\n### Subscribers\n\nTopic | Description | Type\n------------|---------------|------\n`cmd_vel` | Drives the robot's wheels according to a forward and angular velocity | [geometry_msgs/Twist][twist]\n`debris_led` | Enable / disable the blue 'debris' LED | [std_msgs/Bool][bool]\n`spot_led` | Enable / disable the 'spot' LED | [std_msgs/Bool][bool]\n`dock_led` | Enable / disable the 'dock' LED | [std_msgs/Bool][bool]\n`check_led` | Enable / disable the 'check robot` LED | [std_msgs/Bool][bool]\n`power_led` | Set the 'power' LED color and intensity. Accepts 1 or 2 bytes, the first represents the color between green (0) and red (255) and the second (optional) represents the intensity with brightest setting as default (255) | [std_msgs/UInt8MultiArray][uint8multiarray]\n`set_ascii` | Sets the 4 digit LEDs. Accepts 1 to 4 bytes, each representing an ASCII character to be displayed from left to right | [std_msgs/UInt8MultiArray][uint8multiarray]\n`dock` | Activates the demo docking behaviour. Robot enters _Passive_ mode meaning the user loses control (See [OI Spec][oi_spec]) | [std_msgs/Empty][empty]\n`undock` | Switches robot to _Full_ mode giving control back to the user | [std_msgs/Empty][empty]\n`define_song` | Define a song with up to 16 notes. Each note is described by a MIDI note number and a float32 duration in seconds. The longest duration is 255/64 seconds. You can define up to 4 songs (See [OI Spec][oi_spec]) | [ca_msgs/DefineSong][definesong_msg]\n`play_song` | Play a predefined song | [ca_msgs/PlaySong][playsong_msg]\n\n## Commanding your Create\n\nYou can move the robot around by sending [geometry_msgs/Twist][twist] messages to the topic `cmd_vel`:\n\n```\nlinear.x (+) Move forward (m/s)\n (-) Move backward (m/s)\nangular.z (+) Rotate counter-clockwise (rad/s)\n (-) Rotate clockwise (rad/s)\n```\n#### Velocity limits\n\n` -0.5 <= linear.x <= 0.5` and `-4.25 <= angular.z <= 4.25`\n\n### Teleoperation\n\n`ca_tools` comes with a launch file for teleoperating Create with a joystick.\n\n``` bash\n$ roslaunch ca_tools joy_teleop.launch [joy_config:=xbox360]\n```\n\nThere exists configuration files for the [Xbox 360 wired controller](https://www.amazon.ca/Microsoft-Xbox-360-Wired-Controller/dp/B003ZSN600) and the [Logitech F710 controller](http://gaming.logitech.com/en-ca/product/f710-wireless-gamepad). You can adapt these files for your preferred joystick configuration.\n\n## Contributions\n\nContributing to the development and maintenance of _create\\_autonomy_ is encouraged. Feel free to open issues or create pull requests on [GitHub](https://github.com/AutonomyLab/create_autonomy).\n\n### Contributors\n\n* [Michael Browne](http://brownem.engineer/)\n - Confirms driver works with Roomba 700 and 800 series.\n* [Clyde McQueen](https://github.com/clydemcqueen)\n - Added support for sound ([#37](https://github.com/AutonomyLab/create_autonomy/pull/37)).\n* [Ben Wolsieffer](https://github.com/lopsided98) \n - Added JointState publisher for wheels ([#26](https://github.com/AutonomyLab/create_autonomy/pull/26)).\n - Added Create 1 description ([#27](https://github.com/AutonomyLab/create_autonomy/pull/27)).\n\n[libcreate]: https://github.com/AutonomyLab/libcreate\n[oi_spec]: https://www.adafruit.com/datasheets/create_2_Open_Interface_Spec.pdf\n[odometry]: http://docs.ros.org/api/nav_msgs/html/msg/Odometry.html\n[empty]: http://docs.ros.org/api/std_msgs/html/msg/Empty.html\n[uint16]: http://docs.ros.org/api/std_msgs/html/msg/UInt16.html\n[int16]: http://docs.ros.org/api/std_msgs/html/msg/Int16.html\n[twist]: http://docs.ros.org/api/geometry_msgs/html/msg/Twist.html\n[bool]: http://docs.ros.org/api/std_msgs/html/msg/Bool.html\n[uint8multiarray]: http://docs.ros.org/api/std_msgs/html/msg/UInt8MultiArray.html\n[float32]: http://docs.ros.org/api/std_msgs/html/msg/Float32.html\n[ca_msgs]: http://github.com/AutonomyLab/create_autonomy/tree/indigo-devel\n[bumper_msg]: https://github.com/AutonomyLab/create_autonomy/blob/indigo-devel/ca_msgs/msg/Bumper.msg\n[mode_msg]: https://github.com/AutonomyLab/create_autonomy/blob/indigo-devel/ca_msgs/msg/Mode.msg\n[chargingstate_msg]: https://github.com/AutonomyLab/create_autonomy/blob/indigo-devel/ca_msgs/msg/ChargingState.msg\n[jointstate_msg]: http://docs.ros.org/api/sensor_msgs/html/msg/JointState.html\n[definesong_msg]: https://github.com/AutonomyLab/create_autonomy/blob/indigo-devel/ca_msgs/msg/DefineSong.msg\n[playsong_msg]: https://github.com/AutonomyLab/create_autonomy/blob/indigo-devel/ca_msgs/msg/PlaySong.msg\n\n"} +{"text": " 'January',\n 'Feb' => 'February',\n 'Mar' => 'March',\n 'Apr' => 'April',\n 'May' => 'May',\n 'Jun' => 'June',\n 'Jul' => 'July',\n 'Aug' => 'August',\n 'Sep' => 'September',\n 'Oct' => 'October',\n 'Nov' => 'November',\n 'Dec' => 'December',\n );\n\n /*\n * Names of the months of the year, indexed by shortname\n * Planned usage for locale settings\n *\n * @public\n * @var string[]\n */\n public static $numberSuffixes = array(\n 'st',\n 'nd',\n 'rd',\n 'th',\n );\n\n /*\n * Base calendar year to use for calculations\n *\n * @private\n * @var int\n */\n protected static $excelBaseDate = self::CALENDAR_WINDOWS_1900;\n\n /**\n * Set the Excel calendar (Windows 1900 or Mac 1904)\n *\n * @param integer $baseDate Excel base date (1900 or 1904)\n * @return boolean Success or failure\n */\n public static function setExcelCalendar($baseDate)\n {\n if (($baseDate == self::CALENDAR_WINDOWS_1900) ||\n ($baseDate == self::CALENDAR_MAC_1904)) {\n self::$excelBaseDate = $baseDate;\n return true;\n }\n return false;\n }\n\n\n /**\n * Return the Excel calendar (Windows 1900 or Mac 1904)\n *\n * @return integer Excel base date (1900 or 1904)\n */\n public static function getExcelCalendar()\n {\n return self::$excelBaseDate;\n }\n\n\n /**\n * Convert a date from Excel to PHP\n *\n * @param integer $dateValue Excel date/time value\n * @param boolean $adjustToTimezone Flag indicating whether $dateValue should be treated as\n * a UST timestamp, or adjusted to UST\n * @param string $timezone The timezone for finding the adjustment from UST\n * @return integer PHP serialized date/time\n */\n public static function ExcelToPHP($dateValue = 0, $adjustToTimezone = false, $timezone = null)\n {\n if (self::$excelBaseDate == self::CALENDAR_WINDOWS_1900) {\n $myexcelBaseDate = 25569;\n // Adjust for the spurious 29-Feb-1900 (Day 60)\n if ($dateValue < 60) {\n --$myexcelBaseDate;\n }\n } else {\n $myexcelBaseDate = 24107;\n }\n\n // Perform conversion\n if ($dateValue >= 1) {\n $utcDays = $dateValue - $myexcelBaseDate;\n $returnValue = round($utcDays * 86400);\n if (($returnValue <= PHP_INT_MAX) && ($returnValue >= -PHP_INT_MAX)) {\n $returnValue = (integer) $returnValue;\n }\n } else {\n $hours = round($dateValue * 24);\n $mins = round($dateValue * 1440) - round($hours * 60);\n $secs = round($dateValue * 86400) - round($hours * 3600) - round($mins * 60);\n $returnValue = (integer) gmmktime($hours, $mins, $secs);\n }\n\n $timezoneAdjustment = ($adjustToTimezone) ?\n PHPExcel_Shared_TimeZone::getTimezoneAdjustment($timezone, $returnValue) :\n 0;\n\n return $returnValue + $timezoneAdjustment;\n }\n\n\n /**\n * Convert a date from Excel to a PHP Date/Time object\n *\n * @param integer $dateValue Excel date/time value\n * @return DateTime PHP date/time object\n */\n public static function ExcelToPHPObject($dateValue = 0)\n {\n $dateTime = self::ExcelToPHP($dateValue);\n $days = floor($dateTime / 86400);\n $time = round((($dateTime / 86400) - $days) * 86400);\n $hours = round($time / 3600);\n $minutes = round($time / 60) - ($hours * 60);\n $seconds = round($time) - ($hours * 3600) - ($minutes * 60);\n\n $dateObj = date_create('1-Jan-1970+'.$days.' days');\n $dateObj->setTime($hours, $minutes, $seconds);\n\n return $dateObj;\n }\n\n\n /**\n * Convert a date from PHP to Excel\n *\n * @param mixed $dateValue PHP serialized date/time or date object\n * @param boolean $adjustToTimezone Flag indicating whether $dateValue should be treated as\n * a UST timestamp, or adjusted to UST\n * @param string $timezone The timezone for finding the adjustment from UST\n * @return mixed Excel date/time value\n * or boolean FALSE on failure\n */\n public static function PHPToExcel($dateValue = 0, $adjustToTimezone = false, $timezone = null)\n {\n $saveTimeZone = date_default_timezone_get();\n date_default_timezone_set('UTC');\n\n $timezoneAdjustment = ($adjustToTimezone) ?\n PHPExcel_Shared_TimeZone::getTimezoneAdjustment($timezone ? $timezone : $saveTimeZone, $dateValue) :\n 0;\n\n $retValue = false;\n if ((is_object($dateValue)) && ($dateValue instanceof DateTime)) {\n $dateValue->add(new DateInterval('PT' . $timezoneAdjustment . 'S'));\n $retValue = self::FormattedPHPToExcel($dateValue->format('Y'), $dateValue->format('m'), $dateValue->format('d'), $dateValue->format('H'), $dateValue->format('i'), $dateValue->format('s'));\n } elseif (is_numeric($dateValue)) {\n $dateValue += $timezoneAdjustment;\n $retValue = self::FormattedPHPToExcel(date('Y', $dateValue), date('m', $dateValue), date('d', $dateValue), date('H', $dateValue), date('i', $dateValue), date('s', $dateValue));\n } elseif (is_string($dateValue)) {\n $retValue = self::stringToExcel($dateValue);\n }\n date_default_timezone_set($saveTimeZone);\n\n return $retValue;\n }\n\n\n /**\n * FormattedPHPToExcel\n *\n * @param integer $year\n * @param integer $month\n * @param integer $day\n * @param integer $hours\n * @param integer $minutes\n * @param integer $seconds\n * @return integer Excel date/time value\n */\n public static function FormattedPHPToExcel($year, $month, $day, $hours = 0, $minutes = 0, $seconds = 0)\n {\n if (self::$excelBaseDate == self::CALENDAR_WINDOWS_1900) {\n //\n // Fudge factor for the erroneous fact that the year 1900 is treated as a Leap Year in MS Excel\n // This affects every date following 28th February 1900\n //\n $excel1900isLeapYear = true;\n if (($year == 1900) && ($month <= 2)) {\n $excel1900isLeapYear = false;\n }\n $myexcelBaseDate = 2415020;\n } else {\n $myexcelBaseDate = 2416481;\n $excel1900isLeapYear = false;\n }\n\n // Julian base date Adjustment\n if ($month > 2) {\n $month -= 3;\n } else {\n $month += 9;\n --$year;\n }\n\n // Calculate the Julian Date, then subtract the Excel base date (JD 2415020 = 31-Dec-1899 Giving Excel Date of 0)\n $century = substr($year, 0, 2);\n $decade = substr($year, 2, 2);\n $excelDate = floor((146097 * $century) / 4) + floor((1461 * $decade) / 4) + floor((153 * $month + 2) / 5) + $day + 1721119 - $myexcelBaseDate + $excel1900isLeapYear;\n\n $excelTime = (($hours * 3600) + ($minutes * 60) + $seconds) / 86400;\n\n return (float) $excelDate + $excelTime;\n }\n\n\n /**\n * Is a given cell a date/time?\n *\n * @param PHPExcel_Cell $pCell\n * @return boolean\n */\n public static function isDateTime(PHPExcel_Cell $pCell)\n {\n return self::isDateTimeFormat(\n $pCell->getWorksheet()->getStyle(\n $pCell->getCoordinate()\n )->getNumberFormat()\n );\n }\n\n\n /**\n * Is a given number format a date/time?\n *\n * @param PHPExcel_Style_NumberFormat $pFormat\n * @return boolean\n */\n public static function isDateTimeFormat(PHPExcel_Style_NumberFormat $pFormat)\n {\n return self::isDateTimeFormatCode($pFormat->getFormatCode());\n }\n\n\n private static $possibleDateFormatCharacters = 'eymdHs';\n\n /**\n * Is a given number format code a date/time?\n *\n * @param string $pFormatCode\n * @return boolean\n */\n public static function isDateTimeFormatCode($pFormatCode = '')\n {\n if (strtolower($pFormatCode) === strtolower(PHPExcel_Style_NumberFormat::FORMAT_GENERAL)) {\n // \"General\" contains an epoch letter 'e', so we trap for it explicitly here (case-insensitive check)\n return false;\n }\n if (preg_match('/[0#]E[+-]0/i', $pFormatCode)) {\n // Scientific format\n return false;\n }\n\n // Switch on formatcode\n switch ($pFormatCode) {\n // Explicitly defined date formats\n case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD:\n case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2:\n case PHPExcel_Style_NumberFormat::FORMAT_DATE_DDMMYYYY:\n case PHPExcel_Style_NumberFormat::FORMAT_DATE_DMYSLASH:\n case PHPExcel_Style_NumberFormat::FORMAT_DATE_DMYMINUS:\n case PHPExcel_Style_NumberFormat::FORMAT_DATE_DMMINUS:\n case PHPExcel_Style_NumberFormat::FORMAT_DATE_MYMINUS:\n case PHPExcel_Style_NumberFormat::FORMAT_DATE_DATETIME:\n case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME1:\n case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME2:\n case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3:\n case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4:\n case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME5:\n case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME6:\n case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME7:\n case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME8:\n case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDDSLASH:\n case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX14:\n case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15:\n case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX16:\n case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX17:\n case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX22:\n return true;\n }\n\n // Typically number, currency or accounting (or occasionally fraction) formats\n if ((substr($pFormatCode, 0, 1) == '_') || (substr($pFormatCode, 0, 2) == '0 ')) {\n return false;\n }\n // Try checking for any of the date formatting characters that don't appear within square braces\n if (preg_match('/(^|\\])[^\\[]*['.self::$possibleDateFormatCharacters.']/i', $pFormatCode)) {\n // We might also have a format mask containing quoted strings...\n // we don't want to test for any of our characters within the quoted blocks\n if (strpos($pFormatCode, '\"') !== false) {\n $segMatcher = false;\n foreach (explode('\"', $pFormatCode) as $subVal) {\n // Only test in alternate array entries (the non-quoted blocks)\n if (($segMatcher = !$segMatcher) &&\n (preg_match('/(^|\\])[^\\[]*['.self::$possibleDateFormatCharacters.']/i', $subVal))) {\n return true;\n }\n }\n return false;\n }\n return true;\n }\n\n // No date...\n return false;\n }\n\n\n /**\n * Convert a date/time string to Excel time\n *\n * @param string $dateValue Examples: '2009-12-31', '2009-12-31 15:59', '2009-12-31 15:59:10'\n * @return float|FALSE Excel date/time serial value\n */\n public static function stringToExcel($dateValue = '')\n {\n if (strlen($dateValue) < 2) {\n return false;\n }\n if (!preg_match('/^(\\d{1,4}[ \\.\\/\\-][A-Z]{3,9}([ \\.\\/\\-]\\d{1,4})?|[A-Z]{3,9}[ \\.\\/\\-]\\d{1,4}([ \\.\\/\\-]\\d{1,4})?|\\d{1,4}[ \\.\\/\\-]\\d{1,4}([ \\.\\/\\-]\\d{1,4})?)( \\d{1,2}:\\d{1,2}(:\\d{1,2})?)?$/iu', $dateValue)) {\n return false;\n }\n\n $dateValueNew = PHPExcel_Calculation_DateTime::DATEVALUE($dateValue);\n\n if ($dateValueNew === PHPExcel_Calculation_Functions::VALUE()) {\n return false;\n }\n\n if (strpos($dateValue, ':') !== false) {\n $timeValue = PHPExcel_Calculation_DateTime::TIMEVALUE($dateValue);\n if ($timeValue === PHPExcel_Calculation_Functions::VALUE()) {\n return false;\n }\n $dateValueNew += $timeValue;\n }\n return $dateValueNew;\n }\n\n /**\n * Converts a month name (either a long or a short name) to a month number\n *\n * @param string $month Month name or abbreviation\n * @return integer|string Month number (1 - 12), or the original string argument if it isn't a valid month name\n */\n public static function monthStringToNumber($month)\n {\n $monthIndex = 1;\n foreach (self::$monthNames as $shortMonthName => $longMonthName) {\n if (($month === $longMonthName) || ($month === $shortMonthName)) {\n return $monthIndex;\n }\n ++$monthIndex;\n }\n return $month;\n }\n\n /**\n * Strips an ordinal froma numeric value\n *\n * @param string $day Day number with an ordinal\n * @return integer|string The integer value with any ordinal stripped, or the original string argument if it isn't a valid numeric\n */\n public static function dayStringToNumber($day)\n {\n $strippedDayValue = (str_replace(self::$numberSuffixes, '', $day));\n if (is_numeric($strippedDayValue)) {\n return (integer) $strippedDayValue;\n }\n return $day;\n }\n}\n"} +{"text": "\n##CATextLayer\n\n用户界面是无法从一个单独的图片里面构建的。一个设计良好的图标能够很好地表现一个按钮或控件的意图,不过你迟早都要需要一个不错的老式风格的文本标签。\n\n如果你想在一个图层里面显示文字,完全可以借助图层代理直接将字符串使用Core Graphics写入图层的内容(这就是UILabel的精髓)。如果越过寄宿于图层的视图,直接在图层上操作,那其实相当繁琐。你要为每一个显示文字的图层创建一个能像图层代理一样工作的类,还要逻辑上判断哪个图层需要显示哪个字符串,更别提还要记录不同的字体,颜色等一系列乱七八糟的东西。\n\n万幸的是这些都是不必要的,Core Animation提供了一个`CALayer`的子类`CATextLayer`,它以图层的形式包含了`UILabel`几乎所有的绘制特性,并且额外提供了一些新的特性。\n\n同样,`CATextLayer`也要比`UILabel`渲染得快得多。很少有人知道在iOS 6及之前的版本,`UILabel`其实是通过WebKit来实现绘制的,这样就造成了当有很多文字的时候就会有极大的性能压力。而`CATextLayer`使用了Core text,并且渲染得非常快。\n\n让我们来尝试用`CATextLayer`来显示一些文字。清单6.2的代码实现了这一功能,结果如图6.2所示。\n\n清单6.2 用`CATextLayer`来实现一个`UILabel`\n\n```objective-c\n@interface ViewController ()\n\n@property (nonatomic, weak) IBOutlet UIView *labelView;\n\n@end\n\n@implementation ViewController\n- (void)viewDidLoad\n{\n [super viewDidLoad];\n\n //create a text layer\n CATextLayer *textLayer = [CATextLayer layer];\n textLayer.frame = self.labelView.bounds;\n [self.labelView.layer addSublayer:textLayer];\n\n //set text attributes\n textLayer.foregroundColor = [UIColor blackColor].CGColor;\n textLayer.alignmentMode = kCAAlignmentJustified;\n textLayer.wrapped = YES;\n\n //choose a font\n UIFont *font = [UIFont systemFontOfSize:15];\n\n //set layer font\n CFStringRef fontName = (__bridge CFStringRef)font.fontName;\n CGFontRef fontRef = CGFontCreateWithFontName(fontName);\n textLayer.font = fontRef;\n textLayer.fontSize = font.pointSize;\n CGFontRelease(fontRef);\n\n //choose some text\n NSString *text = @\"Lorem ipsum dolor sit amet, consectetur adipiscing \\ elit. Quisque massa arcu, eleifend vel varius in, facilisis pulvinar \\ leo. Nunc quis nunc at mauris pharetra condimentum ut ac neque. Nunc elementum, libero ut porttitor dictum, diam odio congue lacus, vel \\ fringilla sapien diam at purus. Etiam suscipit pretium nunc sit amet \\ lobortis\";\n\n //set layer text\n textLayer.string = text;\n}\n@end\n```\n\n![图6.2](./6.2.png)\n\n图6.2 用`CATextLayer`来显示一个纯文本标签\n\n如果你仔细看这个文本,你会发现一个奇怪的地方:这些文本有一些像素化了。这是因为并没有以Retina的方式渲染,第二章提到了这个`contentScale`属性,用来决定图层内容应该以怎样的分辨率来渲染。`contentsScale`并不关心屏幕的拉伸因素而总是默认为1.0。如果我们想以Retina的质量来显示文字,我们就得手动地设置`CATextLayer`的`contentsScale`属性,如下:\n\n```objective-c\ntextLayer.contentsScale = [UIScreen mainScreen].scale;\n```\n\n这样就解决了这个问题(如图6.3)\n\n![图6.3](./6.3.png)\n\n图6.3 设置`contentsScale`来匹配屏幕\n\n`CATextLayer`的`font`属性不是一个`UIFont`类型,而是一个`CFTypeRef`类型。这样可以根据你的具体需要来决定字体属性应该是用`CGFontRef`类型还是`CTFontRef`类型(Core Text字体)。同时字体大小也是用`fontSize`属性单独设置的,因为`CTFontRef`和`CGFontRef`并不像UIFont一样包含点大小。这个例子会告诉你如何将`UIFont`转换成`CGFontRef`。\n\n另外,`CATextLayer`的`string`属性并不是你想象的`NSString`类型,而是`id`类型。这样你既可以用`NSString`也可以用`NSAttributedString`来指定文本了(注意,`NSAttributedString`并不是`NSString`的子类)。属性化字符串是iOS用来渲染字体风格的机制,它以特定的方式来决定指定范围内的字符串的原始信息,比如字体,颜色,字重,斜体等。\n\n###富文本\n\niOS 6中,Apple给`UILabel`和其他UIKit文本视图添加了直接的属性化字符串的支持,应该说这是一个很方便的特性。不过事实上从iOS3.2开始`CATextLayer`就已经支持属性化字符串了。这样的话,如果你想要支持更低版本的iOS系统,`CATextLayer`无疑是你向界面中增加富文本的好办法,而且也不用去跟复杂的Core Text打交道,也省了用`UIWebView`的麻烦。\n\n让我们编辑一下示例使用到`NSAttributedString`(见清单6.3).iOS 6及以上我们可以用新的`NSTextAttributeName`实例来设置我们的字符串属性,但是练习的目的是为了演示在iOS 5及以下,所以我们用了Core Text,也就是说你需要把Core Text framework添加到你的项目中。否则,编译器是无法识别属性常量的。\n\n图6.4是代码运行结果(注意那个红色的下划线文本)\n\n清单6.3 用NSAttributedString实现一个富文本标签。\n\n```objective-c\n#import \"DrawingView.h\"\n#import \n#import \n\n@interface ViewController ()\n\n@property (nonatomic, weak) IBOutlet UIView *labelView;\n\n@end\n\n@implementation ViewController\n\n- (void)viewDidLoad\n{\n [super viewDidLoad];\n\n //create a text layer\n CATextLayer *textLayer = [CATextLayer layer];\n textLayer.frame = self.labelView.bounds;\n textLayer.contentsScale = [UIScreen mainScreen].scale;\n [self.labelView.layer addSublayer:textLayer];\n\n //set text attributes\n textLayer.alignmentMode = kCAAlignmentJustified;\n textLayer.wrapped = YES;\n\n //choose a font\n UIFont *font = [UIFont systemFontOfSize:15];\n\n //choose some text\n NSString *text = @\"Lorem ipsum dolor sit amet, consectetur adipiscing \\ elit. Quisque massa arcu, eleifend vel varius in, facilisis pulvinar \\ leo. Nunc quis nunc at mauris pharetra condimentum ut ac neque. Nunc \\ elementum, libero ut porttitor dictum, diam odio congue lacus, vel \\ fringilla sapien diam at purus. Etiam suscipit pretium nunc sit amet \\ lobortis\";\n \n //create attributed string\n NSMutableAttributedString *string = nil;\n string = [[NSMutableAttributedString alloc] initWithString:text];\n\n //convert UIFont to a CTFont\n CFStringRef fontName = (__bridge CFStringRef)font.fontName;\n CGFloat fontSize = font.pointSize;\n CTFontRef fontRef = CTFontCreateWithName(fontName, fontSize, NULL);\n\n //set text attributes\n NSDictionary *attribs = @{\n (__bridge id)kCTForegroundColorAttributeName:(__bridge id)[UIColor blackColor].CGColor,\n (__bridge id)kCTFontAttributeName: (__bridge id)fontRef\n };\n\n [string setAttributes:attribs range:NSMakeRange(0, [text length])];\n attribs = @{\n (__bridge id)kCTForegroundColorAttributeName: (__bridge id)[UIColor redColor].CGColor,\n (__bridge id)kCTUnderlineStyleAttributeName: @(kCTUnderlineStyleSingle),\n (__bridge id)kCTFontAttributeName: (__bridge id)fontRef\n };\n [string setAttributes:attribs range:NSMakeRange(6, 5)];\n\n //release the CTFont we created earlier\n CFRelease(fontRef);\n\n //set layer text\n textLayer.string = string;\n}\n@end\n```\n\n![图6.4](./6.4.png)\n\n图6.4 用CATextLayer实现一个富文本标签。\n\n###行距和字距\n\n有必要提一下的是,由于绘制的实现机制不同(Core Text和WebKit),用`CATextLayer`渲染和用`UILabel`渲染出的文本行距和字距也不是不���相同的。\n\n二者的差异程度(由使用的字体和字符决定)总的来说挺小,但是如果你想正确的显示普通便签和`CATextLayer`就一定要记住这一点。\n\n### `UILabel`的替代品\n\n我们已经证实了`CATextLayer`比`UILabel`有着更好的性能表现,同时还有额外的布局选项并且在iOS 5上支持富文本。但是与一般的标签比较而言会更加繁琐一些。如果我们真的在需求一个`UILabel`的可用替代品,最好是能够在Interface Builder上创建我们的标签,而且尽可能地像一般的视图一样正常工作。\n\n我们应该继承`UILabel`,然后添加一个子图层`CATextLayer`并重写显示文本的方法。但是仍然会有由`UILabel`的`-drawRect:`方法创建的空寄宿图。而且由于`CALayer`不支持自动缩放和自动布局,子视图并不是主动跟踪视图边界的大小,所以每次视图大小被更改,我们不得不手动更新子图层的边界。\n\n我们真正想要的是一个用`CATextLayer`作为宿主图层的`UILabel`子类,这样就可以随着视图自动调整大小而且也没有冗余的寄宿图啦。\n\n就像我们在第一章『图层树』讨论的一样,每一个`UIView`都是寄宿在一个`CALayer`的示例上。这个图层是由视图自动创建和管理的,那我们可以用别的图层类型替代它么?一旦被创建,我们就无法代替这个图层了。但是如果我们继承了`UIView`,那我们就可以重写`+layerClass`方法使得在创建的时候能返回一个不同的图层子类。`UIView`会在初始化的时候调用`+layerClass`方法,然后用它的返回类型来创建宿主图层。\n\n清单6.4 演示了一个`UILabel`子类`LayerLabel`用`CATextLayer`绘制它的问题,而不是调用一般的`UILabel`使用的较慢的`-drawRect:`方法。`LayerLabel`示例既可以用代码实现,也可以在Interface Builder实现,只要把普通的标签拖入视图之中,然后设置它的类是LayerLabel就可以了。\n\n清单6.4 使用`CATextLayer`的`UILabel`子类:`LayerLabel`\n\n```objective-c\n#import \"LayerLabel.h\"\n#import \n\n@implementation LayerLabel\n+ (Class)layerClass\n{\n //this makes our label create a CATextLayer //instead of a regular CALayer for its backing layer\n return [CATextLayer class];\n}\n\n- (CATextLayer *)textLayer\n{\n return (CATextLayer *)self.layer;\n}\n\n- (void)setUp\n{\n //set defaults from UILabel settings\n self.text = self.text;\n self.textColor = self.textColor;\n self.font = self.font;\n\n //we should really derive these from the UILabel settings too\n //but that's complicated, so for now we'll just hard-code them\n [self textLayer].alignmentMode = kCAAlignmentJustified;\n \n [self textLayer].wrapped = YES;\n [self.layer display];\n}\n\n- (id)initWithFrame:(CGRect)frame\n{\n //called when creating label programmatically\n if (self = [super initWithFrame:frame]) {\n [self setUp];\n }\n return self;\n}\n\n- (void)awakeFromNib\n{\n //called when creating label using Interface Builder\n [self setUp];\n}\n\n- (void)setText:(NSString *)text\n{\n super.text = text;\n //set layer text\n [self textLayer].string = text;\n}\n\n- (void)setTextColor:(UIColor *)textColor\n{\n super.textColor = textColor;\n //set layer text color\n [self textLayer].foregroundColor = textColor.CGColor;\n}\n\n- (void)setFont:(UIFont *)font\n{\n super.font = font;\n //set layer font\n CFStringRef fontName = (__bridge CFStringRef)font.fontName;\n CGFontRef fontRef = CGFontCreateWithFontName(fontName);\n [self textLayer].font = fontRef;\n [self textLayer].fontSize = font.pointSize;\n \n CGFontRelease(fontRef);\n}\n@end\n```\n\n如果你运行代码,你会发现文本并没有像素化,而我们也没有设置`contentsScale`属性。把`CATextLayer`作为宿主图层的另一好处就是视图自动设置了`contentsScale`属性。\n\n在这个简单的例子中,我们只是实现了`UILabel`的一部分风格和布局属性,不过稍微再改进一下我们就可以创建一个支持`UILabel`所有功能甚至更多功能的`LayerLabel`类(你可以在一些线上的开源项目中找到)。\n\n如果你打算支持iOS 6及以上,基于`CATextLayer`的标签可能就有有些局限性。但是总得来说,如果想在app里面充分利用`CALayer`子类,用`+layerClass`来创建基于不同图层的视图是一个简单可复用的方法。\n"} +{"text": ".class public interface abstract Lcom/google/android/gms/common/api/internal/av;\n.super Ljava/lang/Object;\n\n\n# virtual methods\n.method public abstract a(Lcom/google/android/gms/common/api/internal/cb;)Lcom/google/android/gms/common/api/internal/cb;\n .param p1 # Lcom/google/android/gms/common/api/internal/cb;\n .annotation build Landroid/support/annotation/NonNull;\n .end annotation\n .end param\n .annotation system Ldalvik/annotation/Signature;\n value = {\n \";>(TT;)TT;\"\n }\n .end annotation\n.end method\n\n.method public abstract a()V\n.end method\n\n.method public abstract a(Ljava/lang/String;Ljava/io/FileDescriptor;Ljava/io/PrintWriter;[Ljava/lang/String;)V\n.end method\n\n.method public abstract b()V\n.end method\n\n.method public abstract c()Z\n.end method\n\n.method public abstract d()Z\n.end method\n\n.method public abstract e()V\n.end method\n"} +{"text": "/*\n * Ricoh RS5C313 RTC device/driver\n * Copyright (C) 2007 Nobuhiro Iwamatsu\n *\n * 2005-09-19 modifed by kogiidena\n *\n * Based on the old drivers/char/rs5c313_rtc.c by:\n * Copyright (C) 2000 Philipp Rumpf \n * Copyright (C) 1999 Tetsuya Okada & Niibe Yutaka\n *\n * Based on code written by Paul Gortmaker.\n * Copyright (C) 1996 Paul Gortmaker\n *\n * This file is subject to the terms and conditions of the GNU General Public\n * License. See the file \"COPYING\" in the main directory of this archive\n * for more details.\n *\n * Based on other minimal char device drivers, like Alan's\n * watchdog, Ted's random, etc. etc.\n *\n *\t1.07\tPaul Gortmaker.\n *\t1.08\tMiquel van Smoorenburg: disallow certain things on the\n *\t\tDEC Alpha as the CMOS clock is also used for other things.\n *\t1.09\tNikita Schmidt: epoch support and some Alpha cleanup.\n *\t1.09a\tPete Zaitcev: Sun SPARC\n *\t1.09b\tJeff Garzik: Modularize, init cleanup\n *\t1.09c\tJeff Garzik: SMP cleanup\n *\t1.10 Paul Barton-Davis: add support for async I/O\n *\t1.10a\tAndrea Arcangeli: Alpha updates\n *\t1.10b\tAndrew Morton: SMP lock fix\n *\t1.10c\tCesar Barros: SMP locking fixes and cleanup\n *\t1.10d\tPaul Gortmaker: delete paranoia check in rtc_exit\n *\t1.10e\tMaciej W. Rozycki: Handle DECstation's year weirdness.\n * 1.11 Takashi Iwai: Kernel access functions\n *\t\t\t rtc_register/rtc_unregister/rtc_control\n * 1.11a Daniele Bellucci: Audit create_proc_read_entry in rtc_init\n *\t1.12\tVenkatesh Pallipadi: Hooks for emulating rtc on HPET base-timer\n *\t\tCONFIG_HPET_EMULATE_RTC\n *\t1.13\tNobuhiro Iwamatsu: Updata driver.\n */\n\n#define pr_fmt(fmt) KBUILD_MODNAME \": \" fmt\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define DRV_NAME\t\"rs5c313\"\n\n#ifdef CONFIG_SH_LANDISK\n/*****************************************************/\n/* LANDISK dependence part of RS5C313 */\n/*****************************************************/\n\n#define SCSMR1\t\t0xFFE00000\n#define SCSCR1\t\t0xFFE00008\n#define SCSMR1_CA\t0x80\n#define SCSCR1_CKE\t0x03\n#define SCSPTR1\t\t0xFFE0001C\n#define SCSPTR1_EIO\t0x80\n#define SCSPTR1_SPB1IO\t0x08\n#define SCSPTR1_SPB1DT\t0x04\n#define SCSPTR1_SPB0IO\t0x02\n#define SCSPTR1_SPB0DT\t0x01\n\n#define SDA_OEN\t\tSCSPTR1_SPB1IO\n#define SDA\t\tSCSPTR1_SPB1DT\n#define SCL_OEN\t\tSCSPTR1_SPB0IO\n#define SCL\t\tSCSPTR1_SPB0DT\n\n/* RICOH RS5C313 CE port */\n#define RS5C313_CE\t0xB0000003\n\n/* RICOH RS5C313 CE port bit */\n#define RS5C313_CE_RTCCE\t0x02\n\n/* SCSPTR1 data */\nunsigned char scsptr1_data;\n\n#define RS5C313_CEENABLE __raw_writeb(RS5C313_CE_RTCCE, RS5C313_CE);\n#define RS5C313_CEDISABLE __raw_writeb(0x00, RS5C313_CE)\n#define RS5C313_MISCOP __raw_writeb(0x02, 0xB0000008)\n\nstatic void rs5c313_init_port(void)\n{\n\t/* Set SCK as I/O port and Initialize SCSPTR1 data & I/O port. */\n\t__raw_writeb(__raw_readb(SCSMR1) & ~SCSMR1_CA, SCSMR1);\n\t__raw_writeb(__raw_readb(SCSCR1) & ~SCSCR1_CKE, SCSCR1);\n\n\t/* And Initialize SCL for RS5C313 clock */\n\tscsptr1_data = __raw_readb(SCSPTR1) | SCL;\t/* SCL:H */\n\t__raw_writeb(scsptr1_data, SCSPTR1);\n\tscsptr1_data = __raw_readb(SCSPTR1) | SCL_OEN;\t/* SCL output enable */\n\t__raw_writeb(scsptr1_data, SCSPTR1);\n\tRS5C313_CEDISABLE;\t/* CE:L */\n}\n\nstatic void rs5c313_write_data(unsigned char data)\n{\n\tint i;\n\n\tfor (i = 0; i < 8; i++) {\n\t\t/* SDA:Write Data */\n\t\tscsptr1_data = (scsptr1_data & ~SDA) |\n\t\t\t\t((((0x80 >> i) & data) >> (7 - i)) << 2);\n\t\t__raw_writeb(scsptr1_data, SCSPTR1);\n\t\tif (i == 0) {\n\t\t\tscsptr1_data |= SDA_OEN;\t/* SDA:output enable */\n\t\t\t__raw_writeb(scsptr1_data, SCSPTR1);\n\t\t}\n\t\tndelay(700);\n\t\tscsptr1_data &= ~SCL;\t/* SCL:L */\n\t\t__raw_writeb(scsptr1_data, SCSPTR1);\n\t\tndelay(700);\n\t\tscsptr1_data |= SCL;\t/* SCL:H */\n\t\t__raw_writeb(scsptr1_data, SCSPTR1);\n\t}\n\n\tscsptr1_data &= ~SDA_OEN;\t/* SDA:output disable */\n\t__raw_writeb(scsptr1_data, SCSPTR1);\n}\n\nstatic unsigned char rs5c313_read_data(void)\n{\n\tint i;\n\tunsigned char data = 0;\n\n\tfor (i = 0; i < 8; i++) {\n\t\tndelay(700);\n\t\t/* SDA:Read Data */\n\t\tdata |= ((__raw_readb(SCSPTR1) & SDA) >> 2) << (7 - i);\n\t\tscsptr1_data &= ~SCL;\t/* SCL:L */\n\t\t__raw_writeb(scsptr1_data, SCSPTR1);\n\t\tndelay(700);\n\t\tscsptr1_data |= SCL;\t/* SCL:H */\n\t\t__raw_writeb(scsptr1_data, SCSPTR1);\n\t}\n\treturn data & 0x0F;\n}\n\n#endif /* CONFIG_SH_LANDISK */\n\n/*****************************************************/\n/* machine independence part of RS5C313 */\n/*****************************************************/\n\n/* RICOH RS5C313 address */\n#define RS5C313_ADDR_SEC\t0x00\n#define RS5C313_ADDR_SEC10\t0x01\n#define RS5C313_ADDR_MIN\t0x02\n#define RS5C313_ADDR_MIN10\t0x03\n#define RS5C313_ADDR_HOUR\t0x04\n#define RS5C313_ADDR_HOUR10\t0x05\n#define RS5C313_ADDR_WEEK\t0x06\n#define RS5C313_ADDR_INTINTVREG\t0x07\n#define RS5C313_ADDR_DAY\t0x08\n#define RS5C313_ADDR_DAY10\t0x09\n#define RS5C313_ADDR_MON\t0x0A\n#define RS5C313_ADDR_MON10\t0x0B\n#define RS5C313_ADDR_YEAR\t0x0C\n#define RS5C313_ADDR_YEAR10\t0x0D\n#define RS5C313_ADDR_CNTREG\t0x0E\n#define RS5C313_ADDR_TESTREG\t0x0F\n\n/* RICOH RS5C313 control register */\n#define RS5C313_CNTREG_ADJ_BSY\t0x01\n#define RS5C313_CNTREG_WTEN_XSTP\t0x02\n#define RS5C313_CNTREG_12_24\t0x04\n#define RS5C313_CNTREG_CTFG\t0x08\n\n/* RICOH RS5C313 test register */\n#define RS5C313_TESTREG_TEST\t0x01\n\n/* RICOH RS5C313 control bit */\n#define RS5C313_CNTBIT_READ\t0x40\n#define RS5C313_CNTBIT_AD\t0x20\n#define RS5C313_CNTBIT_DT\t0x10\n\nstatic unsigned char rs5c313_read_reg(unsigned char addr)\n{\n\n\trs5c313_write_data(addr | RS5C313_CNTBIT_READ | RS5C313_CNTBIT_AD);\n\treturn rs5c313_read_data();\n}\n\nstatic void rs5c313_write_reg(unsigned char addr, unsigned char data)\n{\n\tdata &= 0x0f;\n\trs5c313_write_data(addr | RS5C313_CNTBIT_AD);\n\trs5c313_write_data(data | RS5C313_CNTBIT_DT);\n\treturn;\n}\n\nstatic inline unsigned char rs5c313_read_cntreg(void)\n{\n\treturn rs5c313_read_reg(RS5C313_ADDR_CNTREG);\n}\n\nstatic inline void rs5c313_write_cntreg(unsigned char data)\n{\n\trs5c313_write_reg(RS5C313_ADDR_CNTREG, data);\n}\n\nstatic inline void rs5c313_write_intintvreg(unsigned char data)\n{\n\trs5c313_write_reg(RS5C313_ADDR_INTINTVREG, data);\n}\n\nstatic int rs5c313_rtc_read_time(struct device *dev, struct rtc_time *tm)\n{\n\tint data;\n\tint cnt;\n\n\tcnt = 0;\n\twhile (1) {\n\t\tRS5C313_CEENABLE;\t/* CE:H */\n\n\t\t/* Initialize control reg. 24 hour */\n\t\trs5c313_write_cntreg(0x04);\n\n\t\tif (!(rs5c313_read_cntreg() & RS5C313_CNTREG_ADJ_BSY))\n\t\t\tbreak;\n\n\t\tRS5C313_CEDISABLE;\n\t\tndelay(700);\t/* CE:L */\n\n\t\tif (cnt++ > 100) {\n\t\t\tdev_err(dev, \"%s: timeout error\\n\", __func__);\n\t\t\treturn -EIO;\n\t\t}\n\t}\n\n\tdata = rs5c313_read_reg(RS5C313_ADDR_SEC);\n\tdata |= (rs5c313_read_reg(RS5C313_ADDR_SEC10) << 4);\n\ttm->tm_sec = bcd2bin(data);\n\n\tdata = rs5c313_read_reg(RS5C313_ADDR_MIN);\n\tdata |= (rs5c313_read_reg(RS5C313_ADDR_MIN10) << 4);\n\ttm->tm_min = bcd2bin(data);\n\n\tdata = rs5c313_read_reg(RS5C313_ADDR_HOUR);\n\tdata |= (rs5c313_read_reg(RS5C313_ADDR_HOUR10) << 4);\n\ttm->tm_hour = bcd2bin(data);\n\n\tdata = rs5c313_read_reg(RS5C313_ADDR_DAY);\n\tdata |= (rs5c313_read_reg(RS5C313_ADDR_DAY10) << 4);\n\ttm->tm_mday = bcd2bin(data);\n\n\tdata = rs5c313_read_reg(RS5C313_ADDR_MON);\n\tdata |= (rs5c313_read_reg(RS5C313_ADDR_MON10) << 4);\n\ttm->tm_mon = bcd2bin(data) - 1;\n\n\tdata = rs5c313_read_reg(RS5C313_ADDR_YEAR);\n\tdata |= (rs5c313_read_reg(RS5C313_ADDR_YEAR10) << 4);\n\ttm->tm_year = bcd2bin(data);\n\n\tif (tm->tm_year < 70)\n\t\ttm->tm_year += 100;\n\n\tdata = rs5c313_read_reg(RS5C313_ADDR_WEEK);\n\ttm->tm_wday = bcd2bin(data);\n\n\tRS5C313_CEDISABLE;\n\tndelay(700);\t\t/* CE:L */\n\n\treturn 0;\n}\n\nstatic int rs5c313_rtc_set_time(struct device *dev, struct rtc_time *tm)\n{\n\tint data;\n\tint cnt;\n\n\tcnt = 0;\n\t/* busy check. */\n\twhile (1) {\n\t\tRS5C313_CEENABLE;\t/* CE:H */\n\n\t\t/* Initiatlize control reg. 24 hour */\n\t\trs5c313_write_cntreg(0x04);\n\n\t\tif (!(rs5c313_read_cntreg() & RS5C313_CNTREG_ADJ_BSY))\n\t\t\tbreak;\n\t\tRS5C313_MISCOP;\n\t\tRS5C313_CEDISABLE;\n\t\tndelay(700);\t/* CE:L */\n\n\t\tif (cnt++ > 100) {\n\t\t\tdev_err(dev, \"%s: timeout error\\n\", __func__);\n\t\t\treturn -EIO;\n\t\t}\n\t}\n\n\tdata = bin2bcd(tm->tm_sec);\n\trs5c313_write_reg(RS5C313_ADDR_SEC, data);\n\trs5c313_write_reg(RS5C313_ADDR_SEC10, (data >> 4));\n\n\tdata = bin2bcd(tm->tm_min);\n\trs5c313_write_reg(RS5C313_ADDR_MIN, data);\n\trs5c313_write_reg(RS5C313_ADDR_MIN10, (data >> 4));\n\n\tdata = bin2bcd(tm->tm_hour);\n\trs5c313_write_reg(RS5C313_ADDR_HOUR, data);\n\trs5c313_write_reg(RS5C313_ADDR_HOUR10, (data >> 4));\n\n\tdata = bin2bcd(tm->tm_mday);\n\trs5c313_write_reg(RS5C313_ADDR_DAY, data);\n\trs5c313_write_reg(RS5C313_ADDR_DAY10, (data >> 4));\n\n\tdata = bin2bcd(tm->tm_mon + 1);\n\trs5c313_write_reg(RS5C313_ADDR_MON, data);\n\trs5c313_write_reg(RS5C313_ADDR_MON10, (data >> 4));\n\n\tdata = bin2bcd(tm->tm_year % 100);\n\trs5c313_write_reg(RS5C313_ADDR_YEAR, data);\n\trs5c313_write_reg(RS5C313_ADDR_YEAR10, (data >> 4));\n\n\tdata = bin2bcd(tm->tm_wday);\n\trs5c313_write_reg(RS5C313_ADDR_WEEK, data);\n\n\tRS5C313_CEDISABLE;\t/* CE:H */\n\tndelay(700);\n\n\treturn 0;\n}\n\nstatic void rs5c313_check_xstp_bit(void)\n{\n\tstruct rtc_time tm;\n\tint cnt;\n\n\tRS5C313_CEENABLE;\t/* CE:H */\n\tif (rs5c313_read_cntreg() & RS5C313_CNTREG_WTEN_XSTP) {\n\t\t/* INT interval reg. OFF */\n\t\trs5c313_write_intintvreg(0x00);\n\t\t/* Initialize control reg. 24 hour & adjust */\n\t\trs5c313_write_cntreg(0x07);\n\n\t\t/* busy check. */\n\t\tfor (cnt = 0; cnt < 100; cnt++) {\n\t\t\tif (!(rs5c313_read_cntreg() & RS5C313_CNTREG_ADJ_BSY))\n\t\t\t\tbreak;\n\t\t\tRS5C313_MISCOP;\n\t\t}\n\n\t\tmemset(&tm, 0, sizeof(struct rtc_time));\n\t\ttm.tm_mday\t= 1;\n\t\ttm.tm_mon\t= 1 - 1;\n\t\ttm.tm_year\t= 2000 - 1900;\n\n\t\trs5c313_rtc_set_time(NULL, &tm);\n\t\tpr_err(\"invalid value, resetting to 1 Jan 2000\\n\");\n\t}\n\tRS5C313_CEDISABLE;\n\tndelay(700);\t\t/* CE:L */\n}\n\nstatic const struct rtc_class_ops rs5c313_rtc_ops = {\n\t.read_time = rs5c313_rtc_read_time,\n\t.set_time = rs5c313_rtc_set_time,\n};\n\nstatic int rs5c313_rtc_probe(struct platform_device *pdev)\n{\n\tstruct rtc_device *rtc = devm_rtc_device_register(&pdev->dev, \"rs5c313\",\n\t\t\t\t&rs5c313_rtc_ops, THIS_MODULE);\n\n\tif (IS_ERR(rtc))\n\t\treturn PTR_ERR(rtc);\n\n\tplatform_set_drvdata(pdev, rtc);\n\n\treturn 0;\n}\n\nstatic struct platform_driver rs5c313_rtc_platform_driver = {\n\t.driver = {\n\t\t.name = DRV_NAME,\n\t},\n\t.probe\t= rs5c313_rtc_probe,\n};\n\nstatic int __init rs5c313_rtc_init(void)\n{\n\tint err;\n\n\terr = platform_driver_register(&rs5c313_rtc_platform_driver);\n\tif (err)\n\t\treturn err;\n\n\trs5c313_init_port();\n\trs5c313_check_xstp_bit();\n\n\treturn 0;\n}\n\nstatic void __exit rs5c313_rtc_exit(void)\n{\n\tplatform_driver_unregister(&rs5c313_rtc_platform_driver);\n}\n\nmodule_init(rs5c313_rtc_init);\nmodule_exit(rs5c313_rtc_exit);\n\nMODULE_AUTHOR(\"kogiidena , Nobuhiro Iwamatsu \");\nMODULE_DESCRIPTION(\"Ricoh RS5C313 RTC device driver\");\nMODULE_LICENSE(\"GPL\");\nMODULE_ALIAS(\"platform:\" DRV_NAME);\n"} +{"text": "/*=============================================================================\n Copyright (c) 2001-2008 Joel de Guzman\n Copyright (c) 2001-2008 Hartmut Kaiser\n http://spirit.sourceforge.net/\n\n Distributed under the Boost Software License, Version 1.0. (See accompanying\n file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n=============================================================================*/\n#ifndef BOOST_SPIRIT_INCLUDE_CLASSIC_DISTINCT_FWD\n#define BOOST_SPIRIT_INCLUDE_CLASSIC_DISTINCT_FWD\n#include \n#endif\n"} +{"text": "// DEV NOTE: hard-coded preprocessor directives only for hand-compiled version, remove in auto-compiled version\n// [[[ PREPROCESSOR ]]]\n#define __PERL__TYPES 1\n#undef __CPP__TYPES\n\n// [[[ HEADER ]]]\nusing std::cout; using std::cerr; using std::endl;\n\n#ifndef __CPP__INCLUDED__RPerl__Algorithm__Sort__Bubble_h\n#define __CPP__INCLUDED__RPerl__Algorithm__Sort__Bubble_h 0.010_000\n\n// [[[ INCLUDES & OO INHERITANCE INCLUDES ]]]\n#include // -> RPerl.h -> (rperltypes_mode.h; rperloperations.h; rperltypes.h; HelperFunctions.cpp)\n#include \n\n# ifdef __PERL__TYPES\n\n// [[[<<< BEGIN PERL TYPES >>>]]]\n// [[[<<< BEGIN PERL TYPES >>>]]]\n// [[[<<< BEGIN PERL TYPES >>>]]]\n\n// [[[ CONSTANTS ]]]\nconst SV* RPerl__Algorithm__Sort__Bubble__TIME_BEST = (const SV*) newSVpv(\"O($n)\", 0);\nconst SV* RPerl__Algorithm__Sort__Bubble__TIME_AVERAGE = (const SV*) newSVpv(\"O($n ** 2)\", 0);\nconst SV* RPerl__Algorithm__Sort__Bubble__TIME_WORST = (const SV*) newSVpv(\"O($n ** 2)\", 0);\nconst SV* RPerl__Algorithm__Sort__Bubble__SPACE_WORST = (const SV*) newSVpv(\"O(1)\", 0);\n\n// [[[ OO INHERITANCE ]]]\n\nclass RPerl__Algorithm__Sort__Bubble : public RPerl__Algorithm__Sort {\npublic:\n // [[[ OO PROPERTIES ]]]\n SV* integer_data;\n SV* number_data;\n\n // [[[ OO METHODS ]]]\n\n // <<< OO PROPERTIES, ACCESSORS & MUTATORS >>>\n SV* get_integer_data() { return SvREFCNT_inc(this->integer_data); }\n void set_integer_data(SV* integer_data_new) { this->integer_data = integer_data_new; }\n SV* get_number_data() { return SvREFCNT_inc(this->number_data); }\n void set_number_data(SV* number_data_new) { this->number_data = number_data_new; }\n SV* get_foo() { return SvREFCNT_inc(this->foo); }\n void set_foo(SV* foo_new) { this->foo = foo_new; }\n\n // <<< CONSTRUCTOR & DESTRUCTOR >>>\n RPerl__Algorithm__Sort__Bubble() {}\n ~RPerl__Algorithm__Sort__Bubble() {}\n\n // <<< CLASS NAME REPORTER >>>\n virtual SV* myclassname() { return newSVpv(\"RPerl::Algorithm::Sort::Bubble\", 0); }\n\n // <<< CONSTANTS, SHIMS >>>\n SV* TIME_BEST() { return RPerl__Algorithm__Sort__Bubble__TIME_BEST; }\n SV* TIME_AVERAGE() { return RPerl__Algorithm__Sort__Bubble__TIME_AVERAGE; }\n SV* TIME_WORST() { return RPerl__Algorithm__Sort__Bubble__TIME_WORST; }\n SV* SPACE_WORST() { return RPerl__Algorithm__Sort__Bubble__SPACE_WORST; }\n\n // <<< USER-DEFINED METHODS >>>\n void integer_sort();\n void number_sort();\n void inherited_Bubble(SV* person);\n SV* inherited_Bubble_foo_get();\n void inherited_Bubble_foo_set(SV* foo_new);\n void inherited(SV* person);\n}; // end of class\n\n// [[[ OO SUBCLASSES ]]]\n#define RPerl__Algorithm__Sort__Bubble_rawptr RPerl__Algorithm__Sort__Bubble*\ntypedef std::unique_ptr RPerl__Algorithm__Sort__Bubble_ptr;\ntypedef std::vector RPerl__Algorithm__Sort__Bubble_arrayref;\ntypedef std::unordered_map RPerl__Algorithm__Sort__Bubble_hashref;\ntypedef std::unordered_map::iterator RPerl__Algorithm__Sort__Bubble_hashref_iterator;\n\n// [[[ SUBROUTINES ]]]\nSV* RPerl__Algorithm__Sort__Bubble__integer_bubblesort(SV* integer_data);\nSV* RPerl__Algorithm__Sort__Bubble__number_bubblesort(SV* number_data);\nSV* RPerl__Algorithm__Sort__Bubble__uninherited_Bubble(SV* person);\nSV* RPerl__Algorithm__Sort__Bubble__uninherited(SV* person);\nSV* RPerl__Algorithm__Sort__Bubble__integer_bubblesort_typetest0(SV* lucky_integers);\nSV* RPerl__Algorithm__Sort__Bubble__number_bubblesort_typetest0(SV* lucky_numbers);\n\n// <<< SHIM MACROS >>>\n#define integer_bubblesort(integer_data) RPerl__Algorithm__Sort__Bubble__integer_bubblesort(integer_data)\n#define number_bubblesort(number_data) RPerl__Algorithm__Sort__Bubble__number_bubblesort(number_data)\n#define uninherited_Bubble(person) RPerl__Algorithm__Sort__Bubble__uninherited_Bubble(person)\n#define uninherited(person) RPerl__Algorithm__Sort__Bubble__uninherited(person)\n#define integer_bubblesort_typetest0(lucky_integers) RPerl__Algorithm__Sort__Bubble__integer_bubblesort_typetest0(lucky_integers)\n#define number_bubblesort_typetest0(lucky_numbers) RPerl__Algorithm__Sort__Bubble__number_bubblesort_typetest0(lucky_numbers)\n\n// <<< OPERATIONS & DATA TYPES REPORTER >>>\nSV* RPerl__Algorithm__Sort__Bubble__MODE_ID() { return newSViv(1); } // CPPOPS_PERLTYPES is 1\n\n// [[[<<< END PERL TYPES >>>]]]\n// [[[<<< END PERL TYPES >>>]]]\n// [[[<<< END PERL TYPES >>>]]]\n\n# elif defined __CPP__TYPES\n\nPurposefully_die_from_a_compile-time_error,_due_to____CPP__TYPES_being_defined.__We_need_to_define_only___PERL__TYPES_in_this_file!\n\n# else\n\nPurposefully_die_from_a_compile-time_error,_due_to_neither___PERL__TYPES_nor___CPP__TYPES_being_defined.__We_need_to_define_only___PERL__TYPES_in_this_file!\n\n# endif\n\n#endif\n"} +{"text": "flask==0.12.2\nhttp://download.pytorch.org/whl/cu80/torch-0.2.0.post3-cp36-cp36m-manylinux1_x86_64.whl\nrequests\n"} +{"text": "#\n# @@@ START COPYRIGHT @@@\n#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n# @@@ END COPYRIGHT @@@\n#\n\n# Define some default values that can be overridden by system properties\nhbase.root.logger=INFO,hbaseclient\nhbase.log.dir=.\nhbase.log.file=trafodion.util.log\n\n# Define the root logger to the system property \"hbase.root.logger\".\nlog4j.rootLogger=${hbase.root.logger}\n\n# Logging Threshold\nlog4j.threshhold=ALL\n\n#\n# Rolling File Appender\n# Uncomment the 'DailyRollingFile Appender to roll the logs daily\n# (based on the DatePattern)\nlog4j.appender.hbaseclient=org.apache.log4j.RollingFileAppender\n#log4j.appender.hbaseclient=org.apache.log4j.DailyRollingFileAppender\nlog4j.appender.hbaseclient.File=${hbase.log.file}\nlog4j.appender.hbaseclient.MaxFileSize=64MB\nlog4j.appender.hbaseclient.MaxBackupIndex=20\nlog4j.appender.hbaseclient.layout=org.apache.log4j.PatternLayout\nlog4j.appender.hbaseclient.layout.ConversionPattern=%d{ISO8601} %p %c{2}: %m%n\nlog4j.appender.hbaseclient.Append=true\n#log4j.appender.hbaseclient.DatePattern='.'yyyy-MM-dd \nlog4j.appender.hbaseclient.immediateFlush=true\n\n# Custom Logging levels\n\nlog4j.logger.org.apache.zookeeper=ERROR\nlog4j.logger.org.apache.hadoop.hbase=DEBUG\nlog4j.logger.org.trafodion.dtm=TRACE\nlog4j.logger.com.tandem.sqlmx=ERROR\n\n"} +{"text": "'use strict';\nvar common = require('../common');\nvar assert = require('assert');\nvar net = require('net');\n\nvar tcpPort = common.PORT;\nvar bytesRead = 0;\nvar bytesWritten = 0;\nvar count = 0;\n\nvar tcp = net.Server(function(s) {\n console.log('tcp server connection');\n\n // trigger old mode.\n s.resume();\n\n s.on('end', function() {\n bytesRead += s.bytesRead;\n console.log('tcp socket disconnect #' + count);\n });\n});\n\ntcp.listen(common.PORT, function doTest() {\n console.error('listening');\n var socket = net.createConnection(tcpPort);\n\n socket.on('connect', function() {\n count++;\n console.error('CLIENT connect #%d', count);\n\n socket.write('foo', function() {\n console.error('CLIENT: write cb');\n socket.end('bar');\n });\n });\n\n socket.on('finish', function() {\n bytesWritten += socket.bytesWritten;\n console.error('CLIENT end event #%d', count);\n });\n\n socket.on('close', function() {\n console.error('CLIENT close event #%d', count);\n console.log('Bytes read: ' + bytesRead);\n console.log('Bytes written: ' + bytesWritten);\n if (count < 2) {\n console.error('RECONNECTING');\n socket.connect(tcpPort);\n } else {\n tcp.close();\n }\n });\n});\n\nprocess.on('exit', function() {\n assert.equal(bytesRead, 12);\n assert.equal(bytesWritten, 12);\n});\n"} +{"text": "FROM apolloauto/apollo:cyber-x86_64-18.04-20200914_0704\n\nARG GEOLOC\nARG BUILD_STAGE\nARG INSTALL_MODE\n\nWORKDIR /apollo\n\nCOPY archive /tmp/archive\nCOPY installers /tmp/installers\n\nRUN bash /tmp/installers/install_geo_adjustment.sh ${GEOLOC}\n\nRUN bash /tmp/installers/install_modules_base.sh\nRUN bash /tmp/installers/install_gpu_support.sh # ${WORKHORSE}\n\nRUN bash /tmp/installers/install_ordinary_modules.sh ${INSTALL_MODE}\n\nRUN bash /tmp/installers/install_drivers_deps.sh ${INSTALL_MODE}\nRUN bash /tmp/installers/install_perception_deps.sh ${INSTALL_MODE}\nRUN bash /tmp/installers/install_dreamview_deps.sh ${GEOLOC}\n\nRUN bash /tmp/installers/install_contrib_deps.sh ${INSTALL_MODE}\nRUN bash /tmp/installers/install_3rdparty_pept_deps.sh ${INSTALL_MODE}\n\nRUN bash /tmp/installers/install_release_deps.sh\n\nRUN bash /tmp/installers/post_install.sh ${BUILD_STAGE}\n"} +{"text": "//===------ArgsToFrontendOptionsConverter.h-- --------------------*-C++ -*-===//\n//\n// This source file is part of the Swift.org open source project\n//\n// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors\n// Licensed under Apache License v2.0 with Runtime Library Exception\n//\n// See https://swift.org/LICENSE.txt for license information\n// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors\n//\n//===----------------------------------------------------------------------===//\n\n#ifndef POLARPHP_FRONTEND_ARGSTOFRONTENDOPTIONSCONVERTER_H\n#define POLARPHP_FRONTEND_ARGSTOFRONTENDOPTIONSCONVERTER_H\n\n#include \"polarphp/ast/DiagnosticConsumer.h\"\n#include \"polarphp/ast/DiagnosticEngine.h\"\n#include \"polarphp/frontend/FrontendOptions.h\"\n#include \"polarphp/option/Options.h\"\n#include \"llvm/Option/ArgList.h\"\n\n#include \n\nnamespace polar {\n\nclass ArgsToFrontendOptionsConverter {\nprivate:\n DiagnosticEngine &Diags;\n const llvm::opt::ArgList &Args;\n FrontendOptions &Opts;\n\n Optional>\n cachedOutputFilenamesFromCommandLineOrFilelist;\n\n void handleDebugCrashGroupArguments();\n\n void computeDebugTimeOptions();\n bool computeFallbackModuleName();\n bool computeModuleName();\n bool computeMainAndSupplementaryOutputFilenames();\n void computeDumpScopeMapLocations();\n void computeHelpOptions();\n void computeImplicitImportModuleNames();\n void computeImportObjCHeaderOptions();\n void computeLLVMArgs();\n void computePlaygroundOptions();\n void computePrintStatsOptions();\n void computeTBDOptions();\n\n bool setUpInputKindAndImmediateArgs();\n\n bool checkUnusedSupplementaryOutputPaths() const;\n\n bool checkForUnusedOutputPaths() const;\n\npublic:\n ArgsToFrontendOptionsConverter(DiagnosticEngine &Diags,\n const llvm::opt::ArgList &Args,\n FrontendOptions &Opts)\n : Diags(Diags), Args(Args), Opts(Opts) {}\n\n /// Populates the FrontendOptions the converter was initialized with.\n ///\n /// \\param buffers If present, buffers read in the processing of the frontend\n /// options will be saved here. These should only be used for debugging\n /// purposes.\n bool convert(\n SmallVectorImpl> *buffers);\n\n static FrontendOptions::ActionType\n determineRequestedAction(const llvm::opt::ArgList &);\n};\n\n} // namespace polar\n\n#endif /* POLARPHP_FRONTEND_ARGSTOFRONTENDOPTIONSCONVERTER_H */\n"} +{"text": "--MUST READ: \n-- to use this file do the following\n-- 1)find and replace each capitalized instance of NodeTemplate\n-- with a capitalized version of your node's name\n-- 2) find and replace each lowercase instance of nodeTemplate\n-- with a lowercase version of your node's name(this should be the same as the filename)\n-- 3) start coding\n\n-----------------------------------------------\n-- NodeTemplate.lua\n-----------------------------------------------\n\nlocal NodeTemplate = {}\nNodeTemplate.__index = NodeTemplate\nNodeTemplate.isNodeTemplate = true\n\n---\n-- Creates a new NodeTemplate object\n-- @param node the table used to create this\n-- @param a collider of objects\n-- @return the NodeTemplate object created\nfunction NodeTemplate.new(node, collider)\n --creates a new object\n local nodeTemplate = {}\n --sets it to use the functions and variables defined in NodeTemplate\n -- if it doesn;t have one by that name\n setmetatable(nodeTemplate, NodeTemplate)\n --stores all the parameters from the tmx file\n nodeTemplate.node = node\n \n nodeTemplate.position = {x = node.x, y = node.y}\n nodeTemplate.width = node.width\n nodeTemplate.height = node.height\n \n --initialize the node's bounding box\n nodeTemplate.collider = collider\n nodeTemplate.bb = collider:addRectangle(node.x, node.y, node.width, node.height)\n nodeTemplate.bb.node = nodeTemplate\n nodeTemplate.collider:setPassive(nodeTemplate.bb)\n \n --define some offsets for the bounding box that can be used each update cycle\n nodeTemplate.bb_offset = {x = 0,y = 0}\n \n --add more initialization code here if you want\n \n return nodeTemplate\nend\n\n---\n-- Draws the NodeTemplate to the screen\n-- @return nil\nfunction NodeTemplate:draw()\n --to access the field called \"foo\" of this node do the following:\n -- self.foo\nend\n\nfunction NodeTemplate:keypressed( button, player )\nend\n\n---\n-- Called when the NodeTemplate begins colliding with another node\n-- @param node the node you're colliding with\n-- @param dt ?\n-- @param mtv_x amount the node must be moved in the x direction to stop colliding\n-- @param mtv_y amount the node must be moved in the y direction to stop colliding\n-- @return nil\nfunction NodeTemplate:collide(node, dt, mtv_x, mtv_y)\nend\n\n---\n-- Called when the NodeTemplate finishes colliding with another node\n-- @return nil\nfunction NodeTemplate:collide_end(node, dt)\nend\n\n---\n-- Updates the NodeTemplate\n-- dt is the amount of time in seconds since the last update\nfunction NodeTemplate:update(dt)\n\n --do this immediately before leaving the function\n -- repositions the bounding box based on your current coordinates\n local x1,y1,x2,y2 = self.bb:bbox()\n self.bb:moveTo( self.position.x + (x2-x1)/2 + self.bb_offset.x,\n self.position.y + (y2-y1)/2 + self.bb_offset.y )\nend\n\nreturn NodeTemplate\n"} +{"text": "// Copyright 2017 the V8 project authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n#include \"src/asmjs/asm-scanner.h\"\n#include \"src/objects/objects.h\"\n#include \"src/parsing/scanner-character-streams.h\"\n#include \"src/parsing/scanner.h\"\n#include \"testing/gtest/include/gtest/gtest.h\"\n\nnamespace v8 {\nnamespace internal {\n\n#define TOK(t) AsmJsScanner::kToken_##t\n\nclass AsmJsScannerTest : public ::testing::Test {\n protected:\n void SetupScanner(const char* source) {\n stream = ScannerStream::ForTesting(source);\n scanner.reset(new AsmJsScanner(stream.get()));\n }\n\n void Skip(AsmJsScanner::token_t t) {\n CHECK_EQ(t, scanner->Token());\n scanner->Next();\n }\n\n void SkipGlobal() {\n CHECK(scanner->IsGlobal());\n scanner->Next();\n }\n\n void SkipLocal() {\n CHECK(scanner->IsLocal());\n scanner->Next();\n }\n\n void CheckForEnd() { CHECK_EQ(scanner->Token(), AsmJsScanner::kEndOfInput); }\n\n void CheckForParseError() {\n CHECK_EQ(scanner->Token(), AsmJsScanner::kParseError);\n }\n\n std::unique_ptr stream;\n std::unique_ptr scanner;\n};\n\nTEST_F(AsmJsScannerTest, SimpleFunction) {\n SetupScanner(\"function foo() { return; }\");\n Skip(TOK(function));\n DCHECK_EQ(\"foo\", scanner->GetIdentifierString());\n SkipGlobal();\n Skip('(');\n Skip(')');\n Skip('{');\n // clang-format off\n Skip(TOK(return));\n // clang-format on\n Skip(';');\n Skip('}');\n CheckForEnd();\n}\n\nTEST_F(AsmJsScannerTest, JSKeywords) {\n SetupScanner(\n \"arguments break case const continue\\n\"\n \"default do else eval for function\\n\"\n \"if new return switch var while\\n\");\n Skip(TOK(arguments));\n Skip(TOK(break));\n Skip(TOK(case));\n Skip(TOK(const));\n Skip(TOK(continue));\n Skip(TOK(default));\n Skip(TOK(do));\n Skip(TOK(else));\n Skip(TOK(eval));\n Skip(TOK(for));\n Skip(TOK(function));\n Skip(TOK(if));\n Skip(TOK(new));\n // clang-format off\n Skip(TOK(return));\n // clang-format on\n Skip(TOK(switch));\n Skip(TOK(var));\n Skip(TOK(while));\n CheckForEnd();\n}\n\nTEST_F(AsmJsScannerTest, JSOperatorsSpread) {\n SetupScanner(\n \"+ - * / % & | ^ ~ << >> >>>\\n\"\n \"< > <= >= == !=\\n\");\n Skip('+');\n Skip('-');\n Skip('*');\n Skip('/');\n Skip('%');\n Skip('&');\n Skip('|');\n Skip('^');\n Skip('~');\n Skip(TOK(SHL));\n Skip(TOK(SAR));\n Skip(TOK(SHR));\n Skip('<');\n Skip('>');\n Skip(TOK(LE));\n Skip(TOK(GE));\n Skip(TOK(EQ));\n Skip(TOK(NE));\n CheckForEnd();\n}\n\nTEST_F(AsmJsScannerTest, JSOperatorsTight) {\n SetupScanner(\n \"+-*/%&|^~<<>> >>>\\n\"\n \"<><=>= ==!=\\n\");\n Skip('+');\n Skip('-');\n Skip('*');\n Skip('/');\n Skip('%');\n Skip('&');\n Skip('|');\n Skip('^');\n Skip('~');\n Skip(TOK(SHL));\n Skip(TOK(SAR));\n Skip(TOK(SHR));\n Skip('<');\n Skip('>');\n Skip(TOK(LE));\n Skip(TOK(GE));\n Skip(TOK(EQ));\n Skip(TOK(NE));\n CheckForEnd();\n}\n\nTEST_F(AsmJsScannerTest, UsesOfAsm) {\n SetupScanner(\"'use asm' \\\"use asm\\\"\\n\");\n Skip(TOK(UseAsm));\n Skip(TOK(UseAsm));\n CheckForEnd();\n}\n\nTEST_F(AsmJsScannerTest, DefaultGlobalScope) {\n SetupScanner(\"var x = x + x;\");\n Skip(TOK(var));\n CHECK_EQ(\"x\", scanner->GetIdentifierString());\n AsmJsScanner::token_t x = scanner->Token();\n SkipGlobal();\n Skip('=');\n Skip(x);\n Skip('+');\n Skip(x);\n Skip(';');\n CheckForEnd();\n}\n\nTEST_F(AsmJsScannerTest, GlobalScope) {\n SetupScanner(\"var x = x + x;\");\n scanner->EnterGlobalScope();\n Skip(TOK(var));\n CHECK_EQ(\"x\", scanner->GetIdentifierString());\n AsmJsScanner::token_t x = scanner->Token();\n SkipGlobal();\n Skip('=');\n Skip(x);\n Skip('+');\n Skip(x);\n Skip(';');\n CheckForEnd();\n}\n\nTEST_F(AsmJsScannerTest, LocalScope) {\n SetupScanner(\"var x = x + x;\");\n scanner->EnterLocalScope();\n Skip(TOK(var));\n CHECK_EQ(\"x\", scanner->GetIdentifierString());\n AsmJsScanner::token_t x = scanner->Token();\n SkipLocal();\n Skip('=');\n Skip(x);\n Skip('+');\n Skip(x);\n Skip(';');\n CheckForEnd();\n}\n\nTEST_F(AsmJsScannerTest, Numbers) {\n SetupScanner(\"1 1.2 0x1F 1.e3\");\n\n CHECK(scanner->IsUnsigned());\n CHECK_EQ(1, scanner->AsUnsigned());\n scanner->Next();\n\n CHECK(scanner->IsDouble());\n CHECK_EQ(1.2, scanner->AsDouble());\n scanner->Next();\n\n CHECK(scanner->IsUnsigned());\n CHECK_EQ(31, scanner->AsUnsigned());\n scanner->Next();\n\n CHECK(scanner->IsDouble());\n CHECK_EQ(1.0e3, scanner->AsDouble());\n scanner->Next();\n\n CheckForEnd();\n}\n\nTEST_F(AsmJsScannerTest, UnsignedNumbers) {\n SetupScanner(\"0x7FFFFFFF 0x80000000 0xFFFFFFFF 0x100000000\");\n\n CHECK(scanner->IsUnsigned());\n CHECK_EQ(0x7FFFFFFF, scanner->AsUnsigned());\n scanner->Next();\n\n CHECK(scanner->IsUnsigned());\n CHECK_EQ(0x80000000, scanner->AsUnsigned());\n scanner->Next();\n\n CHECK(scanner->IsUnsigned());\n CHECK_EQ(0xFFFFFFFF, scanner->AsUnsigned());\n scanner->Next();\n\n // Numeric \"unsigned\" literals with a payload of more than 32-bit are rejected\n // by asm.js in all contexts, we hence consider `0x100000000` to be an error.\n CheckForParseError();\n}\n\nTEST_F(AsmJsScannerTest, BadNumber) {\n SetupScanner(\".123fe\");\n Skip('.');\n CheckForParseError();\n}\n\nTEST_F(AsmJsScannerTest, Rewind1) {\n SetupScanner(\"+ - * /\");\n Skip('+');\n scanner->Rewind();\n Skip('+');\n Skip('-');\n scanner->Rewind();\n Skip('-');\n Skip('*');\n scanner->Rewind();\n Skip('*');\n Skip('/');\n scanner->Rewind();\n Skip('/');\n CheckForEnd();\n}\n\nTEST_F(AsmJsScannerTest, Comments) {\n SetupScanner(\n \"var // This is a test /* */ eval\\n\"\n \"var /* test *** test */ eval\\n\"\n \"function /* this */ ^\");\n Skip(TOK(var));\n Skip(TOK(var));\n Skip(TOK(eval));\n Skip(TOK(function));\n Skip('^');\n CheckForEnd();\n}\n\nTEST_F(AsmJsScannerTest, TrailingCComment) {\n SetupScanner(\"var /* test\\n\");\n Skip(TOK(var));\n CheckForParseError();\n}\n\nTEST_F(AsmJsScannerTest, Seeking) {\n SetupScanner(\"var eval do arguments function break\\n\");\n Skip(TOK(var));\n size_t old_pos = scanner->Position();\n Skip(TOK(eval));\n Skip(TOK(do));\n Skip(TOK(arguments));\n scanner->Rewind();\n Skip(TOK(arguments));\n scanner->Rewind();\n scanner->Seek(old_pos);\n Skip(TOK(eval));\n Skip(TOK(do));\n Skip(TOK(arguments));\n Skip(TOK(function));\n Skip(TOK(break));\n CheckForEnd();\n}\n\nTEST_F(AsmJsScannerTest, Newlines) {\n SetupScanner(\n \"var x = 1\\n\"\n \"var y = 2\\n\");\n Skip(TOK(var));\n scanner->Next();\n Skip('=');\n scanner->Next();\n CHECK(scanner->IsPrecededByNewline());\n Skip(TOK(var));\n scanner->Next();\n Skip('=');\n scanner->Next();\n CHECK(scanner->IsPrecededByNewline());\n CheckForEnd();\n}\n\n} // namespace internal\n} // namespace v8\n"} +{"text": "/////////////////////////////////////////////////////////////////////////////\n// Name: src/common/imagtga.cpp\n// Purpose: wxImage TGA handler\n// Author: Seth Jackson\n// Copyright: (c) 2005 Seth Jackson\n// Licence: wxWindows licence\n/////////////////////////////////////////////////////////////////////////////\n\n// ============================================================================\n// declarations\n// ============================================================================\n\n// ----------------------------------------------------------------------------\n// headers\n// ----------------------------------------------------------------------------\n\n// For compilers that support precompilation, includes \"wx.h\".\n#include \"wx/wxprec.h\"\n\n#ifdef __BORLANDC__\n #pragma hdrstop\n#endif\n\n#if wxUSE_IMAGE && wxUSE_TGA\n\n#ifndef WX_PRECOMP\n #include \"wx/palette.h\"\n#endif\n\n#include \"wx/imagtga.h\"\n#include \"wx/log.h\"\n#include \"wx/scopedarray.h\"\n\n// ----------------------------------------------------------------------------\n// constants\n// ----------------------------------------------------------------------------\n\n// TGA error codes.\nenum\n{\n wxTGA_OK,\n wxTGA_INVFORMAT,\n wxTGA_MEMERR,\n wxTGA_IOERR\n};\n\n// TGA header bytes.\nenum\n{\n HDR_OFFSET = 0,\n HDR_COLORTYPE = 1,\n HDR_IMAGETYPE = 2,\n HDR_PALETTESTART = 3,\n HDR_PALETTELENGTH = 5,\n HDR_PALETTEBITS = 7,\n HDR_XORIGIN = 8,\n HDR_YORIGIN = 10,\n HDR_WIDTH = 12,\n HDR_HEIGHT = 14,\n HDR_BPP = 16,\n HDR_ORIENTATION = 17,\n HDR_SIZE\n};\n\n// TGA color types.\nenum\n{\n wxTGA_UNMAPPED = 0,\n wxTGA_MAPPED = 1\n};\n\n// ============================================================================\n// implementation\n// ============================================================================\n\nwxIMPLEMENT_DYNAMIC_CLASS(wxTGAHandler, wxImageHandler);\n\n#if wxUSE_STREAMS\n\n// ----------------------------------------------------------------------------\n// worker functions\n// ----------------------------------------------------------------------------\n\nstatic\nvoid FlipTGA(unsigned char* imageData, int width, int height, short pixelSize)\n{\n int lineLength = width * pixelSize;\n unsigned char *line1 = imageData;\n unsigned char *line2 = &imageData[lineLength * (height - 1)];\n\n unsigned char temp;\n for ( ; line1 < line2; line2 -= (lineLength * 2))\n {\n for (int index = 0; index < lineLength; line1++, line2++, index++)\n {\n temp = *line1;\n *line1 = *line2;\n *line2 = temp;\n }\n }\n}\n\n// return wxTGA_OK or wxTGA_IOERR\nstatic\nint DecodeRLE(unsigned char* imageData, unsigned long imageSize,\n short pixelSize, wxInputStream& stream)\n{\n unsigned long outputLength = 0;\n unsigned int length;\n unsigned char buf[4];\n\n while (outputLength < imageSize)\n {\n int ch = stream.GetC();\n if ( ch == wxEOF )\n return wxTGA_IOERR;\n\n unsigned char current;\n current = ch;\n\n // RLE packet.\n if ( current & 0x80 )\n {\n // Get the run length of the packet.\n current &= 0x7f;\n\n current++;\n\n length = current;\n\n outputLength += current * pixelSize;\n\n if (outputLength > imageSize)\n {\n return wxTGA_IOERR;\n }\n\n // Repeat the pixel length times.\n if ( !stream.Read(buf, pixelSize) )\n return wxTGA_IOERR;\n\n for (unsigned int i = 0; i < length; i++)\n {\n memcpy(imageData, buf, pixelSize);\n\n imageData += pixelSize;\n }\n }\n else // Raw packet.\n {\n // Get the run length of the packet.\n current++;\n\n length = current * pixelSize;\n\n outputLength += length;\n\n if (outputLength > imageSize)\n {\n return wxTGA_IOERR;\n }\n\n // Write the next length pixels directly to the image data.\n if ( !stream.Read(imageData, length) )\n return wxTGA_IOERR;\n\n imageData += length;\n }\n }\n\n return wxTGA_OK;\n}\n\n/*\nMimic the behaviour of wxPalette.GetRGB and the way the TGA image handler\nused it. That is: don't check the return value of GetRGB and continue decoding\nusing previous RGB values.\n\nIt might be better to check for palette index bounds and stop decoding if\nit's out of range (and add something like wxTGA_DATAERR to indicate unexpected\npixel data).\n*/\nstatic\nvoid Palette_GetRGB(const unsigned char *palette, unsigned int paletteCount,\n unsigned int index,\n unsigned char *red, unsigned char *green, unsigned char *blue)\n{\n if (index >= paletteCount)\n {\n return;\n }\n\n *red = palette[index];\n *green = palette[(paletteCount * 1) + index];\n *blue = palette[(paletteCount * 2) + index];\n}\n\nstatic\nvoid Palette_SetRGB(unsigned char *palette, unsigned int paletteCount,\n unsigned int index,\n unsigned char red, unsigned char green, unsigned char blue)\n{\n palette[index] = red;\n palette[(paletteCount * 1) + index] = green;\n palette[(paletteCount * 2) + index] = blue;\n}\n\nstatic\nint ReadTGA(wxImage* image, wxInputStream& stream)\n{\n // Read in the TGA header\n unsigned char hdr[HDR_SIZE];\n stream.Read(hdr, HDR_SIZE);\n\n short offset = hdr[HDR_OFFSET] + HDR_SIZE;\n short colorType = hdr[HDR_COLORTYPE];\n short imageType = hdr[HDR_IMAGETYPE];\n unsigned int paletteLength = hdr[HDR_PALETTELENGTH]\n + 256 * hdr[HDR_PALETTELENGTH + 1];\n int width = (hdr[HDR_WIDTH] + 256 * hdr[HDR_WIDTH + 1]) -\n (hdr[HDR_XORIGIN] + 256 * hdr[HDR_XORIGIN + 1]);\n int height = (hdr[HDR_HEIGHT] + 256 * hdr[HDR_HEIGHT + 1]) -\n (hdr[HDR_YORIGIN] + 256 * hdr[HDR_YORIGIN + 1]);\n short bpp = hdr[HDR_BPP];\n short orientation = hdr[HDR_ORIENTATION] & 0x20;\n\n image->Create(width, height);\n\n if (!image->IsOk())\n {\n return wxTGA_MEMERR;\n }\n\n const short pixelSize = bpp / 8;\n\n const unsigned long imageSize = static_cast(width) * height * pixelSize;\n\n wxScopedArray imageData(imageSize);\n\n if (!imageData)\n {\n return wxTGA_MEMERR;\n }\n\n unsigned char *dst = image->GetData();\n\n unsigned char* alpha = NULL;\n if (bpp == 16 || bpp == 32)\n {\n image->SetAlpha();\n\n alpha = image->GetAlpha();\n }\n\n // Seek from the offset we got from the TGA header.\n if (stream.SeekI(offset, wxFromStart) == wxInvalidOffset)\n return wxTGA_INVFORMAT;\n\n wxScopedArray palette;\n // Load a palette if we have one.\n if (colorType == wxTGA_MAPPED)\n {\n {\n wxScopedArray paletteTmp(paletteLength*3);\n palette.swap(paletteTmp);\n }\n\n unsigned char buf[3];\n\n for (unsigned int i = 0; i < paletteLength; i++)\n {\n stream.Read(buf, 3);\n\n Palette_SetRGB(palette.get(), paletteLength, i, buf[2], buf[1], buf[0]);\n }\n\n#if wxUSE_PALETTE\n // Set the palette of the image.\n image->SetPalette(wxPalette((int) paletteLength, &palette[0],\n &palette[paletteLength * 1], &palette[paletteLength * 2]));\n#endif // wxUSE_PALETTE\n\n }\n\n // Handle the various TGA formats we support.\n\n switch (imageType)\n {\n // Raw indexed.\n\n case 1:\n {\n unsigned char r = 0;\n unsigned char g = 0;\n unsigned char b = 0;\n\n // No compression read the data directly to imageData.\n\n stream.Read(imageData.get(), imageSize);\n\n // If orientation == 0, then the image is stored upside down.\n // We need to store it right side up.\n\n if (orientation == 0)\n {\n FlipTGA(imageData.get(), width, height, pixelSize);\n }\n\n // Handle the different pixel depths.\n\n switch (bpp)\n {\n // 8 bpp.\n\n case 8:\n {\n for (unsigned long index = 0; index < imageSize; index += pixelSize)\n {\n Palette_GetRGB(palette.get(), paletteLength,\n imageData[index], &r, &g, &b);\n\n *(dst++) = r;\n *(dst++) = g;\n *(dst++) = b;\n }\n }\n break;\n\n // 16 bpp.\n\n case 16:\n {\n for (unsigned long index = 0; index < imageSize; index += pixelSize)\n {\n Palette_GetRGB(palette.get(), paletteLength,\n imageData[index], &r, &g, &b);\n\n *(dst++) = r;\n *(dst++) = g;\n *(dst++) = b;\n *(alpha++) = (imageData[index + 1] & 0x80) ? 0 : 255;\n }\n }\n break;\n\n default:\n return wxTGA_INVFORMAT;\n }\n }\n break;\n\n // Raw RGB.\n\n case 2:\n {\n // No compression read the data directly to imageData.\n\n stream.Read(imageData.get(), imageSize);\n\n // If orientation == 0, then the image is stored upside down.\n // We need to store it right side up.\n\n if (orientation == 0)\n {\n FlipTGA(imageData.get(), width, height, pixelSize);\n }\n\n // Handle the different pixel depths.\n\n switch (bpp)\n {\n //16 bpp.\n\n case 16:\n {\n for (unsigned long index = 0; index < imageSize; index += pixelSize)\n {\n unsigned char temp;\n temp = (imageData[index + 1] & 0x7c) << 1;\n temp |= temp >> 5;\n *(dst++) = temp;\n\n temp = ((imageData[index + 1] & 0x03) << 6) | ((imageData[index] & 0xe0) >> 2);\n temp |= temp >> 5;\n *(dst++) = temp;\n\n temp = (imageData[index] & 0x1f) << 3;\n temp |= temp >> 5;\n *(dst++) = temp;\n\n *(alpha++) = (imageData[index + 1] & 0x80) ? 0 : 255;\n }\n }\n break;\n\n // 24 bpp.\n\n case 24:\n {\n for (unsigned long index = 0; index < imageSize; index += pixelSize)\n {\n *(dst++) = imageData[index + 2];\n *(dst++) = imageData[index + 1];\n *(dst++) = imageData[index];\n }\n }\n break;\n\n // 32 bpp.\n\n case 32:\n {\n for (unsigned long index = 0; index < imageSize; index += pixelSize)\n {\n *(dst++) = imageData[index + 2];\n *(dst++) = imageData[index + 1];\n *(dst++) = imageData[index];\n *(alpha++) = imageData[index + 3];\n }\n }\n break;\n\n default:\n return wxTGA_INVFORMAT;\n }\n }\n break;\n\n // Raw grayscale.\n\n case 3:\n {\n // No compression read the data directly to imageData.\n\n stream.Read(imageData.get(), imageSize);\n\n // If orientation == 0, then the image is stored upside down.\n // We need to store it right side up.\n\n if (orientation == 0)\n {\n FlipTGA(imageData.get(), width, height, pixelSize);\n }\n\n // Handle the different pixel depths.\n\n switch (bpp)\n {\n // 8 bpp.\n\n case 8:\n {\n for (unsigned long index = 0; index < imageSize; index += pixelSize)\n {\n *(dst++) = imageData[index];\n *(dst++) = imageData[index];\n *(dst++) = imageData[index];\n }\n }\n break;\n\n // 16 bpp.\n\n case 16:\n {\n for (unsigned long index = 0; index < imageSize; index += pixelSize)\n {\n *(dst++) = imageData[index];\n *(dst++) = imageData[index];\n *(dst++) = imageData[index];\n *(alpha++) = imageData[index + 1];\n }\n }\n break;\n\n default:\n return wxTGA_INVFORMAT;\n }\n }\n break;\n\n // RLE indexed.\n\n case 9:\n {\n unsigned char r = 0;\n unsigned char g = 0;\n unsigned char b = 0;\n\n // Decode the RLE data.\n\n int rc = DecodeRLE(imageData.get(), imageSize, pixelSize, stream);\n if ( rc != wxTGA_OK )\n return rc;\n\n // If orientation == 0, then the image is stored upside down.\n // We need to store it right side up.\n\n if (orientation == 0)\n {\n FlipTGA(imageData.get(), width, height, pixelSize);\n }\n\n // Handle the different pixel depths.\n\n switch (bpp)\n {\n // 8 bpp.\n\n case 8:\n {\n for (unsigned long index = 0; index < imageSize; index += pixelSize)\n {\n Palette_GetRGB(palette.get(), paletteLength,\n imageData[index], &r, &g, &b);\n\n *(dst++) = r;\n *(dst++) = g;\n *(dst++) = b;\n }\n }\n break;\n\n // 16 bpp.\n\n case 16:\n {\n for (unsigned long index = 0; index < imageSize; index += pixelSize)\n {\n Palette_GetRGB(palette.get(), paletteLength,\n imageData[index], &r, &g, &b);\n\n *(dst++) = r;\n *(dst++) = g;\n *(dst++) = b;\n *(alpha++) = (imageData[index + 1] & 0x80) ? 0 : 255;\n }\n }\n break;\n\n default:\n return wxTGA_INVFORMAT;\n }\n }\n break;\n\n // RLE RGB.\n\n case 10:\n {\n // Decode the RLE data.\n\n int rc = DecodeRLE(imageData.get(), imageSize, pixelSize, stream);\n if ( rc != wxTGA_OK )\n return rc;\n\n // If orientation == 0, then the image is stored upside down.\n // We need to store it right side up.\n\n if (orientation == 0)\n {\n FlipTGA(imageData.get(), width, height, pixelSize);\n }\n\n // Handle the different pixel depths.\n\n switch (bpp)\n {\n //16 bpp.\n\n case 16:\n {\n for (unsigned long index = 0; index < imageSize; index += pixelSize)\n {\n unsigned char temp;\n temp = (imageData[index + 1] & 0x7c) << 1;\n temp |= temp >> 5;\n *(dst++) = temp;\n\n temp = ((imageData[index + 1] & 0x03) << 6) | ((imageData[index] & 0xe0) >> 2);\n temp |= temp >> 5;\n *(dst++) = temp;\n\n temp = (imageData[index] & 0x1f) << 3;\n temp |= temp >> 5;\n *(dst++) = temp;\n\n *(alpha++) = (imageData[index + 1] & 0x80) ? 0 : 255;\n }\n }\n break;\n\n // 24 bpp.\n\n case 24:\n {\n for (unsigned long index = 0; index < imageSize; index += pixelSize)\n {\n *(dst++) = imageData[index + 2];\n *(dst++) = imageData[index + 1];\n *(dst++) = imageData[index];\n }\n }\n break;\n\n // 32 bpp.\n\n case 32:\n {\n for (unsigned long index = 0; index < imageSize; index += pixelSize)\n {\n *(dst++) = imageData[index + 2];\n *(dst++) = imageData[index + 1];\n *(dst++) = imageData[index];\n *(alpha++) = imageData[index + 3];\n }\n }\n break;\n\n default:\n return wxTGA_INVFORMAT;\n }\n }\n break;\n\n // RLE grayscale.\n\n case 11:\n {\n // Decode the RLE data.\n\n int rc = DecodeRLE(imageData.get(), imageSize, pixelSize, stream);\n if ( rc != wxTGA_OK )\n return rc;\n\n // If orientation == 0, then the image is stored upside down.\n // We need to store it right side up.\n\n if (orientation == 0)\n {\n FlipTGA(imageData.get(), width, height, pixelSize);\n }\n\n // Handle the different pixel depths.\n\n switch (bpp)\n {\n // 8 bpp.\n\n case 8:\n {\n for (unsigned long index = 0; index < imageSize; index += pixelSize)\n {\n *(dst++) = imageData[index];\n *(dst++) = imageData[index];\n *(dst++) = imageData[index];\n }\n }\n break;\n\n // 16 bpp.\n\n case 16:\n {\n for (unsigned long index = 0; index < imageSize; index += pixelSize)\n {\n *(dst++) = imageData[index];\n *(dst++) = imageData[index];\n *(dst++) = imageData[index];\n *(alpha++) = imageData[index + 1];\n }\n }\n break;\n\n default:\n return wxTGA_INVFORMAT;\n }\n }\n break;\n\n default:\n return wxTGA_INVFORMAT;\n }\n\n return wxTGA_OK;\n}\n\nstatic\nint SaveTGA(const wxImage& image, wxOutputStream *stream)\n{\n bool hasAlpha = image.HasAlpha();\n unsigned bytesPerPixel = 3 + (hasAlpha ? 1 : 0);\n wxSize size = image.GetSize();\n size_t scanlineSize = size.x * bytesPerPixel;\n wxScopedArray scanlineData(scanlineSize);\n if (!scanlineData)\n {\n return wxTGA_MEMERR;\n }\n\n // Compose and write the TGA header\n unsigned char hdr[HDR_SIZE];\n (void) memset(&hdr, 0, HDR_SIZE);\n\n hdr[HDR_COLORTYPE] = wxTGA_UNMAPPED;\n hdr[HDR_IMAGETYPE] = 2 /* Uncompressed truecolour */;\n\n hdr[HDR_WIDTH] = size.x & 0xFF;\n hdr[HDR_WIDTH + 1] = (size.x >> 8) & 0xFF;\n\n hdr[HDR_HEIGHT] = size.y & 0xFF;\n hdr[HDR_HEIGHT + 1] = (size.y >> 8) & 0xFF;\n\n hdr[HDR_BPP] = hasAlpha ? 32 : 24;\n hdr[HDR_ORIENTATION] = 1 << 5; // set bit to indicate top-down order\n if (hasAlpha)\n {\n hdr[HDR_ORIENTATION] |= 8; // number of alpha bits\n }\n\n if ( !stream->Write(hdr, HDR_SIZE) )\n {\n return wxTGA_IOERR;\n }\n\n\n // Write image data, converting RGB to BGR and adding alpha if applicable\n\n unsigned char *src = image.GetData();\n unsigned char *alpha = image.GetAlpha();\n for (int y = 0; y < size.y; ++y)\n {\n unsigned char *dst = scanlineData.get();\n for (int x = 0; x < size.x; ++x)\n {\n dst[0] = src[2];\n dst[1] = src[1];\n dst[2] = src[0];\n if (alpha)\n {\n dst[3] = *(alpha++);\n }\n src += 3;\n dst += bytesPerPixel;\n }\n if ( !stream->Write(scanlineData.get(), scanlineSize) )\n {\n return wxTGA_IOERR;\n }\n }\n\n return wxTGA_OK;\n}\n\n// ----------------------------------------------------------------------------\n// wxTGAHandler\n// ----------------------------------------------------------------------------\n\nbool wxTGAHandler::LoadFile(wxImage* image,\n wxInputStream& stream,\n bool verbose,\n int WXUNUSED(index))\n{\n if ( !CanRead(stream) )\n {\n if ( verbose )\n {\n wxLogError(wxT(\"TGA: this is not a TGA file.\"));\n }\n\n return false;\n }\n\n image->Destroy();\n\n int error = ReadTGA(image, stream);\n if ( error != wxTGA_OK )\n {\n if ( verbose )\n {\n switch ( error )\n {\n case wxTGA_INVFORMAT:\n wxLogError(wxT(\"TGA: image format unsupported.\"));\n break;\n\n case wxTGA_MEMERR:\n wxLogError(wxT(\"TGA: couldn't allocate memory.\"));\n break;\n\n case wxTGA_IOERR:\n wxLogError(wxT(\"TGA: couldn't read image data.\"));\n break;\n\n default:\n wxLogError(wxT(\"TGA: unknown error!\"));\n }\n }\n\n image->Destroy();\n\n return false;\n }\n\n return true;\n}\n\nbool wxTGAHandler::SaveFile(wxImage* image, wxOutputStream& stream, bool verbose)\n{\n int error = SaveTGA(*image, &stream);\n\n if ( error != wxTGA_OK )\n {\n if ( verbose )\n {\n switch ( error )\n {\n case wxTGA_MEMERR:\n wxLogError(wxT(\"TGA: couldn't allocate memory.\"));\n break;\n\n case wxTGA_IOERR:\n wxLogError(wxT(\"TGA: couldn't write image data.\"));\n break;\n\n default:\n wxLogError(wxT(\"TGA: unknown error!\"));\n }\n }\n\n return false;\n }\n\n return true;\n}\n\nbool wxTGAHandler::DoCanRead(wxInputStream& stream)\n{\n // read the fixed-size TGA headers\n unsigned char hdr[HDR_SIZE];\n stream.Read(hdr, HDR_SIZE); // it's ok to modify the stream position here\n\n // Check whether we can read the file or not.\n\n short colorType = hdr[HDR_COLORTYPE];\n if ( colorType != wxTGA_UNMAPPED && colorType != wxTGA_MAPPED )\n {\n return false;\n }\n\n short imageType = hdr[HDR_IMAGETYPE];\n if ( imageType == 0 || imageType == 32 || imageType == 33 )\n {\n return false;\n }\n\n short bpp = hdr[HDR_BPP];\n if ( bpp != 8 && bpp != 16 && bpp != 24 && bpp != 32 )\n {\n return false;\n }\n\n return true;\n}\n\n#endif // wxUSE_STREAMS\n\n#endif // wxUSE_IMAGE && wxUSE_TGA\n"} +{"text": "using cloudscribe.Core.Models;\nusing cloudscribe.Core.Models.Geography;\nusing Microsoft.EntityFrameworkCore;\nusing Microsoft.EntityFrameworkCore.ChangeTracking;\nusing Microsoft.EntityFrameworkCore.Infrastructure;\nusing System;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace cloudscribe.Core.Storage.EFCore.Common\n{\n public interface ICoreDbContext : IDisposable\n {\n DbSet Countries { get; set; }\n DbSet Roles { get; set; }\n DbSet SiteHosts { get; set; }\n DbSet Sites { get; set; }\n DbSet States { get; set; }\n DbSet UserClaims { get; set; }\n DbSet UserLocations { get; set; }\n DbSet UserLogins { get; set; }\n DbSet UserRoles { get; set; }\n DbSet Users { get; set; }\n DbSet UserTokens { get; set; }\n\n ChangeTracker ChangeTracker { get; }\n\n DatabaseFacade Database { get; }\n\n Task SaveChangesAsync(CancellationToken cancellationToken = default(CancellationToken));\n }\n}"} +{"text": "\n\n \n \n Debug\n AnyCPU\n {040BDCC3-4B4A-4A53-928D-937D33918A47}\n Library\n Properties\n CSharpTest62\n CSharpTest62\n v4.5.2\n 512\n \n \n true\n full\n false\n bin\\Debug\\\n DEBUG;TRACE\n prompt\n 4\n \n \n pdbonly\n true\n bin\\Release\\\n TRACE\n prompt\n 4\n \n \n \n \n \n \n \n \n \n \n \n ..\\CSharpTest1\\bin\\Debug\\CSharpTest1.dll\n \n \n ..\\CSharpTest2\\bin\\Debug\\CSharpTest2.dll\n \n \n ..\\CSharpTest3\\bin\\Debug\\CSharpTest3.dll\n \n \n ..\\CSharpTest4\\bin\\Debug\\CSharpTest4.dll\n \n \n ..\\CSharpTest5\\bin\\Debug\\CSharpTest5.dll\n \n \n ..\\CSharpTest6\\bin\\Debug\\CSharpTest6.dll\n \n \n ..\\CSharpTest7\\bin\\Debug\\CSharpTest7.dll\n \n \n ..\\CSharpTest8\\bin\\Debug\\CSharpTest8.dll\n \n \n ..\\CSharpTest9\\bin\\Debug\\CSharpTest9.dll\n \n \n ..\\CSharpTest10\\bin\\Debug\\CSharpTest10.dll\n \n \n ..\\CSharpTest11\\bin\\Debug\\CSharpTest11.dll\n \n \n ..\\CSharpTest12\\bin\\Debug\\CSharpTest12.dll\n \n \n ..\\CSharpTest13\\bin\\Debug\\CSharpTest13.dll\n \n \n ..\\CSharpTest14\\bin\\Debug\\CSharpTest14.dll\n \n \n ..\\CSharpTest15\\bin\\Debug\\CSharpTest15.dll\n \n \n ..\\CSharpTest16\\bin\\Debug\\CSharpTest16.dll\n \n \n ..\\CSharpTest17\\bin\\Debug\\CSharpTest17.dll\n \n \n ..\\CSharpTest18\\bin\\Debug\\CSharpTest18.dll\n \n \n ..\\CSharpTest19\\bin\\Debug\\CSharpTest19.dll\n \n \n ..\\CSharpTest20\\bin\\Debug\\CSharpTest20.dll\n \n \n ..\\CSharpTest21\\bin\\Debug\\CSharpTest21.dll\n \n \n ..\\CSharpTest22\\bin\\Debug\\CSharpTest22.dll\n \n \n ..\\CSharpTest23\\bin\\Debug\\CSharpTest23.dll\n \n \n ..\\CSharpTest24\\bin\\Debug\\CSharpTest24.dll\n \n \n ..\\CSharpTest25\\bin\\Debug\\CSharpTest25.dll\n \n \n ..\\CSharpTest26\\bin\\Debug\\CSharpTest26.dll\n \n \n ..\\CSharpTest27\\bin\\Debug\\CSharpTest27.dll\n \n \n ..\\CSharpTest28\\bin\\Debug\\CSharpTest28.dll\n \n \n ..\\CSharpTest29\\bin\\Debug\\CSharpTest29.dll\n \n \n ..\\CSharpTest30\\bin\\Debug\\CSharpTest30.dll\n \n \n ..\\CSharpTest31\\bin\\Debug\\CSharpTest31.dll\n \n \n ..\\CSharpTest32\\bin\\Debug\\CSharpTest32.dll\n \n \n ..\\CSharpTest33\\bin\\Debug\\CSharpTest33.dll\n \n \n ..\\CSharpTest34\\bin\\Debug\\CSharpTest34.dll\n \n \n ..\\CSharpTest35\\bin\\Debug\\CSharpTest35.dll\n \n \n ..\\CSharpTest36\\bin\\Debug\\CSharpTest36.dll\n \n \n ..\\CSharpTest37\\bin\\Debug\\CSharpTest37.dll\n \n \n ..\\CSharpTest38\\bin\\Debug\\CSharpTest38.dll\n \n \n ..\\CSharpTest39\\bin\\Debug\\CSharpTest39.dll\n \n \n ..\\CSharpTest40\\bin\\Debug\\CSharpTest40.dll\n \n \n ..\\CSharpTest41\\bin\\Debug\\CSharpTest41.dll\n \n \n ..\\CSharpTest42\\bin\\Debug\\CSharpTest42.dll\n \n \n ..\\CSharpTest43\\bin\\Debug\\CSharpTest43.dll\n \n \n ..\\CSharpTest44\\bin\\Debug\\CSharpTest44.dll\n \n \n ..\\CSharpTest45\\bin\\Debug\\CSharpTest45.dll\n \n \n ..\\CSharpTest46\\bin\\Debug\\CSharpTest46.dll\n \n \n ..\\CSharpTest47\\bin\\Debug\\CSharpTest47.dll\n \n \n ..\\CSharpTest48\\bin\\Debug\\CSharpTest48.dll\n \n \n ..\\CSharpTest49\\bin\\Debug\\CSharpTest49.dll\n \n \n ..\\CSharpTest50\\bin\\Debug\\CSharpTest50.dll\n \n \n ..\\CSharpTest51\\bin\\Debug\\CSharpTest51.dll\n \n \n ..\\CSharpTest52\\bin\\Debug\\CSharpTest52.dll\n \n \n ..\\CSharpTest53\\bin\\Debug\\CSharpTest53.dll\n \n \n ..\\CSharpTest54\\bin\\Debug\\CSharpTest54.dll\n \n \n ..\\CSharpTest55\\bin\\Debug\\CSharpTest55.dll\n \n \n ..\\CSharpTest56\\bin\\Debug\\CSharpTest56.dll\n \n \n ..\\CSharpTest57\\bin\\Debug\\CSharpTest57.dll\n \n \n ..\\CSharpTest58\\bin\\Debug\\CSharpTest58.dll\n \n \n ..\\CSharpTest59\\bin\\Debug\\CSharpTest59.dll\n \n \n ..\\CSharpTest60\\bin\\Debug\\CSharpTest60.dll\n \n \n ..\\CSharpTest61\\bin\\Debug\\CSharpTest61.dll\n \n \n \n\n \n \n\n \n \n \n"} +{"text": "#tb 0: 100/2397\n0, 0, 0, 1, 144768, 0xef48043f\n"} +{"text": "/*\r\n\r\nCopyright 2000-12 Miranda IM, 2012-20 Miranda NG team,\r\nall portions of this codebase are copyrighted to the people\r\nlisted in contributors.txt.\r\n\r\nThis program is free software; you can redistribute it and/or\r\nmodify it under the terms of the GNU General Public License\r\nas published by the Free Software Foundation; either version 2\r\nof the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful,\r\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\r\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r\nGNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License\r\nalong with this program; if not, write to the Free Software\r\nFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\r\n*/\r\n\r\n#include \"stdafx.h\"\r\n\r\nint LoadSendRecvMessageModule(void);\r\nvoid SplitmsgShutdown(void);\r\n\r\nCMPlugin g_plugin;\r\n\r\n/////////////////////////////////////////////////////////////////////////////////////////\r\n\r\nPLUGININFOEX pluginInfoEx = {\r\n\tsizeof(PLUGININFOEX),\r\n\t__PLUGIN_NAME,\r\n\tMIRANDA_VERSION_DWORD,\r\n\t__DESCRIPTION,\r\n\t__AUTHOR,\r\n\t__COPYRIGHT,\r\n\t__AUTHORWEB,\r\n\tUNICODE_AWARE,\r\n\t{ 0x657fe89b, 0xd121, 0x40c2, { 0x8a, 0xc9, 0xb9, 0xfa, 0x57, 0x55, 0xb3, 0x0D } } //{657FE89B-D121-40c2-8AC9-B9FA5755B30D}\r\n};\r\n\r\nCMPlugin::CMPlugin() :\r\n\tPLUGIN(SRMMMOD, pluginInfoEx)\r\n{}\r\n\r\n/////////////////////////////////////////////////////////////////////////////////////////\r\n\r\nextern \"C\" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_SRMM, MIID_LAST };\r\n\r\n/////////////////////////////////////////////////////////////////////////////////////////\r\n\r\nint CMPlugin::Load()\r\n{\r\n\thLogger = RegisterSrmmLog(\"built-in\", L\"StdMsg internal log\", &logBuilder);\r\n\r\n\tLoad_ChatModule();\r\n\treturn LoadSendRecvMessageModule();\r\n}\r\n\r\n/////////////////////////////////////////////////////////////////////////////////////////\r\n\r\nint CMPlugin::Unload()\r\n{\r\n\tUnregisterSrmmLog(hLogger);\r\n\tSplitmsgShutdown();\r\n\tUnload_ChatModule();\r\n\treturn 0;\r\n}\r\n"} +{"text": "receivers:\n multireceiver:\nexporters:\nprocessors:\n exampleprocessor:\npipelines:\n traces:\n receivers: [invalidreceivername]\n"} +{"text": "\n/*\n * font_nelson_cole2:\n * 2018 - Create by Fred Nora.\n * Based on original font Nelson Cole. \n */\n\n\nstatic unsigned char font_nelson_cole2[128*8] = {\n\t\n//0 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000 \n\n//1\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n \n//2 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n \n//3 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n \n//4 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n//5 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n//6 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n//7 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n//8\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n//9\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n//10 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n//11 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n \n//12 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n \n//13 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n \n//14 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n//15 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n//16 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n//17 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n \n//18 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n//19 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n\n//20 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n//21 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n \n \n//22 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n//23 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n \n//24 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n//25 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n//26 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n \n//27 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n//28 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n//29 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n//30 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t\n\t\n//31 \n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n\n\t/* 32 0x20 ' ' */\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n\t/* 33 0x21 '!' */\n\t0x18, // 00011000\n\t0x3c, // 00111100\n\t0x3c, // 00111100\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x00, // 00000000\n\t0x18, // 00011000\n\t0x00, // 00000000\n\n\t/* 34 0x22 '\"' */\n\t0x66, // 01100110\n\t0x66, // 01100110\n\t0x24, // 00100100\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n\t/* 35 0x23 '#' */\n\t0x6c, // 01101100\n\t0x6c, // 01101100\n\t0xfe, // 11111110\n\t0x6c, // 01101100\n\t0xfe, // 11111110\n\t0x6c, // 01101100\n\t0x6c, // 01101100\n\t0x00, // 00000000\n\n\t/* 36 0x24 '$' */\n\t0x18, // 00011000 \n\t0x3e, // 00111110\n\t0x60, // 01100000 \n\t0x3c, // 00111100 \n\t0x06, // 00000110\n\t0x7c, // 01111100 \n\t0x18, // 00011000 \n\t0x00, // 00000000 \n\n\t/* 37 0x25 '%' */\n\t0x00, // 00000000 \n\t0xc6, // 11000110 \n\t0xcc, // 11001100 \n\t0x18, // 00011000 \n\t0x30, // 00110000 \n\t0x66, // 01100110 \n\t0xc6, // 11000110 \n\t0x00, // 00000000 \n\n\t/* 38 0x26 '&' */\n\t0x38, // 00111000\n\t0x6c, // 01101100\n\t0x38, // 00111000\n\t0x76, // 01110110 \n\t0xdc, // 11011100\n\t0xcc, // 11001100 \n\t0x76, // 01110110\n\t0x00, // 00000000\n\n\t/* 39 0x27 ''' */\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x30, // 00110000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n\t/* 40 0x28 '(' */\n\t0x0c, // 00001100\n\t0x18, // 00011000\n\t0x30, // 00110000\n\t0x30, // 00110000\n\t0x30, // 00110000\n\t0x18, // 00011000\n\t0x0c, // 00001100\n\t0x00, // 00000000\n\n\t/* 41 0x29 ')' */\n\t0x30, // 00110000\n\t0x18, // 00011000\n\t0x0c, // 00001100\n\t0x0c, // 00001100\n\t0x0c, // 00001100\n\t0x18, // 00011000\n\t0x30, // 00110000\n\t0x00, // 00000000\n\n\t/* 42 0x2A '*' */\n\t0x00, // 00000000\n\t0x66, // 01100110\n\t0x3c, // 00111100\n\t0xff, // 11111111\n\t0x3c, // 00111100\n\t0x66, // 01100110\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n\t/* 43 0x2B '+' */\n\t0x00, // 00000000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x7e, // 01111110\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n\t/* 44 0x2C ',' */\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x30, // 00110000\n\n\t/* 45 0x2D '-' */\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x7e, // 01111110\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n\t/* 46 0x2E '.' */\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x00, // 00000000\n\n\t/* 47 0x2F '/' */\n\t0x06, // 00000110\n\t0x0c, // 00001100\n\t0x18, // 00011000\n\t0x30, // 00110000\n\t0x60, // 01100000\n\t0xc0, // 11000000\n\t0x80, // 10000000\n\t0x00, // 00000000\n\n\t/* 48 0x30 '0' */\n\t0x38, // 00111000\n\t0x6c, // 01101100\n\t0xc6, // 11000110\n\t0xd6, // 11010110\n\t0xc6, // 11000110\n\t0x6c, // 01101100\n\t0x38, // 00111000\n\t0x00, // 00000000\n\n\t/* 49 0x31 '1' */\n\t0x18, // 00011000 \n\t0x38, // 00111000 \n\t0x18, // 00011000 \n\t0x18, // 00011000 \n\t0x18, // 00011000\n\t0x18, // 00011000 \n\t0x7e, // 01111110 \n\t0x00, // 00000000\n\n\t/* 50 0x32 '2' */\n\t0x7c, // 01111100\n\t0xc6, // 11000110\n\t0x06, // 00000110\n\t0x1c, // 00011100\n\t0x30, // 00110000\n\t0x66, // 01100110\n\t0xfe, // 11111110\n\t0x00, // 00000000\n\n\t/* 51 0x33 '3' */\n\t0x7c, // 01111100\n\t0xc6, // 11000110\n\t0x06, // 00000110\n\t0x3c, // 00111100\n\t0x06, // 00000110\n\t0xc6, // 11000110\n\t0x7c, // 01111100\n\t0x00, // 00000000\n\n\t/* 52 0x34 '4' */\n\t0x1c, // 00011100\n\t0x3c, // 00111100\n\t0x6c, // 01101100\n\t0xcc, // 11001100\n\t0xfe, // 11111110\n\t0x0c, // 00001100\n\t0x1e, // 00011110\n\t0x00, // 00000000\n\n\t/* 53 0x35 '5' */\n\t0xfe, // 11111110\n\t0xc0, // 11000000\n\t0xc0, // 11000000\n\t0xfc, // 11111100\n\t0x06, // 00000110\n\t0xc6, // 11000110\n\t0x7c, // 01111100\n\t0x00, // 00000000\n\n\t/* 54 0x36 '6' */\n\t0x38, // 00111000\n\t0x60, // 01100000\n\t0xc0, // 11000000\n\t0xfc, // 11111100\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0x7c, // 01111100\n\t0x00, // 00000000\n\n\t/* 55 0x37 '7' */\n\t0xfe, // 11111110\n\t0xc6, // 11000110\n\t0x0c, // 00001100\n\t0x18, // 00011000\n\t0x30, // 00110000\n\t0x30, // 00110000\n\t0x30, // 00110000\n\t0x00, // 00000000\n\n\t/* 56 0x38 '8' */\n\t0x7c, // 01111100\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0x7c, // 01111100\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0x7c, // 01111100\n\t0x00, // 00000000\n\n\t/* 57 0x39 '9' */\n\t0x7c, // 01111100\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0x7e, // 01111110\n\t0x06, // 00000110\n\t0x0c, // 00001100\n\t0x78, // 01111000\n\t0x00, // 00000000\n\n\t/* 58 0x3A ':' */\n\t0x00, // 00000000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x00, // 00000000\n\n\t/* 59 0x3B ';' */\n\t0x00, // 00000000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x30, // 00110000\n\n\t/* 60 0x3C '<' */\n\t0x06, // 00000110\n\t0x0c, // 00001100\n\t0x18, // 00011000\n\t0x30, // 00110000\n\t0x18, // 00011000\n\t0x0c, // 00001100\n\t0x06, // 00000110\n\t0x00, // 00000000\n\n\t/* 61 0x3D '=' */\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x7e, // 01111110\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x7e, // 01111110\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n\t/* 62 0x3E '>' */\n\t0x60, // 01100000 \n\t0x30, // 00110000\n\t0x18, // 00011000\n\t0x0c, // 00001100\n\t0x18, // 00011000\n\t0x30, // 00110000\n\t0x60, // 01100000\n\t0x00, // 00000000\n\n\t/* 63 0x3F '?' */\n\t0x7c, // 01111100\n\t0xc6, // 11000110\n\t0x0c, // 00001100\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x00, // 00000000\n\t0x18, // 00011000\n\t0x00, // 00000000\n\n\t/* 64 0x40 '@' */\n\t0x7c, // 01111100\n\t0xc6, // 11000110\n\t0xde, // 11011110\n\t0xde, // 11011110\n\t0xde, // 11011110\n\t0xc0, // 11000000\n\t0x78, // 01111000\n\t0x00, // 00000000\n\n\n \t/* 65 0x41 'A' */\n \t0x38, // 00111000\n\t0x6c, // 01101100\n\t0xc6, // 11000110\n\t0xfe, // 11111110\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n \t0x00, // 00000000\n\t\n\t/* 66 0x42 'B' */\n\t0xfc, // 11111100\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xfc, // 11111100\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xfc, // 11111100\n\t0x00, // 00000000\n\t\n \t/* 67 0x43 'C' */\n\t0x7c, // 01111100\n\t0xc6, // 11000110\n\t0xc0, // 11000000\n\t0xc0, // 11000000\n\t0xc0, // 11000000\n\t0xc6, // 11000110\n\t0x7c, // 01111100\n\t0x00, // 00000000\n\t\n\t/*68 0x44 'D' */\n\t0xfc, // 11111100\n\t0x66, // 01100110\n\t0x66, // 01100110\n\t0x66, // 01100110\n\t0x66, // 01100110\n\t0x66, // 01100110\n\t0xfc, // 11111100\n\t0x00, // 00000000\n\t\n\t/* 69 0x45 'E' */\n\t0xfe, // 11111110\n\t0xc0, // 11000000\n\t0xc0, // 11000000\n\t0xfe, // 11111110\n\t0xc0, // 11000000\n\t0xc0, // 11000000\n\t0xfe, // 11111110\n\t0x00, // 00000000\n\t\n \t/*\t70 0x46 'F' */\t\t\n\t0xfe, // 11111110\n\t0xc0, // 11000000\n\t0xc0, // 11000000\n\t0xfe, // 11111110\n\t0xc0, // 11000000\n\t0xc0, // 11000000\n\t0xc0, // 11000000\n\t0x00, // 00000000\n\n\n\t/*\t71 0x47 'G' */\n\t0x7c, // 01111100\n\t0xc6, // 11000110\n\t0xc0, // 11000000\n\t0xce, // 11001110\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0x7e, // 01111110\n\t0x00, // 00000000\n\n\n\t/*\t72 0x48 'H' */\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xfe, // 11111110\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0x00, // 00000000\n\t\n\t/* 73 0x49 'I' */\n\t0x7e, // 01111110\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x7e, // 01111110\n\t0x00, // 00000000\n\n\t/* 74 0x4A 'J' */\n\t0x3e, // 00111110\n\t0x0c, // 00001100\n\t0x0c, // 00001100\n\t0x0c, // 00001100\n\t0x0c, // 00001100\n\t0xcc, // 11001100\n\t0xf8, // 11111000\n\t0x00, // 00000000\n\n\n\t/* 75 0x4B 'K' */\n\t0xc6, // 11000110\n\t0xcc, // 11001100\n\t0xd8, // 11011000\n\t0xf0, // 11110000\n\t0xd8, // 11011000\n\t0xcc, // 11001100\n\t0xc6, // 11000110\n\t0x00, // 00000000\n\n\t/* 76 0x4C 'L' */\n\t0xc0, // 11000000\n\t0xc0, // 11000000\n\t0xc0, // 11000000\n\t0xc0, // 11000000\n\t0xc0, // 11000000\n\t0xc0, // 11000010\n\t0xfe, // 11111110\n\t0x00, // 00000000\n\t\n\t/* 77 0x4D 'M' */\n\t0xc6, // 11000110\n\t0xee, // 11101110\n\t0xfe, // 11111110\n\t0xfe, // 11111110\n\t0xd6, // 11010110\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0x00, // 00000000\n\n\t/* 78 0x4F 'N' */\n \t0xc6, // 11000110\n \t0xe6, // 11100110\n \t0xf6, // 11110110\n\t0xfe, // 11111110\n\t0xde, // 11011110\n\t0xce, // 11001110\n\t0xc6, // 11000110\n\t0x00, // 00000000\n\t/* 79 0x50 'O' */\n\t0x7c, // 01111100\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0x7c, // 01111100\n\t0x00, // 00000000\n\n\n\t/* 80 0x51 'P' */\n\t0xfc, // 11111100\n\t0xc6, // 11000110 \n\t0xc6, // 11000110\n\t0xfc, // 11111100\n\t0xc0, // 11000000\n\t0xc0, // 11000000\n\t0xc0, // 11000000\n\t0x00, // 00000000\n\t\n\t/* 81 0x52 'Q' */\n \t0x7c, // 01111100\n \t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xce, // 11001110\n\t0x7c, // 01111100\n\t0x0e, // 00001110\n\t\n\t/* 82 0x53 'R' */\n\t0xfc, // 11111100\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xfc, // 11111100\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0x00, // 00000000\n\n \t/* 83 0x54 'S' */\n\t0x7e, // 01111110\n\t0xc0, // 11000000\n\t0xc0, // 11000000\n\t0x7c, // 01111100\n\t0x06, // 00000110\n\t0x06, // 00000110\n\t0xfc, // 11111100\n\t0x00, // 00000000\n\n\t/* 84 0x55 'T' */\n\t0x7e, // 01111110\n\t0x18, // 01111110\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x00, // 00000000\n\t\n\t/* 85 0x56 'U' */\n\t0xc6, // 11000110\n\t0xc6, // 11000110\t\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0x7c, // 01111100\n\t0x00, // 00000000\n\n\t/* 86 0x57 'V' */\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0x6c, // 01101100\n\t0x38, // 00111000\n\t0x10, // 00010000\n\t0x00, // 00000000\n\n\t/* 87 0x58 'W' */\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xd6, // 11010110\n\t0xfe, // 11111110\n\t0xfe, // 11111110\n\t0xee, // 11101110\n\t0xc6, // 11000110\n\t0x00, // 00000000\n\n\t/* 88 0x59 'X' */\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0x6c, // 01101100\n\t0x38, // 00111000\n\t0x6c, // 01101100\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0x00, // 00000000\n\t\n\t\n\t/* 89 0x50 'Y' */\n \t0x66, // 01100110\n\t0x66, // 01100110\n\t0x66, // 01100110\n\t0x3c, // 00111100\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x3c, // 00111100\n\t0x00, // 00000000\n\n\t/* 90 0x5A 'Z' */\n\t0xfe, // 11111110\n\t0xc6, // 11000110\n\t0x0c, // 00001100\n\t0x18, // 00011000\n\t0x32, // 00110010\n\t0x66, // 01100110\n\t0xfe, // 11111110\n\t0x00, // 00000000\n\n\t/* 91 0x5B '[' */\n\t0x3c, // 00111100\n\t0x30, // 00110000\n\t0x30, // 00110000\n\t0x30, // 00110000\n\t0x30, // 00110000\n\t0x30, // 00110000\n\t0x3c, // 00111100\n\t0x00, // 00000000\t\n\t\n\t/* 92 0x5C '\\' */\n\t0xc0, // 11000000\n\t0x60, // 01100000\n\t0x30, // 00110000\n\t0x18, // 00011000\n\t0x0c, // 00001100\n\t0x06, // 00000110\n\t0x02, // 00000010\n\t0x00, // 00000000\n\n\t/* 93 0x5D ']' */\n\t0x3c, // 00111100\n\t0x0c, // 00001100\n\t0x0c, // 00001100\n\t0x0c, // 00001100\n\t0x0c, // 00001100\n\t0x0c, // 00001100\n\t0x3c, // 00111100\n\t0x00, // 00000000\n\n\t/* 94 0x5E '^' */\n\t0x10, // 00010000\n\t0x38, // 00111000\n\t0x6c, // 01101100\n\t0xc6, // 11000110\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n\t/* 95 0x5F '_' */\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0xff, // 11111111\n\t0x00, // 00000000\n\t\n\t/* 96 0x60 '`' */\n\t0x30, // 0011000\n\t0x18, // 00011000\n\t0x0c, // 00001100\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t\n\t/* 97 0x61 'a' */\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x78, // 01111000\n\t0x0c, // 00001100\n\t0x7c, // 01111100\n\t0xcc, // 11001100\n\t0x76, // 01110110\n\t0x00, // 00000000\n\t\n\t/* 98 0x62 'b' */\n\t0xc0, // 11000000\n\t0xc0, // 11000000\n\t0xc0, // 11000000\n\t0xfc, // 11111100\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xfc, // 11111100\n\t0x00, // 00000000\n\n\t/* 99 0x63 'c' */\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x7c, // 01111100\n\t0xc6, // 11000110\n\t0xc0, // 11000000\n\t0xc6, // 11000110\n\t0x7c, // 01111100\n\t0x00, // 00000000\n\n\t/* 100 0x64 'd' */\n\t0x06, // 00000110\n\t0x06, // 00000110\n\t0x06, // 00000110\n\t0x7e, // 01111110\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0x7e, // 01111110\n\t0x00, // 00000000\n\n\t/* 101 0x65 'e' */\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x7c, // 01111100\n\t0xc6, // 11000110\n\t0xfc, // 11111100\n\t0xc0, // 11000000\n\t0x7e, // 01111110\n\t0x00, // 00000000\n\t\n\t/* 102 0x66 'f' */\n\t0x3e, // 00111110\n\t0x60, // 01100000\n\t0xfe, // 11111110\n\t0x60, // 01100000\n\t0x60, // 01100000\n\t0x60, // 01100000\n\t0x60, // 01100000\n\t0x00, // 00000000\n\n\t\n\n\t/* 103 0x67 'g' */\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x7e, // 01111110\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0x7e, // 01111110\n\t0x06, // 00000110\n\t0xfc, // 11111100\n\n\t/* 104 0x68 'h' */\n\t0xc0, // 11000000\n\t0xc0, // 11000000\n\t0xc0, // 11000000\n\t0xfc, // 11111100\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0x00, // 00000000\n\n\t/* 105 0x69 'i' */\n\t0x18, // 00011000\n\t0x00, // 00000000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x00, // 00000000\n\n\t/* 106 0x6A 'j' */\n\t0x18, // 00011000\n\t0x00, // 00000000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0xf0, // 11110000\n\t0x00, // 00000000\n\n\t/* 107 0x6B 'k' */\n\t0x60, // 01100000\n\t0x60, // 01100000\n\t0x66, // 01100110\n\t0x6c, // 01101100\n\t0x78, // 01111000\n\t0x6c, // 01101100\n\t0x66, // 01100110\n\t0x00, // 00000000\n\t\n\t/* 108 0x6C 'l' */\n\t0x70, // 01110000\n\t0x30, // 00110000\n\t0x30, // 00110000\n\t0x30, // 00110000\n\t0x30, // 00110000\n\t0x30, // 00110000 \n\t0x78, // 01111000\n\t0x00, // 00000000\n\n\t/* 109 0x6D 'm' */\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0xec, // 11101100\n\t0xfe, // 11111110\n\t0xd6, // 11010110\n\t0xd6, // 11010110\n\t0xd6, // 11010110\n\t0x00, // 00000000\n\t\n\n\t/* 110 0x6E 'n' */\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0xdc, // 11011100\n\t0x66, // 01100110\n\t0x66, // 01100110\n\t0x66, // 01100110\n\t0x66, // 01100110\n\t0x00, // 00000000\n\n\t/* 111 0x6F 'o' */\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x7c, // 01111100\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0x7c, // 01111100\n\t0x00, // 00000000\n\n\t/* 112 0x70 'p' */\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0xfc, // 11111100\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xfc, // 11111100\n\t0xc0, // 11000000\n\t0xc0, // 11000000\n\n\t/* 113 0x71 'q' */\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x7e, // 01111110\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0x7e, // 01111110\n\t0x06, // 00000110\n\t0x06, // 00000110\n\n\t/* 114 0x72 'r' */\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0xdc, // 11011100\n\t0x76, // 01110110\n\t0x60, // 01100000\n\t0x60, // 01100000\n\t0xf0, // 11110000\n\t0x00, // 00000000\n\n\n\t/* 115 0x73 's' */\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x7e, // 01111110\n\t0xc0, // 11000000\n\t0x7c, // 01111100\n\t0x06, // 00000110\n\t0xfc, // 11111100\n\t0x00, // 00000000\n\n\t/* 116 0x74 't' */\n\t0x60, // 01100000\n\t0x60, // 01100000\n\t0xf8, // 11111000\n\t0x60, // 01100000\n\t0x60, // 01100000\n\t0x60, // 01100000\n\t0x3c, // 00111100\n\t0x00, // 00000000\n\n\t/* 117 0x75 'u' */\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0xcc, // 11001100\n\t0xcc, // 11001100\n\t0xcc, // 11001100\n\t0xcc, // 11001100\n\t0x76, // 01110110\n\t0x00, // 00000000\n\t\n\t/* 118 0x76 'v' */\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x66, // 01100110\n\t0x66, // 01100110\n\t0x66, // 01100110\n\t0x3c, // 00111100\n\t0x18, // 00011000\n\t0x00, // 00000000\n\t\n\t/* 120 0x77 'w' */\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0xc6, // 11000110\n\t0xd6, // 11010110\n\t0xfe, // 11111110\n\t0xfe, // 11111110\n\t0xc6, // 11000110\n\t0x00, // 00000000\n\t\n\n\t/* 119 0x78 'x' */\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0xc6, // 11000110\n\t0x6c, // 01101100\n\t0x38, // 00111000\n\t0x6c, // 01101100\n\t0xc6, // 11000110\n\t0x00, // 00000000\n\n\t\n\t/* 121 0x79 'y' */\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0x7e, // 01111110\n\t0x06, // 00000110\n\t0xfc, // 11111100\n\n\n\t/* 122 0x7A 'z' */\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x7e, // 01111110\n\t0x0c, // 00001100\n\t0x18, // 00011000\n\t0x30, // 00110000\n\t0x7e, // 01111110\n\t0x00, // 00000000\n\n\t/* 123 0x7B '{' */\n\t0x0e, // 00001110\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x70, // 01110000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x0e, // 00001110\n\t0x00, // 00000000\n\n\t/* 124 0x7C '|' */\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x00, // 00000000\n\n\t/* 125 0x7d '}' */\n\t0x70, // 01110000\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x0e, // 00001110\n\t0x18, // 00011000\n\t0x18, // 00011000\n\t0x70, // 01110000\n\t0x00, // 00000000\n\n\t/* 126 0x7e '~' */\n\t0x76, // 01110110\n\t0xdc, // 11011100\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\t0x00, // 00000000\n\n\t/* 127 0x7f Del */\n\t0x00, // 00000000\n\t0x10, // 00010000\n\t0x38, // 00111000\n\t0x6c, // 01101100\n\t0xc6, // 11000110\n\t0xc6, // 11000110\n\t0xfe, // 11111110\n\t0x00, // 00000000\n\t\n\n};\n\n\n\n/*\n\n\nvoid *font_vga_8x8 = {\n\t0,\n\t8,\n\t8,\n\tfont_data_8x8,\n\t0\n}; */\n\n\n"} +{"text": "// This defines the interface to the QsciDocument class.\n//\n// Copyright (c) 2019 Riverbank Computing Limited \n// \n// This file is part of QScintilla.\n// \n// This file may be used under the terms of the GNU General Public License\n// version 3.0 as published by the Free Software Foundation and appearing in\n// the file LICENSE included in the packaging of this file. Please review the\n// following information to ensure the GNU General Public License version 3.0\n// requirements will be met: http://www.gnu.org/copyleft/gpl.html.\n// \n// If you do not wish to use this file under the terms of the GPL version 3.0\n// then you may purchase a commercial license. For more information contact\n// info@riverbankcomputing.com.\n// \n// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE\n// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\n\n\n#ifndef QSCIDOCUMENT_H\n#define QSCIDOCUMENT_H\n\n#include \n\n\nclass QsciScintillaBase;\nclass QsciDocumentP;\n\n\n//! \\brief The QsciDocument class represents a document to be edited.\n//!\n//! It is an opaque class that can be attached to multiple instances of\n//! QsciScintilla to create different simultaneous views of the same document.\n//! QsciDocument uses implicit sharing so that copying class instances is a\n//! cheap operation.\nclass QSCINTILLA_EXPORT QsciDocument\n{\npublic:\n //! Create a new unattached document.\n QsciDocument();\n virtual ~QsciDocument();\n\n QsciDocument(const QsciDocument &);\n QsciDocument &operator=(const QsciDocument &);\n\nprivate:\n friend class QsciScintilla;\n\n void attach(const QsciDocument &that);\n void detach();\n void display(QsciScintillaBase *qsb, const QsciDocument *from);\n void undisplay(QsciScintillaBase *qsb);\n\n bool isModified() const;\n void setModified(bool m);\n\n QsciDocumentP *pdoc;\n};\n\n#endif\n"} +{"text": "// This file is part of libigl, a simple c++ geometry processing library.\n//\n// Copyright (C) 2013 Alec Jacobson \n//\n// This Source Code Form is subject to the terms of the Mozilla Public License\n// v. 2.0. If a copy of the MPL was not distributed with this file, You can\n// obtain one at http://mozilla.org/MPL/2.0/.\n#include \"per_corner_normals.h\"\n\n#include \"vertex_triangle_adjacency.h\"\n#include \"per_face_normals.h\"\n#include \"PI.h\"\n\ntemplate \nIGL_INLINE void igl::per_corner_normals(\n const Eigen::PlainObjectBase& V,\n const Eigen::PlainObjectBase& F,\n const double corner_threshold,\n Eigen::PlainObjectBase & CN)\n{\n using namespace Eigen;\n using namespace std;\n Eigen::Matrix FN;\n per_face_normals(V,F,FN);\n vector > VF,VFi;\n vertex_triangle_adjacency(V,F,VF,VFi);\n return per_corner_normals(V,F,FN,VF,corner_threshold,CN);\n}\n\ntemplate <\n typename DerivedV, \n typename DerivedF, \n typename DerivedFN, \n typename DerivedCN>\nIGL_INLINE void igl::per_corner_normals(\n const Eigen::PlainObjectBase& V,\n const Eigen::PlainObjectBase& F,\n const Eigen::PlainObjectBase& FN,\n const double corner_threshold,\n Eigen::PlainObjectBase & CN)\n{\n using namespace Eigen;\n using namespace std;\n vector > VF,VFi;\n vertex_triangle_adjacency(V,F,VF,VFi);\n return per_corner_normals(V,F,FN,VF,corner_threshold,CN);\n}\n\ntemplate <\n typename DerivedV, \n typename DerivedF, \n typename DerivedFN, \n typename IndexType,\n typename DerivedCN>\nIGL_INLINE void igl::per_corner_normals(\n const Eigen::PlainObjectBase& /*V*/,\n const Eigen::PlainObjectBase& F,\n const Eigen::PlainObjectBase& FN,\n const std::vector >& VF,\n const double corner_threshold,\n Eigen::PlainObjectBase & CN)\n{\n using namespace Eigen;\n using namespace std;\n\n // number of faces\n const int m = F.rows();\n // valence of faces\n const int n = F.cols();\n\n // initialize output to ***zero***\n CN.setZero(m*n,3);\n\n // loop over faces\n for(size_t i = 0;int(i) fn = FN.row(i);\n // loop over corners\n for(size_t j = 0;int(j) &incident_faces = VF[F(i,j)];\n // loop over faces sharing vertex of this corner\n for(int k = 0;k<(int)incident_faces.size();k++)\n {\n Eigen::Matrix ifn = FN.row(incident_faces[k]);\n // dot product between face's normal and other face's normal\n double dp = fn.dot(ifn);\n // if difference in normal is slight then add to average\n if(dp > cos(corner_threshold*PI/180))\n {\n // add to running sum\n CN.row(i*n+j) += ifn;\n // else ignore\n }else\n {\n }\n }\n // normalize to take average\n CN.row(i*n+j).normalize();\n }\n }\n}\n#ifdef IGL_STATIC_LIBRARY\n// Explicit template instantiation\n// generated by autoexplicit.sh\ntemplate void igl::per_corner_normals, Eigen::Matrix >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, double, Eigen::PlainObjectBase >&);\ntemplate void igl::per_corner_normals, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, double, Eigen::PlainObjectBase >&);\ntemplate void igl::per_corner_normals, Eigen::Matrix >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, double, Eigen::PlainObjectBase >&);\ntemplate void igl::per_corner_normals, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, double, Eigen::PlainObjectBase >&);\n#endif\n"} +{"text": "package net.shadowmage.ancientwarfare.automation.block;\n\nimport codechicken.lib.model.ModelRegistryHelper;\nimport codechicken.lib.model.bakery.CCBakeryModel;\nimport codechicken.lib.model.bakery.IBakeryProvider;\nimport codechicken.lib.model.bakery.ModelBakery;\nimport codechicken.lib.model.bakery.generation.IBakery;\nimport net.minecraft.block.state.IBlockState;\nimport net.minecraft.client.renderer.block.model.ModelResourceLocation;\nimport net.minecraft.client.renderer.block.statemap.StateMapperBase;\nimport net.minecraft.client.renderer.texture.TextureAtlasSprite;\nimport net.minecraft.tileentity.TileEntity;\nimport net.minecraft.util.math.BlockPos;\nimport net.minecraft.world.IBlockAccess;\nimport net.minecraft.world.World;\nimport net.minecraftforge.client.model.ModelLoader;\nimport net.minecraftforge.common.property.IExtendedBlockState;\nimport net.minecraftforge.fml.relauncher.Side;\nimport net.minecraftforge.fml.relauncher.SideOnly;\nimport net.shadowmage.ancientwarfare.automation.render.TorqueJunctionRenderer;\nimport net.shadowmage.ancientwarfare.automation.render.property.AutomationProperties;\nimport net.shadowmage.ancientwarfare.automation.tile.torque.TileConduitHeavy;\nimport net.shadowmage.ancientwarfare.automation.tile.torque.TileConduitLight;\nimport net.shadowmage.ancientwarfare.automation.tile.torque.TileConduitMedium;\nimport net.shadowmage.ancientwarfare.core.render.BlockStateKeyGenerator;\nimport net.shadowmage.ancientwarfare.core.render.property.CoreProperties;\nimport net.shadowmage.ancientwarfare.core.util.ModelLoaderHelper;\n\npublic class BlockTorqueJunction extends BlockTorqueTransportSided implements IBakeryProvider {\n\tpublic BlockTorqueJunction(String regName) {\n\t\tsuper(regName);\n\t}\n\n\t@Override\n\t@SideOnly(Side.CLIENT)\n\tpublic IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {\n\t\treturn TorqueJunctionRenderer.INSTANCE.handleState((IExtendedBlockState) state, world, pos);\n\t}\n\n\t@Override\n\tpublic TileEntity createTileEntity(World world, IBlockState state) {\n\t\tswitch (state.getValue(AutomationProperties.TIER)) {\n\t\t\tcase LIGHT:\n\t\t\t\treturn new TileConduitLight();\n\t\t\tcase MEDIUM:\n\t\t\t\treturn new TileConduitMedium();\n\t\t\tcase HEAVY:\n\t\t\t\treturn new TileConduitHeavy();\n\t\t}\n\t\treturn new TileConduitLight();\n\t}\n\n\t@Override\n\t@SideOnly(Side.CLIENT)\n\tpublic void registerClient() {\n\t\tModelLoaderHelper.registerItem(this, \"automation\", \"light\", false); //the actual switch for itemstack types is processed by renderer\n\n\t\tModelBakery.registerBlockKeyGenerator(this, new BlockStateKeyGenerator.Builder().addKeyProperties(AutomationProperties.TIER).addKeyProperties(CoreProperties.UNLISTED_FACING, AutomationProperties.DYNAMIC).addKeyProperties(BlockTorqueTransportSided.CONNECTIONS).addKeyProperties(o -> String.format(\"%.6f\", o), AutomationProperties.ROTATIONS).build());\n\n\t\tModelLoader.setCustomStateMapper(this, new StateMapperBase() {\n\t\t\t@Override\n\t\t\t@SideOnly(Side.CLIENT)\n\t\t\tprotected ModelResourceLocation getModelResourceLocation(IBlockState state) {\n\t\t\t\tswitch (state.getValue(AutomationProperties.TIER)) {\n\t\t\t\t\tcase LIGHT:\n\t\t\t\t\t\treturn TorqueJunctionRenderer.LIGHT_MODEL_LOCATION;\n\t\t\t\t\tcase MEDIUM:\n\t\t\t\t\t\treturn TorqueJunctionRenderer.MEDIUM_MODEL_LOCATION;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn TorqueJunctionRenderer.HEAVY_MODEL_LOCATION;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tModelRegistryHelper.register(TorqueJunctionRenderer.LIGHT_MODEL_LOCATION, new CCBakeryModel() {\n\t\t\t@Override\n\t\t\t@SideOnly(Side.CLIENT)\n\t\t\tpublic TextureAtlasSprite getParticleTexture() {\n\t\t\t\treturn TorqueJunctionRenderer.INSTANCE.getSprite(TorqueTier.LIGHT);\n\t\t\t}\n\t\t});\n\n\t\tModelRegistryHelper.register(TorqueJunctionRenderer.MEDIUM_MODEL_LOCATION, new CCBakeryModel() {\n\t\t\t@Override\n\t\t\t@SideOnly(Side.CLIENT)\n\t\t\tpublic TextureAtlasSprite getParticleTexture() {\n\t\t\t\treturn TorqueJunctionRenderer.INSTANCE.getSprite(TorqueTier.MEDIUM);\n\t\t\t}\n\t\t});\n\n\t\tModelRegistryHelper.register(TorqueJunctionRenderer.HEAVY_MODEL_LOCATION, new CCBakeryModel() {\n\t\t\t@Override\n\t\t\t@SideOnly(Side.CLIENT)\n\t\t\tpublic TextureAtlasSprite getParticleTexture() {\n\t\t\t\treturn TorqueJunctionRenderer.INSTANCE.getSprite(TorqueTier.HEAVY);\n\t\t\t}\n\t\t});\n\t}\n\n\t@Override\n\t@SideOnly(Side.CLIENT)\n\tpublic IBakery getBakery() {\n\t\treturn TorqueJunctionRenderer.INSTANCE;\n\t}\n}\n"} +{"text": "\nchecker-help:\n\t@echo ' coccicheck - Check with Coccinelle.'\n"} +{"text": "// SPDX-License-Identifier: BSD-2-Clause\n/*\n * Copyright 2019 Broadcom.\n */\n\n#include \n#include \n#include \n#include \n\n#define GPIO_SERVICE_UUID \\\n\t\t{ 0x6272636D, 0x2018, 0x1101, \\\n\t\t{ 0x42, 0x43, 0x4D, 0x5F, 0x47, 0x50, 0x49, 0x4F } }\n\n/*\n * Configure GPIO Pin\n *\n * [in] value[0].a: gpio pin number\n * [in] value[0].b: direction to configure\n */\n#define PTA_BCM_GPIO_CMD_CFG\t0\n\n/*\n * Set GPIO pin\n *\n * [in] value[0].a: gpio pin number\n * [in] value[0].b: value drive on pin\n */\n#define PTA_BCM_GPIO_CMD_SET\t1\n\n/*\n * Get GPIO pin\n *\n * [in] value[0].a: gpio pin number\n * [out] value[1].a: value read from gpio pin\n */\n#define PTA_BCM_GPIO_CMD_GET\t2\n\n#define GPIO_TA_NAME\t\t\"pta_bcm_gpio.ta\"\n\nstatic TEE_Result pta_gpio_config(uint32_t param_types,\n\t\t\t\t TEE_Param params[TEE_NUM_PARAMS])\n{\n\tuint32_t gpio_num = 0;\n\tstruct bcm_gpio_chip *bcm_gc = NULL;\n\tstruct gpio_chip *gc = NULL;\n\tbool dir = false;\n\tTEE_Result res = TEE_SUCCESS;\n\tuint32_t exp_param_types = TEE_PARAM_TYPES(TEE_PARAM_TYPE_VALUE_INPUT,\n\t\t\t\t\t\t TEE_PARAM_TYPE_NONE,\n\t\t\t\t\t\t TEE_PARAM_TYPE_NONE,\n\t\t\t\t\t\t TEE_PARAM_TYPE_NONE);\n\n\tif (exp_param_types != param_types) {\n\t\tEMSG(\"Invalid Param types\");\n\t\treturn TEE_ERROR_BAD_PARAMETERS;\n\t}\n\n\tgpio_num = params[0].value.a;\n\tdir = params[0].value.b;\n\n\tbcm_gc = bcm_gpio_pin_to_chip(gpio_num);\n\tif (!bcm_gc) {\n\t\tEMSG(\"GPIO %u not supported\", gpio_num);\n\t\treturn TEE_ERROR_NOT_SUPPORTED;\n\t}\n\n\tgc = &bcm_gc->chip;\n\n\t/* Make gpio secure. */\n\tiproc_gpio_set_secure(gpio_num);\n\n\tif (dir) {\n\t\t/* Set GPIO to output with default value to 0 */\n\t\tgc->ops->set_direction(gpio_num, GPIO_DIR_OUT);\n\t\tgc->ops->set_value(gpio_num, 0);\n\t} else {\n\t\tgc->ops->set_direction(gpio_num, GPIO_DIR_IN);\n\t}\n\n\treturn res;\n}\n\nstatic TEE_Result pta_gpio_set(uint32_t param_types,\n\t\t\t TEE_Param params[TEE_NUM_PARAMS])\n{\n\tuint32_t gpio_num = 0;\n\tuint32_t val = 0;\n\tTEE_Result res = TEE_SUCCESS;\n\tstruct bcm_gpio_chip *bcm_gc = NULL;\n\tstruct gpio_chip *gc = NULL;\n\tuint32_t exp_param_types = TEE_PARAM_TYPES(TEE_PARAM_TYPE_VALUE_INPUT,\n\t\t\t\t\t\t TEE_PARAM_TYPE_NONE,\n\t\t\t\t\t\t TEE_PARAM_TYPE_NONE,\n\t\t\t\t\t\t TEE_PARAM_TYPE_NONE);\n\n\tif (exp_param_types != param_types) {\n\t\tEMSG(\"Invalid Param types\");\n\t\treturn TEE_ERROR_BAD_PARAMETERS;\n\t}\n\n\tgpio_num = params[0].value.a;\n\tval = !!params[0].value.b;\n\n\tbcm_gc = bcm_gpio_pin_to_chip(gpio_num);\n\tif (!bcm_gc) {\n\t\tEMSG(\"GPIO %u not supported\", gpio_num);\n\t\treturn TEE_ERROR_NOT_SUPPORTED;\n\t}\n\n\tgc = &bcm_gc->chip;\n\n\t/*\n\t * For setting a value to GPIO Pin,\n\t * need to make sure the PIN is configured in\n\t * output direction.\n\t */\n\tif (gc->ops->get_direction(gpio_num) != GPIO_DIR_OUT) {\n\t\tEMSG(\"gpio pin %u is configured as INPUT\", gpio_num);\n\t\treturn TEE_ERROR_ACCESS_DENIED;\n\t}\n\n\tgc->ops->set_value(gpio_num, val);\n\n\tDMSG(\"GPIO(%d) value = 0x%08x\", gpio_num, gc->ops->get_value(gpio_num));\n\n\treturn res;\n}\n\nstatic TEE_Result pta_gpio_get(uint32_t param_types,\n\t\t\t TEE_Param params[TEE_NUM_PARAMS])\n{\n\tuint32_t gpio_num = 0;\n\tstruct bcm_gpio_chip *bcm_gc = NULL;\n\tstruct gpio_chip *gc = NULL;\n\tuint32_t exp_param_types = TEE_PARAM_TYPES(TEE_PARAM_TYPE_VALUE_INPUT,\n\t\t\t\t\t\t TEE_PARAM_TYPE_VALUE_OUTPUT,\n\t\t\t\t\t\t TEE_PARAM_TYPE_NONE,\n\t\t\t\t\t\t TEE_PARAM_TYPE_NONE);\n\n\tif (exp_param_types != param_types) {\n\t\tEMSG(\"Invalid Param types\");\n\t\treturn TEE_ERROR_BAD_PARAMETERS;\n\t}\n\n\tgpio_num = params[0].value.a;\n\n\tbcm_gc = bcm_gpio_pin_to_chip(gpio_num);\n\tif (!bcm_gc) {\n\t\tEMSG(\"GPIO %u not supported\", gpio_num);\n\t\treturn TEE_ERROR_NOT_SUPPORTED;\n\t}\n\n\tgc = &bcm_gc->chip;\n\n\tparams[1].value.a = gc->ops->get_value(gpio_num);\n\n\tDMSG(\"gpio(%d) value = 0x%08x\", gpio_num, params[1].value.a);\n\n\treturn TEE_SUCCESS;\n}\n\nstatic TEE_Result invoke_command(void *session_context __unused,\n\t\t\t\t uint32_t cmd_id,\n\t\t\t\t uint32_t param_types,\n\t\t\t\t TEE_Param params[TEE_NUM_PARAMS])\n{\n\tTEE_Result res = TEE_SUCCESS;\n\n\tDMSG(\"command entry point[%d] for \\\"%s\\\"\", cmd_id, GPIO_TA_NAME);\n\n\tswitch (cmd_id) {\n\tcase PTA_BCM_GPIO_CMD_CFG:\n\t\tres = pta_gpio_config(param_types, params);\n\t\tbreak;\n\tcase PTA_BCM_GPIO_CMD_SET:\n\t\tres = pta_gpio_set(param_types, params);\n\t\tbreak;\n\tcase PTA_BCM_GPIO_CMD_GET:\n\t\tres = pta_gpio_get(param_types, params);\n\t\tbreak;\n\tdefault:\n\t\tEMSG(\"cmd: %d Not supported %s\\n\", cmd_id, GPIO_TA_NAME);\n\t\tres = TEE_ERROR_NOT_SUPPORTED;\n\t\tbreak;\n\t}\n\n\treturn res;\n}\n\npseudo_ta_register(.uuid = GPIO_SERVICE_UUID,\n\t\t .name = GPIO_TA_NAME,\n\t\t .flags = PTA_DEFAULT_FLAGS,\n\t\t .invoke_command_entry_point = invoke_command);\n"} +{"text": "// Created with JS_STRUCTURED_CLONE_VERSION = 3\n// var x = {\n// \"ab\": 1,\n// 12: 2,\n// };\n// print(uneval(serialize(x).clonebuffer));\n\nvar clonebuffer = serialize(\"abc\");\nclonebuffer.clonebuffer = \"\\x00\\x00\\x00\\x00\\b\\x00\\xFF\\xFF\\f\\x00\\x00\\x00\\x03\\x00\\xFF\\xFF\\x00\\x00\\x00\\x00\\x00\\x00\\x00@\\x02\\x00\\x00\\x00\\x04\\x00\\xFF\\xFFa\\x00b\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\xF0?\\x00\\x00\\x00\\x00\\x00\\x00\\xFF\\xFF\"\nvar obj = deserialize(clonebuffer)\nassertEq(obj.ab, 1);\nassertEq(obj[12], 2);\nassertEq(Object.keys(obj).toString(), \"12,ab\");\n"} +{"text": "#%RAML 1.0 DataType\n\nusage: provides a pattern to validate against an an HTTP string\n\npattern: ^http://\n"} +{"text": "import * as React from 'react';\nimport compose from 'recompose/compose';\nimport { SearchWrapper, SearchInput, ClearSearch, SearchForm } from './style';\nimport Icon from 'src/components/icon';\n\ntype Props = {};\ntype State = {\n isOpen: boolean,\n value: string,\n searchQueryString: string,\n};\nclass SearchViewInput extends React.Component {\n state = { isOpen: false, value: '', searchQueryString: '' };\n\n open = () => {\n this.setState({ isOpen: true });\n this.searchInput.focus();\n };\n\n close = () => {\n if (this.state.value.length === 0) {\n this.setState({ isOpen: false, searchQueryString: '' });\n }\n this.searchInput.blur();\n };\n\n clearClose = () => {\n this.setState({ value: '', searchQueryString: '' });\n this.searchInput.focus();\n };\n\n onChange = e => {\n this.setState({ value: e.target.value });\n };\n\n handleSubmit = e => {\n e.preventDefault();\n const searchString = this.state.value.toLowerCase().trim();\n this.props.handleSubmit(searchString);\n };\n\n render() {\n const { value, isOpen } = this.state;\n const placeholder = 'Search for conversations...';\n\n return (\n \n \n 0}\n isOpen={isOpen}\n >\n ×\n \n \n {\n this.searchInput = input;\n }}\n autoFocus={true}\n />\n \n \n );\n }\n}\n\nexport default compose()(SearchViewInput);\n"} +{"text": "package rtg.world.biome.realistic.vanilla;\n\nimport net.minecraft.block.Block;\nimport net.minecraft.block.BlockPlanks.EnumType;\nimport net.minecraft.block.state.IBlockState;\nimport net.minecraft.init.Biomes;\nimport net.minecraft.init.Blocks;\nimport net.minecraft.world.biome.Biome;\nimport net.minecraft.world.chunk.ChunkPrimer;\nimport rtg.api.config.BiomeConfig;\nimport rtg.api.util.BlockUtil;\nimport rtg.api.util.noise.SimplexNoise;\nimport rtg.api.world.RTGWorld;\nimport rtg.api.world.biome.RealisticBiomeBase;\nimport rtg.api.world.deco.*;\nimport rtg.api.world.gen.feature.tree.rtg.TreeRTG;\nimport rtg.api.world.gen.feature.tree.rtg.TreeRTGPinusNigra;\nimport rtg.api.world.surface.SurfaceBase;\nimport rtg.api.world.terrain.TerrainBase;\n\nimport java.util.Random;\n\n\npublic class RealisticBiomeVanillaExtremeHillsEdge extends RealisticBiomeBase {\n\n public static Biome biome = Biomes.EXTREME_HILLS_EDGE;\n public static Biome river = Biomes.RIVER;\n\n public RealisticBiomeVanillaExtremeHillsEdge() {\n\n super(biome, BeachType.STONE);\n }\n\n @Override\n public void initConfig() {\n this.getConfig().ALLOW_RIVERS.set(false);\n this.getConfig().ALLOW_SCENIC_LAKES.set(false);\n this.getConfig().addProperty(this.getConfig().ALLOW_LOGS).set(true);\n this.getConfig().addProperty(this.getConfig().FALLEN_LOG_DENSITY_MULTIPLIER);\n this.getConfig().addProperty(this.getConfig().SURFACE_MIX_BLOCK).set(\"\");\n this.getConfig().addProperty(this.getConfig().SURFACE_MIX_FILLER_BLOCK).set(\"\");\n }\n\n @Override\n public TerrainBase initTerrain() {\n\n return new RealisticBiomeVanillaExtremeHills.RidgedExtremeHills(125f, 67f, 200f);\n }\n\n @Override\n public SurfaceBase initSurface() {\n\n return new SurfaceVanillaExtremeHillsEdge(getConfig(), biome.topBlock, biome.fillerBlock, Blocks.GRASS.getDefaultState(), Blocks.DIRT.getDefaultState(), 60f, -0.14f, 14f, 0.25f);\n }\n\n @Override\n public void initDecos() {\n\n TreeRTG nigraTree = new TreeRTGPinusNigra();\n nigraTree.setLogBlock(Blocks.LOG.getDefaultState());\n nigraTree.setLeavesBlock(Blocks.LEAVES.getDefaultState());\n nigraTree.setMinTrunkSize(18);\n nigraTree.setMaxTrunkSize(27);\n nigraTree.setMinCrownSize(7);\n nigraTree.setMaxCrownSize(10);\n this.addTree(nigraTree);\n\n DecoTree decoTrees = new DecoTree(nigraTree);\n decoTrees.setStrengthFactorForLoops(4f);\n decoTrees.setStrengthNoiseFactorXForLoops(true);\n decoTrees.getDistribution().setNoiseDivisor(100f);\n decoTrees.getDistribution().setNoiseFactor(6f);\n decoTrees.getDistribution().setNoiseAddend(0.8f);\n decoTrees.setTreeType(DecoTree.TreeType.RTG_TREE);\n decoTrees.setTreeCondition(DecoTree.TreeCondition.RANDOM_CHANCE);\n decoTrees.setTreeConditionChance(24);\n decoTrees.setMaxY(100);\n this.addDeco(decoTrees);\n\n DecoFallenTree decoFallenTree = new DecoFallenTree();\n decoFallenTree.getDistribution().setNoiseDivisor(100f);\n decoFallenTree.getDistribution().setNoiseFactor(6f);\n decoFallenTree.getDistribution().setNoiseAddend(0.8f);\n decoFallenTree.setLogConditionChance(6);\n decoFallenTree.setLogBlock(BlockUtil.getStateLog(EnumType.SPRUCE));\n decoFallenTree.setLeavesBlock(BlockUtil.getStateLeaf(EnumType.SPRUCE));\n decoFallenTree.setMinSize(3);\n decoFallenTree.setMaxSize(6);\n this.addDeco(decoFallenTree, this.getConfig().ALLOW_LOGS.get());\n\n DecoShrub decoShrub = new DecoShrub();\n decoShrub.setMaxY(100);\n decoShrub.setLoopMultiplier(2f);\n this.addDeco(decoShrub);\n\n DecoBoulder decoBoulder = new DecoBoulder();\n decoBoulder.setBoulderBlock(Blocks.MOSSY_COBBLESTONE.getDefaultState());\n decoBoulder.setChance(12);\n decoBoulder.setMaxY(95);\n decoBoulder.setStrengthFactor(2f);\n this.addDeco(decoBoulder);\n\n DecoMushrooms decoMushrooms = new DecoMushrooms();\n decoMushrooms.setMaxY(90);\n decoMushrooms.setRandomFloat(3f);\n this.addDeco(decoMushrooms);\n\n DecoPumpkin decoPumpkin = new DecoPumpkin();\n decoPumpkin.setMaxY(90);\n decoPumpkin.setRandomFloat(20f);\n this.addDeco(decoPumpkin);\n }\n\n public static class TerrainVanillaExtremeHillsEdge extends TerrainBase {\n\n private float start;\n private float height;\n private float base;\n private float width;\n\n public TerrainVanillaExtremeHillsEdge(float hillStart, float landHeight, float baseHeight, float hillWidth) {\n\n start = hillStart;\n height = landHeight;\n base = baseHeight;\n width = hillWidth;\n }\n\n @Override\n public float generateNoise(RTGWorld rtgWorld, int x, int y, float border, float river) {\n\n return terrainHighland(x, y, rtgWorld, river, start, width, height, 10f);\n }\n }\n\n public static class SurfaceVanillaExtremeHillsEdge extends SurfaceBase {\n\n private IBlockState mixBlockTop;\n private IBlockState mixBlockFill;\n private float width;\n private float height;\n private float smallW;\n private float smallS;\n\n public SurfaceVanillaExtremeHillsEdge(BiomeConfig config, IBlockState top, IBlockState filler, IBlockState mixTop, IBlockState mixFill, float mixWidth,\n float mixHeight, float smallWidth, float smallStrength) {\n\n super(config, top, filler);\n\n mixBlockTop = this.getConfigBlock(config.SURFACE_MIX_BLOCK.get(), mixTop);\n mixBlockFill = this.getConfigBlock(config.SURFACE_MIX_FILLER_BLOCK.get(), mixFill);\n\n width = mixWidth;\n height = mixHeight;\n smallW = smallWidth;\n smallS = smallStrength;\n }\n\n @Override\n public void paintTerrain(ChunkPrimer primer, int i, int j, int x, int z, int depth, RTGWorld rtgWorld, float[] noise, float river, Biome[] base) {\n\n Random rand = rtgWorld.rand();\n SimplexNoise simplex = rtgWorld.simplexInstance(0);\n float c = TerrainBase.calcCliff(x, z, noise);\n boolean cliff = c > 1.4f;\n boolean mix = false;\n\n for (int k = 255; k > -1; k--) {\n Block b = primer.getBlockState(x, k, z).getBlock();\n if (b == Blocks.AIR) {\n depth = -1;\n }\n else if (b == Blocks.STONE) {\n depth++;\n\n if (cliff) {\n if (depth > -1 && depth < 2) {\n if (rand.nextInt(3) == 0) {\n\n primer.setBlockState(x, k, z, hcCobble());\n }\n else {\n\n primer.setBlockState(x, k, z, hcStone());\n }\n }\n else if (depth < 10) {\n primer.setBlockState(x, k, z, hcStone());\n }\n }\n else {\n if (depth == 0 && k > 61) {\n if (simplex.noise2f(i / width, j / width) + simplex.noise2f(i / smallW, j / smallW) * smallS > height) {\n primer.setBlockState(x, k, z, mixBlockTop);\n mix = true;\n }\n else {\n primer.setBlockState(x, k, z, topBlock);\n }\n }\n else if (depth < 4) {\n if (mix) {\n primer.setBlockState(x, k, z, mixBlockFill);\n }\n else {\n primer.setBlockState(x, k, z, fillerBlock);\n }\n }\n }\n }\n }\n }\n }\n}\n"} +{"text": "#include \n\nint main()\n{\n // change type to double\n double a = 2, b = 3, c;\n c = sum(a,b); // Calling a function the compiler has no knowledge of\n printf(\"c = %f\\n\", c);\n return 0;\n}\n\ndouble sum(double a, double b)\n{\n double c;\n c = a + b;\n return c;\n}\n"} +{"text": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n// Code generated by informer-gen. DO NOT EDIT.\n\npackage v1alpha1\n\nimport (\n\t\"context\"\n\ttime \"time\"\n\n\tnodev1alpha1 \"k8s.io/api/node/v1alpha1\"\n\tv1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n\truntime \"k8s.io/apimachinery/pkg/runtime\"\n\twatch \"k8s.io/apimachinery/pkg/watch\"\n\tinternalinterfaces \"k8s.io/client-go/informers/internalinterfaces\"\n\tkubernetes \"k8s.io/client-go/kubernetes\"\n\tv1alpha1 \"k8s.io/client-go/listers/node/v1alpha1\"\n\tcache \"k8s.io/client-go/tools/cache\"\n)\n\n// RuntimeClassInformer provides access to a shared informer and lister for\n// RuntimeClasses.\ntype RuntimeClassInformer interface {\n\tInformer() cache.SharedIndexInformer\n\tLister() v1alpha1.RuntimeClassLister\n}\n\ntype runtimeClassInformer struct {\n\tfactory internalinterfaces.SharedInformerFactory\n\ttweakListOptions internalinterfaces.TweakListOptionsFunc\n}\n\n// NewRuntimeClassInformer constructs a new informer for RuntimeClass type.\n// Always prefer using an informer factory to get a shared informer instead of getting an independent\n// one. This reduces memory footprint and number of connections to the server.\nfunc NewRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {\n\treturn NewFilteredRuntimeClassInformer(client, resyncPeriod, indexers, nil)\n}\n\n// NewFilteredRuntimeClassInformer constructs a new informer for RuntimeClass type.\n// Always prefer using an informer factory to get a shared informer instead of getting an independent\n// one. This reduces memory footprint and number of connections to the server.\nfunc NewFilteredRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {\n\treturn cache.NewSharedIndexInformer(\n\t\t&cache.ListWatch{\n\t\t\tListFunc: func(options v1.ListOptions) (runtime.Object, error) {\n\t\t\t\tif tweakListOptions != nil {\n\t\t\t\t\ttweakListOptions(&options)\n\t\t\t\t}\n\t\t\t\treturn client.NodeV1alpha1().RuntimeClasses().List(context.TODO(), options)\n\t\t\t},\n\t\t\tWatchFunc: func(options v1.ListOptions) (watch.Interface, error) {\n\t\t\t\tif tweakListOptions != nil {\n\t\t\t\t\ttweakListOptions(&options)\n\t\t\t\t}\n\t\t\t\treturn client.NodeV1alpha1().RuntimeClasses().Watch(context.TODO(), options)\n\t\t\t},\n\t\t},\n\t\t&nodev1alpha1.RuntimeClass{},\n\t\tresyncPeriod,\n\t\tindexers,\n\t)\n}\n\nfunc (f *runtimeClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {\n\treturn NewFilteredRuntimeClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)\n}\n\nfunc (f *runtimeClassInformer) Informer() cache.SharedIndexInformer {\n\treturn f.factory.InformerFor(&nodev1alpha1.RuntimeClass{}, f.defaultInformer)\n}\n\nfunc (f *runtimeClassInformer) Lister() v1alpha1.RuntimeClassLister {\n\treturn v1alpha1.NewRuntimeClassLister(f.Informer().GetIndexer())\n}\n"} +{"text": "#--\n# Project: google4r\n# File: lib/google4r/checkout/commands.rb \n# Author: Manuel Holtgrewe \n# Copyright: (c) 2007 by Manuel Holtgrewe\n# License: MIT License as follows:\n#\n# Permission is hereby granted, free of charge, to any person obtaining \n# a copy of this software and associated documentation files (the \n# \"Software\"), to deal in the Software without restriction, including \n# without limitation the rights to use, copy, modify, merge, publish, \n# distribute, sublicense, and/or sell copies of the Software, and to permit\n# persons to whom the Software is furnished to do so, subject to the \n# following conditions:\n#\n# The above copyright notice and this permission notice shall be included \n# in all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF \n# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. \n# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY \n# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, \n# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE\n# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \n#++\n# This file contains the classes and modules that are used by the command\n# generating code.\n\nrequire 'openssl'\nrequire 'money'\nrequire 'net/http'\nrequire 'net/https'\nrequire 'uri'\n\nmodule Google4R #:nodoc:\n module Checkout #:nodoc:\n # Abstract super class for all commands that are to be sent to Google. Provides the base\n # functionality for signing and encoding the cart.\n class Command\n # The URL to use for requests to the sandboxed API. The merchant id is to be\n # put in via String#%.\n #--\n # TODO: Move this into a class variable (e.g. via cattr) so it is adaptable.\n #++\n SANDBOX_URL = \"https://sandbox.google.com/checkout/cws/v2/Merchant/%s/request\"\n \n # The URL to use for real requests to the Google Checkout API. The merchant id\n # is to be put in via String#%.\n #--\n # TODO: Move this into a class variable (e.g. via cattr) so it is adaptable.\n #++\n PRODUCTION_URL = \"https://checkout.google.com/cws/v2/Merchant/%s/request\"\n \n # The Frontent class that was used to create this CheckoutCommand and whose\n # configuration will be used.\n attr_reader :frontend\n \n # The tag name of the command\n attr_reader :command_tag_name\n \n # The google order number, required, String\n attr_accessor :google_order_number\n\n # Initialize the frontend attribute with the value of the frontend parameter.\n def initialize(frontend)\n @frontend = frontend\n end\n\n # Sends the cart's XML to GoogleCheckout via HTTPs with Basic Auth.\n #\n # Raises an OpenSSL::SSL::SSLError when the SSL certificate verification failed.\n #\n # Raises a GoogleCheckoutError when Google returns an error.\n #\n # Raises a RuntimeException on unknown responses.\n #--\n # TODO: The send-and-expect-response part should be adaptable to other commands and responses.\n #++\n def send_to_google_checkout\n # Create HTTP(S) POST command and set up Basic Authentication.\n url_str = \n if frontend.configuration[:use_sandbox] then\n SANDBOX_URL % frontend.configuration[:merchant_id]\n else\n PRODUCTION_URL % frontend.configuration[:merchant_id]\n end\n url = URI.parse(url_str)\n \n request = Net::HTTP::Post.new(url.path)\n request.basic_auth(frontend.configuration[:merchant_id], frontend.configuration[:merchant_key])\n\n # Set up the HTTP connection object and the SSL layer.\n https = Net::HTTP.new(url.host, url.port)\n https.use_ssl = true\n https.cert_store = self.class.x509_store\n https.verify_mode = OpenSSL::SSL::VERIFY_PEER\n https.verify_depth = 5\n\n # Send the request to Google.\n result = https.request(request, self.to_xml)\n \n case result\n when Net::HTTPSuccess then\n xml_doc = REXML::Document.new(result.body)\n \n case xml_doc.root.name\n when 'checkout-redirect'\n serial_number = xml_doc.elements['/checkout-redirect'].attributes['serial-number']\n redirect_url = xml_doc.elements['/checkout-redirect/redirect-url/text()'].value\n return CheckoutRedirectResponse.new(serial_number, redirect_url)\n when 'request-received'\n serial_number = xml_doc.elements['/request-received'].attributes['serial-number']\n return serial_number\n else\n raise \"Unknown response:\\n--\\n#{xml_doc.to_s}\\n--\"\n end\n when Net::HTTPClientError then\n xml_doc = REXML::Document.new(result.body)\n \n if xml_doc.elements['/error'].attributes['serial-number'].nil? or xml_doc.elements['/error/error-message/text()'].nil? then\n raise \"Invalid response from Google:\\n---\\n#{result.body}\\n---\"\n end\n \n hash = \n {\n :serial_number => xml_doc.elements['/error'].attributes['serial-number'],\n :message => xml_doc.elements['/error/error-message/text()'].value\n }\n \n raise GoogleCheckoutError.new(hash)\n when Net::HTTPRedirection, Net::HTTPServerError, Net::HTTPInformation then\n raise \"Unexpected reponse code (#{result.class}): #{result.code} - #{result.message}\"\n else\n raise \"Unknown reponse code: #{result.code} - #{result.message}\"\n end\n end\n \n # Class method to return the command's XML representation.\n def to_xml\n if self.class == Command then\n raise NotImplementedError, \"Command#to_xml has to be used in a subclass.\"\n else\n generator_class = Google4R::Command.get_const(\"#{self.class}XmlGenerator\")\n return generator_class.new(self).generate\n end\n end\n \n protected\n \n # Class method to return the OpenSSL::X509::Store instance for the\n # CA certificates.\n #--\n # TODO: Is OpenSSL::X509::Store thread safe when reading only? This method most certainly is *not*. It must become so.\n #++\n def self.x509_store\n return @@x509_store if defined?(@@x509_store)\n \n cacert_path = File.expand_path(File.dirname(__FILE__) + '/../../../var/cacert.pem')\n \n @@x509_store = OpenSSL::X509::Store.new\n @@x509_store.add_file(cacert_path)\n \n return @@x509_store\n end\n end\n\n # The CheckoutCommand represents a command sent\n # to the server.\n #\n # A CheckoutCommand instance can have an arbitrary number of TaxTable\n # and ShippingMethod instances. You must create these instances using the\n # create_* methods which CheckoutCommand supplies.\n # \n # CheckoutCommand#send_to_google_checkout returns CheckoutRedirectResponse \n # instances.\n #\n # Use the Frontend class to create new CheckoutCommand instances and do not\n # instanciate the class directly.\n #\n # Note that you have to create/set the tax tables for CheckoutCommands before you\n # can add any items to the cart that define a tax table.\n #\n # === Example\n #\n # frontend = Google4R::Checkout::Frontend.new(configuration)\n # frontend.tax_table_factory = TaxTableFactory.new\n # command = frontend.create_checkout_command\n class CheckoutCommand < Command\n # The ShoppingCart of this CheckoutCommand.\n attr_reader :shopping_cart\n \n # An array of the TaxTable objects of this CheckoutCommand. They have been\n # created with the tax table factory of the frontend which created this\n # command.\n attr_reader :tax_tables\n \n # An array of ShippingMethod objects of this CheckoutCommand. Use \n # #create_shipping_method to create new shipping methods.\n attr_reader :shipping_methods\n\n # The URL at where the cart can be edited (String, optional).\n attr_accessor :edit_cart_url\n \n # The URL to continue shopping after completing the checkout (String, optional).\n attr_accessor :continue_shopping_url\n \n # A boolean flag; true iff the customer HAS to provide his phone number (optional).\n attr_accessor :request_buyer_phone_number\n \n # The URL of the merchant calculation callback (optional).\n attr_accessor :merchant_calculations_url\n \n # A boolean flag to indicate whether merchant coupon is supported or not (optional).\n attr_accessor :accept_merchant_coupons\n\n # A boolean flag to indicate whether gift certificate is supported or not (optional).\n attr_accessor :accept_gift_certificates\n \n # A Google Checkout merchant ID that identifies the eCommerce provider.\n attr_accessor :platform_id\n \n # Generates the XML for this CheckoutCommand.\n def to_xml\n CheckoutCommandXmlGenerator.new(self).generate\n end\n \n # Initialize a new CheckoutCommand with a fresh CheckoutCart and an empty\n # Array of tax tables and an empty array of ShippingMethod instances.\n # Do not use this method directly but use Frontent#create_checkout_command\n # to create CheckoutCommand objects.\n def initialize(frontend)\n super(frontend)\n @shopping_cart = ShoppingCart.new(self)\n @tax_tables = frontend.tax_table_factory.effective_tax_tables_at(Time.new)\n @shipping_methods = Array.new\n end\n \n # Use this method to create a new shipping method. You have to pass in one of\n # { PickupShipping, FlatRateShipping } for clazz. The method will create a \n # new instance of the class you passedin object and add it to the internal list \n # of shipping methods.\n #\n # If you pass a block to this method (preferred) then the newly created\n # ShippingMethod object will be passed into this block for setting its attributes.\n # The newly created shipping method will be returned in all cases.\n #\n # The first created shipping method will be used as the default.\n #\n # Raises a ArgumentError if the parameter clazz is invalid.\n def create_shipping_method(clazz, &block)\n if not [ PickupShipping, FlatRateShipping, MerchantCalculatedShipping ].include?(clazz) then\n raise ArgumentError, \"Unknown shipping method: #{clazz.inspect}.\"\n end\n \n shipping_method = clazz.new\n @shipping_methods << shipping_method\n\n yield(shipping_method) if block_given?\n \n return shipping_method\n end\n end\n\n # CheckoutRedirectResponse instances are returned when a CheckoutCommand is successfully\n # processed by Google Checkout.\n class CheckoutRedirectResponse\n # The serial number of the response.\n attr_reader :serial_number\n \n # The URL to redirect to.\n attr_reader :redirect_url\n \n # Create a new CheckoutRedirectResponse with the given serial number and redirection URL.\n # Do not create CheckoutRedirectResponse instances in your own code. Google4R creates them\n # for you.\n def initialize(serial_number, redirect_url)\n @serial_number = serial_number\n @redirect_url = redirect_url\n end\n end\n\n #\n # The ChargeOrderCommand instructs Google Checkout to charge the buyer for a\n # particular order.\n #\n class ChargeOrderCommand < Command\n # The amount to charge, optional, Money\n attr_accessor :amount\n\n # frontend, required\n def initialize(frontend)\n super(frontend)\n end\n\n # Generates the XML for this ChargeOrderCommand\n def to_xml\n ChargeOrderCommandXmlGenerator.new(self).generate\n end\n end\n\n # The RefundOrderCommand instructs Google Checkout to refund an order\n class RefundOrderCommand < Command\n # The amount to refund, optional, Money\n attr_accessor :amount\n \n # The reason that the order is to be refunded, String of maximum 140 characters, required\n attr_accessor :reason\n \n # A comment related to the refunded order, String of maximum 140 characters, optional\n attr_accessor :comment\n\n def initialize(frontend)\n super(frontend)\n end\n\n def to_xml\n RefundOrderCommandXmlGenerator.new(self).generate\n end\n end\n \n # The CancelOrderCommand instructs Google Checkout to cancel an order\n class CancelOrderCommand < Command\n # The reason that the order is to be cancelled, String of maximum 140 characters, required\n attr_accessor :reason\n \n # A comment related to the cancelled order, String of maximum 140 characters, optional\n attr_accessor :comment\n\n def initialize(frontend)\n super(frontend)\n end\n\n def to_xml\n CancelOrderCommandXmlGenerator.new(self).generate\n end\n end\n\n # The AuthorizeOrderCommand instructs Google Checkout to explicitly reauthorize\n # a customer's credit card for the uncharged balance of an order to verify that\n # funds for the order are available\n class AuthorizeOrderCommand < Command\n def initialize(frontend)\n super(frontend)\n end\n\n def to_xml\n AuthorizeOrderCommandXmlGenerator.new(self).generate\n end\n end\n \n # The ProcessOrderCommand instructs Google Checkout to to update\n # an order's fulfillment state from NEW to PROCESSING\n class ProcessOrderCommand < Command\n def initialize(frontend)\n super(frontend)\n end\n\n def to_xml\n ProcessOrderCommandXmlGenerator.new(self).generate\n end\n end\n\n # The AddMerchantOrderCommand instructs Google Checkout to associate a \n # merchant-assigned order number with an order\n class AddMerchantOrderNumberCommand < Command\n # The merchant-assigned order number associated with an order\n attr_accessor :merchant_order_number\n \n def initialize(frontend)\n super(frontend)\n end\n\n def to_xml\n AddMerchantOrderNumberCommandXmlGenerator.new(self).generate\n end\n end\n \n # The DeliverOrderCommand indicates that Google should update an order's fulfillment order state to DELIVERED\n class DeliverOrderCommand < Command\n # if google checkout should email buyer to ssay order is dispatched\n attr_accessor :send_email\n \n # The name of the company responsible for shipping the item. Valid values\n # for this tag are DHL, FedEx, UPS, USPS and Other.\n attr_accessor :carrier\n \n # The shipper's tracking number that is associated with an order\n attr_accessor :tracking_number\n \n def initialize(frontend)\n super(frontend)\n end\n\n def to_xml\n DeliverOrderCommandXmlGenerator.new(self).generate\n end \n end\n \n # The AddTrackingDataCommand instructs Google Checkout to associate a shipper's tracking number with an order.\n class AddTrackingDataCommand < Command\n # The name of the company responsible for shipping the item. Valid values\n # for this tag are DHL, FedEx, UPS, USPS and Other.\n attr_accessor :carrier\n \n # The shipper's tracking number that is associated with an order\n attr_accessor :tracking_number\n \n def initialize(frontend)\n super(frontend)\n end\n\n def to_xml\n AddTrackingDataCommandXmlGenerator.new(self).generate\n end \n end\n \n # The SendBuyerMessageCommand instructs Google Checkout to place a message in the customer's Google Checkout account.\n class SendBuyerMessageCommand < Command\n # The message to the customer\n attr_accessor :message\n \n # if google checkout should email buyer to ssay order is dispatched\n attr_accessor :send_email\n \n def initialize(frontend)\n super(frontend)\n end\n\n def to_xml\n SendBuyerMessageCommandXmlGenerator.new(self).generate\n end \n end\n \n # The ArchiveOrderCommand instructs Google Checkout to remove an order from your Merchant Center Inbox.\n class ArchiveOrderCommand < Command\n def initialize(frontend)\n super(frontend)\n end\n\n def to_xml\n ArchiveOrderCommandXmlGenerator.new(self).generate\n end\n end\n \n # The UnarchiveOrderCommand instructs Google Checkout to return a previously archived order to your Merchant Center Inbox.\n class UnarchiveOrderCommand < Command\n def initialize(frontend)\n super(frontend)\n end\n\n def to_xml\n UnarchiveOrderCommandXmlGenerator.new(self).generate\n end\n end\n end\nend\n"} +{"text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# mayhem/windll/kernel32.py\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n# * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n# * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n# * Neither the name of the project nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n#\n\nimport ctypes\n\nimport mayhem.datatypes.windows as wintypes\n\n_kernel32 = ctypes.windll.kernel32\n\ndef _patch_winfunctype(function, restype, argtypes=(), **kwargs):\n\taddress = ctypes.cast(function, ctypes.c_void_p).value\n\tprototype = wintypes.WINFUNCTYPE(restype, *argtypes, **kwargs)\n\treturn prototype(address)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms724211(v=vs.85).aspx\nCloseHandle = _patch_winfunctype(\n\t_kernel32.CloseHandle,\n\twintypes.BOOL,\n\t(wintypes.HANDLE,)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/aa365146(v=vs.85).aspx\nConnectNamedPipe = _patch_winfunctype(\n\t_kernel32.ConnectNamedPipe,\n\twintypes.BOOL,\n\t(wintypes.HANDLE, wintypes.POVERLAPPED)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms682396(v=vs.85).aspx\nCreateEventA = _patch_winfunctype(\n\t_kernel32.CreateEventA,\n\twintypes.HANDLE,\n\t(wintypes.PSECURITY_ATTRIBUTES, wintypes.BOOL, wintypes.BOOL, wintypes.LPSTR)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms682396(v=vs.85).aspx\nCreateEventW = _patch_winfunctype(\n\t_kernel32.CreateEventW,\n\twintypes.HANDLE,\n\t(wintypes.PSECURITY_ATTRIBUTES, wintypes.BOOL, wintypes.BOOL, wintypes.LPWSTR)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx\nCreateFileA = _patch_winfunctype(\n\t_kernel32.CreateFileA,\n\twintypes.HANDLE,\n\t(\n\t\twintypes.LPSTR,\n\t\twintypes.DWORD,\n\t\twintypes.DWORD,\n\t\twintypes.PSECURITY_ATTRIBUTES,\n\t\twintypes.DWORD,\n\t\twintypes.DWORD,\n\t\twintypes.HANDLE\n\t)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx\nCreateFileW = _patch_winfunctype(\n\t_kernel32.CreateFileW,\n\twintypes.HANDLE,\n\t(\n\t\twintypes.LPWSTR,\n\t\twintypes.DWORD,\n\t\twintypes.DWORD,\n\t\twintypes.PSECURITY_ATTRIBUTES,\n\t\twintypes.DWORD,\n\t\twintypes.DWORD,\n\t\twintypes.HANDLE\n\t)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/aa365150(v=vs.85).aspx\nCreateNamedPipeA = _patch_winfunctype(\n\t_kernel32.CreateNamedPipeA,\n\twintypes.HANDLE,\n\t(\n\t\twintypes.LPSTR,\n\t\twintypes.DWORD,\n\t\twintypes.DWORD,\n\t\twintypes.DWORD,\n\t\twintypes.DWORD,\n\t\twintypes.DWORD,\n\t\twintypes.DWORD,\n\t\twintypes.PSECURITY_ATTRIBUTES\n\t)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/aa365150(v=vs.85).aspx\nCreateNamedPipeW = _patch_winfunctype(\n\t_kernel32.CreateNamedPipeW,\n\twintypes.HANDLE,\n\t(\n\t\twintypes.LPWSTR,\n\t\twintypes.DWORD,\n\t\twintypes.DWORD,\n\t\twintypes.DWORD,\n\t\twintypes.DWORD,\n\t\twintypes.DWORD,\n\t\twintypes.DWORD,\n\t\twintypes.PSECURITY_ATTRIBUTES\n\t)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx\nCreateProcessA = _patch_winfunctype(\n\t_kernel32.CreateProcessA,\n\twintypes.BOOL,\n\t(\n\t\twintypes.LPSTR,\n\t\twintypes.LPSTR,\n\t\twintypes.PSECURITY_ATTRIBUTES,\n\t\twintypes.PSECURITY_ATTRIBUTES,\n\t\twintypes.BOOL,\n\t\twintypes.DWORD,\n\t\twintypes.LPVOID,\n\t\twintypes.LPSTR,\n\t\twintypes.PSTARTUPINFO,\n\t\twintypes.PPROCESS_INFORMATION\n\t)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx\nCreateProcessW = _patch_winfunctype(\n\t_kernel32.CreateProcessW,\n\twintypes.BOOL,\n\t(\n\t\twintypes.LPWSTR,\n\t\twintypes.LPWSTR,\n\t\twintypes.PSECURITY_ATTRIBUTES,\n\t\twintypes.PSECURITY_ATTRIBUTES,\n\t\twintypes.BOOL,\n\t\twintypes.DWORD,\n\t\twintypes.LPVOID,\n\t\twintypes.LPWSTR,\n\t\twintypes.PSTARTUPINFO,\n\t\twintypes.PPROCESS_INFORMATION\n\t)\n)\n\nCreateRemoteThread = _patch_winfunctype(\n\t_kernel32.CreateRemoteThread,\n\twintypes.HANDLE,\n\t(\n\t\twintypes.HANDLE,\n\t\twintypes.PSECURITY_ATTRIBUTES,\n\t\twintypes.SIZE_T,\n\t\twintypes.PVOID,\n\t\twintypes.LPVOID,\n\t\twintypes.DWORD,\n\t\twintypes.LPDWORD\n\t)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms682453(v=vs.85).aspx\nCreateThread = _patch_winfunctype(\n\t_kernel32.CreateThread,\n\twintypes.HANDLE,\n\t(\n\t\twintypes.PSECURITY_ATTRIBUTES,\n\t\twintypes.SIZE_T,\n\t\twintypes.PVOID,\n\t\twintypes.LPVOID,\n\t\twintypes.DWORD,\n\t\twintypes.LPDWORD\n\t)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms724251(v=vs.85).aspx\nDuplicateHandle = _patch_winfunctype(\n\t_kernel32.DuplicateHandle,\n\twintypes.BOOL,\n\t(\n\t\twintypes.HANDLE,\n\t\twintypes.HANDLE,\n\t\twintypes.HANDLE,\n\t\twintypes.LPHANDLE,\n\t\twintypes.DWORD,\n\t\twintypes.BOOL,\n\t\twintypes.DWORD\n\t)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms682658(v=vs.85).aspx\nExitProcess = _patch_winfunctype(\n\t_kernel32.ExitProcess,\n\twintypes.VOID,\n\t(wintypes.UINT,)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms682659(v=vs.85).aspx\nExitThread = _patch_winfunctype(\n\t_kernel32.ExitThread,\n\twintypes.VOID,\n\t(wintypes.DWORD,)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms683152(v=vs.85).aspx\nFreeLibrary = _patch_winfunctype(\n\t_kernel32.FreeLibrary,\n\twintypes.BOOL,\n\t(wintypes.HANDLE,)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms683179(v=vs.85).aspx\nGetCurrentProcess = _patch_winfunctype(\n\t_kernel32.GetCurrentProcess,\n\twintypes.HANDLE\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms683180(v=vs.85).aspx\nGetCurrentProcessId = _patch_winfunctype(\n\t_kernel32.GetCurrentProcessId,\n\twintypes.DWORD\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms683182(v=vs.85).aspx\nGetCurrentThread = _patch_winfunctype(\n\t_kernel32.GetCurrentThread,\n\twintypes.HANDLE\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms683183(v=vs.85).aspx\nGetCurrentThreadId = _patch_winfunctype(\n\t_kernel32.GetCurrentThreadId,\n\twintypes.DWORD\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms683189(v=vs.85).aspx\nGetExitCodeProcess = _patch_winfunctype(\n\t_kernel32.GetExitCodeProcess,\n\twintypes.BOOL,\n\t(wintypes.HANDLE, wintypes.LPDWORD)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms683190(v=vs.85).aspx\nGetExitCodeThread = _patch_winfunctype(\n\t_kernel32.GetExitCodeThread,\n\twintypes.BOOL,\n\t(wintypes.HANDLE, wintypes.PDWORD)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms679360(v=vs.85).aspx\nGetLastError = _patch_winfunctype(\n\t_kernel32.GetLastError,\n\twintypes.DWORD\n)\n\nif hasattr(_kernel32, 'GetModuleFileNameExA'):\n\t# https://msdn.microsoft.com/en-us/library/windows/desktop/ms683198(v=vs.85).aspx\n\tGetModuleFileNameExA = _patch_winfunctype(\n\t\t_kernel32.GetModuleFileNameExA,\n\t\twintypes.DWORD,\n\t\t(wintypes.HANDLE, wintypes.HMODULE, wintypes.LPSTR, wintypes.DWORD)\n\t)\n\nif hasattr(_kernel32, 'GetModuleFileNameExW'):\n\t# https://msdn.microsoft.com/en-us/library/windows/desktop/ms683198(v=vs.85).aspx\n\tGetModuleFileNameExW = _patch_winfunctype(\n\t\t_kernel32.GetModuleFileNameExW,\n\t\twintypes.DWORD,\n\t\t(wintypes.HANDLE, wintypes.HMODULE, wintypes.LPSTR, wintypes.DWORD)\n\t)\n\n\nGetModuleHandleA = _patch_winfunctype(\n\t_kernel32.GetModuleHandleA,\n\twintypes.HANDLE,\n\t(wintypes.LPSTR,)\n)\n\nGetModuleHandleW = _patch_winfunctype(\n\t_kernel32.GetModuleHandleW,\n\twintypes.HANDLE,\n\t(wintypes.LPWSTR,)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms683200(v=vs.85).aspx\nGetModuelHandleExA = _patch_winfunctype(\n\t_kernel32.GetModuleHandleExA,\n\twintypes.BOOL,\n\t(wintypes.DWORD, wintypes.LPSTR, wintypes.PHMODULE)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms683200(v=vs.85).aspx\nGetModuelHandleExW = _patch_winfunctype(\n\t_kernel32.GetModuleHandleExW,\n\twintypes.BOOL,\n\t(wintypes.DWORD, wintypes.LPWSTR, wintypes.PHMODULE)\n)\n\nGetProcAddress = _patch_winfunctype(\n\t_kernel32.GetProcAddress,\n\twintypes.PVOID,\n\t(wintypes.HMODULE, wintypes.LPSTR)\n)\n\nGetProcessId = _patch_winfunctype(\n\t_kernel32.GetProcessId,\n\twintypes.DWORD,\n\t(wintypes.HANDLE,)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms724381(v=vs.85).aspx\nGetSystemInfo = _patch_winfunctype(\n\t_kernel32.GetSystemInfo,\n\twintypes.VOID,\n\t(wintypes.PSYSTEM_INFO,)\n)\n\nif hasattr(ctypes.windll.kernel32, 'IsWow64Process'):\n\t# https://msdn.microsoft.com/en-us/library/windows/desktop/ms684139(v=vs.85).aspx\n\tIsWow64Process = _patch_winfunctype(\n\t\t_kernel32.IsWow64Process,\n\t\twintypes.BOOL,\n\t\t(wintypes.HANDLE, wintypes.PBOOL)\n\t)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms684175(v=vs.85).aspx\nLoadLibraryA = _patch_winfunctype(\n\t_kernel32.LoadLibraryA,\n\twintypes.HMODULE,\n\t(wintypes.LPSTR,)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms684175(v=vs.85).aspx\nLoadLibraryW = _patch_winfunctype(\n\t_kernel32.LoadLibraryW,\n\twintypes.HMODULE,\n\t(wintypes.LPWSTR,)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms684179(v=vs.85).aspx\nLoadLibraryExA = _patch_winfunctype(\n\t_kernel32.LoadLibraryExA,\n\twintypes.HMODULE,\n\t(wintypes.LPSTR, wintypes.HANDLE, wintypes.DWORD)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms684179(v=vs.85).aspx\nLoadLibraryExW = _patch_winfunctype(\n\t_kernel32.LoadLibraryExW,\n\twintypes.HMODULE,\n\t(wintypes.LPWSTR, wintypes.HANDLE, wintypes.DWORD)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms684320(v=vs.85).aspx\nOpenProcess = _patch_winfunctype(\n\t_kernel32.OpenProcess,\n\twintypes.HANDLE,\n\t(wintypes.DWORD, wintypes.BOOL, wintypes.DWORD)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms684335(v=vs.85).aspx\nOpenThread = _patch_winfunctype(\n\t_kernel32.OpenThread,\n\twintypes.HANDLE,\n\t(wintypes.DWORD, wintypes.BOOL, wintypes.DWORD)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/aa365467(v=vs.85).aspx\nReadFile = _patch_winfunctype(\n\t_kernel32.ReadFile,\n\twintypes.BOOL,\n\t(wintypes.HANDLE, wintypes.LPVOID, wintypes.DWORD, wintypes.LPDWORD, wintypes.POVERLAPPED)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms680553(v=vs.85).aspx\nReadProcessMemory = _patch_winfunctype(\n\t_kernel32.ReadProcessMemory,\n\twintypes.BOOL,\n\t(wintypes.HANDLE, wintypes.LPVOID, wintypes.LPVOID, wintypes.SIZE_T, wintypes.SIZE_T)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms686714(v=vs.85).aspx\nTerminateProcess = _patch_winfunctype(\n\t_kernel32.TerminateProcess,\n\twintypes.BOOL,\n\t(wintypes.HANDLE, wintypes.UINT)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/aa366887(v=vs.85).aspx\nVirtualAlloc = _patch_winfunctype(\n\t_kernel32.VirtualAlloc,\n\twintypes.LPVOID,\n\t(wintypes.LPVOID, wintypes.SIZE_T, wintypes.DWORD, wintypes.DWORD)\n)\n\nVirtualAllocEx = _patch_winfunctype(\n\t_kernel32.VirtualAllocEx,\n\twintypes.SIZE_T,\n\t(wintypes.HANDLE, wintypes.LPVOID, wintypes.SIZE_T, wintypes.DWORD, wintypes.DWORD)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/aa366892(v=vs.85).aspx\nVirtualFree = _patch_winfunctype(\n\t_kernel32.VirtualFree,\n\twintypes.BOOL,\n\t(wintypes.LPVOID, wintypes.SIZE_T, wintypes.DWORD)\n)\n\nVirtualFreeEx = _patch_winfunctype(\n\t_kernel32.VirtualFreeEx,\n\twintypes.BOOL,\n\t(wintypes.HANDLE, wintypes.LPVOID, wintypes.SIZE_T, wintypes.DWORD)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/aa366898(v=vs.85).aspx\nVirtualProtect = _patch_winfunctype(\n\t_kernel32.VirtualProtect,\n\twintypes.BOOL,\n\t(wintypes.LPVOID, wintypes.SIZE_T, wintypes.DWORD, wintypes.PDWORD)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/aa366899(v=vs.85).aspx\nVirtualProtectEx = _patch_winfunctype(\n\t_kernel32.VirtualProtectEx,\n\twintypes.BOOL,\n\t(wintypes.HANDLE, wintypes.LPVOID, wintypes.SIZE_T, wintypes.DWORD, wintypes.PDWORD)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/aa366902(v=vs.85).aspx\nVirtualQuery = _patch_winfunctype(\n\t_kernel32.VirtualQuery,\n\twintypes.SIZE_T,\n\t(wintypes.LPVOID, wintypes.PMEMORY_BASIC_INFORMATION, wintypes.SIZE_T)\n)\n\nVirtualQueryEx = _patch_winfunctype(\n\t_kernel32.VirtualQueryEx,\n\twintypes.SIZE_T,\n\t(wintypes.HANDLE, wintypes.LPVOID, wintypes.PMEMORY_BASIC_INFORMATION, wintypes.SIZE_T)\n)\n\nWaitForSingleObject = _patch_winfunctype(\n\t_kernel32.WaitForSingleObject,\n\twintypes.DWORD,\n\t(wintypes.HANDLE, wintypes.DWORD)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms687036(v=vs.85).aspx\nWaitForSingleObjectEx = _patch_winfunctype(\n\t_kernel32.WaitForSingleObjectEx,\n\twintypes.DWORD,\n\t(wintypes.HANDLE, wintypes.DWORD, wintypes.BOOL)\n)\n\n# https://msdn.microsoft.com/en-us/library/windows/desktop/ms681674(v=vs.85).aspx\nWriteProcessMemory = _patch_winfunctype(\n\t_kernel32.WriteProcessMemory,\n\twintypes.BOOL,\n\t(wintypes.HANDLE, wintypes.LPVOID, wintypes.LPVOID, wintypes.SIZE_T, wintypes.PSIZE_T)\n)\n\naddress = GetModuleHandleW('kernel32.dll')\n"} +{"text": "// Copyright (c) 2011, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n// * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n// * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n// * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// safe_readlink.h: Define the google_breakpad::SafeReadLink function,\n// which wraps sys_readlink and gurantees the result is NULL-terminated.\n\n#ifndef COMMON_LINUX_SAFE_READLINK_H_\n#define COMMON_LINUX_SAFE_READLINK_H_\n\n#include \n\nnamespace google_breakpad {\n\n// This function wraps sys_readlink() and performs the same functionalty,\n// but guarantees |buffer| is NULL-terminated if sys_readlink() returns\n// no error. It takes the same arguments as sys_readlink(), but unlike\n// sys_readlink(), it returns true on success.\n//\n// |buffer_size| specifies the size of |buffer| in bytes. As this function\n// always NULL-terminates |buffer| on success, |buffer_size| should be\n// at least one byte longer than the expected path length (e.g. PATH_MAX,\n// which is typically defined as the maximum length of a path name\n// including the NULL byte).\n//\n// The implementation of this function calls sys_readlink() instead of\n// readlink(), it can thus be used in the context where calling to libc\n// functions is discouraged.\nbool SafeReadLink(const char* path, char* buffer, size_t buffer_size);\n\n// Same as the three-argument version of SafeReadLink() but deduces the\n// size of |buffer| if it is a char array of known size.\ntemplate \nbool SafeReadLink(const char* path, char (&buffer)[N]) {\n return SafeReadLink(path, buffer, sizeof(buffer));\n}\n\n} // namespace google_breakpad\n\n#endif // COMMON_LINUX_SAFE_READLINK_H_\n"} +{"text": "route_id,agency_id,route_short_name,route_long_name,route_desc,route_type,route_url,route_color,route_text_color\nAB,DTA,,Airport - Bullfrog,,3\nBFC,DTA,,Bullfrog - Furnace Creek Resort,,3\nSTBA,DTA,,Stagecoach - Airport Shuttle,,3\nCITY,DTA,,City,,3\nAAMV,DTA,,Airport - Amargosa Valley,,3"} +{"text": "import React, { PureComponent } from 'react'\nimport { connect } from 'react-redux'\nimport styled from 'styled-components'\n\nimport { Character, IntersectionObserver, Loader } from '@/components'\nimport { Characters as CharactersEntity } from '@/entities'\nimport styles from './styles.scss'\n\nconst Ul = styled.ul`\n margin: 0;\n padding: 0;\n list-style-type: none;\n display: flex;\n flex-wrap: wrap;\n justify-content: space-around;\n`\nconst Li = styled.li`\n flex-basis: calc(20% - 30px);\n margin-bottom: 30px;\n\n @media screen and (max-width: 1024px) {\n flex-basis: calc(50% - 30px);\n }\n`\n\ninterface ICharactersProps {\n getCharacters: (a) => {}\n characters: {\n allIds: number[]\n byId: {}\n page: number\n hasMore: boolean\n isLoading: boolean\n }\n}\n\nexport class Characters extends PureComponent {\n public componentDidMount() {\n const {\n characters: {\n allIds: { length }\n }\n } = this.props\n\n if (!length) {\n this.fetch()\n }\n }\n\n private fetch = () => {\n const {\n getCharacters,\n characters: { page, hasMore, isLoading }\n } = this.props\n if (hasMore && !isLoading) {\n getCharacters({ page: page + 1 })\n }\n }\n\n private renderCharacter = id => {\n const {\n characters: { byId }\n } = this.props\n const { name, image } = byId[id]\n return (\n
  • \n \n
  • \n )\n }\n\n public render() {\n const {\n characters: { allIds, isLoading }\n } = this.props\n return (\n <>\n

    Characters page

    \n
      {allIds.map(this.renderCharacter)}
    \n \n \n \n \n )\n }\n}\n\nexport const mapStateToProps = ({ characters }) => ({\n characters\n})\n\nconst mapDispatchToProps = dispatch => ({\n getCharacters: CharactersEntity.get(dispatch)\n})\n\nexport default connect(mapStateToProps, mapDispatchToProps)(Characters)\n"} +{"text": "hasOne(Rank::class);\n }\n}\n"} +{"text": "\n\"\"\n\"\"\n\"\"\n\"\"\n\n"} +{"text": "#!python\n#cython: embedsignature=True\n#cython: linetrace=True\n#########################################################################\n#\n# License: BSD\n# Created: August 05, 2010\n# Author: Francesc Alted - francesc@blosc.org\n#\n########################################################################\n\nfrom __future__ import absolute_import\n\nimport sys\nimport os\nimport os.path\nimport struct\nimport shutil\nimport tempfile\nimport json\nimport datetime\nimport threading\n\nimport numpy as np\ncimport numpy as np\nfrom numpy cimport (ndarray,\n dtype,\n import_array,\n PyArray_GETITEM,\n PyArray_SETITEM,\n npy_intp,\n )\nimport cython\n\nimport bcolz\nfrom bcolz import utils, attrs, array2string\n\nfrom .utils import build_carray\n\nif sys.version_info >= (3, 0):\n _MAXINT = 2 ** 31 - 1\n _inttypes = (int, np.integer)\nelse:\n _MAXINT = sys.maxint\n _inttypes = (int, long, np.integer)\n\n_KB = 1024\n_MB = 1024 * _KB\n\n# Directories for saving the data and metadata for bcolz persistency\nDATA_DIR = 'data'\nMETA_DIR = 'meta'\nSIZES_FILE = 'sizes'\nSTORAGE_FILE = 'storage'\n\n# For the persistence layer\nEXTENSION = '.blp'\nMAGIC = b'blpk'\nBLOSCPACK_HEADER_LENGTH = 16\nBLOSC_HEADER_LENGTH = 16\nFORMAT_VERSION = 1\nMAX_FORMAT_VERSION = 255\nMAX_CHUNKS = (2 ** 63) - 1\n\n# The type used for size values: indexes, coordinates, dimension\n# lengths, row numbers, shapes, chunk shapes, byte counts...\nSizeType = np.int64\n\n# The native int type for this platform\nIntType = np.dtype(np.int_)\n\n#-----------------------------------------------------------------\n\n# numpy functions & objects\nfrom definitions cimport (malloc,\n realloc,\n free,\n memcpy,\n memset,\n strdup,\n strcmp,\n PyBytes_GET_SIZE,\n PyBytes_FromStringAndSize,\n PyBytes_AS_STRING,\n Py_BEGIN_ALLOW_THREADS,\n Py_END_ALLOW_THREADS,\n PyBuffer_FromMemory,\n Py_uintptr_t,\n )\n\n#-----------------------------------------------------------------\n\n\n# Check blosc version\ncdef extern from \"check_blosc_version.h\":\n pass\n\n# Blosc routines\ncdef extern from \"blosc.h\":\n cdef enum:\n BLOSC_MAX_OVERHEAD,\n BLOSC_VERSION_STRING,\n BLOSC_VERSION_DATE,\n BLOSC_MAX_TYPESIZE\n\n void blosc_init()\n void blosc_destroy()\n void blosc_get_versions(char *version_str, char *version_date)\n int blosc_set_nthreads(int nthreads)\n int blosc_set_compressor(const char*compname)\n int blosc_compress(int clevel, int doshuffle, size_t typesize,\n size_t nbytes, void *src, void *dest,\n size_t destsize) nogil\n int blosc_compress_ctx(int clevel, int doshuffle, size_t typesize,\n size_t nbytes, const void* src, void* dest,\n size_t destsize, const char* compressor,\n size_t blocksize, int numinternalthreads) nogil\n int blosc_decompress(void *src, void *dest, size_t destsize) nogil\n int blosc_decompress_ctx(const void *src, void *dest, size_t destsize,\n int numinternalthreads) nogil\n int blosc_getitem(void *src, int start, int nitems, void *dest) nogil\n void blosc_free_resources()\n void blosc_cbuffer_sizes(void *cbuffer, size_t *nbytes,\n size_t *cbytes, size_t *blocksize)\n void blosc_cbuffer_metainfo(void *cbuffer, size_t *typesize, int *flags)\n void blosc_cbuffer_versions(void *cbuffer, int *version, int *versionlz)\n void blosc_set_blocksize(size_t blocksize)\n char* blosc_list_compressors()\n\n\n\n#----------------------------------------------------------------------------\n\n# Initialization code\n\n# The numpy API requires this function to be called before\n# using any numpy facilities in an extension module.\nimport_array()\n\n#-------------------------------------------------------------\n\n# Some utilities\ndef blosc_compressor_list():\n \"\"\"\n blosc_compressor_list()\n\n Returns a list of compressors available in the Blosc build.\n\n Parameters\n ----------\n None\n\n Returns\n -------\n out : list\n The list of names.\n \"\"\"\n list_compr = blosc_list_compressors()\n if sys.version_info >= (3, 0):\n # Convert compressor names into regular strings in Python 3 (unicode)\n list_compr = list_compr.decode()\n clist = list_compr.split(',')\n return clist\n\ndef _blosc_set_nthreads(nthreads):\n \"\"\"\n _blosc_set_nthreads(nthreads)\n\n Sets the number of threads that Blosc can use.\n\n Parameters\n ----------\n nthreads : int\n The desired number of threads to use.\n\n Returns\n -------\n out : int\n The previous setting for the number of threads.\n \"\"\"\n return blosc_set_nthreads(nthreads)\n\ndef _blosc_init():\n \"\"\"\n _blosc_init()\n\n Initialize the Blosc library.\n\n \"\"\"\n blosc_init()\n\ndef _blosc_destroy():\n \"\"\"\n _blosc_destroy()\n\n Finalize the Blosc library.\n\n \"\"\"\n blosc_destroy()\n\ndef blosc_version():\n \"\"\"\n blosc_version()\n\n Return the version of the Blosc library.\n\n \"\"\"\n # All the 'decode' contorsions are for Python 3 returning actual strings\n ver_str = BLOSC_VERSION_STRING\n if hasattr(ver_str, \"decode\"):\n ver_str = ver_str.decode()\n ver_date = BLOSC_VERSION_DATE\n if hasattr(ver_date, \"decode\"):\n ver_date = ver_date.decode()\n return (ver_str, ver_date)\n\ndef list_bytes_to_str(lst):\n \"\"\"The Python 3 JSON encoder doesn't accept 'bytes' objects,\n this utility function converts all bytes to strings.\n \"\"\"\n if isinstance(lst, bytes):\n return lst.decode('ascii')\n elif isinstance(lst, list):\n return [list_bytes_to_str(x) for x in lst]\n else:\n return lst\n\n# This is the same than in utils.py, but works faster in extensions\ncdef get_len_of_range(npy_intp start, npy_intp stop, npy_intp step):\n \"\"\"Get the length of a (start, stop, step) range.\"\"\"\n cdef npy_intp n\n\n n = 0\n if start < stop:\n # Do not use a cython.cdiv here (do not ask me why!)\n n = ((stop - start - 1) // step + 1)\n return n\n\ncdef clip_chunk(npy_intp nchunk, npy_intp chunklen,\n npy_intp start, npy_intp stop, npy_intp step):\n \"\"\"Get the limits of a certain chunk based on its length.\"\"\"\n cdef npy_intp startb, stopb, blen, distance\n\n startb = start - nchunk * chunklen\n stopb = stop - nchunk * chunklen\n\n # Check limits\n if (startb >= chunklen) or (stopb <= 0):\n return startb, stopb, 0 # null size\n if startb < 0:\n startb = 0\n if stopb > chunklen:\n stopb = chunklen\n\n # step corrections\n if step > 1:\n # Just correcting startb is enough\n distance = (nchunk * chunklen + startb) - start\n if distance % step > 0:\n startb += (step - (distance % step))\n if startb > chunklen:\n return startb, stopb, 0 # null size\n\n # Compute size of the clipped block\n blen = get_len_of_range(startb, stopb, step)\n\n return startb, stopb, blen\n\ncdef int check_zeros(char *data, int nbytes):\n \"\"\"Check whether [data, data+nbytes] is zero or not.\"\"\"\n cdef int i, iszero, chunklen, leftover\n cdef size_t *sdata\n\n iszero = 1\n sdata = data\n chunklen = cython.cdiv(nbytes, sizeof(size_t))\n leftover = nbytes % sizeof(size_t)\n with nogil:\n for i from 0 <= i < chunklen:\n if sdata[i] != 0:\n iszero = 0\n break\n else:\n data += nbytes - leftover\n for i from 0 <= i < leftover:\n if data[i] != 0:\n iszero = 0\n break\n return iszero\n\ncdef int true_count(char *data, int nbytes):\n \"\"\"Count the number of true values in data (boolean).\"\"\"\n cdef int i, count\n\n with nogil:\n count = 0\n for i from 0 <= i < nbytes:\n count += (data[i])\n return count\n\n#-------------------------------------------------------------\n\n# set the value of this variable to True or False to override the\n# default adaptive behaviour\nuse_threads = None\n\n\ndef _get_use_threads():\n global use_threads\n\n if use_threads in [True, False]:\n # user has manually overridden the default behaviour\n _use_threads = use_threads\n\n else:\n # adaptive behaviour: allow blosc to use threads if it is being\n # called from the main Python thread, inferring that it is being run\n # from within a single-threaded program; otherwise do not allow\n # blosc to use threads, inferring it is being run from within a\n # multi-threaded program\n if hasattr(threading, 'main_thread'):\n _use_threads = (threading.main_thread() ==\n threading.current_thread())\n else:\n _use_threads = threading.current_thread().name == 'MainThread'\n\n return _use_threads\n\n\ncdef class chunk:\n \"\"\"\n chunk(array, atom, cparams)\n\n Compressed in-memory container for a data chunk.\n\n This class is meant to be used only by the `carray` class.\n\n \"\"\"\n\n property dtype:\n \"The NumPy dtype for this chunk.\"\n def __get__(self):\n return self.atom\n\n def __cinit__(self, object dobject, object atom, object cparams,\n object _memory=True, object _compr=False):\n cdef int itemsize, footprint\n cdef size_t nbytes, cbytes, blocksize\n cdef dtype dtype_\n cdef char *data\n\n self.atom = atom\n self.atomsize = atom.itemsize\n dtype_ = atom.base\n self.typekind = dtype_.kind\n # Hack for allowing strings with len > BLOSC_MAX_TYPESIZE\n if self.typekind == 'S':\n itemsize = 1\n elif self.typekind == 'U':\n itemsize = 4\n elif self.typekind == 'V' and dtype_.itemsize > BLOSC_MAX_TYPESIZE:\n itemsize = 1\n else:\n itemsize = dtype_.itemsize\n if itemsize > BLOSC_MAX_TYPESIZE:\n raise TypeError(\n \"typesize is %d and bcolz does not currently support data \"\n \"types larger than %d bytes\" % (itemsize, BLOSC_MAX_TYPESIZE))\n self.itemsize = itemsize\n footprint = 0\n\n if _compr:\n # Data comes in an already compressed state inside a Python String\n self.dobject = dobject\n # Set size info for the instance\n data = PyBytes_AS_STRING(dobject);\n blosc_cbuffer_sizes(data, &nbytes, &cbytes, &blocksize)\n elif dtype_ == 'O':\n # The objects should arrive here already pickled\n data = PyBytes_AS_STRING(dobject)\n nbytes = PyBytes_GET_SIZE(dobject)\n cbytes, blocksize = self.compress_data(data, 1, nbytes, cparams)\n else:\n # Compress the data object (a NumPy object)\n nbytes, cbytes, blocksize, footprint = self.compress_arrdata(\n dobject, itemsize, cparams, _memory)\n footprint += 128 # add the (aprox) footprint of this instance in bytes\n\n # Fill instance data\n self.nbytes = nbytes\n self.cbytes = cbytes\n self.blocksize = blocksize\n\n cdef compress_arrdata(self, ndarray array, int itemsize,\n object cparams, object _memory):\n \"\"\"Compress data in `array`\"\"\"\n cdef size_t nbytes, cbytes, blocksize, footprint\n\n # Compute the total number of bytes in this array\n nbytes = array.itemsize * array.size\n cbytes = 0\n footprint = 0\n\n # Check whether incoming data can be expressed as a constant or not.\n # Disk-based chunks are not allowed to do this.\n self.isconstant = 0\n self.constant = None\n if _memory and (array.strides[0] == 0\n or check_zeros(array.data, nbytes)):\n self.isconstant = 1\n # Get the NumPy constant. Avoid this NumPy quirk:\n # np.array(['1'], dtype='S3').dtype != s[0].dtype\n if array.dtype.kind != 'S':\n self.constant = array[0]\n else:\n self.constant = np.array(array[0], dtype=array.dtype)\n # Add overhead (64 bytes for the overhead of the numpy container)\n footprint += 64 + self.constant.size * self.constant.itemsize\n\n if self.isconstant:\n blocksize = 4 * 1024 # use 4 KB as a cache for blocks\n # Make blocksize a multiple of itemsize\n if blocksize % itemsize > 0:\n blocksize = cython.cdiv(blocksize, itemsize) * itemsize\n # Correct in case we have a large itemsize\n if blocksize == 0:\n blocksize = itemsize\n else:\n if self.typekind == 'b':\n self.true_count = true_count(array.data, nbytes)\n\n if array.strides[0] == 0:\n # The chunk is made of constants. Regenerate the actual data.\n array = array.copy()\n\n # Quantize data if necessary before compression\n if cparams.quantize:\n array = utils.quantize(array, cparams.quantize)\n # Compress data\n cbytes, blocksize = self.compress_data(\n array.data, itemsize, nbytes, cparams)\n return (nbytes, cbytes, blocksize, footprint)\n\n cdef compress_data(self, char *data, size_t itemsize, size_t nbytes,\n object cparams):\n \"\"\"Compress data with `cparams` and return metadata.\"\"\"\n cdef size_t nbytes_, cbytes, blocksize\n cdef int clevel, shuffle, ret\n cdef char *dest\n cdef char *cname_str\n\n clevel = cparams.clevel\n shuffle = cparams.shuffle\n cname = cparams.cname\n if type(cname) != bytes:\n cname = cname.encode()\n if blosc_set_compressor(cname) < 0:\n raise ValueError(\n \"Compressor '%s' is not available in this build\" % cname)\n dest = malloc(nbytes + BLOSC_MAX_OVERHEAD)\n if _get_use_threads():\n with nogil:\n ret = blosc_compress(clevel, shuffle, itemsize, nbytes,\n data, dest, nbytes + BLOSC_MAX_OVERHEAD)\n else:\n cname_str = cname\n with nogil:\n ret = blosc_compress_ctx(clevel, shuffle, itemsize, nbytes,\n data, dest,\n nbytes + BLOSC_MAX_OVERHEAD,\n cname_str, 0, 1)\n if ret <= 0:\n raise RuntimeError(\n \"fatal error during Blosc compression: %d\" % ret)\n # Copy the compressed buffer into a Bytes buffer\n cbytes = ret\n self.dobject = PyBytes_FromStringAndSize(dest, cbytes)\n # Get blocksize info for the instance\n blosc_cbuffer_sizes(dest, &nbytes_, &cbytes, &blocksize)\n assert nbytes_ == nbytes\n free(dest)\n\n return (cbytes, blocksize)\n\n def getdata(self):\n \"\"\"Get a compressed string object for this chunk (for persistence).\"\"\"\n cdef object string\n\n assert (not self.isconstant,\n \"This function can only be used for persistency\")\n return self.dobject\n\n def getudata(self):\n \"\"\"Get an uncompressed string out of this chunk (for 'O'bject types).\"\"\"\n cdef int ret\n cdef char *src\n cdef char *dest\n\n result_str = PyBytes_FromStringAndSize(NULL, self.nbytes)\n src = PyBytes_AS_STRING(self.dobject)\n dest = PyBytes_AS_STRING(result_str)\n\n if _get_use_threads():\n with nogil:\n ret = blosc_decompress(src, dest, self.nbytes)\n else:\n with nogil:\n ret = blosc_decompress_ctx(src, dest, self.nbytes, 1)\n if ret < 0:\n raise RuntimeError(\n \"fatal error during Blosc decompression: %d\" % ret)\n return result_str\n\n cdef void _getitem(self, int start, int stop, char *dest):\n \"\"\"Read data from `start` to `stop` and return it as a numpy array.\"\"\"\n cdef int ret, bsize, blen, nitems, nstart\n cdef ndarray constants\n cdef char *data\n\n blen = stop - start\n bsize = blen * self.atomsize\n nitems = cython.cdiv(bsize, self.itemsize)\n nstart = cython.cdiv(start * self.atomsize, self.itemsize)\n\n if self.isconstant:\n # The chunk is made of constants\n constants = np.ndarray(shape=(blen,), dtype=self.dtype,\n buffer=self.constant, strides=(0,)).copy()\n memcpy(dest, constants.data, bsize)\n return\n\n # Fill dest with uncompressed data\n data = PyBytes_AS_STRING(self.dobject)\n if bsize == self.nbytes:\n ret = blosc_decompress(data, dest, bsize)\n else:\n ret = blosc_getitem(data, nstart, nitems, dest)\n if ret < 0:\n raise RuntimeError(\n \"fatal error during Blosc decompression: %d\" % ret)\n\n def __getitem__(self, object key):\n \"\"\"__getitem__(self, key) -> values.\"\"\"\n cdef ndarray array\n cdef object start, stop, step, clen, idx\n\n if isinstance(key, _inttypes):\n # Quickly return a single element\n array = np.empty(shape=(1,), dtype=self.dtype)\n self._getitem(key, key + 1, array.data)\n return PyArray_GETITEM(array, array.data)\n elif isinstance(key, slice):\n (start, stop, step) = key.start, key.stop, key.step\n elif isinstance(key, tuple) and self.dtype.shape != ():\n # Build an array to guess indices\n clen = cython.cdiv(self.nbytes, self.itemsize)\n idx = np.arange(clen, dtype=np.int32).reshape(self.dtype.shape)\n idx2 = idx(key)\n if idx2.flags.contiguous:\n # The slice represents a contiguous slice. Get start and stop.\n start, stop = idx2.flatten()[[0, -1]]\n step = 1\n else:\n (start, stop, step) = key[0].start, key[0].stop, key[0].step\n else:\n raise IndexError(\"key not suitable:\", key)\n\n # Get the corrected values for start, stop, step\n clen = cython.cdiv(self.nbytes, self.atomsize)\n (start, stop, step) = slice(start, stop, step).indices(clen)\n\n # Build a numpy container\n array = np.empty(shape=(stop - start,), dtype=self.dtype)\n # Read actual data\n self._getitem(start, stop, array.data)\n\n # Return the value depending on the step\n if step > 1:\n return array[::step]\n return array\n\n def __setitem__(self, object key, object value):\n \"\"\"__setitem__(self, key, value) -> None.\"\"\"\n raise NotImplementedError()\n\n def __str__(self):\n \"\"\"Represent the chunk as an string.\"\"\"\n return str(self[:])\n\n def __repr__(self):\n \"\"\"Represent the chunk as an string, with additional info.\"\"\"\n cratio = self.nbytes / float(self.cbytes)\n fullrepr = \"chunk(%s) nbytes: %d; cbytes: %d; ratio: %.2f\\n%r\" % \\\n (self.dtype, self.nbytes, self.cbytes, cratio, str(self))\n return fullrepr\n\n\ncdef create_bloscpack_header(nchunks=None, format_version=FORMAT_VERSION):\n \"\"\"Create the bloscpack header string.\n\n Parameters\n ----------\n nchunks : int\n the number of chunks, default: None\n format_version : int\n the version format for the compressed file\n\n Returns\n -------\n bloscpack_header : string\n the header as string\n\n Notes\n -----\n\n The bloscpack header is 16 bytes as follows:\n\n |-0-|-1-|-2-|-3-|-4-|-5-|-6-|-7-|-8-|-9-|-A-|-B-|-C-|-D-|-E-|-F-|\n | b l p k | ^ | RESERVED | nchunks |\n version\n\n The first four are the magic string 'blpk'. The next one is an 8 bit\n unsigned little-endian integer that encodes the format version. The next\n three are reserved, and in the last eight there is a signed 64 bit little\n endian integer that encodes the number of chunks.\n\n Currently (bcolz 1.x), version is 1 and nchunks always have a value of 1\n (this might change in bcolz 2.0).\n\n The value of '-1' for 'nchunks' designates an unknown size and can be\n set by setting 'nchunks' to None.\n\n Raises\n ------\n ValueError\n if the nchunks argument is too large or negative\n struct.error\n if the format_version is too large or negative\n\n \"\"\"\n if not 0 <= nchunks <= MAX_CHUNKS and nchunks is not None:\n raise ValueError(\n \"'nchunks' must be in the range 0 <= n <= %d, not '%s'\" %\n (MAX_CHUNKS, str(nchunks)))\n return (MAGIC + struct.pack('= (3, 0):\n def decode_byte(byte):\n return byte\nelse:\n def decode_byte(byte):\n return int(byte.encode('hex'), 16)\ndef decode_uint32(fourbyte):\n return struct.unpack(' cython.cdiv(self._nbytes, self._chunksize)\n\n property partitions:\n \"\"\"List of tuples indicating the bounds for each chunk\"\"\"\n def __get__(self):\n nchunks = cython.cdiv(self._nbytes, self._chunksize)\n chunklen = cython.cdiv(self._chunksize, self.atomsize)\n return [(i * chunklen, (i + 1) * chunklen) for i in\n xrange(nchunks)]\n\n property attrs:\n \"\"\"The attribute accessor.\n\n See Also\n --------\n\n attrs.attrs\n\n \"\"\"\n def __get__(self):\n return self._attrs\n\n property cbytes:\n \"The compressed size of this object (in bytes).\"\n def __get__(self):\n return self._cbytes\n\n property chunklen:\n \"The chunklen of this object (in rows).\"\n def __get__(self):\n return self._chunklen\n\n property cparams:\n \"The compression parameters for this object.\"\n def __get__(self):\n return self._cparams\n\n property dflt:\n \"The default value of this object.\"\n def __get__(self):\n return self._dflt\n\n property dtype:\n \"The dtype of this object.\"\n def __get__(self):\n return self._dtype.base\n\n property len:\n \"The length (leading dimension) of this object.\"\n def __get__(self):\n if self._dtype.char == 'O':\n return len(self.chunks)\n else:\n # Important to do the cast in order to get a npy_intp result\n return cython.cdiv(self._nbytes, self.atomsize)\n\n property mode:\n \"The mode used to create/open the `mode`.\"\n def __get__(self):\n return self._mode\n def __set__(self, value):\n self._mode = value\n if hasattr(self.chunks, 'mode'):\n self.chunks.mode = value\n\n property nbytes:\n \"The original (uncompressed) size of this object (in bytes).\"\n def __get__(self):\n return self._nbytes\n\n property nleftover:\n \"The number of leftover elements.\"\n def __get__(self):\n return cython.cdiv(self.leftover, self.atomsize)\n\n property ndim:\n \"The number of dimensions of this object.\"\n def __get__(self):\n return len(self.shape)\n\n property safe:\n \"Whether or not to perform type/shape checks on every operation.\"\n def __get__(self):\n return self._safe\n\n property shape:\n \"The shape of this object.\"\n def __get__(self):\n # note: the int cast is in order to get a consistent type\n # across windows and linux\n return tuple((int(self.len),) + self._dtype.shape)\n\n property size:\n \"The size of this object.\"\n def __get__(self):\n return np.prod(self.shape)\n\n property rootdir:\n \"The on-disk directory used for persistency.\"\n def __get__(self):\n return self._rootdir\n def __set__(self, value):\n if not self.rootdir:\n raise ValueError(\n \"cannot modify the rootdir value of an in-memory carray\")\n self._rootdir = value\n self.chunks.rootdir = value\n\n def __cinit__(self, object array=None, object cparams=None,\n object dtype=None, object dflt=None,\n object expectedlen=None, object chunklen=None,\n object rootdir=None, object safe=True, object mode=\"a\"):\n\n self._rootdir = rootdir\n if mode not in ('r', 'w', 'a'):\n raise ValueError(\"mode should be 'r', 'w' or 'a'\")\n self._mode = mode\n self._safe = safe\n\n if array is not None:\n self._create_carray(array, cparams, dtype, dflt,\n expectedlen, chunklen, rootdir, mode)\n _new = True\n elif rootdir is not None:\n meta_info = self._read_meta()\n self._open_carray(*meta_info)\n _new = False\n else:\n raise ValueError(\n \"You need at least to pass an array or/and a rootdir\")\n\n # Attach the attrs to this object\n self._attrs = attrs.attrs(self._rootdir, self.mode, _new=_new)\n\n # Cache a len-1 array for accelerating self[int] case\n self.arr1 = np.empty(shape=(1,), dtype=self._dtype)\n\n # Sentinels\n self.sss_mode = False\n self.wheretrue_mode = False\n self.where_mode = False\n self.idxcache = -1 # cache not initialized\n\n cdef _adapt_dtype(self, dtype_, shape):\n \"\"\"adapt the dtype to one supported in carray.\n returns the adapted type with the shape modified accordingly.\n \"\"\"\n if dtype_.hasobject:\n if dtype_ != np.object_:\n raise TypeError(repr(dtype_) + \" is not a supported dtype\")\n else:\n dtype_ = np.dtype((dtype_, shape[1:]))\n\n return dtype_\n\n def _create_carray(self, array, cparams, dtype, dflt,\n expectedlen, chunklen, rootdir, mode):\n \"\"\"Create a new array.\n\n There are restrictions creating carray objects with dtypes that have\n objects (dtype.hasobject is True). The only case where this dtype is\n supported is on unidimensional arrays whose dtype is object (objects in\n composite dtypes are not supported).\n\n \"\"\"\n cdef int itemsize, atomsize, chunksize\n cdef ndarray lastchunkarr\n cdef object array_, _dflt\n\n # Check defaults for cparams\n if cparams is None:\n cparams = bcolz.cparams()\n\n if not isinstance(cparams, bcolz.cparams):\n raise ValueError(\n \"`cparams` param must be an instance of `cparams` class\")\n\n # Convert input to an appropriate type\n if type(dtype) is str:\n dtype = np.dtype(dtype)\n\n # avoid bad performance with another carray, as in utils it would\n # construct the temp ndarray using a slow iterator.\n #\n # TODO: There should be a fast path creating carrays from other carrays\n # (especially when dtypes and compression params match)\n if isinstance(array, carray):\n array = array[:]\n\n array_ = utils.to_ndarray(array, dtype)\n\n # if no base dtype is provided, use the dtype from the array.\n if dtype is None:\n dtype = array_.dtype.base\n\n # Multidimensional array. The atom will have array_.shape[1:] dims.\n # atom dimensions will be stored in `self._dtype`, which is different\n # than `self.dtype` in that `self._dtype` dimensions are borrowed\n # from `self.shape`. `self.dtype` will always be scalar (NumPy\n # convention).\n #\n # Note that objects are a special case. Carray does not support object\n # arrays of more than one dimension.\n self._dtype = dtype = self._adapt_dtype(dtype, array_.shape)\n\n # Check that atom size is less than 2 GB\n if dtype.itemsize >= 2 ** 31:\n raise ValueError(\"atomic size is too large (>= 2 GB)\")\n\n # Check that atom size is larger than 0\n if dtype.itemsize == 0:\n raise TypeError(\"atomic size cannot be zero\")\n\n self.atomsize = atomsize = dtype.itemsize\n \"\"\"The size in bytes of the atom (carray[0,:]).\"\"\"\n self.itemsize = itemsize = dtype.base.itemsize\n \"\"\"The size in bytes of the elments of the carray.\"\"\"\n\n # Check defaults for dflt\n _dflt = np.zeros((), dtype=dtype.base)\n if dflt is not None:\n _dflt[()] = dflt\n self._dflt = _dflt\n\n # Compute the chunklen/chunksize\n if expectedlen is None:\n # Try a guess\n try:\n expectedlen = len(array_)\n except TypeError:\n raise NotImplementedError(\n \"creating carrays from scalar objects is not supported\")\n try:\n self.expectedlen = expectedlen\n except OverflowError:\n raise OverflowError(\n \"The size cannot be larger than 2**31 on 32-bit platforms\")\n if chunklen is None:\n # Try a guess\n chunksize = utils.calc_chunksize(\n (expectedlen * atomsize) / float(_MB))\n # Chunksize must be a multiple of atomsize\n chunksize = cython.cdiv(chunksize, atomsize) * atomsize\n # Protection against large itemsizes\n if chunksize < atomsize:\n chunksize = atomsize\n else:\n if not isinstance(chunklen, int) or chunklen < 1:\n raise ValueError(\"chunklen must be a positive integer\")\n chunksize = chunklen * atomsize\n chunklen = cython.cdiv(chunksize, atomsize)\n self._chunksize = chunksize\n self._chunklen = chunklen\n\n # Book memory for last chunk (uncompressed)\n # Use np.zeros here because they compress better\n lastchunkarr = np.zeros(dtype=dtype, shape=(chunklen,))\n self.lastchunk = lastchunkarr.data\n self.lastchunkarr = lastchunkarr\n\n # Create layout for data and metadata\n self._cparams = cparams\n self.chunks = []\n \"\"\"The chunks container\"\"\"\n if rootdir is not None:\n self._mkdirs(rootdir, mode)\n metainfo = (\n dtype, cparams, self.shape[0], lastchunkarr, self._mode)\n self.chunks = chunks(self._rootdir, metainfo=metainfo, _new=True)\n # We can write the metainfo already\n self._write_meta()\n\n # Finally, fill the chunks\n # Object dtype requires special storage\n if array_.dtype.char == 'O':\n for obj in array_:\n self._store_obj(obj)\n else:\n self._fill_chunks(array_)\n\n # and flush the data pending...\n self.flush()\n\n def _open_carray(self, shape, cparams, dtype, dflt,\n expectedlen, cbytes, chunklen, xchunks=None):\n \"\"\"Open an existing array.\"\"\"\n cdef ndarray lastchunkarr\n cdef object array_, _dflt\n cdef npy_intp calen\n\n if len(shape) == 1:\n self._dtype = dtype\n else:\n # Multidimensional array. The atom will have array_.shape[1:]\n # dims.\n # atom dimensions will be stored in `self._dtype`, which is\n # different\n # than `self.dtype` in that `self._dtype` dimensions are borrowed\n # from `self.shape`. `self.dtype` will always be scalar (NumPy\n # convention).\n self._dtype = dtype = np.dtype((dtype.base, shape[1:]))\n\n self._cparams = cparams\n self.atomsize = dtype.itemsize\n self.itemsize = dtype.base.itemsize\n self._chunklen = chunklen\n self._chunksize = chunklen * self.atomsize\n self._dflt = dflt\n self.expectedlen = expectedlen\n\n # Book memory for last chunk (uncompressed)\n # Use np.zeros here because they compress better\n lastchunkarr = np.zeros(dtype=dtype, shape=(chunklen,))\n self.lastchunk = lastchunkarr.data\n self.lastchunkarr = lastchunkarr\n\n if xchunks is None:\n # No chunks container, so read meta info from disk\n # Check rootdir hierarchy\n if not os.path.isdir(self._rootdir):\n raise IOError(\"root directory does not exist\")\n self.datadir = os.path.join(self._rootdir, DATA_DIR)\n if not os.path.isdir(self.datadir):\n raise IOError(\"data directory does not exist\")\n self.metadir = os.path.join(self._rootdir, META_DIR)\n if not os.path.isdir(self.metadir):\n raise IOError(\"meta directory does not exist\")\n\n # Finally, open data directory\n metainfo = (dtype, cparams, shape[0], lastchunkarr, self._mode)\n self.chunks = chunks(self._rootdir, metainfo=metainfo, _new=False)\n else:\n self.chunks, lastchunkarr[:] = xchunks\n\n # Update some counters\n calen = shape[0] # the length ot the carray\n self.leftover = cython.cmod(calen, chunklen) * self.atomsize\n self._cbytes = cbytes\n self._nbytes = calen * self.atomsize\n\n if self._mode == \"w\":\n # Remove all entries when mode is 'w'\n self.resize(0)\n\n def _fill_chunks(self, object array_):\n \"\"\"Fill chunks, either in-memory or on-disk.\"\"\"\n cdef int leftover, chunklen\n cdef npy_intp i, nchunks\n cdef npy_intp nbytes, cbytes\n cdef chunk chunk_\n cdef ndarray remainder\n\n # The number of bytes in incoming array\n nbytes = self.itemsize * array_.size\n self._nbytes = nbytes\n\n # Compress data in chunks\n cbytes = 0\n chunklen = self._chunklen\n nchunks = cython.cdiv(nbytes, self._chunksize)\n for i from 0 <= i < nchunks:\n assert i * chunklen < array_.size, \"i, nchunks: %d, %d\" % (\n i, nchunks)\n chunk_ = chunk(array_[i * chunklen:(i + 1) * chunklen],\n self._dtype, self._cparams,\n _memory=self._rootdir is None)\n self.chunks.append(chunk_)\n cbytes += chunk_.cbytes\n self.leftover = leftover = cython.cmod(nbytes, self._chunksize)\n if leftover:\n remainder = array_[nchunks * chunklen:]\n memcpy(self.lastchunk, remainder.data, leftover)\n cbytes += self._chunksize # count the space in last chunk\n self._cbytes = cbytes\n\n def _mkdirs(self, object rootdir, object mode):\n \"\"\"Create the basic directory layout for persistent storage.\"\"\"\n if os.path.exists(rootdir):\n if self._mode != \"w\":\n raise IOError(\n \"specified rootdir path '%s' already exists \"\n \"and creation mode is '%s'\" % (rootdir, mode))\n if os.path.isdir(rootdir):\n shutil.rmtree(rootdir)\n else:\n os.remove(rootdir)\n os.mkdir(rootdir)\n self.datadir = os.path.join(rootdir, DATA_DIR)\n os.mkdir(self.datadir)\n self.metadir = os.path.join(rootdir, META_DIR)\n os.mkdir(self.metadir)\n\n def _write_meta(self):\n \"\"\"Write metadata persistently.\"\"\"\n storagef = os.path.join(self.metadir, STORAGE_FILE)\n with open(storagef, 'wb') as storagefh:\n dflt_list = self.dflt.tolist()\n if type(dflt_list) in (datetime.datetime,\n datetime.date, datetime.time):\n # The datetime cannot be serialized with JSON. Use a 0 int.\n dflt_list = 0\n # In Python 3, the json encoder doesn't accept bytes objects\n if sys.version_info >= (3, 0):\n dflt_list = list_bytes_to_str(dflt_list)\n storagefh.write(json.dumps({\n # str(self.dtype) produces bytes by default in cython.py3.\n # Calling .__str__() is a workaround.\n \"dtype\": self.dtype.__str__(),\n \"cparams\": {\n \"clevel\": self.cparams.clevel,\n \"shuffle\": self.cparams.shuffle,\n \"cname\": self.cparams.cname,\n \"quantize\": self.cparams.quantize,\n },\n \"chunklen\": self._chunklen,\n \"expectedlen\": self.expectedlen,\n \"dflt\": dflt_list,\n }, ensure_ascii=True).encode('ascii'))\n storagefh.write(b\"\\n\")\n\n def _read_meta(self):\n \"\"\"Read persistent metadata.\"\"\"\n\n # First read the size info\n metadir = os.path.join(self._rootdir, META_DIR)\n shapef = os.path.join(metadir, SIZES_FILE)\n with open(shapef, 'rb') as shapefh:\n sizes = json.loads(shapefh.read().decode('ascii'))\n shape = sizes['shape']\n if type(shape) == list:\n shape = tuple(shape)\n nbytes = sizes[\"nbytes\"]\n cbytes = sizes[\"cbytes\"]\n\n # Then the rest of metadata\n storagef = os.path.join(metadir, STORAGE_FILE)\n with open(storagef, 'rb') as storagefh:\n data = json.loads(storagefh.read().decode('ascii'))\n dtype_ = np.dtype(data[\"dtype\"])\n chunklen = data[\"chunklen\"]\n cparams = data[\"cparams\"]\n cname = cparams['cname'] if 'cname' in cparams else 'blosclz'\n quantize = cparams['quantize'] if 'quantize' in cparams else None\n cparams = bcolz.cparams(\n clevel=data[\"cparams\"][\"clevel\"],\n shuffle=data[\"cparams\"][\"shuffle\"],\n cname=cname,\n quantize=quantize)\n expectedlen = data[\"expectedlen\"]\n dflt = data[\"dflt\"]\n return (shape, cparams, dtype_, dflt, expectedlen, cbytes, chunklen)\n\n def _store_obj(self, object arrobj):\n cdef chunk chunk_\n import pickle\n\n pick_obj = pickle.dumps(arrobj, pickle.HIGHEST_PROTOCOL)\n chunk_ = chunk(pick_obj, np.dtype('O'), self._cparams,\n _memory=self._rootdir is None)\n\n self.chunks.append(chunk_)\n # Update some counters\n nbytes, cbytes = chunk_.nbytes, chunk_.cbytes\n self._cbytes += cbytes\n self._nbytes += nbytes\n\n def append(self, object array):\n \"\"\"Append a numpy `array` to this instance.\n\n Parameters\n ----------\n array : NumPy-like object\n The array to be appended. Must be compatible with shape and\n type of\n the carray.\n\n \"\"\"\n cdef int atomsize, itemsize, chunksize, leftover\n cdef int nbytesfirst, chunklen, start, stop\n cdef npy_intp nbytes, cbytes, bsize, i, nchunks, j\n cdef ndarray remainder, arrcpy, dflts\n cdef chunk chunk_\n\n if self.safe:\n if self.mode == \"r\":\n raise IOError(\n \"cannot modify data because mode is '%s'\" % self.mode)\n\n arrcpy = utils.to_ndarray(array, self._dtype, safe=self._safe)\n if arrcpy.dtype != self._dtype.base:\n raise TypeError(\"array dtype does not match with self\")\n\n # Object dtype requires special storage\n if arrcpy.dtype.char == 'O':\n for j in range(len(arrcpy)):\n self._store_obj(arrcpy[j])\n return\n\n # Appending a single row should be supported\n if np.shape(arrcpy) == self._dtype.shape:\n arrcpy = arrcpy.reshape((1,) + np.shape(arrcpy))\n if np.shape(arrcpy)[1:] != self._dtype.shape:\n raise ValueError(\n \"array trailing dimensions do not match with self\")\n else:\n arrcpy = array\n\n atomsize = self.atomsize\n itemsize = self.itemsize\n chunksize = self._chunksize\n chunks = self.chunks\n leftover = self.leftover\n bsize = arrcpy.size * itemsize\n cbytes = 0\n\n # Check if array fits in existing buffer\n if (bsize + leftover) < chunksize:\n # Data fits in lastchunk buffer. Just copy it\n if arrcpy.strides[0] > 0:\n memcpy(self.lastchunk + leftover, arrcpy.data, bsize)\n else:\n start = cython.cdiv(leftover, atomsize)\n stop = cython.cdiv((leftover + bsize), atomsize)\n self.lastchunkarr[start:stop] = arrcpy\n leftover += bsize\n else:\n # Data does not fit in buffer. Break it in chunks.\n\n # First, fill the last buffer completely (if needed)\n if leftover:\n nbytesfirst = chunksize - leftover\n if arrcpy.strides[0] > 0:\n memcpy(self.lastchunk + leftover, arrcpy.data, nbytesfirst)\n else:\n start = cython.cdiv(leftover, atomsize)\n stop = cython.cdiv((leftover + nbytesfirst), atomsize)\n self.lastchunkarr[start:stop] = arrcpy[start:stop]\n # Compress the last chunk and add it to the list\n chunk_ = chunk(self.lastchunkarr, self._dtype, self._cparams,\n _memory=self._rootdir is None)\n chunks.append(chunk_)\n cbytes = chunk_.cbytes\n else:\n nbytesfirst = 0\n\n # Then fill other possible chunks\n nbytes = bsize - nbytesfirst\n nchunks = cython.cdiv(nbytes, chunksize)\n chunklen = self._chunklen\n # Get a new view skipping the elements that have been already\n # copied\n remainder = arrcpy[cython.cdiv(nbytesfirst, atomsize):]\n for i from 0 <= i < nchunks:\n chunk_ = chunk(\n remainder[i * chunklen:(i + 1) * chunklen], self._dtype,\n self._cparams,\n _memory=self._rootdir is None)\n chunks.append(chunk_)\n cbytes += chunk_.cbytes\n\n # Finally, deal with the leftover\n leftover = cython.cmod(nbytes, chunksize)\n if leftover:\n remainder = remainder[nchunks * chunklen:]\n if arrcpy.strides[0] > 0:\n memcpy(self.lastchunk, remainder.data, leftover)\n else:\n self.lastchunkarr[:len(remainder)] = remainder\n\n # Update some counters\n self.leftover = leftover\n self._cbytes += cbytes\n self._nbytes += bsize\n return\n\n def trim(self, object nitems):\n \"\"\"Remove the trailing `nitems` from this instance.\n\n Parameters\n ----------\n nitems : int\n The number of trailing items to be trimmed. If negative,\n the object\n is enlarged instead.\n\n \"\"\"\n cdef int atomsize, leftover, leftover2\n cdef npy_intp cbytes, bsize, nchunk2\n cdef chunk chunk_\n\n if not isinstance(nitems, _inttypes + (float,)):\n raise TypeError(\"`nitems` must be an integer\")\n\n # Check that we don't run out of space\n if nitems > self.len:\n raise ValueError(\"`nitems` must be less than total length\")\n # A negative number of items means that we want to grow the object\n if nitems <= 0:\n self.resize(self.len - nitems)\n return\n\n atomsize = self.atomsize\n chunks = self.chunks\n leftover = self.leftover\n bsize = nitems * atomsize\n cbytes = 0\n\n # Check if items belong to the last chunk\n if (leftover - bsize) > 0:\n # Just update leftover counter\n leftover -= bsize\n else:\n # nitems larger than last chunk\n nchunk = cython.cdiv((self.len - nitems), self._chunklen)\n leftover2 = cython.cmod((self.len - nitems), self._chunklen)\n leftover = leftover2 * atomsize\n\n # Remove complete chunks\n nchunk2 = lnchunk = cython.cdiv(\n self._nbytes, self._chunksize)\n while nchunk2 > nchunk:\n chunk_ = chunks.pop()\n cbytes += chunk_.cbytes\n nchunk2 -= 1\n\n # Finally, deal with the leftover\n if leftover:\n self.lastchunkarr[:leftover2] = chunk_[:leftover2]\n if self._rootdir:\n # Last chunk is removed automatically by the chunks.pop(\n # ) call, and\n # always is counted as if it is not compressed (although\n # it is in\n # this state on-disk)\n cbytes += chunk_.nbytes\n\n # Update some counters\n self.leftover = leftover\n self._cbytes -= cbytes\n self._nbytes -= bsize\n # Flush last chunk and update counters on-disk\n self.flush()\n\n def resize(self, object nitems):\n \"\"\"Resize the instance to have `nitems`.\n\n Parameters\n ----------\n nitems : int\n The final length of the object. If `nitems` is larger than the\n actual\n length, new items will appended using `self.dflt` as filling\n values.\n\n \"\"\"\n cdef object chunk\n\n if not isinstance(nitems, _inttypes + (float,)):\n raise TypeError(\"`nitems` must be an integer\")\n\n if nitems == self.len:\n return\n elif nitems < 0:\n raise ValueError(\"`nitems` cannot be negative\")\n\n if nitems > self.len:\n chunk = np.empty(nitems - self.len, dtype=self._dtype)\n chunk[:] = self._dflt\n self.append(chunk)\n self.flush()\n else:\n # Just trim the excess of items\n self.trim(self.len - nitems)\n\n def reshape(self, newshape):\n \"\"\"Returns a new carray containing the same data with a new shape.\n\n Parameters\n ----------\n newshape : int or tuple of ints\n The new shape should be compatible with the original shape. If\n an integer, then the result will be a 1-D array of that length.\n One shape dimension can be -1. In this case, the value is inferred\n from the length of the array and remaining dimensions.\n\n Returns\n -------\n reshaped_array : carray\n A copy of the original carray.\n\n \"\"\"\n cdef npy_intp newlen, ilen, isize, osize, newsize, rsize, i\n cdef object ishape, oshape, pos, newdtype, out\n\n # Enforce newshape as tuple\n if isinstance(newshape, _inttypes):\n newshape = (newshape,)\n newsize = np.prod(newshape)\n\n ishape = self.shape\n ilen = ishape[0]\n isize = np.prod(ishape)\n\n # Check for -1 in newshape\n if -1 in newshape:\n if newshape.count(-1) > 1:\n raise ValueError(\"only one shape dimension can be -1\")\n pos = newshape.index(-1)\n osize = np.prod(newshape[:pos] + newshape[pos + 1:])\n if isize == 0:\n newshape = newshape[:pos] + (0,) + newshape[pos + 1:]\n else:\n newshape = newshape[:pos] + (isize / osize,) + newshape[\n pos + 1:]\n newsize = np.prod(newshape)\n\n # Check shape compatibility\n if isize != newsize:\n raise ValueError(\n \"`newshape` is not compatible with the current one\")\n # Create the output container\n newdtype = np.dtype((self._dtype.base, newshape[1:]))\n newlen = newshape[0]\n\n # If shapes are both n-dimensional, convert first to 1-dim shape\n # and then convert again to the final newshape.\n if len(ishape) > 1 and len(newshape) > 1:\n out = self.reshape(-1)\n return out.reshape(newshape)\n\n if self._rootdir:\n # If persistent, do the copy to a temporary dir\n absdir = os.path.dirname(self._rootdir)\n rootdir = tempfile.mkdtemp(suffix='__temp__', dir=absdir)\n else:\n rootdir = None\n\n # Create the final container and fill it\n out = carray([], dtype=newdtype, cparams=self.cparams,\n expectedlen=newlen,\n rootdir=rootdir, mode='w')\n if newlen < ilen:\n rsize = isize / newlen\n for i from 0 <= i < newlen:\n out.append(\n self[i * rsize:(i + 1) * rsize].reshape(newdtype.shape))\n else:\n for i from 0 <= i < ilen:\n out.append(self[i].reshape(-1))\n out.flush()\n\n # Finally, rename the temporary data directory to self._rootdir\n if self._rootdir:\n shutil.rmtree(self._rootdir)\n os.rename(rootdir, self._rootdir)\n # Restore the rootdir and mode\n out.rootdir = self._rootdir\n out.mode = self._mode\n\n return out\n\n def copy(self, **kwargs):\n \"\"\"Return a copy of this object.\n\n Parameters\n ----------\n kwargs : list of parameters or dictionary\n Any parameter supported by the carray constructor.\n\n Returns\n -------\n out : carray object\n The copy of this object.\n\n \"\"\"\n cdef object chunklen\n\n # Get defaults for some parameters\n expectedlen = kwargs.pop('expectedlen', self.len)\n\n # Create a new, empty carray\n ccopy = carray(np.empty(0, dtype=self._dtype),\n expectedlen=expectedlen,\n **kwargs)\n\n # Now copy the carray chunk by chunk\n chunklen = self._chunklen\n for i from 0 <= i < self.len by chunklen:\n ccopy.append(self[i:i + chunklen])\n ccopy.flush()\n\n return ccopy\n\n def view(self):\n \"\"\"Create a light weight view of the data in the original carray.\n\n Returns\n -------\n out : carray object\n The view of this object.\n\n See Also\n --------\n copy\n\n \"\"\"\n # Create a light weight data container\n cview = carray(np.empty(0, dtype=self._dtype))\n # And populate it with metainfo (including chunks)\n meta_info = (self.shape, self.cparams, self.dtype, self.dflt,\n self.expectedlen, self.cbytes, self.chunklen)\n cview._open_carray(*meta_info, xchunks=(self.chunks, self.lastchunkarr))\n return cview\n\n def sum(self, dtype=None):\n \"\"\"Return the sum of the array elements.\n\n Parameters\n ----------\n dtype : NumPy dtype\n The desired type of the output. If ``None``, the dtype of\n `self` is\n used. An exception is when `self` has an integer type with less\n precision than the default platform integer. In that case, the\n default platform integer is used instead (NumPy convention).\n\n\n Returns\n -------\n out : NumPy scalar with `dtype`\n\n \"\"\"\n cdef chunk chunk_\n cdef npy_intp nchunk, nchunks\n cdef object result\n\n if dtype is None:\n dtype = self._dtype.base\n # Check if we have less precision than required for ints\n # (mimick NumPy logic)\n if dtype.kind in ('b', 'i') and dtype.itemsize < IntType.itemsize:\n dtype = IntType\n else:\n dtype = np.dtype(dtype)\n if dtype.kind == 'S':\n raise TypeError(\"cannot perform reduce with flexible type\")\n\n # Get a container for the result\n result = np.zeros(1, dtype=dtype)[0]\n\n nchunks = cython.cdiv(self._nbytes, self._chunksize)\n for chunk_ in self.chunks:\n if chunk_.isconstant:\n result += chunk_.constant * self._chunklen\n elif self._dtype.type == np.bool_:\n result += chunk_.true_count\n else:\n result += chunk_[:].sum(dtype=dtype)\n if self.leftover:\n leftover = self.len - nchunks * self._chunklen\n result += self.lastchunkarr[:leftover].sum(dtype=dtype)\n\n return result\n\n def __len__(self):\n return self.len\n\n def __sizeof__(self):\n return self._cbytes\n\n cdef int getitem_cache(self, npy_intp pos, char *dest):\n \"\"\"Get a single item and put it in `dest`. It caches a complete block.\n\n It returns 1 if asked `pos` can be copied to `dest`. Else,\n this returns\n 0.\n\n NOTE: As Blosc supports decompressing just a block inside a chunk, the\n data that is cached is a *block*, as it is the least amount of data\n that\n can be decompressed. This saves both time and memory.\n\n IMPORTANT: Any update operation (e.g. __setitem__) *must* disable this\n cache by setting self.idxcache = -2.\n \"\"\"\n cdef int ret, atomsize, blocksize, offset, extent\n cdef int idxcache, posinbytes, blocklen\n cdef npy_intp nchunk, nchunks, chunklen\n cdef chunk chunk_\n\n atomsize = self.atomsize\n nchunks = cython.cdiv(self._nbytes, self._chunksize)\n chunklen = self._chunklen\n nchunk = cython.cdiv(pos, chunklen)\n pos -= nchunk * chunklen\n\n # Check whether pos is in the last chunk\n if nchunk == nchunks and self.leftover:\n posinbytes = (pos % chunklen) * atomsize\n memcpy(dest, self.lastchunk + posinbytes, atomsize)\n return 1\n\n # Locate the *block* inside the chunk\n chunk_ = self.chunks[nchunk]\n blocksize = chunk_.blocksize\n blocklen = cython.cdiv(blocksize, atomsize)\n\n if (atomsize > blocksize):\n # This request cannot be resolved here\n return 0\n\n # Check whether the cache block has to be initialized\n if self.idxcache < 0:\n self.blockcache = np.empty(shape=(blocklen,), dtype=self._dtype)\n self.datacache = self.blockcache.data\n\n # Check if block is cached\n offset = cython.cdiv(pos, blocklen) * blocklen\n posinbytes = (pos % blocklen) * atomsize\n idxcache = nchunk * chunklen + offset\n if idxcache == self.idxcache:\n # Hit!\n memcpy(dest, self.datacache + posinbytes, atomsize)\n return 1\n\n # No luck. Read a complete block.\n extent = blocklen\n if offset + blocklen > chunklen:\n extent = chunklen % blocklen\n chunk_._getitem(offset, offset + extent, self.datacache)\n # Copy the interesting bits to dest\n memcpy(dest, self.datacache + posinbytes, atomsize)\n # Update the cache index\n self.idxcache = idxcache\n return 1\n\n def free_cachemem(self):\n \"\"\"Release in-memory cached chunk\"\"\"\n if type(self.chunks) is not list:\n self.chunks.free_cachemem()\n self.idxcache = -1\n self.blockcache = None\n\n def _getitem_object(self, start, stop=None, step=None):\n \"\"\"Retrieve elements of type object.\"\"\"\n import pickle\n\n if stop is None and step is None:\n # Integer\n cchunk = self.chunks[start]\n chunk = cchunk.getudata()\n return pickle.loads(chunk)\n\n # Range\n objs = [self._getitem_object(i) for i in xrange(start, stop, step)]\n return np.array(objs, dtype=self._dtype)\n\n def __getitem__(self, object key):\n \"\"\" x.__getitem__(key) <==> x[key]\n\n Returns values based on `key`. All the functionality of\n ``ndarray.__getitem__()`` is supported (including fancy indexing),\n plus a\n special support for expressions:\n\n Parameters\n ----------\n key : string\n It will be interpret as a boolean expression (computed via\n `eval`) and\n the elements where these values are true will be returned as a\n NumPy\n array.\n\n See Also\n --------\n eval\n\n \"\"\"\n\n cdef int chunklen\n cdef npy_intp startb, stopb\n cdef npy_intp nchunk, keychunk, nchunks, first_chunk, last_chunk\n cdef npy_intp nwrow, blen\n cdef ndarray arr1, dest\n cdef object start, stop, step\n cdef object arr\n cdef chunk _chunk\n\n chunklen = self._chunklen\n\n # Check for integer\n if isinstance(key, _inttypes):\n if key < 0:\n # To support negative values\n key += self.len\n if key >= self.len:\n raise IndexError(\"index out of range\")\n arr1 = self.arr1\n if self.dtype.char == 'O':\n return self._getitem_object(key)\n if self.getitem_cache(key, arr1.data):\n if self.itemsize == self.atomsize:\n return PyArray_GETITEM(arr1, arr1.data)\n else:\n return arr1[0].copy()\n # Fallback action: use the slice code\n return np.squeeze(self[slice(key, key + 1, 1)])\n # Slices\n elif isinstance(key, slice):\n (start, stop, step) = key.start, key.stop, key.step\n if step and step <= 0:\n raise NotImplementedError(\"step in slice can only be positive\")\n # Multidimensional keys\n elif isinstance(key, tuple):\n if len(key) == 0:\n raise ValueError(\"empty tuple not supported\")\n elif len(key) == 1:\n return self[key[0]]\n # An n-dimensional slice\n # First, retrieve elements in the leading dimension\n arr = self[key[0]]\n # Then, keep only the required elements in other dimensions\n if type(key[0]) == slice:\n arr = arr[(slice(None),) + key[1:]]\n else:\n arr = arr[key[1:]]\n # Force a copy in case returned array is not contiguous\n if not arr.flags.contiguous:\n arr = arr.copy()\n return arr\n # List of integers (case of fancy indexing)\n elif isinstance(key, list):\n # Try to convert to a integer array\n try:\n key = np.array(key, dtype=np.int_)\n except:\n raise IndexError(\n \"key cannot be converted to an array of indices\")\n return self[key]\n # A boolean or integer array (case of fancy indexing)\n elif hasattr(key, \"dtype\"):\n if key.dtype.type == np.bool_:\n # A boolean array\n if len(key) != self.len:\n raise IndexError(\n \"boolean array length must match len(self)\")\n if isinstance(key, carray):\n count = key.sum()\n else:\n count = -1\n return np.fromiter(self.where(key), dtype=self._dtype,\n count=count)\n elif np.issubsctype(key, np.int_):\n # An integer array\n return np.array([self[i] for i in key], dtype=self._dtype.base)\n else:\n raise IndexError(\n \"arrays used as indices must be integer (or boolean)\")\n # A boolean expression (case of fancy indexing)\n elif type(key) is str:\n # Evaluate\n result = bcolz.eval(key)\n if result.dtype.type != np.bool_:\n raise IndexError(\"only boolean expressions supported\")\n if len(result) != self.len:\n raise IndexError(\n \"boolean expression outcome must match len(self)\")\n # Call __getitem__ again\n return self[result]\n # All the rest not implemented\n else:\n raise NotImplementedError(\"key not supported: %s\" % repr(key))\n\n # From now on, will only deal with [start:stop:step] slices\n\n # Get the corrected values for start, stop, step\n (start, stop, step) = slice(start, stop, step).indices(self.len)\n\n # Build a numpy container\n blen = get_len_of_range(start, stop, step)\n arr = np.empty(shape=(blen,), dtype=self._dtype)\n if blen == 0:\n # If empty, return immediately\n return arr\n\n if self.dtype.char == 'O':\n return self._getitem_object(start, stop, step)\n\n # Fill it from data in chunks\n nwrow = 0\n nchunks = cython.cdiv(self._nbytes, self._chunksize)\n if self.leftover > 0:\n nchunks += 1\n first_chunk = cython.cdiv(start, self.chunklen)\n last_chunk = cython.cdiv(stop, self.chunklen) + 1\n last_chunk = min(last_chunk, nchunks)\n for nchunk from first_chunk <= nchunk < last_chunk:\n # Compute start & stop for each block\n startb, stopb, blen = clip_chunk(nchunk, chunklen, start, stop,\n step)\n if blen == 0:\n continue\n # Get the data chunk and assign it to result array\n if nchunk == nchunks - 1 and self.leftover:\n arr[nwrow:nwrow + blen] = self.lastchunkarr[startb:stopb:step]\n else:\n if step > 1:\n arr[nwrow:nwrow + blen] = self.chunks[nchunk][\n startb:stopb:step]\n else:\n # no step, can store directly\n dest = arr[nwrow:nwrow + blen]\n _chunk = self.chunks[nchunk]\n _chunk._getitem(startb, stopb, dest.data)\n nwrow += blen\n\n return arr\n\n def __setitem__(self, object key, object value):\n \"\"\" x.__setitem__(key, value) <==> x[key] = value\n\n Sets values based on `key`. All the functionality of\n ``ndarray.__setitem__()`` is supported (including fancy indexing),\n plus a\n special support for expressions:\n\n Parameters\n ----------\n key : string\n It will be interpret as a boolean expression (computed via\n `eval`) and\n the elements where these values are true will be set to `value`.\n\n See Also\n --------\n eval\n\n \"\"\"\n cdef int chunklen\n cdef npy_intp startb, stopb\n cdef npy_intp nchunk, keychunk, nchunks, first_chunk, last_chunk\n cdef npy_intp nwrow, blen, vlen\n cdef chunk chunk_\n cdef object start, stop, step\n cdef object cdata, arr\n\n if self.mode == \"r\":\n raise IOError(\n \"cannot modify data because mode is '%s'\" % self.mode)\n\n # We are going to modify data. Mark block cache as dirty.\n if self.idxcache >= 0:\n # -2 means that cbytes counter has not to be changed\n self.idxcache = -2\n\n # Check for integer\n if isinstance(key, _inttypes):\n if key < 0:\n # To support negative values\n key += self.len\n if key >= self.len:\n raise IndexError(\"index out of range\")\n (start, stop, step) = key, key + 1, 1\n # Slices\n elif isinstance(key, slice):\n (start, stop, step) = key.start, key.stop, key.step\n if step:\n if step <= 0:\n raise NotImplementedError(\n \"step in slice can only be positive\")\n # Multidimensional keys\n elif isinstance(key, tuple):\n if len(key) == 0:\n raise ValueError(\"empty tuple not supported\")\n elif len(key) == 1:\n self[key[0]] = value\n return\n # An n-dimensional slice\n # First, retrieve elements in the leading dimension\n arr = self[key[0]]\n # Then, assing only the requested elements in other dimensions\n if type(key[0]) == slice:\n arr[(slice(None),) + key[1:]] = value\n else:\n arr[key[1:]] = value\n # Finally, update this superset of values in self\n self[key[0]] = arr\n return\n # List of integers (case of fancy indexing)\n elif isinstance(key, list):\n # Try to convert to a integer array\n try:\n key = np.array(key, dtype=np.int_)\n except:\n raise IndexError(\n \"key cannot be converted to an array of indices\")\n self[key] = value\n return\n # A boolean or integer array (case of fancy indexing)\n elif hasattr(key, \"dtype\"):\n if key.dtype.type == np.bool_:\n # A boolean array\n if len(key) != self.len:\n raise ValueError(\n \"boolean array length must match len(self)\")\n self.bool_update(key, value)\n return\n elif np.issubsctype(key, np.int_):\n # An integer array\n value = utils.to_ndarray(value, self._dtype, arrlen=len(key),\n safe=self._safe)\n # XXX This could be optimised, but it works like this\n for i, item in enumerate(key):\n self[item] = value[i]\n return\n else:\n raise IndexError(\n \"arrays used as indices must be of integer (or boolean) \"\n \"type\")\n # An boolean expression (case of fancy indexing)\n elif type(key) is str:\n # Evaluate\n result = bcolz.eval(key)\n if result.dtype.type != np.bool_:\n raise IndexError(\"only boolean expressions supported\")\n if len(result) != self.len:\n raise IndexError(\n \"boolean expression outcome must match len(self)\")\n # Call __setitem__ again\n self[result] = value\n return\n # All the rest not implemented\n else:\n raise NotImplementedError(\"key not supported: %s\" % repr(key))\n\n # Get the corrected values for start, stop, step\n (start, stop, step) = slice(start, stop, step).indices(self.len)\n\n # Special case for a complete replacement with a compatible dtype in\n # value\n if (hasattr(value, \"dtype\") and self._dtype == value.dtype and\n start == 0 and stop == len(self) == len(value) and step == 1):\n self._set_entire_carray(value)\n return\n\n # Build a numpy object out of value\n vlen = get_len_of_range(start, stop, step)\n if vlen == 0:\n # If range is empty, return immediately\n return\n value = utils.to_ndarray(value, self._dtype, arrlen=vlen,\n safe=self._safe)\n\n # Fill it from data in chunks\n nwrow = 0\n chunklen = self._chunklen\n nchunks = cython.cdiv(self._nbytes, self._chunksize)\n if self.leftover > 0:\n nchunks += 1\n first_chunk = cython.cdiv(start, self.chunklen)\n last_chunk = cython.cdiv(stop, self.chunklen) + 1\n last_chunk = min(last_chunk, nchunks)\n for nchunk from first_chunk <= nchunk < last_chunk:\n # Compute start & stop for each block\n startb, stopb, blen = clip_chunk(nchunk, chunklen, start, stop,\n step)\n if blen == 0:\n continue\n # Modify the data in chunk\n if nchunk == nchunks - 1 and self.leftover:\n self.lastchunkarr[startb:stopb:step] = value[\n nwrow:nwrow + blen]\n else:\n # Get the data chunk\n chunk_ = self.chunks[nchunk]\n self._cbytes -= chunk_.cbytes\n if stopb - startb < chunklen or step > 1:\n # Get all the values in chunk\n cdata = chunk_[:]\n # Overwrite it with data from value\n cdata[startb:stopb:step] = value[nwrow:nwrow + blen]\n else:\n # Replacing a complete chunk, no need to access existing\n # data\n cdata = value[nwrow:nwrow + blen]\n # Replace the chunk\n chunk_ = chunk(cdata, self._dtype, self._cparams,\n _memory=self._rootdir is None)\n self.chunks[nchunk] = chunk_\n # Update cbytes counter\n self._cbytes += chunk_.cbytes\n nwrow += blen\n\n # Safety check\n assert (nwrow == vlen)\n\n def _set_entire_carray(self, value):\n \"\"\"Copy the value in self chunk by chunk\"\"\"\n\n # The number of bytes in incoming value\n nbytes = self.itemsize * value.size\n self._nbytes = nbytes\n\n chunklen = self._chunklen\n nchunks = self.nchunks\n self._cbytes = self._chunksize # count the last chunk\n for nchunk in range(nchunks):\n cdata = value[nchunk * chunklen:(nchunk + 1) * chunklen]\n # Build and replace the chunk\n chunk_ = chunk(cdata, self._dtype, self._cparams,\n _memory=self._rootdir is None)\n self.chunks[nchunk] = chunk_\n # Update cbytes counter\n self._cbytes += chunk_.cbytes\n if self.leftover:\n self.lastchunkarr[:len(self) - nchunks * chunklen] = value[\n nchunks * chunklen:]\n return\n\n # This is a private function that is specific for `eval`\n def _getrange(self, npy_intp start, npy_intp blen, ndarray out):\n cdef int chunklen\n cdef npy_intp startb, stopb\n cdef npy_intp nwrow, stop, cblen\n cdef npy_intp schunk, echunk, nchunk, nchunks\n cdef chunk chunk_\n\n # Check that we are inside limits\n nrows = cython.cdiv(self._nbytes, self.atomsize)\n if (start + blen) > nrows:\n blen = nrows - start\n\n # Fill `out` from data in chunks\n nwrow = 0\n stop = start + blen\n nchunks = cython.cdiv(self._nbytes, self._chunksize)\n chunklen = cython.cdiv(self._chunksize, self.atomsize)\n schunk = cython.cdiv(start, chunklen)\n echunk = cython.cdiv((start + blen), chunklen)\n for nchunk from schunk <= nchunk <= echunk:\n # Compute start & stop for each block\n startb = start % chunklen\n stopb = chunklen\n if (start + startb) + chunklen > stop:\n # XXX I still have to explain why this expression works\n # for chunklen > (start + blen)\n stopb = (stop - start) + startb\n # stopb can never be larger than chunklen\n if stopb > chunklen:\n stopb = chunklen\n cblen = stopb - startb\n if cblen == 0:\n continue\n # Get the data chunk and assign it to result array\n if nchunk == nchunks and self.leftover:\n out[nwrow:nwrow + cblen] = self.lastchunkarr[startb:stopb]\n else:\n chunk_ = self.chunks[nchunk]\n chunk_._getitem(startb, stopb,\n out.data + nwrow * self.atomsize)\n nwrow += cblen\n start += cblen\n\n cdef void bool_update(self, boolarr, value):\n \"\"\"Update self in positions where `boolarr` is true with `value`\n array.\"\"\"\n cdef int chunklen\n cdef npy_intp startb, stopb\n cdef npy_intp nchunk, nchunks, nrows\n cdef npy_intp nwrow, blen, vlen, n\n cdef chunk chunk_\n cdef object cdata, boolb\n\n vlen = boolarr.sum() # number of true values in bool array\n value = utils.to_ndarray(value, self._dtype, arrlen=vlen,\n safe=self._safe)\n\n # Fill it from data in chunks\n nwrow = 0\n chunklen = self._chunklen\n nchunks = cython.cdiv(self._nbytes, self._chunksize)\n if self.leftover > 0:\n nchunks += 1\n nrows = cython.cdiv(self._nbytes, self.atomsize)\n for nchunk from 0 <= nchunk < nchunks:\n # Compute start & stop for each block\n startb, stopb, _ = clip_chunk(nchunk, chunklen, 0, nrows, 1)\n # Get boolean values for this chunk\n n = nchunk * chunklen\n boolb = boolarr[n + startb:n + stopb]\n blen = boolb.sum()\n if blen == 0:\n continue\n # Modify the data in chunk\n if nchunk == nchunks - 1 and self.leftover:\n # Update the valid part of the lastchunkarr\n lastchunkarr = self.lastchunkarr[:len(boolb)]\n lastchunkarr[boolb] = value[nwrow:nwrow + blen]\n else:\n # Get the data chunk\n chunk_ = self.chunks[nchunk]\n self._cbytes -= chunk_.cbytes\n # Get all the values there\n cdata = chunk_[:]\n # Overwrite it with data from value\n cdata[boolb] = value[nwrow:nwrow + blen]\n # Replace the chunk\n chunk_ = chunk(cdata, self._dtype, self._cparams,\n _memory=self._rootdir is None)\n self.chunks[nchunk] = chunk_\n # Update cbytes counter\n self._cbytes += chunk_.cbytes\n nwrow += blen\n\n # Safety check\n assert (nwrow == vlen)\n\n cdef reset_iter_sentinels(self):\n \"\"\"Reset sentinels for iterator.\"\"\"\n self.sss_mode = False\n self.wheretrue_mode = False\n self.where_mode = False\n self.where_arr = None\n self.nhits = 0\n self.limit = _MAXINT\n self.skip = 0\n self.start = 0\n self.stop = cython.cdiv(self._nbytes, self.atomsize)\n self.step = 1\n self.iter_exhausted = False\n\n def __iter__(self):\n\n if self.iter_exhausted:\n # Iterator is exhausted, so return immediately\n return self\n\n if not (self.sss_mode or\n self.wheretrue_mode or\n self.where_mode):\n # No mode. Probably a direct iter() call. Use sss_mode here.\n return self.iter()\n\n # Initialize some internal values\n self.startb = 0\n self.nrowsread = self.start\n self._nrow = self.start - self.step\n self._row = -1 # a sentinel\n if self.where_mode and isinstance(self.where_arr, carray):\n self.nrowsinbuf = self.where_arr.chunklen\n else:\n self.nrowsinbuf = self._chunklen\n\n return self\n\n def iter(self, start=0, stop=None, step=1, limit=None, skip=0, _next=False):\n \"\"\"Iterator with `start`, `stop` and `step` bounds.\n\n Parameters\n ----------\n start : int\n The starting item.\n stop : int\n The item after which the iterator stops.\n step : int\n The number of items incremented during each iteration. Cannot be\n negative.\n limit : int\n A maximum number of elements to return. The default is return\n everything.\n skip : int\n An initial number of elements to skip. The default is 0.\n\n Returns\n -------\n out : iterator\n\n See Also\n --------\n where, wheretrue\n\n \"\"\"\n # Check limits\n if step <= 0:\n raise NotImplementedError(\"step param can only be positive\")\n if _next:\n cview = self\n else:\n cview = self.view()\n return cview._init_iter(start, stop, step, limit, skip)\n\n def _init_iter(self, start, stop, step, limit, skip):\n self.reset_iter_sentinels()\n self.sss_mode = True\n self.start, self.stop, self.step = \\\n slice(start, stop, step).indices(self.len)\n if limit is not None:\n self.limit = limit + skip\n self.skip = skip\n return iter(self)\n\n def wheretrue(self, limit=None, skip=0):\n \"\"\"Iterator that returns indices where this object is true.\n\n This is currently only useful for boolean carrays that are unidimensional.\n\n Parameters\n ----------\n limit : int\n A maximum number of elements to return. The default is return\n everything.\n skip : int\n An initial number of elements to skip. The default is 0.\n\n Returns\n -------\n out : iterator\n\n See Also\n --------\n iter, where\n\n \"\"\"\n # Check self\n if self._dtype.base.type != np.bool_:\n raise ValueError(\"`self` is not an array of booleans\")\n if self.ndim > 1:\n raise NotImplementedError(\"`self` is not unidimensional\")\n cview = self.view()\n return cview._init_wheretrue(limit, skip)\n\n def _init_wheretrue(self, limit, skip):\n self.reset_iter_sentinels()\n self.wheretrue_mode = True\n if limit is not None:\n self.limit = limit + skip\n self.skip = skip\n return iter(self)\n\n def where(self, boolarr, limit=None, skip=0):\n \"\"\"Iterator that returns values of this object where `boolarr` is true.\n\n This is currently only useful for boolean carrays that are unidimensional.\n\n Parameters\n ----------\n boolarr : a carray or NumPy array of boolean type\n The boolean values.\n limit : int\n A maximum number of elements to return. The default is return\n everything.\n skip : int\n An initial number of elements to skip. The default is 0.\n\n Returns\n -------\n out : iterator\n\n See Also\n --------\n iter, wheretrue\n\n \"\"\"\n # Check input\n if self.ndim > 1:\n raise NotImplementedError(\"`self` is not unidimensional\")\n if not hasattr(boolarr, \"dtype\"):\n raise ValueError(\"`boolarr` is not an array\")\n if boolarr.dtype.type != np.bool_:\n raise ValueError(\"`boolarr` is not an array of booleans\")\n if len(boolarr) != self.len:\n raise ValueError(\n \"`boolarr` must be of the same length than ``self``\")\n cview = self.view()\n return cview._init_where(boolarr, limit, skip)\n\n def _init_where(self, boolarr, limit, skip):\n self.reset_iter_sentinels()\n self.where_mode = True\n self.where_arr = boolarr\n if limit is not None:\n self.limit = limit + skip\n self.skip = skip\n return iter(self)\n\n def __next__(self):\n cdef char *vbool\n cdef int nhits_buf\n\n if not (self.sss_mode or\n self.wheretrue_mode or\n self.where_mode):\n # No mode. Probably a direct call to next(). Use sss_mode here.\n self.iter(_next=True)\n\n self.nextelement = self._nrow + self.step\n while (self.nextelement < self.stop) and (self.nhits < self.limit):\n if self.nextelement >= self.nrowsread:\n # Skip until there is interesting information\n while self.nextelement >= self.nrowsread + self.nrowsinbuf:\n self.nrowsread += self.nrowsinbuf\n # Compute the end for this iteration\n self.stopb = self.stop - self.nrowsread\n if self.stopb > self.nrowsinbuf:\n self.stopb = self.nrowsinbuf\n self._row = self.startb - self.step\n\n # Skip chunks with zeros if in wheretrue_mode\n if self.wheretrue_mode and self.check_zeros(self):\n self.nrowsread += self.nrowsinbuf\n self.nextelement += self.nrowsinbuf\n continue\n\n if self.where_mode:\n # Skip chunks with zeros in where_arr\n if self.check_zeros(self.where_arr):\n self.nrowsread += self.nrowsinbuf\n self.nextelement += self.nrowsinbuf\n continue\n # Read a chunk of the boolean array\n self.where_buf = self.where_arr[\n self.nrowsread:self.nrowsread + self.nrowsinbuf]\n\n # Read a data chunk\n self.iobuf = self[\n self.nrowsread:self.nrowsread + self.nrowsinbuf]\n self.nrowsread += self.nrowsinbuf\n\n # Check if we can skip this buffer\n if (self.wheretrue_mode or self.where_mode) and self.skip > 0:\n if self.wheretrue_mode:\n nhits_buf = self.iobuf.sum()\n else:\n nhits_buf = self.where_buf.sum()\n if (self.nhits + nhits_buf) < self.skip:\n self.nhits += nhits_buf\n self.nextelement += self.nrowsinbuf\n continue\n\n self._row += self.step\n self._nrow = self.nextelement\n if self._row + self.step >= self.stopb:\n # Compute the start row for the next buffer\n self.startb = (self._row + self.step) % self.nrowsinbuf\n self.nextelement = self._nrow + self.step\n\n # Return a value depending on the mode we are\n if self.wheretrue_mode:\n vbool = (self.iobuf.data + self._row)\n if vbool[0]:\n self.nhits += 1\n if self.nhits <= self.skip:\n continue\n return self._nrow\n else:\n continue\n if self.where_mode:\n vbool = (self.where_buf.data + self._row)\n if not vbool[0]:\n continue\n self.nhits += 1\n if self.nhits <= self.skip:\n continue\n # Return the current value in I/O buffer\n if self.itemsize == self.atomsize:\n return PyArray_GETITEM(\n self.iobuf, self.iobuf.data + self._row * self.atomsize)\n else:\n return self.iobuf[self._row]\n\n else:\n # Release buffers\n self.iobuf = np.empty(0, dtype=self._dtype)\n self.where_buf = np.empty(0, dtype=np.bool_)\n self.iter_exhausted = True\n raise StopIteration # end of iteration\n\n cdef int check_zeros(self, object barr):\n \"\"\"Check for zeros. Return 1 if all zeros, else return 0.\"\"\"\n cdef int bsize\n cdef npy_intp nchunk\n cdef carray carr\n cdef ndarray ndarr\n cdef chunk chunk_\n\n if isinstance(barr, carray):\n # Check for zero'ed chunks in carrays\n carr = barr\n nchunk = cython.cdiv(self.nrowsread, self.nrowsinbuf)\n if nchunk < len(carr.chunks):\n chunk_ = carr.chunks[nchunk]\n if chunk_.isconstant and chunk_.constant in (0, ''):\n return 1\n else:\n # Check for zero'ed chunks in ndarrays\n ndarr = barr\n bsize = self.nrowsinbuf\n if self.nrowsread + bsize > self.len:\n bsize = self.len - self.nrowsread\n if check_zeros(ndarr.data + self.nrowsread, bsize):\n return 1\n return 0\n\n def _update_disk_sizes(self):\n \"\"\"Update the sizes on-disk.\"\"\"\n sizes = dict()\n if self._rootdir:\n sizes['shape'] = self.shape\n sizes['nbytes'] = self.nbytes\n sizes['cbytes'] = self.cbytes\n rowsf = os.path.join(self.metadir, SIZES_FILE)\n with open(rowsf, 'wb') as rowsfh:\n rowsfh.write(\n json.dumps(sizes, ensure_ascii=True).encode('ascii'))\n rowsfh.write(b'\\n')\n\n def flush(self):\n \"\"\"Flush data in internal buffers to disk.\n\n This call should typically be done after performing modifications\n (__settitem__(), append()) in persistence mode. If you don't do this,\n you risk losing part of your modifications.\n\n \"\"\"\n cdef chunk chunk_\n cdef npy_intp nchunks\n cdef int leftover_atoms\n\n if self._rootdir is None:\n return\n\n if self.leftover:\n leftover_atoms = cython.cdiv(self.leftover, self.atomsize)\n chunk_ = chunk(self.lastchunkarr[:leftover_atoms], self.dtype,\n self.cparams,\n _memory=self._rootdir is None)\n # Flush this chunk to disk\n self.chunks.flush(chunk_)\n\n # Finally, update the sizes metadata on-disk\n self._update_disk_sizes()\n\n # XXX This does not work. Will have to realize how to properly\n # flush buffers before self going away...\n # def __del__(self):\n # # Make a flush to disk if this object get disposed\n # self.flush()\n\n def purge(self):\n \"\"\" Remove the underlying data for on-disk arrays. \"\"\"\n if self.rootdir:\n shutil.rmtree(self.rootdir)\n\n def __str__(self):\n return array2string(self)\n\n def __repr__(self):\n snbytes = utils.human_readable_size(self._nbytes)\n scbytes = utils.human_readable_size(self._cbytes)\n if not self._cbytes:\n cratio = np.nan\n else:\n cratio = self._nbytes / float(self._cbytes)\n header = \"carray(%s, %s)\\n\" % (self.shape, self.dtype)\n header += \" nbytes := %s; cbytes := %s; ratio: %.2f\\n\" % (\n snbytes, scbytes, cratio)\n header += \" cparams := %r\\n\" % self.cparams\n blocksize = self.chunks[0].blocksize if len(self.chunks) > 0 else 0\n header += \" chunklen := %s; chunksize: %s; blocksize: %s\\n\" % (\n self.chunklen, self._chunksize, blocksize)\n if self._rootdir:\n header += \" rootdir := '%s'\\n\" % self._rootdir\n header += \" mode := '%s'\\n\" % self.mode\n fullrepr = header + str(self)\n return fullrepr\n\n def __reduce__(self):\n if self.rootdir:\n return (build_carray, (None,self.rootdir,))\n else:\n return (build_carray,(self[:],None,))\n\n def __enter__(self):\n return self\n\n def __exit__(self, type, value, tb):\n if self.mode != 'r':\n self.flush()\n\n def __array__(self, dtype=None, **kwargs):\n x = self[:]\n if dtype and x.dtype != dtype:\n x = x.astype(dtype)\n return x\n\n\n## Local Variables:\n## mode: python\n## tab-width: 4\n## fill-column: 78\n## End:\n"} +{"text": "# $FreeBSD$\n\nPORTNAME=\tgogui\nDISTVERSIONPREFIX=\tv\nDISTVERSION=\t1.4.10\nCATEGORIES=\tgames java\nMASTER_SITES=\thttp://www.randelshofer.ch/quaqua/files/:quaqua\nDISTFILES=\tquaqua-5.2.1.nested.zip:quaqua\n\nMAINTAINER=\tyuri@FreeBSD.org\nCOMMENT=\tGUI for programs that play Go through Go Text Protocol (GTP)\n\nLICENSE=\tLGPL21 BSD3CLAUSE\nLICENSE_COMB=\tmulti\n\nBUILD_DEPENDS=\txsltproc:textproc/libxslt \\\n\t\tdocbook-xsl>0:textproc/docbook-xsl\n\nUSE_GITHUB=\tyes\nGH_ACCOUNT=\tlemonsqueeze\nUSE_JAVA=\tyes\nUSE_ANT=\tyes\n\nMAKE_ARGS+=\t-Ddocbook-xsl.dir=${LOCALBASE}/share/xsl/docbook\n\nNO_ARCH=\tyes\n\nGOGUI_JARS=\tgogui-adapter gogui-convert gogui-dummy gogui-server gogui-terminal gogui-twogtp \\\n\t\tgogui-client gogui-display gogui-regress gogui-statistics gogui-thumbnailer gogui\n\nPLIST_FILES=\t${GOGUI_JARS:C/^/bin\\//} ${GOGUI_JARS:C/^/${JAVAJARDIR}\\//:C/$$/.jar/} ${JAVAJARDIR}/quaqua.jar\n\npost-extract:\n\t@cd ${WRKDIR} && \\\n\t\tunzip quaqua-5.2.1.zip && \\\n\t\t${MKDIR} ${WRKSRC}/lib && \\\n\t\t${MV} Quaqua/dist/quaqua.jar ${WRKSRC}/lib\n\npost-patch:\n\t@${REINPLACE_CMD} 's|/usr/share|${LOCALBASE}/share|' ${WRKSRC}/build.xml\n\ndo-install:\n.for j in ${GOGUI_JARS}\n\t${INSTALL_DATA} ${WRKSRC}/lib/${j}.jar ${STAGEDIR}${JAVAJARDIR}\n\t@(echo \"#!/bin/sh\"; \\\n\t echo \"\"; \\\n\t echo \"${JAVA} -jar ${JAVAJARDIR}/${j}.jar\" \\\n\t) > ${STAGEDIR}${PREFIX}/bin/${j}\n\t@${CHMOD} +x ${STAGEDIR}${PREFIX}/bin/${j}\n.endfor\n\t${INSTALL_DATA} ${WRKSRC}/lib/quaqua.jar ${STAGEDIR}${JAVAJARDIR}\n\n.include \n"} +{"text": "\n\n \n CSS 2.1 Test Suite: float\n \n \n \n \n
    \n

    \n ⇦ This blue box should be on the left.\n

    \n
    \n
    \n

    \n This teal box should be on the right. ⇨\n

    \n
    \n

    \n This text should be in between a blue box on the ⇦left and a teal box on the right⇨.\n

    \n \n"} +{"text": "package archiver\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n\t\"strings\"\n\n\t\"github.com/golang/snappy\"\n)\n\n// TarSz is for TarSz format\nvar TarSz tarSzFormat\n\nfunc init() {\n\tRegisterFormat(\"TarSz\", TarSz)\n}\n\ntype tarSzFormat struct{}\n\nfunc (tarSzFormat) Match(filename string) bool {\n\treturn strings.HasSuffix(strings.ToLower(filename), \".tar.sz\") || strings.HasSuffix(strings.ToLower(filename), \".tsz\") || isTarSz(filename)\n}\n\n// isTarSz checks the file has the sz compressed Tar format header by\n// reading its beginning block.\nfunc isTarSz(tarszPath string) bool {\n\tf, err := os.Open(tarszPath)\n\tif err != nil {\n\t\treturn false\n\t}\n\tdefer f.Close()\n\n\tszr := snappy.NewReader(f)\n\tbuf := make([]byte, tarBlockSize)\n\tn, err := szr.Read(buf)\n\tif err != nil || n < tarBlockSize {\n\t\treturn false\n\t}\n\n\treturn hasTarHeader(buf)\n}\n\n// Write outputs a .tar.sz file to a Writer containing\n// the contents of files listed in filePaths. File paths\n// can be those of regular files or directories. Regular\n// files are stored at the 'root' of the archive, and\n// directories are recursively added.\nfunc (tarSzFormat) Write(output io.Writer, filePaths []string) error {\n\treturn writeTarSz(filePaths, output, \"\")\n}\n\n// Make creates a .tar.sz file at tarszPath containing\n// the contents of files listed in filePaths. File paths\n// can be those of regular files or directories. Regular\n// files are stored at the 'root' of the archive, and\n// directories are recursively added.\nfunc (tarSzFormat) Make(tarszPath string, filePaths []string) error {\n\tout, err := os.Create(tarszPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating %s: %v\", tarszPath, err)\n\t}\n\tdefer out.Close()\n\n\treturn writeTarSz(filePaths, out, tarszPath)\n}\n\nfunc writeTarSz(filePaths []string, output io.Writer, dest string) error {\n\tszw := snappy.NewBufferedWriter(output)\n\tdefer szw.Close()\n\n\treturn writeTar(filePaths, szw, dest)\n}\n\n// Read untars a .tar.sz file read from a Reader and decompresses\n// the contents into destination.\nfunc (tarSzFormat) Read(input io.Reader, destination string) error {\n\tszr := snappy.NewReader(input)\n\n\treturn Tar.Read(szr, destination)\n}\n\n// Open untars source and decompresses the contents into destination.\nfunc (tarSzFormat) Open(source, destination string) error {\n\tf, err := os.Open(source)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%s: failed to open archive: %v\", source, err)\n\t}\n\tdefer f.Close()\n\n\treturn TarSz.Read(f, destination)\n}\n"} +{"text": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n \n\nnamespace SocketIOClient.Messages\n{\n public class EventMessage : Message\n {\n\t\tprivate static object ackLock = new object();\n\t\tprivate static int _akid = 0;\n\t\tprivate static int NextAckID\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\tlock (ackLock)\n\t\t\t\t{\n\t\t\t\t\t_akid++;\n\t\t\t\t\tif (_akid < 0)\n\t\t\t\t\t\t_akid = 0;\n\t\t\t\t\treturn _akid;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic Action Callback;\n\n public EventMessage()\n {\n this.MessageType = SocketIOMessageTypes.Event;\n }\n\n\t\tpublic EventMessage(string eventName, object jsonObject, string endpoint , Action callBack )\n\t\t\t: this()\n {\n\t\t\tthis.Callback = callBack;\n\t\t\tthis.Endpoint = endpoint;\n\n\t\t\tif (callBack != null)\n\t\t\t\tthis.AckId = EventMessage.NextAckID;\n\n\t\t\tthis.JsonEncodedMessage = new JsonEncodedEventMessage(eventName, jsonObject);\n\t\t\tthis.MessageText = this.Json.ToJsonString();\n }\n\n public static EventMessage Deserialize(string rawMessage)\n {\n\t\t\tEventMessage evtMsg = new EventMessage();\n // '5:' [message id ('+')] ':' [message endpoint] ':' [json encoded event]\n // 5:1::{\"a\":\"b\"}\n\t\t\tevtMsg.RawMessage = rawMessage;\n\t\t\ttry\n\t\t\t{\n\t\t\t\tstring[] args = rawMessage.Split(SPLITCHARS, 4); // limit the number of pieces\n\t\t\t\tif (args.Length == 4)\n\t\t\t\t{\n\t\t\t\t\tint id;\n\t\t\t\t\tif (int.TryParse(args[1], out id))\n\t\t\t\t\t\tevtMsg.AckId = id;\n\t\t\t\t\tevtMsg.Endpoint = args[2];\n\t\t\t\t\tevtMsg.MessageText = args[3];\n\n\t\t\t\t\tif (!string.IsNullOrEmpty(evtMsg.MessageText) &&\n\t\t\t\t\t\tevtMsg.MessageText.Contains(\"name\") &&\n\t\t\t\t\t\tevtMsg.MessageText.Contains(\"args\"))\n\t\t\t\t\t{\n\t\t\t\t\t\tevtMsg.Json = JsonEncodedEventMessage.Deserialize(evtMsg.MessageText);\n\t\t\t\t\t\tevtMsg.Event = evtMsg.Json.name;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tevtMsg.Json = new JsonEncodedEventMessage();\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (Exception ex)\n\t\t\t{\n\t\t\t\tTrace.WriteLine(ex);\n\t\t\t}\n\t\t\treturn evtMsg;\n }\n\n\t\tpublic override string Encoded\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\tint msgId = (int)this.MessageType;\n\t\t\t\tif (this.AckId.HasValue)\n\t\t\t\t{\n\t\t\t\t\tif (this.Callback == null)\n\t\t\t\t\t\treturn string.Format(\"{0}:{1}:{2}:{3}\", msgId, this.AckId ?? -1, this.Endpoint, this.MessageText);\n\t\t\t\t\telse\n\t\t\t\t\t\treturn string.Format(\"{0}:{1}+:{2}:{3}\", msgId, this.AckId ?? -1, this.Endpoint, this.MessageText);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\treturn string.Format(\"{0}::{1}:{2}\", msgId, this.Endpoint, this.MessageText);\n\t\t\t}\n\t\t}\n \n }\n}\n"} +{"text": "# coding=utf-8\n# Copyright 2020 The Google Research Authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom transformers.modeling_auto import *\nfrom .modeling_roberta import RobertaForAirOPE\n\nMODEL_FOR_AIROPE_MAPPING = OrderedDict([(RobertaConfig, RobertaForAirOPE)])\n\n\nclass AutoModelForAirOPE:\n\n def __init__(self):\n raise EnvironmentError(\n \"AutoModel is designed to be instantiated \"\n \"using the `AutoModelForAirOPE.from_pretrained(pretrained_model_name_or_path)` or \"\n \"`AutoModelForAirOPE.from_config(config)` methods.\")\n\n @classmethod\n def from_config(cls, config):\n for config_class, model_class in MODEL_FOR_AIROPE_MAPPING.items():\n if isinstance(config, config_class):\n return model_class(config)\n raise ValueError(\n \"Unrecognized configuration class {} for this kind of AutoModel: {}.\\n\"\n \"Model type should be one of {}.\".format(\n config.__class__, cls.__name__,\n \", \".join(c.__name__ for c in MODEL_FOR_AIROPE_MAPPING.keys())))\n\n @classmethod\n def from_pretrained(cls, pretrained_model_name_or_path, *model_args,\n **kwargs):\n config = kwargs.pop(\"config\", None)\n if not isinstance(config, PretrainedConfig):\n config = AutoConfig.from_pretrained(pretrained_model_name_or_path,\n **kwargs)\n\n for config_class, model_class in MODEL_FOR_AIROPE_MAPPING.items():\n if isinstance(config, config_class):\n return model_class.from_pretrained(\n pretrained_model_name_or_path, *model_args, config=config, **kwargs)\n raise ValueError(\n \"Unrecognized configuration class {} for this kind of AutoModel: {}.\\n\"\n \"Model type should be one of {}.\".format(\n config.__class__, cls.__name__,\n \", \".join(c.__name__ for c in MODEL_FOR_AIROPE_MAPPING.keys())))\n"} +{"text": "/**\n *\n * This file is a part of ZOOLA - an extensible BeanShell implementation.\n * Zoola is based on original BeanShell code created by Pat Niemeyer.\n *\n * Original BeanShell code is Copyright (C) 2000 Pat Niemeyer .\n *\n * New portions are Copyright 2012 Rafal Lewczuk \n *\n * This is free software. You can redistribute it and/or modify it under the\n * terms of the GNU Lesser General Public License as published by the Free Software\n * Foundation, either version 3 of the License, or (at your option) any later\n * version.\n *\n * This software is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more\n * details.\n *\n * You should have received a copy of the GNU Lesser General Public License\n * along with ZOOLA. If not, see .\n *\n */\n\npackage bsh;\n\n/**\n\tStatic routines supporing type comparison and conversion in BeanShell.\n\n The following are notes on type comparison and conversion in BeanShell.\n\n\n*/\npublic class Types\n{\n\t/*\n\t\tType conversion identifiers. An ASSIGNMENT allows conversions that would\n\t\tnormally happen on assignment. A CAST performs numeric conversions to smaller\n\t\ttypes (as in an explicit Java cast) and things allowed only in variable and array\n\t\tdeclarations (e.g. byte b = 42;)\n\t*/\n\tpublic static final int CAST=0, ASSIGNMENT=1;\n\t\n\tstatic final int \n\t\tJAVA_BASE_ASSIGNABLE = 1,\n\t\tJAVA_BOX_TYPES_ASSIGABLE = 2,\n\t\tJAVA_VARARGS_ASSIGNABLE = 3,\n\t\tBSH_ASSIGNABLE = 4;\n\n\tstatic final int\n\t\tFIRST_ROUND_ASSIGNABLE = JAVA_BASE_ASSIGNABLE,\n\t\tLAST_ROUND_ASSIGNABLE = BSH_ASSIGNABLE;\n\n\t/**\n\t\tSpecial value that indicates by identity that the result of a cast\n\t\toperation was a valid cast. This is used by castObject() and\n\t\tcastPrimitive() in the checkOnly mode of operation. This value is a\n\t\tPrimitive type so that it can be returned by castPrimitive.\n\t*/\n\tstatic Primitive VALID_CAST = new Primitive(1);\n\tstatic Primitive INVALID_CAST = new Primitive(-1);\n\n\t/**\n\t\tGet the Java types of the arguments.\n\t*/\n public static Class[] getTypes( Object[] args )\n {\n if ( args == null )\n return new Class[0];\n\n Class[] types = new Class[ args.length ];\n\n for( int i=0; i\n\n\t\tFor Java primitive TYPE classes this method takes primitive promotion\n\t\tinto account. The ordinary Class.isAssignableFrom() does not take\n\t\tprimitive promotion conversions into account. Note that Java allows\n\t\tadditional assignments without a cast in combination with variable\n\t\tdeclarations and array allocations. Those are handled elsewhere\n\t \t(maybe should be here with a flag?)\n\t\t

    \n\t\tThis class accepts a null rhsType type indicating that the rhsType was the\n\t\tvalue Primitive.NULL and allows it to be assigned to any reference lhsType\n\t\ttype (non primitive).\n\t\t

    \n\n\t\tNote that the getAssignableForm() method is the primary bsh method for\n\t\tchecking assignability. It adds additional bsh conversions, etc.\n\n\t\t@see #isBshAssignable( Class, Class )\n\t\t@param lhsType assigning from rhsType to lhsType\n\t\t@param rhsType assigning from rhsType to lhsType\n\t*/\n\tpublic static boolean isJavaAssignable( Class lhsType, Class rhsType ) {\n\t\treturn isJavaBaseAssignable( lhsType, rhsType )\n\t\t\t|| isJavaBoxTypesAssignable( lhsType, rhsType );\n\t}\n\n\t/**\n\t\tIs the assignment legal via original Java (up to version 1.4)\n\t\tassignment rules, not including auto-boxing/unboxing.\n\t @param rhsType may be null to indicate primitive null value\n\t*/\n\tpublic static boolean isJavaBaseAssignable( Class lhsType, Class rhsType )\n\t{\n\t\t/*\n\t\t\tAssignment to loose type, defer to bsh extensions\n\t\t\tNote: we could shortcut this here:\n\t\t\tif ( lhsType == null ) return true;\n\t\t\trather than forcing another round. It's not strictly a Java issue,\n\t\t\tso does it belong here?\n\t\t*/\n\t\tif ( lhsType == null )\n\t\t\treturn false;\n\n\t\t// null rhs type corresponds to type of Primitive.NULL\n\t\t// assignable to any object type\n\t\tif ( rhsType == null )\n\t\t\treturn !lhsType.isPrimitive();\n\n\t\tif ( lhsType.isPrimitive() && rhsType.isPrimitive() )\n\t\t{\n\t\t\tif ( lhsType == rhsType )\n\t\t\t\treturn true;\n\n\t\t\t// handle primitive widening conversions - JLS 5.1.2\n\t\t\tif ( (rhsType == Byte.TYPE) &&\n\t\t\t\t(lhsType == Short.TYPE || lhsType == Integer.TYPE\n\t\t\t\t|| lhsType == Long.TYPE || lhsType == Float.TYPE\n\t\t\t\t|| lhsType == Double.TYPE))\n return true;\n\n if ( (rhsType == Short.TYPE) &&\n\t\t\t\t(lhsType == Integer.TYPE || lhsType == Long.TYPE ||\n lhsType == Float.TYPE || lhsType == Double.TYPE))\n return true;\n\n if ((rhsType == Character.TYPE) &&\n\t\t\t\t(lhsType == Integer.TYPE || lhsType == Long.TYPE ||\n lhsType == Float.TYPE || lhsType == Double.TYPE))\n return true;\n\n if ((rhsType == Integer.TYPE) &&\n\t\t\t\t(lhsType == Long.TYPE || lhsType == Float.TYPE ||\n lhsType == Double.TYPE))\n return true;\n\n if ((rhsType == Long.TYPE) &&\n\t\t\t\t(lhsType == Float.TYPE || lhsType == Double.TYPE))\n return true;\n\n if ((rhsType == Float.TYPE) && (lhsType == Double.TYPE))\n return true;\n }\n else\n if ( lhsType.isAssignableFrom(rhsType) )\n return true;\n\n return false;\n }\n\n\t/**\n\t\tDetermine if the type is assignable via Java boxing/unboxing rules.\n\t*/\n\tpublic static boolean isJavaBoxTypesAssignable(\n\t\tClass lhsType, Class rhsType )\n\t{\n\t\t// Assignment to loose type... defer to bsh extensions\n\t\tif ( lhsType == null )\n\t\t\treturn false;\n\n\t\t// prim can be boxed and assigned to Object\n\t\tif ( lhsType == Object.class )\n\t\t\treturn true;\n\n\t\t// prim numeric type can be boxed and assigned to number\n\t\tif ( lhsType == Number.class\n\t\t\t&& rhsType != Character.TYPE\n\t\t\t&& rhsType != Boolean.TYPE\n\t\t)\n\t\t\treturn true;\n\n\t\t// General case prim type to wrapper or vice versa.\n\t\t// I don't know if this is faster than a flat list of 'if's like above.\n\t\t// wrapperMap maps both prim to wrapper and wrapper to prim types,\n\t\t// so this test is symmetric\n\t\tif ( Primitive.wrapperMap.get( lhsType ) == rhsType )\n\t\t\treturn true;\n\n\t\treturn false;\n\t}\n\n\t/**\n\t Test if a type can be converted to another type via BeanShell\n\t extended syntax rules (a superset of Java conversion rules).\n\t */\n\tpublic static boolean isBshAssignable( Class toType, Class fromType )\n\t{\n\t\ttry {\n\t\t\treturn castObject(\n\t\t\t\ttoType, fromType, null/*fromValue*/,\n\t\t\t\tASSIGNMENT, true/*checkOnly*/\n\t\t\t) == VALID_CAST;\n\t\t} catch ( UtilEvalError e ) {\n\t\t\t// This should not happen with checkOnly true\n\t\t\tthrow new InterpreterError(\"err in cast check: \"+e);\n\t\t}\n\t}\n\n\t/**\n\t\tAttempt to cast an object instance to a new type if possible via\n\t BeanShell extended syntax rules. These rules are always a superset of\n\t Java conversion rules. If you wish to impose context sensitive\n\t conversion rules then you must test before calling this method.\n\t

    \n\n\t\tThis method can handle fromValue Primitive types (representing\n\t\tprimitive casts) as well as fromValue object casts requiring interface\n\t\tgeneration, etc.\n\n\t\t@param toType the class type of the cast result, which may include\n\t\tprimitive types, e.g. Byte.TYPE\n\n\t\t@param fromValue an Object or bsh.Primitive primitive value (including\n\t\t\tPrimitive.NULL or Primitive.VOID )\n\n\t\t@see #isBshAssignable( Class, Class )\n\t*/\n\tpublic static Object castObject(\n\t\tObject fromValue, Class toType, int operation )\n\t\tthrows UtilEvalError\n\t{\n\t\tif ( fromValue == null )\n\t\t\tthrow new InterpreterError(\"null fromValue\");\n\n\t\tClass fromType =\n\t\t\tfromValue instanceof Primitive ?\n\t\t\t\t((Primitive)fromValue).getType()\n\t\t\t\t: fromValue.getClass();\n\n\t\treturn castObject(\n\t\t\ttoType, fromType, fromValue, operation, false/*checkonly*/ );\n\t}\n\n\t/**\n\t Perform a type conversion or test if a type conversion is possible with\n\t respect to BeanShell extended rules. These rules are always a superset of\n\t the Java language rules, so this method can also perform (but not test)\n\t any Java language assignment or cast conversion.\n\t

    \n\n\t This method can perform the functionality of testing if an assignment\n\t or cast is ultimately possible (with respect to BeanShell) as well as the\n\t functionality of performing the necessary conversion of a value based\n\t on the specified target type. This combined functionality is done for\n\t expediency and could be separated later.\n\t

    \n\n\t Other methods such as isJavaAssignable() should be used to determine the\n\t suitability of an assignment in a fine grained or restrictive way based\n\t on context before calling this method\n\t

    \n\n\t A CAST is stronger than an ASSIGNMENT operation in that it will attempt to\n\t perform primtive operations that cast to a smaller type. e.g. (byte)myLong;\n\t These are used in explicit primitive casts, primitive delclarations and\n\t array declarations. I don't believe there are any object conversions which are\n\t different between ASSIGNMENT and CAST (e.g. scripted object to interface proxy\n\t in bsh is done on assignment as well as cast).\n\t

    \n\n\t This method does not obey strictJava(), you must test first before\n\t using this method if you care. (See #isJavaAssignable()).\n\t

    \n\n\t\t@param toType the class type of the cast result, which may include\n\t\t\tprimitive types, e.g. Byte.TYPE. toType may be null to indicate a\n\t\t\tloose type assignment (which matches any fromType).\n\n\t\t@param fromType is the class type of the value to be cast including\n\t\t\tjava primitive TYPE classes for primitives.\n\t\t\tIf fromValue is (or would be) Primitive.NULL then fromType should be null.\n\n\t\t@param fromValue an Object or bsh.Primitive primitive value (including\n\t\t\tPrimitive.NULL or Primitive.VOID )\n\n\t\t@param checkOnly If checkOnly is true then fromValue must be null.\n\t\t\tFromType is checked for the cast to toType...\n\t\t\tIf checkOnly is false then fromValue must be non-null\n\t\t\t(Primitive.NULL is ok) and the actual cast is performed.\n\n\t\t@throws UtilEvalError on invalid assignment (when operation is\n\t\t\tassignment ).\n\n\t\t@throws UtilTargetError wrapping ClassCastException on cast error\n\t\t\t(when operation is cast)\n\n\t\t@param operation is Types.CAST or Types.ASSIGNMENT\n\n\t\t@see bsh.Primitive.getType()\n\t*/\n\t/*\n\t\tNotes: This method is currently responsible for auto-boxing/unboxing\n\t\tconversions... Where does that need to go?\n\t*/\n\tprivate static Object castObject(\n\t\tClass toType, Class fromType, Object fromValue,\n\t\tint operation, boolean checkOnly )\n\t\tthrows UtilEvalError\n\t{\n\t\t/*\n\t\t\tLots of preconditions checked here...\n\t\t\tOnce things are running smoothly we might comment these out\n\t\t\t(That's what assertions are for).\n\t\t*/\n\t\tif ( checkOnly && fromValue != null )\n\t\t\tthrow new InterpreterError(\"bad cast params 1\");\n\t\tif ( !checkOnly && fromValue == null )\n\t\t\tthrow new InterpreterError(\"bad cast params 2\");\n\t\tif ( fromType == Primitive.class )\n\t\t\tthrow new InterpreterError(\"bad from Type, need to unwrap\");\n\t\tif ( fromValue == Primitive.NULL && fromType != null )\n\t\t\tthrow new InterpreterError(\"inconsistent args 1\");\n\t\tif ( fromValue == Primitive.VOID && fromType != Void.TYPE )\n\t\t\tthrow new InterpreterError(\"inconsistent args 2\");\n\t\tif ( toType == Void.TYPE )\n\t\t\tthrow new InterpreterError(\"loose toType should be null\");\n\t\t\n\t\t// assignment to loose type, void type, or exactly same type\n\t\tif ( toType == null || toType == fromType )\n\t\t\treturn checkOnly ? VALID_CAST :\n\t\t\t\tfromValue;\n\n\t\t// Casting to primitive type\n if ( toType.isPrimitive() )\n\t\t{\n\t\t\tif ( fromType == Void.TYPE || fromType == null \n\t\t\t\t|| fromType.isPrimitive() )\n\t\t\t{\n\t\t\t\t// Both primitives, do primitive cast\n\t\t\t\treturn Primitive.castPrimitive( \n\t\t\t\t\ttoType, fromType, (Primitive)fromValue, \n\t\t\t\t\tcheckOnly, operation );\n\t\t\t} else\n\t\t\t{\n\t\t\t\tif ( Primitive.isWrapperType( fromType ) )\n\t\t\t\t{\n\t\t\t\t\t// wrapper to primitive\n\t\t\t\t\t// Convert value to Primitive and check/cast it.\n\n\t\t\t\t\t//Object r = checkOnly ? VALID_CAST :\n\t\t\t\t\tClass unboxedFromType = Primitive.unboxType( fromType );\n\t\t\t\t\tPrimitive primFromValue;\n\t\t\t\t\tif ( checkOnly ) \n\t\t\t\t\t\tprimFromValue = null; // must be null in checkOnly\n\t\t\t\t\telse\n\t\t\t\t\t\tprimFromValue = (Primitive)Primitive.wrap( \n\t\t\t\t\t\t\tfromValue, unboxedFromType );\n\n\t\t\t\t\treturn Primitive.castPrimitive( \n\t\t\t\t\t\ttoType, unboxedFromType, primFromValue, \n\t\t\t\t\t\tcheckOnly, operation );\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\t// Cannot cast from arbitrary object to primitive\n\t\t\t\t\tif ( checkOnly )\n\t\t\t\t\t\treturn INVALID_CAST;\n\t\t\t\t\telse\n\t\t\t\t\t\tthrow castError( toType, fromType, operation );\n\t\t\t\t}\n\t\t\t}\n }\n\n\t\t// Else, casting to reference type\n\n\t\t// Casting from primitive or void (to reference type)\n\t\tif ( fromType == Void.TYPE || fromType == null\n\t\t\t|| fromType.isPrimitive() )\n\t\t{\n\t\t\t// cast from primitive to wrapper type\n\t\t\tif ( Primitive.isWrapperType( toType )\n\t\t\t\t&& fromType != Void.TYPE && fromType != null )\n\t\t\t{\n\t\t\t\t// primitive to wrapper type\n\t\t\t\treturn checkOnly ? VALID_CAST :\n\t\t\t\t\tPrimitive.castWrapper( \n\t\t\t\t\t\tPrimitive.unboxType(toType), \n\t\t\t\t\t\t((Primitive)fromValue).getValue() );\n\t\t\t}\n\n\t\t\t// Primitive (not null or void) to Object.class type\n\t\t\tif ( toType == Object.class \n\t\t\t\t&& fromType != Void.TYPE && fromType != null )\n\t\t\t{\n\t\t\t\t// box it\n\t\t\t\treturn checkOnly ? VALID_CAST :\n\t\t\t\t\t((Primitive)fromValue).getValue();\n\t\t\t}\n\n\t\t\t// Primitive to arbitrary object type. \n\t\t\t// Allow Primitive.castToType() to handle it as well as cases of \n\t\t\t// Primitive.NULL and Primitive.VOID\n\t\t\treturn Primitive.castPrimitive( \n\t\t\t\ttoType, fromType, (Primitive)fromValue, checkOnly, operation );\n\t\t}\n\n\t\t// If type already assignable no cast necessary\n\t\t// We do this last to allow various errors above to be caught.\n\t\t// e.g cast Primitive.Void to Object would pass this\n\t\tif ( toType.isAssignableFrom( fromType ) )\n\t\t\treturn checkOnly ? VALID_CAST : \n\t\t\t\tfromValue;\n\n\t\t// Can we use the proxy mechanism to cast a bsh.This to \n\t\t// the correct interface?\n\t\tif ( toType.isInterface() \n\t\t\t&& bsh.This.class.isAssignableFrom( fromType ) \n\t\t)\n\t\t\treturn checkOnly ? VALID_CAST : \n\t\t\t\t((bsh.This)fromValue).getInterface( toType );\n\n\t\t// Both numeric wrapper types? \n\t\t// Try numeric style promotion wrapper cast\n\t\tif ( Primitive.isWrapperType( toType ) \n\t\t\t&& Primitive.isWrapperType( fromType ) \n\t\t)\n\t\t\treturn checkOnly ? VALID_CAST :\n\t\t\t\tPrimitive.castWrapper( toType, fromValue );\n\t\t\n\t\tif ( checkOnly )\n\t\t\treturn INVALID_CAST;\n\t\telse\n\t\t\tthrow castError( toType, fromType , operation );\n\t}\n\n\t/**\n\t\tReturn a UtilEvalError or UtilTargetError wrapping a ClassCastException\n\t\tdescribing an illegal assignment or illegal cast, respectively.\t\n\t*/\n public static UtilEvalError castError(\n\t\tClass lhsType, Class rhsType, int operation ) \n {\n\t\treturn castError( \n\t\t\tReflect.normalizeClassName(lhsType),\n\t\t\tReflect.normalizeClassName(rhsType), operation );\n }\n\n public static UtilEvalError castError(\n\t\tString lhs, String rhs, int operation ) \n {\n\t\tif ( operation == ASSIGNMENT )\n\t\t\treturn new UtilEvalError (\n\t\t\t\t\"Can't assign \" + rhs + \" to \"+ lhs );\n\n\t\tException cce = new ClassCastException(\n\t\t\t\"Cannot cast \" + rhs + \" to \" + lhs );\n\t\treturn new UtilTargetError( cce );\n }\n\n}\n"} +{"text": "\r\n\r\n \r\n NServiceBus.Host\r\n \r\n \r\n \r\n

    \r\n Indicates this endpoint is a server.\r\n As such will be set up as a transactional endpoint using impersonation, not purging messages on startup.\r\n \r\n \r\n \r\n \r\n Indicates this endpoint is a client.\r\n As such will be set up as a non-transactional endpoint with no impersonation and purging messages on startup.\r\n \r\n \r\n \r\n \r\n Indicates this endpoint is a publisher.\r\n This is compatible with but not .\r\n \r\n \r\n \r\n \r\n Called in order to configure logging.\r\n \r\n If you want logging configured regardless of profiles, do not use this interface,\r\n instead implement on the class which implements .\r\n \r\n Implementors should work against the generic version of this interface.\r\n \r\n \r\n \r\n \r\n Performs all logging configuration.\r\n \r\n \r\n \r\n \r\n Called in order to configure logging for the given profile type.\r\n If an implementation isn't found for a given profile, then the search continues\r\n recursively up that profile's inheritance hierarchy.\r\n \r\n \r\n \r\n \r\n \r\n \r\n Indicate that the implementing class will specify configuration.\r\n \r\n \r\n \r\n \r\n Abstraction for code which will be called when the given profile is active.\r\n Implementors should implement IHandleProfile{T} rather than IHandleProfile.\r\n \r\n \r\n \r\n \r\n Called when a given profile is activated.\r\n \r\n \r\n \r\n \r\n Generic abstraction for code which will be called when the given profile is active.\r\n \r\n \r\n \r\n \r\n \r\n \r\n Helpers for assembly scanning operations\r\n \r\n \r\n \r\n \r\n Gets a list with assemblies that can be scanned\r\n \r\n \r\n \r\n \r\n \r\n \r\n Implementation which hooks into TopShelf's Start/Stop lifecycle.\r\n \r\n \r\n \r\n \r\n Does startup work.\r\n \r\n \r\n \r\n \r\n Does shutdown work.\r\n \r\n \r\n \r\n \r\n Accepts the type which will specify the users custom configuration.\r\n This type should implement .\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n Event raised when configuration is complete\r\n \r\n \r\n \r\n \r\n In memory implementation of ISagaPersister for quick development.\r\n \r\n \r\n \r\n \r\n In memory storage of subscriptions\r\n \r\n \r\n \r\n \r\n Handles logging configuration for the integration profile.\r\n \r\n \r\n \r\n \r\n Handles logging configuration for the lite profile.\r\n \r\n \r\n \r\n \r\n Sets default colors for a ColredConsoleAppender\r\n \r\n \r\n \r\n \r\n \r\n \r\n Handles logging configuration for the production profile\r\n \r\n \r\n \r\n \r\n Installs the distributed transaction coordinator.\r\n \r\n \r\n \r\n \r\n Installs and starts MSMQ if necessary.\r\n \r\n \r\n \r\n \r\n Installs performance counters.\r\n \r\n \r\n \r\n \r\n Implementors will be provided with a reference to IConfigureThisEndpoint.\r\n Implementors must inherit either or .\r\n \r\n \r\n \r\n \r\n This property will be set by the infrastructure.\r\n \r\n \r\n \r\n \r\n Handles the PerformanceCounters profile.\r\n \r\n \r\n \r\n \r\n Scans and loads profile handlers from the given assemblies\r\n \r\n \r\n \r\n \r\n Initializes the manager with the assemblies to scan and the endpoint configuration to use\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n Returns an object to configure logging based on the specification and profiles passed in.\r\n \r\n \r\n \r\n \r\n \r\n \r\n Activates the profilehandlers that handle the previously identified active profiles. \r\n \r\n \r\n \r\n \r\n \r\n \r\n Handles the client/server bus configuration.\r\n \r\n \r\n \r\n \r\n Checks if the specifier is a client or server and sets up the MsmqTransport and UnicastBus approproiately.\r\n \r\n \r\n \r\n \r\n \r\n \r\n A specialized service host that adds a default endpoint if non is specified in config\r\n \r\n \r\n \r\n \r\n Constructs the host with the given service type\r\n \r\n \r\n \r\n \r\n \r\n \r\n Adds the given endpoint unless its already configured in app.config\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n Marker interface to indicate a run-time profile.\r\n Implementors must be concrete class - interfaces are not supported.\r\n \r\n \r\n \r\n \r\n Specify the order in which message handlers will be invoked.\r\n \r\n \r\n \r\n \r\n In this method, use the order object to specify the order in which message handlers will be activated.\r\n \r\n \r\n \r\n \r\n \r\n \r\n If you want to specify your own container or serializer,\r\n implement this interface on the class which implements .\r\n \r\n Implementors will be invoked before the endpoint starts up.\r\n Dependency injection is not provided for these types.\r\n \r\n \r\n \r\n \r\n Perform initialization logic.\r\n \r\n \r\n \r\n \r\n If you want to specify your own logging,\r\n implement this interface on the class which implements . \r\n \r\n \r\n \r\n \r\n Initialize logging.\r\n \r\n \r\n \r\n \r\n Implementers will be invoked when the endpoint starts up.\r\n Dependency injection is provided for these types.\r\n \r\n \r\n \r\n \r\n Method called at startup.\r\n \r\n \r\n \r\n \r\n Method called on shutdown.\r\n \r\n \r\n \r\n \r\n Used to specify the order in which message handlers will be activated.\r\n \r\n \r\n \r\n \r\n Specifies that the given type will be activated before all others.\r\n \r\n \r\n \r\n \r\n \r\n \r\n Specifies an ordering of multiple types using the syntax:\r\n First{H1}.Then{H2}().Then{H3}()... etc\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n Profile indicating that you want the host to automatically check if the Distributed Transaction Coordinator\r\n windows service has its security settings configured correctly, and if they aren't, set the correct settings,\r\n check that the service is running, and if it isn't, run the MSDTC service.\r\n \r\n \r\n \r\n \r\n Profile indicating that you want the host to automatically check if MSMQ is installed,\r\n install MSMQ if it isn't, check that the right components of MSMQ are active,\r\n change the active MSMQ components as needed, check that the MSMQ service is running,\r\n and run the MSMQ service if it isn't.\r\n \r\n \r\n \r\n \r\n Profile indicating that you want the host to install the performance counters.\r\n \r\n \r\n \r\n \r\n Indicates that infrastructure suitable for integration environments be used.\r\n \r\n \r\n \r\n \r\n Indicates that the lightest weight infrastructure should be used.\r\n \r\n \r\n \r\n \r\n Indicates that performance counters should be published.\r\n \r\n \r\n \r\n \r\n Indicates that the infrastructure should configure itself for production.\r\n \r\n \r\n \r\n \r\n Entry point to the process.\r\n \r\n \r\n \r\n \r\n Gives a string which serves to identify the endpoint.\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n Gives an identifier for this endpoint\r\n \r\n \r\n \r\n \r\n Plugs into the generic service locator to return an instance of .\r\n \r\n \r\n \r\n \r\n Command line arguments.\r\n \r\n \r\n \r\n \r\n Returns an instance of \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n Not implemented.\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n The standard exception thrown when a ServiceLocator has an error in resolving an object.\r\n \r\n \r\n \r\n \r\n Initializes a new instance of the class.\r\n \r\n \r\n \r\n \r\n Initializes a new instance of the class with a specified error message.\r\n \r\n \r\n The message that describes the error. \r\n \r\n \r\n \r\n \r\n Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception.\r\n \r\n \r\n The error message that explains the reason for the exception. \r\n \r\n \r\n The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. \r\n \r\n \r\n \r\n \r\n Initializes a new instance of the class with serialized data.\r\n \r\n \r\n The that holds the serialized object data about the exception being thrown. \r\n \r\n \r\n The that contains contextual information about the source or destination. \r\n \r\n \r\n The parameter is null. \r\n \r\n \r\n The class name is null or is zero (0). \r\n \r\n \r\n \r\n \r\n The generic Service Locator interface. This interface is used\r\n to retrieve services (instances identified by type and optional\r\n name) from a container.\r\n \r\n \r\n \r\n \r\n Get an instance of the given .\r\n \r\n Type of object requested.\r\n if there is an error resolving\r\n the service instance.\r\n The requested service instance.\r\n \r\n \r\n \r\n Get an instance of the given named .\r\n \r\n Type of object requested.\r\n Name the object was registered with.\r\n if there is an error resolving\r\n the service instance.\r\n The requested service instance.\r\n \r\n \r\n \r\n Get all instances of the given currently\r\n registered in the container.\r\n \r\n Type of object requested.\r\n if there is are errors resolving\r\n the service instance.\r\n A sequence of instances of the requested .\r\n \r\n \r\n \r\n Get an instance of the given .\r\n \r\n Type of object requested.\r\n if there is are errors resolving\r\n the service instance.\r\n The requested service instance.\r\n \r\n \r\n \r\n Get an instance of the given named .\r\n \r\n Type of object requested.\r\n Name the object was registered with.\r\n if there is are errors resolving\r\n the service instance.\r\n The requested service instance.\r\n \r\n \r\n \r\n Get all instances of the given currently\r\n registered in the container.\r\n \r\n Type of object requested.\r\n if there is are errors resolving\r\n the service instance.\r\n A sequence of instances of the requested .\r\n \r\n \r\n \r\n A strongly-typed resource class, for looking up localized strings, etc.\r\n \r\n \r\n \r\n \r\n Returns the cached ResourceManager instance used by this class.\r\n \r\n \r\n \r\n \r\n Overrides the current thread's CurrentUICulture property for all\r\n resource lookups using this strongly typed resource class.\r\n \r\n \r\n \r\n \r\n Looks up a localized string similar to Activation error occured while trying to get all instances of type {0}.\r\n \r\n \r\n \r\n \r\n Looks up a localized string similar to Activation error occured while trying to get instance of type {0}, key \"{1}\".\r\n \r\n \r\n \r\n \r\n This class provides the ambient container for this application. If your\r\n framework defines such an ambient container, use ServiceLocator.Current\r\n to get it.\r\n \r\n \r\n \r\n \r\n Set the delegate that is used to retrieve the current container.\r\n \r\n Delegate that, when called, will return\r\n the current ambient container.\r\n \r\n \r\n \r\n The current ambient container.\r\n \r\n \r\n \r\n \r\n This class is a helper that provides a default implementation\r\n for most of the methods of .\r\n \r\n \r\n \r\n \r\n Implementation of .\r\n \r\n The requested service.\r\n if there is an error in resolving the service instance.\r\n The requested object.\r\n \r\n \r\n \r\n Get an instance of the given .\r\n \r\n Type of object requested.\r\n if there is an error resolving\r\n the service instance.\r\n The requested service instance.\r\n \r\n \r\n \r\n Get an instance of the given named .\r\n \r\n Type of object requested.\r\n Name the object was registered with.\r\n if there is an error resolving\r\n the service instance.\r\n The requested service instance.\r\n \r\n \r\n \r\n Get all instances of the given currently\r\n registered in the container.\r\n \r\n Type of object requested.\r\n if there is are errors resolving\r\n the service instance.\r\n A sequence of instances of the requested .\r\n \r\n \r\n \r\n Get an instance of the given .\r\n \r\n Type of object requested.\r\n if there is are errors resolving\r\n the service instance.\r\n The requested service instance.\r\n \r\n \r\n \r\n Get an instance of the given named .\r\n \r\n Type of object requested.\r\n Name the object was registered with.\r\n if there is are errors resolving\r\n the service instance.\r\n The requested service instance.\r\n \r\n \r\n \r\n Get all instances of the given currently\r\n registered in the container.\r\n \r\n Type of object requested.\r\n if there is are errors resolving\r\n the service instance.\r\n A sequence of instances of the requested .\r\n \r\n \r\n \r\n When implemented by inheriting classes, this method will do the actual work of resolving\r\n the requested service instance.\r\n \r\n Type of instance requested.\r\n Name of registered service you want. May be null.\r\n The requested service instance.\r\n \r\n \r\n \r\n When implemented by inheriting classes, this method will do the actual work of\r\n resolving all the requested service instances.\r\n \r\n Type of service requested.\r\n Sequence of service instance objects.\r\n \r\n \r\n \r\n Format the exception message for use in an \r\n that occurs while resolving a single service.\r\n \r\n The actual exception thrown by the implementation.\r\n Type of service requested.\r\n Name requested.\r\n The formatted exception message string.\r\n \r\n \r\n \r\n Format the exception message for use in an \r\n that occurs while resolving multiple service instances.\r\n \r\n The actual exception thrown by the implementation.\r\n Type of service requested.\r\n The formatted exception message string.\r\n \r\n \r\n \r\n This delegate type is used to provide a method that will\r\n return the current container. Used with the \r\n static accessor class.\r\n \r\n An .\r\n \r\n \r\n"} +{"text": "/****************************************************************************\n**\n** Copyright (C) 2015 The Qt Company Ltd.\n** Contact: http://www.qt.io/licensing/\n**\n** This file is part of the tools applications of the Qt Toolkit.\n**\n** $QT_BEGIN_LICENSE:LGPL$\n** Commercial License Usage\n** Licensees holding valid commercial Qt licenses may use this file in\n** accordance with the commercial license agreement provided with the\n** Software or, alternatively, in accordance with the terms contained in\n** a written agreement between you and The Qt Company. For licensing terms\n** and conditions see http://www.qt.io/terms-conditions. For further\n** information use the contact form at http://www.qt.io/contact-us.\n**\n** GNU Lesser General Public License Usage\n** Alternatively, this file may be used under the terms of the GNU Lesser\n** General Public License version 2.1 or version 3 as published by the Free\n** Software Foundation and appearing in the file LICENSE.LGPLv21 and\n** LICENSE.LGPLv3 included in the packaging of this file. Please review the\n** following information to ensure the GNU Lesser General Public License\n** requirements will be met: https://www.gnu.org/licenses/lgpl.html and\n** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.\n**\n** As a special exception, The Qt Company gives you certain additional\n** rights. These rights are described in The Qt Company LGPL Exception\n** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.\n**\n** GNU General Public License Usage\n** Alternatively, this file may be used under the terms of the GNU\n** General Public License version 3.0 as published by the Free Software\n** Foundation and appearing in the file LICENSE.GPL included in the\n** packaging of this file. Please review the following information to\n** ensure the GNU General Public License version 3.0 requirements will be\n** met: http://www.gnu.org/copyleft/gpl.html.\n**\n** $QT_END_LICENSE$\n**\n****************************************************************************/\n\n#ifndef DEBUGGER_TRK_PRIVATE_UTILS\n#define DEBUGGER_TRK_PRIVATE_UTILS\n\n#include \"trkutils.h\"\n#include \"symbianutils_global.h\"\n\nQT_BEGIN_NAMESPACE\nclass QDateTime;\nQT_END_NAMESPACE\n\nnamespace trk {\n\nvoid appendDateTime(QByteArray *ba, QDateTime dateTime, Endianness = TargetByteOrder);\n// returns a QByteArray containing optionally\n// the serial frame [0x01 0x90 ] and 0x7e encoded7d(ba) 0x7e\nQByteArray frameMessage(byte command, byte token, const QByteArray &data, bool serialFrame);\nbool extractResult(QByteArray *buffer, bool serialFrame, TrkResult *r, bool& linkEstablishmentMode, QByteArray *rawData = 0);\n\n} // namespace trk\n\n#endif // DEBUGGER_TRK_PRIVATE_UTILS\n"} +{"text": "/**\n * Testing 15.5.5.2-7\n * Attempt to access a character index of a string with len ≤ index \n * Covers 2046\n * Equivalent to ch15/15.5/15.5.5/15.5.5.2/15.5.5.5.2-7-4.js\n */\n\nfunction testcase() { \n var foo = \"foo\";\n var bar = foo[3];\n return bar == undefined;\n}\nrunTestCase(testcase);\n"} +{"text": "include (../../shared.pri)\r\n\r\nHEADERS += \\\r\n alignset.h \\\r\n levmarmethods.h \\\r\n mutual.h \\\r\n parameters.h \\\r\n shutils.h \\\r\n solver.h \\\r\n edit_mutualcorrs.h \\\r\n edit_mutualcorrsDialog.h \\\r\n edit_mutualcorrs_factory.h\r\n\r\nSOURCES += \\\r\n alignset.cpp \\\r\n edit_mutualcorrs.cpp \\\r\n edit_mutualcorrsDialog.cpp \\\r\n edit_mutualcorrs_factory.cpp \\\r\n solver.cpp \\\r\n levmarmethods.cpp \\\r\n mutual.cpp \\\r\n parameters.cpp\r\n\r\nRESOURCES += \\\r\n edit_mutualcorrs.qrc\r\n\r\nFORMS += \\\r\n edit_mutualcorrsDialog.ui\r\n\r\nTARGET = edit_mutualcorrs\r\n\r\nINCLUDEPATH *= \\\r\n $$MESHLAB_EXTERNAL_DIRECTORY/levmar-2.3 \\\r\n $$VCGDIR/wrap/newuoa/include\r\n\r\nwin32-msvc:LIBS += $$MESHLAB_DISTRIB_DIRECTORY/lib/win32-msvc/levmar.lib\r\nwin32-g++:LIBS += -L$$MESHLAB_DISTRIB_DIRECTORY/lib/win32-gcc -llevmar\r\nmacx:LIBS+= $$MESHLAB_DISTRIB_DIRECTORY/lib/macx64/liblevmar.a\r\nlinux:LIBS += -llevmar\r\n"} +{"text": "import 'package:flutter/material.dart';\nimport 'package:flutter/widgets.dart';\nimport 'package:flutter_nb/ui/widget/more_widgets.dart';\n\n/*class SystemPage extends StatefulWidget {\n @override\n State createState() {\n // TODO: implement createState\n return SystemPageState();\n }\n}\n\nclass SystemPageState extends State with TickerProviderStateMixin {\n int _count = 0;\n\n @override\n Widget build(BuildContext context) {\n return Scaffold(\n appBar: MoreWidgets.buildAppBar(\n context,\n '体系',\n centerTitle: true,\n elevation: 2.0,\n leading: IconButton(\n icon: Icon(Icons.arrow_back),\n onPressed: () {\n Navigator.pop(context);\n }),\n ),\n body: Center(\n child: Column(\n mainAxisAlignment: MainAxisAlignment.center,\n children: [\n AnimatedSwitcher(\n duration: const Duration(milliseconds: 500),\n transitionBuilder: (Widget child, Animation animation) {\n //执行缩放动画\n return ScaleTransition(child: child, scale: animation);\n },\n child: Text(\n '$_count',\n //显示指定key,不同的key会被认为是不同的Text,这样才能执行动画\n key: ValueKey(_count),\n style: Theme.of(context).textTheme.display1,\n ),\n ),\n RaisedButton(\n child: const Text(\n '+1',\n ),\n onPressed: () {\n setState(() {\n _count += 1;\n });\n },\n ),\n ],\n ),\n ));\n }\n}*/\n\nclass SystemPage extends StatefulWidget {\n @override\n _AnimatedWidgetsTestState createState() => _AnimatedWidgetsTestState();\n}\n\nclass _AnimatedWidgetsTestState extends State {\n double _padding = 10;\n var _align = Alignment.topRight;\n double _height = 100;\n double _left = 0;\n Color _color = Colors.red;\n TextStyle _style = TextStyle(color: Colors.black);\n Color _decorationColor = Colors.blue;\n\n @override\n Widget build(BuildContext context) {\n var duration = Duration(seconds: 5);\n return Scaffold(\n appBar: MoreWidgets.buildAppBar(\n context,\n '体系',\n centerTitle: true,\n elevation: 2.0,\n leading: IconButton(\n icon: Icon(Icons.arrow_back),\n onPressed: () {\n Navigator.pop(context);\n }),\n ),\n body: SingleChildScrollView(\n child: Column(\n children: [\n RaisedButton(\n onPressed: () {\n setState(() {\n _padding = 20;\n });\n },\n child: AnimatedPadding(\n duration: duration,\n padding: EdgeInsets.all(_padding),\n child: Text(\"AnimatedPadding\"),\n ),\n ),\n SizedBox(\n height: 50,\n child: Stack(\n children: [\n AnimatedPositioned(\n duration: duration,\n left: _left,\n child: RaisedButton(\n onPressed: () {\n setState(() {\n _left = 100;\n });\n },\n child: Text(\"AnimatedPositioned\"),\n ),\n )\n ],\n ),\n ),\n Container(\n height: 100,\n color: Colors.grey,\n child: AnimatedAlign(\n duration: duration,\n alignment: _align,\n child: RaisedButton(\n onPressed: () {\n setState(() {\n _align = Alignment.center;\n });\n },\n child: Text(\"AnimatedAlign\"),\n ),\n ),\n ),\n AnimatedContainer(\n duration: duration,\n height: _height,\n color: _color,\n child: FlatButton(\n onPressed: () {\n setState(() {\n _height = 150;\n _color = Colors.blue;\n });\n },\n child: Text(\n \"AnimatedContainer\",\n style: TextStyle(color: Colors.white),\n ),\n ),\n ),\n AnimatedDefaultTextStyle(\n child: GestureDetector(\n child: Text(\"hello world\"),\n onTap: () {\n setState(() {\n _style = TextStyle(\n color: Colors.blue,\n decorationStyle: TextDecorationStyle.solid,\n decorationColor: Colors.blue,\n );\n });\n },\n ),\n style: _style,\n duration: duration,\n ),\n AnimatedDecoratedBox(\n duration: duration,\n decoration: BoxDecoration(color: _decorationColor),\n child: FlatButton(\n onPressed: () {\n setState(() {\n _decorationColor = Colors.red;\n });\n },\n child: Text(\n \"AnimatedDecoratedBox\",\n style: TextStyle(color: Colors.white),\n ),\n ),\n )\n ].map((e) {\n return Padding(\n padding: EdgeInsets.symmetric(vertical: 16),\n child: e,\n );\n }).toList(),\n ),\n ));\n }\n}\n\nclass AnimatedDecoratedBox extends ImplicitlyAnimatedWidget {\n AnimatedDecoratedBox({\n Key key,\n @required this.decoration,\n this.child,\n Curve curve = Curves.linear, //动画曲线\n @required Duration duration, // 正向动画执行时长\n }) : super(\n key: key,\n curve: curve,\n duration: duration,\n );\n final BoxDecoration decoration;\n final Widget child;\n\n @override\n _AnimatedDecoratedBoxState createState() {\n return _AnimatedDecoratedBoxState();\n }\n}\n\nclass _AnimatedDecoratedBoxState\n extends AnimatedWidgetBaseState {\n DecorationTween _decoration; //定义一个Tween\n\n @override\n Widget build(BuildContext context) {\n return DecoratedBox(\n decoration: _decoration.evaluate(animation),\n child: widget.child,\n );\n }\n\n @override\n void forEachTween(visitor) {\n // 在需要更新Tween时,基类会调用此方法\n _decoration = visitor(_decoration, widget.decoration,\n (value) => DecorationTween(begin: value));\n }\n}\n"} +{"text": "const routes = [\n {\n path: 'system_info',\n component: () => import('./views/SystemInfo'),\n meta: { requiresAdmin: true },\n },\n {\n path: 'logo_info',\n component: () => import('./views/Logo'),\n meta: { requiresAdmin: true },\n },\n]\n\nexport default routes\n"} +{"text": "\n\n \n \n \n Vulkan\n 0.0.5950.20892\n 0.0.6105.39043\n 0.0.6106.39464\n 0.0.6134.41045\n 0.0.6142.19338\n \n \n System.Enum\n \n \n \n System.Flags\n \n \n \n Bitmask specifying classes of memory access the will participate in a memory barrier dependency\n \n \n \n \n \n \n Field\n \n 0.0.5950.20892\n 0.0.6105.39043\n 0.0.6106.39464\n 0.0.6134.41045\n 0.0.6142.19338\n \n \n Vulkan.AccessFlags\n \n \n indicates that the access is a read via a color attachment.\n \n \n \n \n \n Field\n \n 0.0.5950.20892\n 0.0.6105.39043\n 0.0.6106.39464\n 0.0.6134.41045\n 0.0.6142.19338\n \n \n Vulkan.AccessFlags\n \n \n indicates that the access is a write via a color or resolve attachment.\n \n \n \n \n \n Field\n \n 0.0.5950.20892\n 0.0.6105.39043\n 0.0.6106.39464\n 0.0.6134.41045\n 0.0.6142.19338\n \n \n Vulkan.AccessFlags\n \n \n indicates that the access is a read via a depth/stencil attachment.\n \n \n \n \n \n Field\n \n 0.0.5950.20892\n 0.0.6105.39043\n 0.0.6106.39464\n 0.0.6134.41045\n 0.0.6142.19338\n \n \n Vulkan.AccessFlags\n \n \n indicates that the access is a write via a depth/stencil attachment.\n \n \n \n \n \n Field\n \n 0.0.5950.20892\n 0.0.6105.39043\n 0.0.6106.39464\n 0.0.6134.41045\n 0.0.6142.19338\n \n \n Vulkan.AccessFlags\n \n \n indicates that the access is a read via the host.\n \n \n \n \n \n Field\n \n 0.0.5950.20892\n 0.0.6105.39043\n 0.0.6106.39464\n 0.0.6134.41045\n 0.0.6142.19338\n \n \n Vulkan.AccessFlags\n \n \n indicates that the access is a write via the host.\n \n \n \n \n \n Field\n \n 0.0.5950.20892\n 0.0.6105.39043\n 0.0.6106.39464\n 0.0.6134.41045\n 0.0.6142.19338\n \n \n Vulkan.AccessFlags\n \n \n indicates that the access is an index buffer read.\n \n \n \n \n \n Field\n \n 0.0.5950.20892\n 0.0.6105.39043\n 0.0.6106.39464\n 0.0.6134.41045\n 0.0.6142.19338\n \n \n Vulkan.AccessFlags\n \n \n indicates that the access is an indirect command structure read as part of an indirect drawing command.\n \n \n \n \n \n Field\n \n 0.0.5950.20892\n 0.0.6105.39043\n 0.0.6106.39464\n 0.0.6134.41045\n 0.0.6142.19338\n \n \n Vulkan.AccessFlags\n \n \n indicates that the access is a read via an input attachment descriptor.\n \n \n \n \n \n Field\n \n 0.0.5950.20892\n 0.0.6105.39043\n 0.0.6106.39464\n 0.0.6134.41045\n 0.0.6142.19338\n \n \n Vulkan.AccessFlags\n \n \n indicates that the access is a read via a non-specific unit attached to the memory. This unit may: be external to the Vulkan device or otherwise not part of the core Vulkan pipeline. When included in pname:dstAccessMask, all writes using access types in pname:srcAccessMask performed by pipeline stages in pname:srcStageMask must: be visible in memory.\n \n \n \n \n \n Field\n \n 0.0.5950.20892\n 0.0.6105.39043\n 0.0.6106.39464\n 0.0.6134.41045\n 0.0.6142.19338\n \n \n Vulkan.AccessFlags\n \n \n indicates that the access is a write via a non-specific unit attached to the memory. This unit may: be external to the Vulkan device or otherwise not part of the core Vulkan pipeline. When included in pname:srcAccessMask, all access types in pname:dstAccessMask from pipeline stages in pname:dstStageMask will observe the side effects of commands that executed before the barrier. When included in pname:dstAccessMask all writes using access types in pname:srcAccessMask performed by pipeline stages in pname:srcStageMask must: be visible in memory.\n \n \n \n \n \n Field\n \n 0.0.5950.20892\n 0.0.6105.39043\n 0.0.6106.39464\n 0.0.6134.41045\n 0.0.6142.19338\n \n \n Vulkan.AccessFlags\n \n \n indicates that the access is a read from a shader via any other descriptor type.\n \n \n \n \n \n Field\n \n 0.0.5950.20892\n 0.0.6105.39043\n 0.0.6106.39464\n 0.0.6134.41045\n 0.0.6142.19338\n \n \n Vulkan.AccessFlags\n \n \n indicates that the access is a write or atomic from a shader via the same descriptor types as in ename:VK_ACCESS_SHADER_READ_BIT.\n \n \n \n \n \n Field\n \n 0.0.5950.20892\n 0.0.6105.39043\n 0.0.6106.39464\n 0.0.6134.41045\n 0.0.6142.19338\n \n \n Vulkan.AccessFlags\n \n \n indicates that the access is a read from a transfer (copy, blit, resolve, etc.) operation. For the complete set of transfer operations, see <<synchronization-transfer,ename:VK_PIPELINE_STAGE_TRANSFER_BIT>>.\n \n \n \n \n \n Field\n \n 0.0.5950.20892\n 0.0.6105.39043\n 0.0.6106.39464\n 0.0.6134.41045\n 0.0.6142.19338\n \n \n Vulkan.AccessFlags\n \n \n indicates that the access is a write from a transfer (copy, blit, resolve, etc.) operation. For the complete set of transfer operations, see <<synchronization-transfer,ename:VK_PIPELINE_STAGE_TRANSFER_BIT>>.\n \n \n \n \n \n Field\n \n 0.0.5950.20892\n 0.0.6105.39043\n 0.0.6106.39464\n 0.0.6134.41045\n 0.0.6142.19338\n \n \n Vulkan.AccessFlags\n \n \n indicates that the access is a read via a uniform buffer or dynamic uniform buffer descriptor.\n \n \n \n \n \n Field\n \n 0.0.5950.20892\n 0.0.6105.39043\n 0.0.6106.39464\n 0.0.6134.41045\n 0.0.6142.19338\n \n \n Vulkan.AccessFlags\n \n \n indicates that the access is a read via the vertex input bindings.\n \n \n \n"} +{"text": "makeres-table is a collection of graph transformations for use with\nmakeres for efficiently analyzing large structured datasets.\n\nmakeres-table is free (GPL) software, and is built on top of makeres,\nmakeres-macro, and cl-ana (all GPL).\n\nThe utilities provided by the various operators are:\n\n* Merging passes over tables which could be done in parallel into a\n single pass.\n\n* Distinction between physical (written and read via disk/memory) and\n logical (always computed from physical sources) tables.\n\n--------------------------------------------------\nThe operators provided are:\n\n* dotab: General-purpose table iteration; used for non-table results.\n\n* tab: Iteration over a table to produce a physical table.\n\nIf the source table for a physical table needs to be iterated, then as\nmany of the necessary passes over the physical table are generated\nduring the source table iteration (known as collapsing a pass). The\nassumption is that disk access is the bottleneck, so that as much\ncomputation should be done per disk accesss as possible.\n\n* ltab: Iteration over a table to produce a logical table.\n\nTables created via ltab are vaporous; they are not part of the final\ncomputation (technically they always have the value nil), and any\nresults to be generated from an ltab are computed from an appropriate\nphysical source via pass collapsing. This is done prior to physical\ntable pass collapsing, so the actual source table passed over by a\nreduction of a logical table depends on the physical tables.\n\nThe primary use of logical tables is to denote subsets of data which\ndo not really deserve to be written to disk, but are still helpful for\ndescribing a computation (e.g. applying filters or defining a new\nstructure for a subset of data).\n\nAny fields from the source table are available as long as they are not\nshadowed by stating them in the call to push-fields in the ltab\ndefinition.\n\n* deflfields: Definition of logical fields.\n\nLogical fields are analogous to logical tables in that they are always\ncomputed per row; they provide an alternative to physically storing\nfields which could be computed based on already available information.\n"} +{"text": ".section .init\n\tldp x29,x30,[sp],#16\n\tret\n\n.section .fini\n\tldp x29,x30,[sp],#16\n\tret\n"} +{"text": "$(document).ready(function () {\r\n $('fieldset').parent().attr('id', 'quiz');\r\n $(\"#quiz .disable input\").attr(\"disabled\", \"disabled\");\r\n $(\"#quiz .mod-completed input[value='1']\").addClass(\"correct\").prop(\"checked\", true).parent().children().attr(\"disabled\", \"disabled\");\r\n $(\"#quiz .mod-completed .btn\").addClass(\"d-none\");\r\n // Completed Module Pop-up\r\n $('#quiz-modal').modal('show');\r\n\r\n // Quiz\r\n $(document).change(function () {\r\n var numItems = $('#quiz .form-field').length;\r\n var checkedItems = $(\"#quiz input:checked\").length;\r\n\r\n if (checkedItems == numItems) {\r\n $(\"#quiz .btn\").removeClass(\"disabled\");\r\n }\r\n });\r\n $(\"form .btn\").click(function (event) {\r\n var numItems = $('#quiz .form-field').length;\r\n var correctItems = $('#quiz .correct').length + $('#quiz .true').length;\r\n\r\n if (correctItems != numItems) {\r\n event.preventDefault();\r\n\r\n $(this).removeClass(\"btn-primary\").addClass(\"btn-danger\").attr(\"value\", \"Recheck Answsers\");\r\n $(\"input\").not(\"input:checked\").removeClass(\"false\");\r\n $(\".true\").removeClass(\"true\").addClass(\"correct\");\r\n $(\".false\").removeClass(\"false\").addClass(\"wrong\");\r\n $(\".correct\").parent().children().removeClass(\"wrong\").not(\".correct\").attr(\"disabled\", \"disabled\");\r\n }\r\n });\r\n $(\"input:radio\").click(function (ev) {\r\n if (ev.currentTarget.value == \"1\") {\r\n $(this).addClass('true');\r\n\r\n } else if (ev.currentTarget.value == \"0\") {\r\n $(this).addClass('false');\r\n $(this).parent().children().removeClass(\"true\");\r\n }\r\n $(this).parent().children().removeClass(\"wrong\");\r\n });\r\n\r\n // Highlight Syntax\r\n $('pre').addClass('line-numbers py-2 m-0');\r\n Prism.highlightAll();\r\n});"} +{"text": "/* Copyright (c) 2013-2015 Jeffrey Pfau\n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\n#pragma once\n\n#if defined(BUILD_GL) || defined(BUILD_GLES2)\n\n#include \"Display.h\"\n\n#ifdef USE_EPOXY\n#include \n#ifndef GLdouble\n#define GLdouble GLdouble\n#endif\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \"platform/video-backend.h\"\n\nnamespace QGBA {\n\nclass EmptyGLWidget : public QGLWidget {\npublic:\n\tEmptyGLWidget(const QGLFormat& format, QWidget* parent) : QGLWidget(format, parent) { setAutoBufferSwap(false); }\n\nprotected:\n\tvoid paintEvent(QPaintEvent*) override {}\n\tvoid resizeEvent(QResizeEvent*) override {}\n\tvoid mouseMoveEvent(QMouseEvent* event) override { event->ignore(); }\n};\n\nclass PainterGL;\nclass DisplayGL : public Display {\nQ_OBJECT\n\npublic:\n\tDisplayGL(const QGLFormat& format, QWidget* parent = nullptr);\n\t~DisplayGL();\n\n\tvoid startDrawing(std::shared_ptr) override;\n\tbool isDrawing() const override { return m_isDrawing; }\n\tbool supportsShaders() const override;\n\tVideoShader* shaders() override;\n\npublic slots:\n\tvoid stopDrawing() override;\n\tvoid pauseDrawing() override;\n\tvoid unpauseDrawing() override;\n\tvoid forceDraw() override;\n\tvoid lockAspectRatio(bool lock) override;\n\tvoid lockIntegerScaling(bool lock) override;\n\tvoid filter(bool filter) override;\n\tvoid framePosted() override;\n\tvoid setShaders(struct VDir*) override;\n\tvoid clearShaders() override;\n\nprotected:\n\tvirtual void paintEvent(QPaintEvent*) override {}\n\tvirtual void resizeEvent(QResizeEvent*) override;\n\nprivate:\n\tvoid resizePainter();\n\n\tbool m_isDrawing = false;\n\tQGLWidget* m_gl;\n\tPainterGL* m_painter;\n\tQThread* m_drawThread = nullptr;\n\tstd::shared_ptr m_context;\n};\n\nclass PainterGL : public QObject {\nQ_OBJECT\n\npublic:\n\tPainterGL(int majorVersion, QGLWidget* parent);\n\t~PainterGL();\n\n\tvoid setContext(std::shared_ptr);\n\tvoid setMessagePainter(MessagePainter*);\n\tvoid enqueue(const uint32_t* backing);\n\n\tbool supportsShaders() const { return m_supportsShaders; }\n\npublic slots:\n\tvoid forceDraw();\n\tvoid draw();\n\tvoid start();\n\tvoid stop();\n\tvoid pause();\n\tvoid unpause();\n\tvoid resize(const QSize& size);\n\tvoid lockAspectRatio(bool lock);\n\tvoid lockIntegerScaling(bool lock);\n\tvoid filter(bool filter);\n\n\tvoid setShaders(struct VDir*);\n\tvoid clearShaders();\n\tVideoShader* shaders();\n\nprivate:\n\tvoid performDraw();\n\tvoid dequeue();\n\tvoid dequeueAll();\n\n\tQList m_free;\n\tQQueue m_queue;\n\tQPainter m_painter;\n\tQMutex m_mutex;\n\tQGLWidget* m_gl;\n\tbool m_active = false;\n\tbool m_started = false;\n\tstd::shared_ptr m_context = nullptr;\n\tbool m_supportsShaders;\n\tVideoShader m_shader{};\n\tVideoBackend* m_backend = nullptr;\n\tQSize m_size;\n\tMessagePainter* m_messagePainter = nullptr;\n\tQElapsedTimer m_delayTimer;\n};\n\n}\n\n#endif\n"} +{"text": ".\n */\nnamespace Mcustiel\\SimpleRequest\\Validator;\n\nuse Mcustiel\\SimpleRequest\\Interfaces\\ValidatorInterface;\nuse Mcustiel\\SimpleRequest\\Exception\\UnspecifiedValidatorException;\n\n/**\n * Base class for validators that checks the size of a value.\n *\n * @author mcustiel\n */\nabstract class AbstractSizeValidator implements ValidatorInterface\n{\n /**\n * The size to check.\n *\n * @var int\n */\n protected $size;\n\n /**\n * {@inheritdoc}\n *\n * @see \\Mcustiel\\SimpleRequest\\Interfaces\\Specificable::setSpecification()\n */\n public function setSpecification($specification = null)\n {\n if (!is_int($specification) || $specification < 0) {\n throw new UnspecifiedValidatorException(\n 'Size validator is being initialized without a valid number'\n );\n }\n $this->size = $specification;\n }\n\n /**\n * {@inheritdoc}\n *\n * @see \\Mcustiel\\SimpleRequest\\Interfaces\\ValidatorInterface::validate()\n */\n abstract public function validate($value);\n}\n"} +{"text": "#\n# Makefile for the Linux /dev/pts virtual filesystem.\n#\n\nobj-$(CONFIG_UNIX98_PTYS)\t\t+= devpts.o\n\ndevpts-$(CONFIG_UNIX98_PTYS)\t\t:= inode.o\n"} +{"text": "-- boundary2.test\n-- \n-- db eval {\n-- SELECT a FROM t1 WHERE r > -32768 ORDER BY r\n-- }\nSELECT a FROM t1 WHERE r > -32768 ORDER BY r"} +{"text": "(function($) {\n $.extend($.summernote.lang, {\n 'fr-FR': {\n font: {\n bold: 'Gras',\n italic: 'Italique',\n underline: 'Souligné',\n clear: 'Effacer la mise en forme',\n height: 'Interligne',\n name: 'Famille de police',\n strikethrough: 'Barré',\n superscript: 'Exposant',\n subscript: 'Indice',\n size: 'Taille de police'\n },\n image: {\n image: 'Image',\n insert: 'Insérer une image',\n resizeFull: 'Taille originale',\n resizeHalf: 'Redimensionner à 50 %',\n resizeQuarter: 'Redimensionner à 25 %',\n floatLeft: 'Aligné à gauche',\n floatRight: 'Aligné à droite',\n floatNone: 'Pas d\\'alignement',\n shapeRounded: 'Forme: Rectangle arrondie',\n shapeCircle: 'Forme: Cercle',\n shapeThumbnail: 'Forme: Vignette',\n shapeNone: 'Forme: Aucune',\n dragImageHere: 'Faites glisser une image ou un texte dans ce cadre',\n dropImage: 'Lachez l\\'image ou le texte',\n selectFromFiles: 'Choisir un fichier',\n maximumFileSize: 'Taille de fichier maximale',\n maximumFileSizeError: 'Taille maximale du fichier dépassée',\n url: 'URL de l\\'image',\n remove: 'Supprimer l\\'image',\n original: 'Original'\n },\n video: {\n video: 'Vidéo',\n videoLink: 'Lien vidéo',\n insert: 'Insérer une vidéo',\n url: 'URL de la vidéo',\n providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion ou Youku)'\n },\n link: {\n link: 'Lien',\n insert: 'Insérer un lien',\n unlink: 'Supprimer un lien',\n edit: 'Modifier',\n textToDisplay: 'Texte à afficher',\n url: 'URL du lien',\n openInNewWindow: 'Ouvrir dans une nouvelle fenêtre'\n },\n table: {\n table: 'Tableau',\n addRowAbove: 'Ajouter une ligne au-dessus',\n addRowBelow: 'Ajouter une ligne en dessous',\n addColLeft: 'Ajouter une colonne à gauche',\n addColRight: 'Ajouter une colonne à droite',\n delRow: 'Supprimer la ligne',\n delCol: 'Supprimer la colonne',\n delTable: 'Supprimer le tableau'\n },\n hr: {\n insert: 'Insérer une ligne horizontale'\n },\n style: {\n style: 'Style',\n p: 'Normal',\n blockquote: 'Citation',\n pre: 'Code source',\n h1: 'Titre 1',\n h2: 'Titre 2',\n h3: 'Titre 3',\n h4: 'Titre 4',\n h5: 'Titre 5',\n h6: 'Titre 6'\n },\n lists: {\n unordered: 'Liste à puces',\n ordered: 'Liste numérotée'\n },\n options: {\n help: 'Aide',\n fullscreen: 'Plein écran',\n codeview: 'Afficher le code HTML'\n },\n paragraph: {\n paragraph: 'Paragraphe',\n outdent: 'Diminuer le retrait',\n indent: 'Augmenter le retrait',\n left: 'Aligner à gauche',\n center: 'Centrer',\n right: 'Aligner à droite',\n justify: 'Justifier'\n },\n color: {\n recent: 'Dernière couleur sélectionnée',\n more: 'Plus de couleurs',\n background: 'Couleur de fond',\n foreground: 'Couleur de police',\n transparent: 'Transparent',\n setTransparent: 'Définir la transparence',\n reset: 'Restaurer',\n resetToDefault: 'Restaurer la couleur par défaut'\n },\n shortcut: {\n shortcuts: 'Raccourcis',\n close: 'Fermer',\n textFormatting: 'Mise en forme du texte',\n action: 'Action',\n paragraphFormatting: 'Mise en forme des paragraphes',\n documentStyle: 'Style du document',\n extraKeys: 'Touches supplémentaires'\n },\n help: {\n 'insertParagraph': 'Insérer paragraphe',\n 'undo': 'Défaire la dernière commande',\n 'redo': 'Refaire la dernière commande',\n 'tab': 'Tabulation',\n 'untab': 'Tabulation arrière',\n 'bold': 'Mettre en caractère gras',\n 'italic': 'Mettre en italique',\n 'underline': 'Mettre en souligné',\n 'strikethrough': 'Mettre en texte barré',\n 'removeFormat': 'Nettoyer les styles',\n 'justifyLeft': 'Aligner à gauche',\n 'justifyCenter': 'Centrer',\n 'justifyRight': 'Aligner à droite',\n 'justifyFull': 'Justifier à gauche et à droite',\n 'insertUnorderedList': 'Basculer liste à puces',\n 'insertOrderedList': 'Basculer liste ordonnée',\n 'outdent': 'Diminuer le retrait du paragraphe',\n 'indent': 'Augmenter le retrait du paragraphe',\n 'formatPara': 'Changer le paragraphe en cours en normal (P)',\n 'formatH1': 'Changer le paragraphe en cours en entête H1',\n 'formatH2': 'Changer le paragraphe en cours en entête H2',\n 'formatH3': 'Changer le paragraphe en cours en entête H3',\n 'formatH4': 'Changer le paragraphe en cours en entête H4',\n 'formatH5': 'Changer le paragraphe en cours en entête H5',\n 'formatH6': 'Changer le paragraphe en cours en entête H6',\n 'insertHorizontalRule': 'Insérer séparation horizontale',\n 'linkDialog.show': 'Afficher fenêtre d\\'hyperlien'\n },\n history: {\n undo: 'Annuler la dernière action',\n redo: 'Restaurer la dernière action annulée'\n },\n specialChar: {\n specialChar: 'CARACTÈRES SPÉCIAUX',\n select: 'Choisir des caractères spéciaux'\n }\n }\n });\n})(jQuery);\n"} +{"text": "package nyaya.gen\n\nimport java.nio.charset.Charset\nimport scalaz.{BindRec, NonEmptyList, -\\/, \\/-}\nimport scalaz.std.AllInstances._\nimport utest._\nimport nyaya.prop._\nimport nyaya.test.PropTest._\nimport scala.collection.compat._\n\nobject GenTest extends TestSuite {\n\n type VI = Vector[Int]\n type SI = Set[Int]\n\n val utf8 = Charset.forName(\"UTF-8\")\n val validUnicode =\n Prop.equalSelf[String](s\"Unicode string ↔ $utf8\", s => {\n val b = s.getBytes(utf8)\n new String(b, utf8)\n })\n\n val shuffleProp =\n Prop.equal[(VI, VI), VI](\"shuffle\", _._1.sorted, _._2.sorted)\n val shuffleGen =\n for {\n before <- Gen.int.vector\n after <- Gen.shuffle(before)\n } yield (before, after)\n\n val mapByEachKeyProp =\n Prop.equal[(VI, Map[Int, Char]), SI](\"\", _._1.toSet, _._2.keySet)\n val mapByEachKeyGen =\n for {\n is <- Gen.int.vector\n m <- Gen.char.mapByEachKey(is)\n } yield (is, m)\n\n val fillProp =\n Prop.equal[(Int, Vector[Unit]), Int](\"fill.length\", _._1, _._2.length)\n val fillGen =\n for {\n n <- Gen.chooseSize\n v <- Gen.unit.vector(n)\n } yield (n, v)\n\n val freqArgs: Gen[NonEmptyList[Gen.Freq[Char]]] = {\n val freq = Gen.chooseInt(1, 16)\n val gen = Gen.char.map(Gen.pure)\n (freq *** gen).scalazNEL\n }\n\n // For cases when parametricity means there's nothing useful to test without the ability to write a ∃-test\n def didntCrash[A] = Prop.test[A](\"Didn't crash\", _ => true)\n\n def assertType[T](f: => T): Unit = ()\n\n val abc = \"abc\".toCharArray.toList\n\n override def tests = Tests {\n\n \"chooseInt\" - {\n \"bound\" - {\n for (b <- 1 to 34) {\n val values = Gen.chooseInt(b).samples().take(b * 1000).toSet\n assert(values == 0.until(b).toSet)\n }\n }\n \"range\" - {\n val values = Gen.chooseInt(3, 6).samples().take(500).toSet\n assert(values == Set(3, 4, 5, 6))\n }\n \"singleValue\" - {\n Gen.chooseInt(5, 5).samples().take(20).toSet[Int].foreach(l => assert(l == 5))\n }\n \"wholeRange\" - {\n Gen.chooseInt(Int.MinValue, Int.MaxValue).sample() // Just test it doesn't crash\n ()\n }\n \"positiveRange\" - {\n Gen.chooseInt(0, Int.MaxValue).samples().take(1000).foreach(l => assert(l > 0L))\n }\n \"hugeRange\" - {\n // Bit hard to test this better\n def test(l: Int, h: Int): Unit =\n Gen.chooseInt(l, h).samples().take(1000).foreach(x => assert(x >= l && x <= h))\n test(Int.MinValue, Int.MaxValue)\n test(Int.MinValue, Int.MaxValue - 1)\n test(Int.MinValue + 1, Int.MaxValue)\n test(Int.MinValue + 1, Int.MaxValue - 1)\n }\n }\n\n \"chooseLong\" - {\n \"bound\" - {\n for (b <- 1 to 34) {\n val values = Gen.chooseLong(b).samples().take(b * 1000).toSet\n assert(values == 0.until(b).toSet)\n }\n }\n \"bigBound\" - {\n val big = 922337203685477580L\n val values = Gen.chooseLong(big).samples().take(100000).toSet\n val bad = values.filter(l => l < 0 || l >= big)\n assert(bad.isEmpty)\n }\n \"range\" - {\n val values = Gen.chooseLong(3, 6).samples().take(500).toSet\n assert(values == Set[Long](3, 4, 5, 6))\n }\n \"singleValue\" - {\n Gen.chooseLong(5, 5).samples().take(20).toSet[Long].foreach(l => assert(l == 5))\n }\n \"wholeRange\" - {\n Gen.chooseLong(Long.MinValue, Long.MaxValue).sample() // Just test it doesn't crash\n ()\n }\n \"positiveRange\" - {\n Gen.chooseLong(0, Long.MaxValue).samples().take(1000).foreach(l => assert(l > 0L))\n }\n \"hugeRange\" - {\n // Bit hard to test this better\n def test(l: Long, h: Long): Unit =\n Gen.chooseLong(l, h).samples().take(1000).foreach(x => assert(x >= l && x <= h))\n test(Long.MinValue, Long.MaxValue)\n test(Long.MinValue, Long.MaxValue - 1)\n test(Long.MinValue + 1, Long.MaxValue)\n test(Long.MinValue + 1, Long.MaxValue - 1)\n }\n\n \"by2\" - {\n def test(l: Long, h: Long, s: Int = 200): Unit = {\n val actual = Gen.chooseLongBy2(l, h).samples().take(s).toList.sorted.distinct\n val expect = (l to h).toList\n assert(actual == expect)\n }\n \"ee\" - test(2, 10)\n \"eo\" - test(2, 11)\n \"oe\" - test(3, 10)\n \"oo\" - test(3, 11)\n }\n }\n\n \"chooseChar\" - {\n // Ensure scalac actually allows these overloads (in some cases it compiles but fails at callsite)\n val s1 = Gen.chooseChar('a', 'b' to 'z')\n val s2 = Gen.chooseChar('@', \"=!\")\n val s3 = Gen.chooseChar('@', \"=!\", 'a' to 'z', 'A' to 'Z')\n val u1 = Gen.chooseChar_!('a' to 'z')\n val u2 = Gen.chooseChar_!(\"@=!\")\n val u3 = Gen.chooseChar_!(\"@=!\", 'a' to 'z', 'A' to 'Z')\n def test(gs: Gen[Char]*) = { val _ = gs; () }\n test(s1, s2, s3)\n test(u1, u2, u3)\n }\n\n \"charToString\" - {\n assertType[Gen[String]](Gen.char.string)\n assertType[Gen[String]](Gen.char.string1)\n assertType[Gen[String]](Gen.ascii.string)\n }\n\n \"unicodeString\" - Gen.string.mustSatisfy(validUnicode)// (DefaultSettings.propSettings.setSampleSize(500000))\n\n \"fill\" - fillGen .mustSatisfy(fillProp)\n \"shuffle\" - shuffleGen .mustSatisfy(shuffleProp)\n \"subset\" - Gen.int.list.subset .mustSatisfy(didntCrash)\n \"subset1\" - Gen.int.vector.subset1 .mustSatisfy(didntCrash)\n \"take\" - Gen.int.list.take(0 to 210) .mustSatisfy(didntCrash)\n \"mapBy\" - Gen.int.mapBy(Gen.char) .mustSatisfy(didntCrash)\n \"mapByKeySubset\" - Gen.int.list.flatMap(Gen.int.mapByKeySubset) .mustSatisfy(didntCrash)\n \"mapByEachKey\" - mapByEachKeyGen .mustSatisfy(mapByEachKeyProp)\n \"newOrOld\" - Gen.int.list.flatMap(Gen.newOrOld(Gen.int, _)).mustSatisfy(didntCrash)\n \"frequency\" - freqArgs.flatMap(Gen frequencyNE _) .mustSatisfy(didntCrash)\n\n \"sequence\" - {\n val inp = \"heheyay\"\n val vgc = inp.toCharArray.toVector.map(Gen.pure)\n val gvc = Gen sequence vgc\n val res = gvc.map(_ mkString \"\") run GenCtx(GenSize(0), ThreadNumber(0))\n assert(res == inp)\n }\n\n \"tailrec\" - {\n val lim = 100000\n def test(g: Int => Gen[Int]): Unit = assert(g(0).samples().next() == lim)\n \"plain\" - test(Gen.tailrec[Int, Int](i => Gen.pure(if (i < lim) Left(i + 1) else Right(i))))\n \"scalaz\" - test(BindRec[Gen].tailrecM[Int, Int](i => Gen.pure(if (i < lim) -\\/(i + 1) else \\/-(i))))\n }\n\n \"optionGet\" - {\n \"pass\" - Gen.pure(666).option.optionGet.mustSatisfy(Prop.test(\"be 666\", _ == 666))\n \"fail\" - {\n val s = Gen.pure(None: Option[Int]).optionGet.samples()\n try {\n s.next()\n sys error \"Crash expected.\"\n } catch {\n case e: Throwable => assert(e.getMessage contains \"Failed to generate\")\n }\n }\n }\n\n \"reseed\" - {\n val g = for {\n a <- Gen.setConstSeed(0) >> Gen.int\n b <- Gen.setConstSeed(0) >> Gen.reseed >> Gen.int\n c <- Gen.setConstSeed(0) >> Gen.reseed >> Gen.int\n } yield Set(a, b, c)\n g.mustSatisfy(Prop.test(\"must have 3 elements\", _.size == 3))\n }\n\n \"orderedSeq\" - {\n def assertAll(g: Gen[Vector[Char]])(expect: IterableOnce[String]): Unit = {\n val e = expect.iterator.toSet\n val a = g.samples().take(e.size * 50).map(_ mkString \"\").toSet\n assert(a == e)\n }\n\n def combos(r: Range): Seq[String] =\n for {\n a <- r\n b <- r\n c <- r\n } yield (\"a\" * a) + (\"b\" * b) + (\"c\" * c)\n\n \"noDrop\" - {\n \"dups0\" - assertAll(Gen.orderedSeq(abc, 0, dropElems = false))(List(\"abc\"))\n \"dups1\" - assertAll(Gen.orderedSeq(abc, 1, dropElems = false))(combos(1 to 2))\n \"dups2\" - assertAll(Gen.orderedSeq(abc, 2, dropElems = false))(combos(1 to 3))\n }\n\n \"dropEmpty\" - {\n def test(dups: Int) =\n assertAll(Gen.orderedSeq(abc, dups, dropElems = true, emptyResult = true))(\n combos(0 to (dups + 1)))\n \"dups0\" - test(0)\n \"dups1\" - test(1)\n }\n\n \"dropNonEmpty\" - {\n def test(dups: Int) =\n assertAll(Gen.orderedSeq(abc, dups, dropElems = true, emptyResult = false))(\n combos(0 to (dups + 1)).filter(_.nonEmpty))\n \"dups0\" - test(0)\n \"dups1\" - test(1)\n }\n }\n\n \"choose\" - {\n for (n <- 1 to 17) {\n val src = (0 until n).iterator.map(i => (i + 'a').toChar).toSet\n def test(g: Gen[Char]): Unit = {\n val a = g.samples().take(n * n * n * 2).toSet\n assert(a == src)\n }\n test(Gen.choose_!(src.toVector))\n test(Gen.choose_!(src.toList))\n test(Gen.chooseArray_!(src.toArray))\n }\n }\n\n \"sizedSet\" - {\n for (set <- Gen.chooseInt(0, 50).sizedSet(40).samples().take(50))\n assert(set.size == 40)\n }\n\n \"fairlyDistributedSeq\" - {\n for {\n n <- 0 to 30\n s <- Gen.fairlyDistributedSeq(List(true, false))(n).samples().take(10)\n } {\n assert(s.length == n)\n val t = s.count(identity)\n val f = s.length - t\n assert(Math.abs(t - f) <= 1)\n }\n }\n\n \"uuid\" - {\n val (a, b) = Gen.uuid.pair.sample()\n assert(a != b)\n }\n\n \"withSeed\" - {\n val (a,b,c,d,e) = Gen.tuple5(\n Gen.long,\n Gen.long,\n Gen.long withSeed 0,\n Gen.long withSeed 1,\n Gen.long\n ).sample()\n // println((c, d, e))\n val (s0, s1a, s1b) = (-4962768465676381896L,-4964420948893066024L,7564655870752979346L)\n assert(c == s0, d == s1a, e == s1b)\n assert(Set(a,b,c,d,e).size == 5)\n }\n\n \"withSeedAcrossSamples\" - {\n val actual = Gen.long.withSeed(0).samples().take(3).toList\n val expect = List(-4962768465676381896L, -7346045213905167455L, 8717422115870565898L)\n assert(actual == expect)\n }\n\n \"withConstSeed\" - {\n val actual = Gen.long.withConstSeed(0).samples().take(3).toList\n val expect = List.fill(3)(-4962768465676381896L)\n assert(actual == expect)\n }\n\n \"dateTime\" - {\n \"deterministic\" - {\n implicit val genNow = Gen pure Gen.Now(1476661717639L)\n val g = Gen.dateTime.aroundNowDays(10).asEpochMs.withSeed(0).sample()\n assert(g == 1477367458999L)\n }\n }\n\n }\n}\n"} +{"text": "{\n \"id\": 6346,\n \"name\": \"Damis\",\n \"incomplete\": true,\n \"members\": true,\n \"release_date\": \"2005-04-18\",\n \"combat_level\": 103,\n \"size\": 1,\n \"hitpoints\": 90,\n \"max_hit\": 22,\n \"attack_type\": [\n \"crush\"\n ],\n \"attack_speed\": 4,\n \"aggressive\": true,\n \"poisonous\": false,\n \"immune_poison\": false,\n \"immune_venom\": false,\n \"attributes\": [],\n \"category\": [],\n \"slayer_monster\": false,\n \"slayer_level\": null,\n \"slayer_xp\": null,\n \"slayer_masters\": [],\n \"duplicate\": true,\n \"examine\": \"The warrior of darkness.\",\n \"icon\": null,\n \"wiki_name\": \"Damis (First form)\",\n \"wiki_url\": \"https://oldschool.runescape.wiki/w/Damis#First_form\",\n \"attack_level\": 90,\n \"strength_level\": 90,\n \"defence_level\": 90,\n \"magic_level\": 1,\n \"ranged_level\": 1,\n \"attack_stab\": 0,\n \"attack_slash\": 0,\n \"attack_crush\": 0,\n \"attack_magic\": 0,\n \"attack_ranged\": 0,\n \"defence_stab\": 60,\n \"defence_slash\": 60,\n \"defence_crush\": 60,\n \"defence_magic\": 60,\n \"defence_ranged\": 60,\n \"attack_accuracy\": 0,\n \"melee_strength\": 80,\n \"ranged_strength\": 0,\n \"magic_damage\": 0,\n \"drops\": [\n {\n \"id\": 4673,\n \"name\": \"Shadow diamond\",\n \"members\": true,\n \"quantity\": \"1\",\n \"noted\": false,\n \"rarity\": 1.0,\n \"drop_requirements\": null\n }\n ]\n}"} +{"text": "#cs ----------------------------------------------------------------------------\n\n AutoIt Version: 3.3.14.2\n Author: myName\n\n Script Function:\n\tTemplate AutoIt script.\n\n#ce ----------------------------------------------------------------------------\n\n; Script Start - Add your code below here\n"} +{"text": "// Copyright 2006, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n// * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n// * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n// * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n#include \n\n#include \"gtest/gtest.h\"\n\nGTEST_API_ int main(int argc, char **argv) {\n printf(\"Running main() from gtest_main.cc\\n\");\n testing::InitGoogleTest(&argc, argv);\n return RUN_ALL_TESTS();\n}\n"} +{"text": "{\n \"required\" : true ,\n \"$schema\" : \"http://json-schema.org/draft-03/schema\" ,\n \"type\" : \"object\" ,\n \"properties\" : {\n \"ticket\" : {\n \"type\" : \"object\" ,\n \"required\" : false ,\n \"properties\" : {\n \"id\" : {\n \"type\" : \"number\" ,\n \"required\" : false\n } ,\n \"subject\" : {\n \"type\" : \"string\" ,\n \"required\" : false\n }\n }\n }\n }\n}"} +{"text": "/**\n * Copyright (c) 2010-2020 Contributors to the openHAB project\n *\n * See the NOTICE file(s) distributed with this work for additional\n * information.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License 2.0 which is available at\n * http://www.eclipse.org/legal/epl-2.0\n *\n * SPDX-License-Identifier: EPL-2.0\n */\npackage org.openhab.binding.upnpcontrol.internal;\n\nimport java.io.IOException;\nimport java.util.Locale;\nimport java.util.Set;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport org.eclipse.jdt.annotation.NonNullByDefault;\nimport org.eclipse.jdt.annotation.Nullable;\nimport org.openhab.binding.upnpcontrol.internal.handler.UpnpRendererHandler;\nimport org.openhab.core.audio.AudioFormat;\nimport org.openhab.core.audio.AudioHTTPServer;\nimport org.openhab.core.audio.AudioSink;\nimport org.openhab.core.audio.AudioStream;\nimport org.openhab.core.audio.FixedLengthAudioStream;\nimport org.openhab.core.audio.URLAudioStream;\nimport org.openhab.core.audio.UnsupportedAudioFormatException;\nimport org.openhab.core.audio.UnsupportedAudioStreamException;\nimport org.openhab.core.library.types.PercentType;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n/**\n *\n * @author Mark Herwege - Initial contribution\n */\n@NonNullByDefault\npublic class UpnpAudioSink implements AudioSink {\n\n private final Logger logger = LoggerFactory.getLogger(UpnpAudioSink.class);\n\n private static final Set> SUPPORTED_STREAMS = Stream\n .of(AudioStream.class, FixedLengthAudioStream.class).collect(Collectors.toSet());\n private UpnpRendererHandler handler;\n private AudioHTTPServer audioHTTPServer;\n private String callbackUrl;\n\n public UpnpAudioSink(UpnpRendererHandler handler, AudioHTTPServer audioHTTPServer, String callbackUrl) {\n this.handler = handler;\n this.audioHTTPServer = audioHTTPServer;\n this.callbackUrl = callbackUrl;\n }\n\n @Override\n public String getId() {\n return handler.getThing().getUID().toString();\n }\n\n @Override\n public @Nullable String getLabel(@Nullable Locale locale) {\n return handler.getThing().getLabel();\n }\n\n @Override\n public void process(@Nullable AudioStream audioStream)\n throws UnsupportedAudioFormatException, UnsupportedAudioStreamException {\n if (audioStream == null) {\n stopMedia();\n return;\n }\n\n String url = null;\n if (audioStream instanceof URLAudioStream) {\n URLAudioStream urlAudioStream = (URLAudioStream) audioStream;\n url = urlAudioStream.getURL();\n } else if (!callbackUrl.isEmpty()) {\n String relativeUrl = audioStream instanceof FixedLengthAudioStream\n ? audioHTTPServer.serve((FixedLengthAudioStream) audioStream, 20)\n : audioHTTPServer.serve(audioStream);\n url = String.valueOf(this.callbackUrl) + relativeUrl;\n } else {\n logger.warn(\"We do not have any callback url, so {} cannot play the audio stream!\", handler.getUDN());\n return;\n }\n playMedia(url);\n }\n\n @Override\n public Set getSupportedFormats() {\n return handler.getSupportedAudioFormats();\n }\n\n @Override\n public Set> getSupportedStreams() {\n return SUPPORTED_STREAMS;\n }\n\n @Override\n public PercentType getVolume() throws IOException {\n return handler.getCurrentVolume();\n }\n\n @Override\n public void setVolume(@Nullable PercentType volume) throws IOException {\n if (volume != null) {\n handler.setVolume(handler.getCurrentChannel(), volume);\n }\n }\n\n private void stopMedia() {\n handler.stop();\n }\n\n private void playMedia(String url) {\n stopMedia();\n String newUrl = url;\n if (!url.startsWith(\"x-\") && !url.startsWith(\"http\")) {\n newUrl = \"x-file-cifs:\" + url;\n }\n handler.setCurrentURI(newUrl, \"\");\n handler.play();\n }\n}\n"} +{"text": "\n\n\t\n\t\t\n\t\n\t\nEND;\n\n//\n\n$dom = new \\DOMDocument;\n $dom->loadHTML($html);\n\n // https://github.com/peachpiecompiler/peachpie/issues/622\n echo \"getElementsByTagName:\";\n $els = $dom->getElementsByTagName('script');\n foreach ($els as $node) {\n $text = trim($node->nodeValue);\n print_r($text);\n }\n}\ntest();\n\necho \"Done.\";\n"} +{"text": "# Copyright 2017 The TensorFlow Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n# ==============================================================================\n\"\"\"TensorFlow Lite tooling helper functionality.\n\nEXPERIMENTAL: APIs here are unstable and likely to change without notice.\n\n@@toco_convert\n@@toco_convert_protos\n@@OpHint\n@@convert_op_hints_to_stubs\n\n\"\"\"\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nimport os as _os\nimport subprocess as _subprocess\nimport tempfile as _tempfile\n\n# pylint: disable=unused-import\nfrom tensorflow.contrib.lite.python.op_hint import convert_op_hints_to_stubs\nfrom tensorflow.contrib.lite.python.op_hint import OpHint\n# pylint: enable=unused-import\nfrom tensorflow.contrib.lite.toco import model_flags_pb2 as _model_flags_pb2\nfrom tensorflow.contrib.lite.toco import toco_flags_pb2 as _toco_flags_pb2\nfrom tensorflow.contrib.lite.toco import types_pb2 as _types_pb2\nfrom tensorflow.python.framework import dtypes as _dtypes\nfrom tensorflow.python.platform import resource_loader as _resource_loader\nfrom tensorflow.python.util.all_util import remove_undocumented\nfrom tensorflow.python.util.lazy_loader import LazyLoader\n\n# Lazy load since some of the performance benchmark skylark rules\n# break dependencies.\n_toco_python = LazyLoader(\n \"tensorflow_wrap_toco\", globals(),\n \"tensorflow.contrib.lite.toco.python.\"\n \"tensorflow_wrap_toco\")\ndel LazyLoader\n\n# Enum types from the protobuf promoted to the API\nFLOAT = _types_pb2.FLOAT\nINT32 = _types_pb2.INT32\nINT64 = _types_pb2.INT64\nSTRING = _types_pb2.STRING\nQUANTIZED_UINT8 = _types_pb2.QUANTIZED_UINT8\nTENSORFLOW_GRAPHDEF = _toco_flags_pb2.TENSORFLOW_GRAPHDEF\nTFLITE = _toco_flags_pb2.TFLITE\nGRAPHVIZ_DOT = _toco_flags_pb2.GRAPHVIZ_DOT\n\n# Currently the default mode of operation is to shell to another python process\n# to protect against crashes. However, it breaks some dependent targets because\n# it forces us to depend on an external py_binary. The experimental API doesn't\n# have that drawback.\nEXPERIMENTAL_USE_TOCO_API_DIRECTLY = False\n\n# Find the toco_from_protos binary using the resource loader if using from\n# bazel, otherwise we are in a pip where console_scripts already has\n# the toco_from_protos tool.\nif EXPERIMENTAL_USE_TOCO_API_DIRECTLY:\n _toco_from_proto_bin = \"\"\nelse:\n _toco_from_proto_bin = _resource_loader.get_path_to_datafile(\n \"../toco/python/toco_from_protos\")\n\nif _toco_from_proto_bin and not _os.path.exists(_toco_from_proto_bin):\n _toco_from_proto_bin = \"toco_from_protos\"\n\n\ndef toco_convert_protos(model_flags_str, toco_flags_str, input_data_str):\n \"\"\"Convert `input_data_str` according to model and toco parameters.\n\n Unless you know what you are doing consider using\n the more friendly @{tf.contrib.lite.toco_convert}}.\n\n Args:\n model_flags_str: Serialized proto describing model properties, see\n `toco/model_flags.proto`.\n toco_flags_str: Serialized proto describing conversion properties, see\n `toco/toco_flags.proto`.\n input_data_str: Input data in serialized form (e.g. a graphdef is common)\n Returns:\n Converted model in serialized form (e.g. a TFLITE model is common).\n Raises:\n RuntimeError: When conversion fails, an exception is raised with the error\n message embedded.\n \"\"\"\n # TODO(aselle): When toco does not use fatal errors for failure, we can\n # switch this on.\n if not _toco_from_proto_bin:\n return _toco_python.TocoConvert(\n model_flags_str, toco_flags_str, input_data_str)\n\n with _tempfile.NamedTemporaryFile() as fp_toco, \\\n _tempfile.NamedTemporaryFile() as fp_model, \\\n _tempfile.NamedTemporaryFile() as fp_input, \\\n _tempfile.NamedTemporaryFile() as fp_output:\n fp_model.write(model_flags_str)\n fp_toco.write(toco_flags_str)\n fp_input.write(input_data_str)\n fp_model.flush()\n fp_toco.flush()\n fp_input.flush()\n\n cmd = [\n _toco_from_proto_bin, fp_model.name, fp_toco.name, fp_input.name,\n fp_output.name\n ]\n cmdline = \" \".join(cmd)\n proc = _subprocess.Popen(\n cmdline,\n shell=True,\n stdout=_subprocess.PIPE,\n stderr=_subprocess.STDOUT,\n close_fds=True)\n stdout, stderr = proc.communicate()\n exitcode = proc.returncode\n if exitcode == 0:\n stuff = fp_output.read()\n return stuff\n else:\n raise RuntimeError(\"TOCO failed see console for info.\\n%s\\n%s\\n\" %\n (stdout, stderr))\n\n\ndef _tensor_name(x):\n return x.name.split(\":\")[0]\n\n\ndef toco_convert(input_data,\n input_tensors,\n output_tensors,\n inference_type=FLOAT,\n input_format=TENSORFLOW_GRAPHDEF,\n output_format=TFLITE,\n quantized_input_stats=None,\n drop_control_dependency=True):\n \"\"\"Convert a model using TOCO from `input_format` to `output_format`.\n\n Typically this is to convert from TensorFlow GraphDef to TFLite, in which\n case the default `input_format` and `output_format` are sufficient.\n\n Args:\n input_data: Input data (i.e. often `sess.graph_def`).\n input_tensors: List of input tensors. Type and shape are computed using\n `foo.get_shape()` and `foo.dtype`.\n output_tensors: List of output tensors (only .name is used from this).\n inference_type: Currently must be `{FLOAT, QUANTIZED_UINT8}`.\n input_format: Type of data to read (currently must be TENSORFLOW_GRAPHDEF).\n output_format: Type of data to write (currently must be TFLITE or\n GRAPHVIZ_DOT)\n quantized_input_stats: For each member of input_tensors the mean and\n std deviation of training data. Only needed if `inference_type` is\n `QUANTIZED_UINT8`.\n drop_control_dependency: Drops control dependencies silently. This is due\n to tf lite not supporting control dependencies.\n\n Returns:\n The converted data. For example if tflite was the destination, then\n this will be a tflite flatbuffer in a bytes array.\n\n Raises:\n ValueError: If the input tensor type is unknown\n RuntimeError: If TOCO fails to convert (in which case the runtime error's\n error text will contain the TOCO error log)\n \"\"\"\n toco = _toco_flags_pb2.TocoFlags()\n toco.input_format = input_format\n toco.output_format = output_format\n toco.drop_control_dependency = drop_control_dependency\n model = _model_flags_pb2.ModelFlags()\n toco.inference_type = inference_type\n for idx, input_tensor in enumerate(input_tensors):\n if input_tensor.dtype == _dtypes.float32:\n tflite_input_type = FLOAT\n elif input_tensor.dtype == _dtypes.int32:\n tflite_input_type = INT32\n elif input_tensor.dtype == _dtypes.int64:\n tflite_input_type = INT64\n # TODO(aselle): Insert strings when they are available\n else:\n raise ValueError(\"Tensors %s not known type %r\" % (input_tensor.name,\n input_tensor.dtype))\n\n input_array = model.input_arrays.add()\n\n if inference_type == QUANTIZED_UINT8:\n if tflite_input_type == FLOAT:\n tflite_input_type = QUANTIZED_UINT8\n input_array.mean_value, input_array.std_value = quantized_input_stats[idx]\n\n input_array.name = _tensor_name(input_tensor)\n input_array.shape.dims.extend(map(int, input_tensor.get_shape()))\n\n for output_tensor in output_tensors:\n model.output_arrays.append(_tensor_name(output_tensor))\n\n # TODO(aselle): Consider handling the case of allowing quantized\n # inputs to be converted to float (via the toco.inference_input_type field).\n data = toco_convert_protos(model.SerializeToString(),\n toco.SerializeToString(),\n input_data.SerializeToString())\n return data\n\n\n_allowed_symbols = [\n \"FLOAT\",\n \"INT32\",\n \"INT64\",\n \"STRING\",\n \"QUANTIZED_UINT8\",\n \"TENSORFLOW_GRAPHDEF\",\n \"TFLITE\",\n \"GRAPHVIZ_DOT\",\n \"EXPERIMENTAL_USE_TOCO_API_DIRECTLY\",\n]\nremove_undocumented(__name__, _allowed_symbols)\n"} +{"text": "\npackage Paws::QLDB::UpdateLedgerResponse;\n use Moose;\n has Arn => (is => 'ro', isa => 'Str');\n has CreationDateTime => (is => 'ro', isa => 'Str');\n has DeletionProtection => (is => 'ro', isa => 'Bool');\n has Name => (is => 'ro', isa => 'Str');\n has State => (is => 'ro', isa => 'Str');\n\n has _request_id => (is => 'ro', isa => 'Str');\n1;\n\n### main pod documentation begin ###\n\n=head1 NAME\n\nPaws::QLDB::UpdateLedgerResponse\n\n=head1 ATTRIBUTES\n\n\n=head2 Arn => Str\n\nThe Amazon Resource Name (ARN) for the ledger.\n\n\n=head2 CreationDateTime => Str\n\nThe date and time, in epoch time format, when the ledger was created.\n(Epoch time format is the number of seconds elapsed since 12:00:00 AM\nJanuary 1, 1970 UTC.)\n\n\n=head2 DeletionProtection => Bool\n\nThe flag that prevents a ledger from being deleted by any user. If not\nprovided on ledger creation, this feature is enabled (C) by\ndefault.\n\nIf deletion protection is enabled, you must first disable it before you\ncan delete the ledger using the QLDB API or the AWS Command Line\nInterface (AWS CLI). You can disable it by calling the C\noperation to set the flag to C. The QLDB console disables\ndeletion protection for you when you use it to delete a ledger.\n\n\n=head2 Name => Str\n\nThe name of the ledger.\n\n\n=head2 State => Str\n\nThe current status of the ledger.\n\nValid values are: C<\"CREATING\">, C<\"ACTIVE\">, C<\"DELETING\">, C<\"DELETED\">\n=head2 _request_id => Str\n\n\n=cut\n\n"} +{"text": "/*\n\nCopyright (c) 2010 - 2018, Nordic Semiconductor ASA\n\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n2. Redistributions in binary form, except as embedded into a Nordic\n Semiconductor ASA integrated circuit in a product or a software update for\n such product, must reproduce the above copyright notice, this list of\n conditions and the following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n3. Neither the name of Nordic Semiconductor ASA nor the names of its\n contributors may be used to endorse or promote products derived from this\n software without specific prior written permission.\n\n4. This software, with or without modification, must only be used with a\n Nordic Semiconductor ASA integrated circuit.\n\n5. Any software provided in binary form under this license must not be reverse\n engineered, decompiled, modified and/or disassembled.\n\nTHIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA \"AS IS\" AND ANY EXPRESS\nOR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\nOF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE\nLIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\nCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\nGOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\nHOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\nLIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT\nOF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n*/\n\n\n/* This file is deprecated */\n#ifndef _NRF51822_PERIPHERALS_H\n#define _NRF51822_PERIPHERALS_H\n\n\n/* Power Peripheral */\n#define POWER_PRESENT\n#define POWER_COUNT 1\n\n#define POWER_FEATURE_RAMON_REGISTERS_PRESENT\n\n/* Software Interrupts */\n#define SWI_PRESENT\n#define SWI_COUNT 6\n\n/* GPIO */\n#define GPIO_PRESENT\n#define GPIO_COUNT 1\n\n#define P0_PIN_NUM 32\n\n/* MPU and BPROT */\n#define BPROT_PRESENT\n\n#define BPROT_REGIONS_SIZE 4096\n#define BPROT_REGIONS_NUM 64\n\n/* Radio */\n#define RADIO_PRESENT\n#define RADIO_COUNT 1\n\n/* Accelerated Address Resolver */\n#define AAR_PRESENT\n#define AAR_COUNT 1\n\n#define AAR_MAX_IRK_NUM 8\n\n/* AES Electronic CodeBook mode encryption */\n#define ECB_PRESENT\n#define ECB_COUNT 1\n\n/* AES CCM mode encryption */\n#define CCM_PRESENT\n#define CCM_COUNT 1\n\n/* Peripheral to Peripheral Interconnect */\n#define PPI_PRESENT\n#define PPI_COUNT 1\n\n#define PPI_CH_NUM 16\n#define PPI_FIXED_CH_NUM 12\n#define PPI_GROUP_NUM 4\n\n/* Timer/Counter */\n#define TIMER_PRESENT\n#define TIMER_COUNT 3\n\n#define TIMER0_MAX_SIZE 32\n#define TIMER1_MAX_SIZE 16\n#define TIMER2_MAX_SIZE 16\n\n#define TIMER0_CC_NUM 4\n#define TIMER1_CC_NUM 4\n#define TIMER2_CC_NUM 4\n\n/* Real Time Counter */\n#define RTC_PRESENT\n#define RTC_COUNT 2\n\n#define RTC0_CC_NUM 3\n#define RTC1_CC_NUM 4\n\n/* RNG */\n#define RNG_PRESENT\n#define RNG_COUNT 1\n\n/* Watchdog Timer */\n#define WDT_PRESENT\n#define WDT_COUNT 1\n\n/* Temperature Sensor */\n#define TEMP_PRESENT\n#define TEMP_COUNT 1\n\n/* Serial Peripheral Interface Master */\n#define SPI_PRESENT\n#define SPI_COUNT 2\n\n/* Serial Peripheral Interface Slave with DMA */\n#define SPIS_PRESENT\n#define SPIS_COUNT 1\n\n#define SPIS1_EASYDMA_MAXCNT_SIZE 8\n\n/* Two Wire Interface Master */\n#define TWI_PRESENT\n#define TWI_COUNT 2\n\n/* Universal Asynchronous Receiver-Transmitter */\n#define UART_PRESENT\n#define UART_COUNT 1\n\n/* Quadrature Decoder */\n#define QDEC_PRESENT\n#define QDEC_COUNT 1\n\n/* Analog to Digital Converter */\n#define ADC_PRESENT\n#define ADC_COUNT 1\n\n/* GPIO Tasks and Events */\n#define GPIOTE_PRESENT\n#define GPIOTE_COUNT 1\n\n#define GPIOTE_CH_NUM 4\n\n/* Low Power Comparator */\n#define LPCOMP_PRESENT\n#define LPCOMP_COUNT 1\n\n#define LPCOMP_REFSEL_RESOLUTION 8\n\n\n#endif // _NRF51822_PERIPHERALS_H\n"} +{"text": "/* Copyright (C) 2002 Jean-Marc Valin \n File: high_lsp_tables.c\n Codebooks for high-band LSPs in SB-CELP mode\n \n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer. \n\n 2. Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n\n 3. The name of the author may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,\n INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n*/\n \nconst signed char high_lsp_cdbk[512]={\n39,12,-14,-20,-29,-61,-67,-76,\n-32,-71,-67,68,77,46,34,5,\n-13,-48,-46,-72,-81,-84,-60,-58,\n-40,-28,82,93,68,45,29,3,\n-19,-47,-28,-43,-35,-30,-8,-13,\n-39,-91,-91,-123,-96,10,10,-6,\n-18,-55,-60,-91,-56,-36,-27,-16,\n-48,-75,40,28,-10,-28,35,9,\n37,19,1,-20,-31,-41,-18,-25,\n-35,-68,-80,45,27,-1,47,13,\n0,-29,-35,-57,-50,-79,-73,-38,\n-19,5,35,14,-10,-23,16,-8,\n5,-24,-40,-62,-23,-27,-22,-16,\n-18,-46,-72,-77,43,21,33,1,\n-80,-70,-70,-64,-56,-52,-39,-33,\n-31,-38,-19,-19,-15,32,33,-2,\n7,-15,-15,-24,-23,-33,-41,-56,\n-24,-57,5,89,64,41,27,5,\n-9,-47,-60,-97,-97,-124,-20,-9,\n-44,-73,31,29,-4,64,48,7,\n-35,-57,0,-3,-26,-47,-3,-6,\n-40,-76,-79,-48,12,81,55,10,\n9,-24,-43,-73,-57,-69,16,5,\n-28,-53,18,29,20,0,-4,-11,\n6,-13,23,7,-17,-35,-37,-37,\n-30,-68,-63,6,24,-9,-14,3,\n21,-13,-27,-57,-49,-80,-24,-41,\n-5,-16,-5,1,45,25,12,-7,\n3,-15,-6,-16,-15,-8,6,-13,\n-42,-81,-80,-87,14,1,-10,-3,\n-43,-69,-46,-24,-28,-29,36,6,\n-43,-56,-12,12,54,79,43,9,\n54,22,2,8,-12,-43,-46,-52,\n-38,-69,-89,-5,75,38,33,5,\n-13,-53,-62,-87,-89,-113,-99,-55,\n-34,-37,62,55,33,16,21,-2,\n-17,-46,-29,-38,-38,-48,-39,-42,\n-36,-75,-72,-88,-48,-30,21,2,\n-15,-57,-64,-98,-84,-76,25,1,\n-46,-80,-12,18,-7,3,34,6,\n38,31,23,4,-1,20,14,-15,\n-43,-78,-91,-24,14,-3,54,16,\n0,-27,-28,-44,-56,-83,-92,-89,\n-3,34,56,41,36,22,20,-8,\n-7,-35,-42,-62,-49,3,12,-10,\n-50,-87,-96,-66,92,70,38,9,\n-70,-71,-62,-42,-39,-43,-11,-7,\n-50,-79,-58,-50,-31,32,31,-6,\n-4,-25,7,-17,-38,-70,-58,-27,\n-43,-83,-28,59,36,20,31,2,\n-27,-71,-80,-109,-98,-75,-33,-32,\n-31,-2,33,15,-6,43,33,-5,\n0,-22,-10,-27,-34,-49,-11,-20,\n-41,-91,-100,-121,-39,57,41,10,\n-19,-50,-38,-59,-60,-70,-18,-20,\n-8,-31,-8,-15,1,-14,-26,-25,\n33,21,32,17,1,-19,-19,-26,\n-58,-81,-35,-22,45,30,11,-11,\n3,-26,-48,-87,-67,-83,-58,3,\n-1,-26,-20,44,10,25,39,5,\n-9,-35,-27,-38,7,10,4,-9,\n-42,-85,-102,-127,52,44,28,10,\n-47,-61,-40,-39,-17,-1,-10,-33,\n-42,-74,-48,21,-4,70,52,10};\n\n\nconst signed char high_lsp_cdbk2[512]={\n-36,-62,6,-9,-10,-14,-56,23,\n1,-26,23,-48,-17,12,8,-7,\n23,29,-36,-28,-6,-29,-17,-5,\n40,23,10,10,-46,-13,36,6,\n4,-30,-29,62,32,-32,-1,22,\n-14,1,-4,-22,-45,2,54,4,\n-30,-57,-59,-12,27,-3,-31,8,\n-9,5,10,-14,32,66,19,9,\n2,-25,-37,23,-15,18,-38,-31,\n5,-9,-21,15,0,22,62,30,\n15,-12,-14,-46,77,21,33,3,\n34,29,-19,50,2,11,9,-38,\n-12,-37,62,1,-15,54,32,6,\n2,-24,20,35,-21,2,19,24,\n-13,55,4,9,39,-19,30,-1,\n-21,73,54,33,8,18,3,15,\n6,-19,-47,6,-3,-48,-50,1,\n26,20,8,-23,-50,65,-14,-55,\n-17,-31,-37,-28,53,-1,-17,-53,\n1,57,11,-8,-25,-30,-37,64,\n5,-52,-45,15,23,31,15,14,\n-25,24,33,-2,-44,-56,-18,6,\n-21,-43,4,-12,17,-37,20,-10,\n34,15,2,15,55,21,-11,-31,\n-6,46,25,16,-9,-25,-8,-62,\n28,17,20,-32,-29,26,30,25,\n-19,2,-16,-17,26,-51,2,50,\n42,19,-66,23,29,-2,3,19,\n-19,-37,32,15,6,30,-34,13,\n11,-5,40,31,10,-42,4,-9,\n26,-9,-70,17,-2,-23,20,-22,\n-55,51,-24,-31,22,-22,15,-13,\n3,-10,-28,-16,56,4,-63,11,\n-18,-15,-18,-38,-35,16,-7,34,\n-1,-21,-49,-47,9,-37,7,8,\n69,55,20,6,-33,-45,-10,-9,\n6,-9,12,71,15,-3,-42,-7,\n-24,32,-35,-2,-42,-17,-5,0,\n-2,-33,-54,13,-12,-34,47,23,\n19,55,7,-8,74,31,14,16,\n-23,-26,19,12,-18,-49,-28,-31,\n-20,2,-14,-20,-47,78,40,13,\n-23,-11,21,-6,18,1,47,5,\n38,35,32,46,22,8,13,16,\n-14,18,51,19,40,39,11,-26,\n-1,-17,47,2,-53,-15,31,-22,\n38,21,-15,-16,5,-33,53,15,\n-38,86,11,-3,-24,49,13,-4,\n-11,-18,28,20,-12,-27,-26,35,\n-25,-35,-3,-20,-61,30,10,-55,\n-12,-22,-52,-54,-14,19,-32,-12,\n45,15,-8,-48,-9,11,-32,8,\n-16,-34,-13,51,18,38,-2,-32,\n-17,22,-2,-18,-28,-70,59,27,\n-28,-19,-10,-20,-9,-9,-8,-21,\n21,-8,35,-2,45,-3,-9,12,\n0,30,7,-39,43,27,-38,-91,\n30,26,19,-55,-4,63,14,-17,\n13,9,13,2,7,4,6,61,\n72,-1,-17,29,-1,-22,-17,8,\n-28,-37,63,44,41,3,2,14,\n9,-6,75,-8,-7,-12,-15,-12,\n13,9,-4,30,-22,-65,15,0,\n-45,4,-4,1,5,22,11,23};\n"} +{"text": "# frozen_string_literal: true\n\nbegin\n require \"builder\"\nrescue LoadError => e\n $stderr.puts \"You don't have builder installed in your application. Please add it to your Gemfile and run bundle install\"\n raise e\nend\n"} +{"text": "var classof = require('./_classof')\n , ITERATOR = require('./_wks')('iterator')\n , Iterators = require('./_iterators');\nmodule.exports = require('./_core').getIteratorMethod = function(it){\n if(it != undefined)return it[ITERATOR]\n || it['@@iterator']\n || Iterators[classof(it)];\n};"} +{"text": "//\n// ImageNode.swift\n//\n// Created by nangezao on 2017/7/19.\n// Copyright © 2017年 nange. All rights reserved.\n//\n/// Permission is hereby granted, free of charge, to any person obtaining a copy\n/// of this software and associated documentation files (the \"Software\"), to deal\n/// in the Software without restriction, including without limitation the rights\n/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n/// copies of the Software, and to permit persons to whom the Software is\n/// furnished to do so, subject to the following conditions:\n///\n/// The above copyright notice and this permission notice shall be included in\n/// all copies or substantial portions of the Software.\n///\n/// Notwithstanding the foregoing, you may not use, copy, modify, merge, publish,\n/// distribute, sublicense, create a derivative work, and/or sell copies of the\n/// Software in any work that is designed, intended, or marketed for pedagogical or\n/// instructional purposes related to programming, coding, application development,\n/// or information technology. Permission for such use, copying, modification,\n/// merger, publication, distribution, sublicensing, creation of derivative works,\n/// or sale is expressly withheld.\n///\n/// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n/// THE SOFTWARE.\n\nimport UIKit\nimport Layoutable\n\npublic enum ContentMode{\n case scaleToFill\n case scaleAspectToFit\n case scaleAspectToFill\n}\n\nopen class ImageNode: ControlNode {\n \n public var image: UIImage?{\n didSet{\n if image != oldValue{\n invalidateIntrinsicContentSize()\n setNeedsDisplay()\n }\n }\n }\n \n public var processor: ImageProcessor? = nil\n \n public var contentMode: ContentMode = .scaleAspectToFill{\n didSet{\n if oldValue != contentMode{\n setNeedsDisplay()\n }\n }\n }\n \n override open var itemIntrinsicContentSize: CGSize{\n if let image = image {\n return image.size\n }\n return .zero\n }\n \n override func contentForLayer(_ layer: AsyncDisplayLayer, isCancel: () -> Bool) -> UIImage? {\n guard let image = image ,bounds.width > 0, bounds.height > 0 else{\n return nil\n }\n \n /// if image size equal to bounds and processor is nil ,no need to process image\n if image.size == bounds.size && processor == nil{\n return image\n }\n \n let key = ImageKey(image: image, size: bounds.size,contentMode: contentMode, processor: processor)\n return ImageRender.imageForKey(key, isCancelled: isCancel)\n }\n\n}\n"} +{"text": "# This file is distributed under the same license as the Django package.\n#\n# Translators:\n# claudep , 2011\n# Jannis Leidel , 2011\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: django-core\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2013-05-18 23:10+0200\\n\"\n\"PO-Revision-Date: 2013-05-19 08:23+0000\\n\"\n\"Last-Translator: claudep \\n\"\n\"Language-Team: French (http://www.transifex.com/projects/p/django/language/\"\n\"fr/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: fr\\n\"\n\"Plural-Forms: nplurals=2; plural=(n > 1);\\n\"\n\n#: tests.py:135 templatetags/humanize.py:168\nmsgid \"today\"\nmsgstr \"aujourd'hui\"\n\n#: tests.py:135 templatetags/humanize.py:172\nmsgid \"yesterday\"\nmsgstr \"hier\"\n\n#: tests.py:135 templatetags/humanize.py:170\nmsgid \"tomorrow\"\nmsgstr \"demain\"\n\n#: templatetags/humanize.py:26\nmsgid \"th\"\nmsgstr \"e\"\n\n#: templatetags/humanize.py:26\nmsgid \"st\"\nmsgstr \"er\"\n\n#: templatetags/humanize.py:26\nmsgid \"nd\"\nmsgstr \"e\"\n\n#: templatetags/humanize.py:26\nmsgid \"rd\"\nmsgstr \"e\"\n\n#: templatetags/humanize.py:55\n#, python-format\nmsgid \"%(value).1f million\"\nmsgid_plural \"%(value).1f million\"\nmsgstr[0] \"%(value).1f million\"\nmsgstr[1] \"%(value).1f millions\"\n\n#: templatetags/humanize.py:56\n#, python-format\nmsgid \"%(value)s million\"\nmsgid_plural \"%(value)s million\"\nmsgstr[0] \"%(value)s million\"\nmsgstr[1] \"%(value)s millions\"\n\n#: templatetags/humanize.py:59\n#, python-format\nmsgid \"%(value).1f billion\"\nmsgid_plural \"%(value).1f billion\"\nmsgstr[0] \"%(value).1f milliard\"\nmsgstr[1] \"%(value).1f milliards\"\n\n#: templatetags/humanize.py:60\n#, python-format\nmsgid \"%(value)s billion\"\nmsgid_plural \"%(value)s billion\"\nmsgstr[0] \"%(value)s milliard\"\nmsgstr[1] \"%(value)s milliards\"\n\n#: templatetags/humanize.py:63\n#, python-format\nmsgid \"%(value).1f trillion\"\nmsgid_plural \"%(value).1f trillion\"\nmsgstr[0] \"%(value).1f billion\"\nmsgstr[1] \"%(value).1f billions\"\n\n#: templatetags/humanize.py:64\n#, python-format\nmsgid \"%(value)s trillion\"\nmsgid_plural \"%(value)s trillion\"\nmsgstr[0] \"%(value)s billion\"\nmsgstr[1] \"%(value)s billions\"\n\n#: templatetags/humanize.py:67\n#, python-format\nmsgid \"%(value).1f quadrillion\"\nmsgid_plural \"%(value).1f quadrillion\"\nmsgstr[0] \"%(value).1f quadrillion\"\nmsgstr[1] \"%(value).1f quadrillions\"\n\n#: templatetags/humanize.py:68\n#, python-format\nmsgid \"%(value)s quadrillion\"\nmsgid_plural \"%(value)s quadrillion\"\nmsgstr[0] \"%(value)s quadrillion\"\nmsgstr[1] \"%(value)s quadrillions\"\n\n#: templatetags/humanize.py:71\n#, python-format\nmsgid \"%(value).1f quintillion\"\nmsgid_plural \"%(value).1f quintillion\"\nmsgstr[0] \"%(value).1f quintillion\"\nmsgstr[1] \"%(value).1f quintillions\"\n\n#: templatetags/humanize.py:72\n#, python-format\nmsgid \"%(value)s quintillion\"\nmsgid_plural \"%(value)s quintillion\"\nmsgstr[0] \"%(value)s quintillion\"\nmsgstr[1] \"%(value)s quintillions\"\n\n#: templatetags/humanize.py:75\n#, python-format\nmsgid \"%(value).1f sextillion\"\nmsgid_plural \"%(value).1f sextillion\"\nmsgstr[0] \"%(value).1f sextillion\"\nmsgstr[1] \"%(value).1f sextillions\"\n\n#: templatetags/humanize.py:76\n#, python-format\nmsgid \"%(value)s sextillion\"\nmsgid_plural \"%(value)s sextillion\"\nmsgstr[0] \"%(value)s sextillion\"\nmsgstr[1] \"%(value)s sextillion\"\n\n#: templatetags/humanize.py:79\n#, python-format\nmsgid \"%(value).1f septillion\"\nmsgid_plural \"%(value).1f septillion\"\nmsgstr[0] \"%(value).1f septillion\"\nmsgstr[1] \"%(value).1f septillions\"\n\n#: templatetags/humanize.py:80\n#, python-format\nmsgid \"%(value)s septillion\"\nmsgid_plural \"%(value)s septillion\"\nmsgstr[0] \"%(value)s septillion\"\nmsgstr[1] \"%(value)s septillions\"\n\n#: templatetags/humanize.py:83\n#, python-format\nmsgid \"%(value).1f octillion\"\nmsgid_plural \"%(value).1f octillion\"\nmsgstr[0] \"%(value).1f octillion\"\nmsgstr[1] \"%(value).1f octillions\"\n\n#: templatetags/humanize.py:84\n#, python-format\nmsgid \"%(value)s octillion\"\nmsgid_plural \"%(value)s octillion\"\nmsgstr[0] \"%(value)s octillion\"\nmsgstr[1] \"%(value)s octillions\"\n\n#: templatetags/humanize.py:87\n#, python-format\nmsgid \"%(value).1f nonillion\"\nmsgid_plural \"%(value).1f nonillion\"\nmsgstr[0] \"%(value).1f nonillion\"\nmsgstr[1] \"%(value).1f nonillions\"\n\n#: templatetags/humanize.py:88\n#, python-format\nmsgid \"%(value)s nonillion\"\nmsgid_plural \"%(value)s nonillion\"\nmsgstr[0] \"%(value)s nonillion\"\nmsgstr[1] \"%(value)s nonillions\"\n\n#: templatetags/humanize.py:91\n#, python-format\nmsgid \"%(value).1f decillion\"\nmsgid_plural \"%(value).1f decillion\"\nmsgstr[0] \"%(value).1f décillion\"\nmsgstr[1] \"%(value).1f décillions\"\n\n#: templatetags/humanize.py:92\n#, python-format\nmsgid \"%(value)s decillion\"\nmsgid_plural \"%(value)s decillion\"\nmsgstr[0] \"%(value)s décillion\"\nmsgstr[1] \"%(value)s décillions\"\n\n#: templatetags/humanize.py:95\n#, python-format\nmsgid \"%(value).1f googol\"\nmsgid_plural \"%(value).1f googol\"\nmsgstr[0] \"%(value).1f gogol\"\nmsgstr[1] \"%(value).1f gogols\"\n\n#: templatetags/humanize.py:96\n#, python-format\nmsgid \"%(value)s googol\"\nmsgid_plural \"%(value)s googol\"\nmsgstr[0] \"%(value)s gogol\"\nmsgstr[1] \"%(value)s gogols\"\n\n#: templatetags/humanize.py:145\nmsgid \"one\"\nmsgstr \"un\"\n\n#: templatetags/humanize.py:145\nmsgid \"two\"\nmsgstr \"deux\"\n\n#: templatetags/humanize.py:145\nmsgid \"three\"\nmsgstr \"trois\"\n\n#: templatetags/humanize.py:145\nmsgid \"four\"\nmsgstr \"quatre\"\n\n#: templatetags/humanize.py:145\nmsgid \"five\"\nmsgstr \"cinq\"\n\n#: templatetags/humanize.py:145\nmsgid \"six\"\nmsgstr \"six\"\n\n#: templatetags/humanize.py:145\nmsgid \"seven\"\nmsgstr \"sept\"\n\n#: templatetags/humanize.py:145\nmsgid \"eight\"\nmsgstr \"huit\"\n\n#: templatetags/humanize.py:145\nmsgid \"nine\"\nmsgstr \"neuf\"\n\n#: templatetags/humanize.py:191\n#, python-format\nmsgctxt \"naturaltime\"\nmsgid \"%(delta)s ago\"\nmsgstr \"il y a %(delta)s\"\n\n#: templatetags/humanize.py:194 templatetags/humanize.py:219\nmsgid \"now\"\nmsgstr \"maintenant\"\n\n#. Translators: \\\\u00a0 is non-breaking space\n#: templatetags/humanize.py:198\n#, python-format\nmsgid \"a second ago\"\nmsgid_plural \"%(count)s\\\\u00a0seconds ago\"\nmsgstr[0] \"il y a une seconde\"\nmsgstr[1] \"il y a %(count)s secondes\"\n\n#. Translators: \\\\u00a0 is non-breaking space\n#: templatetags/humanize.py:204\n#, python-format\nmsgid \"a minute ago\"\nmsgid_plural \"%(count)s\\\\u00a0minutes ago\"\nmsgstr[0] \"il y a une minute\"\nmsgstr[1] \"il y a %(count)s minutes\"\n\n#. Translators: \\\\u00a0 is non-breaking space\n#: templatetags/humanize.py:210\n#, python-format\nmsgid \"an hour ago\"\nmsgid_plural \"%(count)s\\\\u00a0hours ago\"\nmsgstr[0] \"il y a une heure\"\nmsgstr[1] \"il y a %(count)s heures\"\n\n#: templatetags/humanize.py:216\n#, python-format\nmsgctxt \"naturaltime\"\nmsgid \"%(delta)s from now\"\nmsgstr \"dans %(delta)s\"\n\n#. Translators: \\\\u00a0 is non-breaking space\n#: templatetags/humanize.py:223\n#, python-format\nmsgid \"a second from now\"\nmsgid_plural \"%(count)s\\\\u00a0seconds from now\"\nmsgstr[0] \"dans une seconde\"\nmsgstr[1] \"dans %(count)s secondes\"\n\n#. Translators: \\\\u00a0 is non-breaking space\n#: templatetags/humanize.py:229\n#, python-format\nmsgid \"a minute from now\"\nmsgid_plural \"%(count)s\\\\u00a0minutes from now\"\nmsgstr[0] \"dans une minute\"\nmsgstr[1] \"dans %(count)s minutes\"\n\n#. Translators: \\\\u00a0 is non-breaking space\n#: templatetags/humanize.py:235\n#, python-format\nmsgid \"an hour from now\"\nmsgid_plural \"%(count)s\\\\u00a0hours from now\"\nmsgstr[0] \"dans une heure\"\nmsgstr[1] \"dans %(count)s heures\"\n"} +{"text": "/*\n * this is for users how like to sepatet device and button configuration\n * You have to change the table names to:\n *\n * sccpdevices -> sccpdeviceconfig\n * sccplines -> sccpline \n*/\n\nPRAGMA auto_vacuum=2;\n--\n-- Table with line-configuration\n--\nCREATE TABLE sccpdevice (\n type \t\t\t\tvarchar(45) \tDEFAULT NULL,\n addon \t\t\tvarchar(45) \tDEFAULT NULL,\n description\t \t\tvarchar(45) \tDEFAULT NULL,\n tzoffset \t\t\tvarchar(5) \tDEFAULT NULL,\n transfer \t\t\tvarchar(5) \tDEFAULT 'on',\n cfwdall \t\t\tvarchar(5) \tDEFAULT 'on',\n cfwdbusy \t\t\tvarchar(5) \tDEFAULT 'on',\n imageversion\t\t\tvarchar(45) \tDEFAULT NULL,\n deny \t\t\t\tvarchar(45) \tDEFAULT NULL,\n permit \t\t\tvarchar(45) \tDEFAULT NULL,\n dndFeature \t\t\tvarchar(5) \tDEFAULT 'on',\n directrtp \t\t\tvarchar(3) \tDEFAULT 'off',\n earlyrtp \t\t\tvarchar(8) \tDEFAULT 'off',\n mwilamp \t\t\tvarchar(5) \tDEFAULT 'on',\n mwioncall \t\t\tvarchar(5) \tDEFAULT 'off',\n pickupexten\t\t\tvarchar(5) \tDEFAULT 'on',\n pickupcontext \t\tvarchar(100) \tDEFAULT '',\n pickupmodeanswer \t\tvarchar(5) \tDEFAULT 'on',\n private \t\t\tvarchar(5) \tDEFAULT 'off',\n privacy \t\t\tvarchar(100) \tDEFAULT 'full',\n nat \t\t\t\tvarchar(4) \tDEFAULT 'auto',\n softkeyset \t\t\tvarchar(100) \tDEFAULT '',\n audio_tos \t\t\tvarchar(11) \tDEFAULT NULL,\n audio_cos \t\t\tvarchar(1) \tDEFAULT NULL,\n video_tos \t\t\tvarchar(11) \tDEFAULT NULL,\n video_cos \t\t\tvarchar(1) \tDEFAULT NULL,\n conf_allow\t\t\tvarchar(3)\tDEFAULT 'on',\n conf_play_general_announce\tvarchar(3)\tDEFAULT 'on',\n conf_play_part_announce\tvarchar(3)\tDEFAULT 'on', \n conf_mute_on_entry\t\tvarchar(3)\tDEFAULT 'off',\n conf_music_on_hold_class varchar(80)\tDEFAULT 'default',\n conf_show_conflist varchar(3) DEFAULT 'on',\n backgroundImage\t\tvarchar(255) \tDEFAULT '',\n ringtone\t\t\tvarchar(255)\tDEFAULT '',\n setvar \t\t\tvarchar(100) \tDEFAULT NULL,\n disallow \t\t\tvarchar(255) \tDEFAULT NULL,\n allow \t\t\tvarchar(255) \tDEFAULT NULL,\n name \t\t\t\tvarchar(15) \tNOT NULL DEFAULT '',\n PRIMARY KEY (name)\n);\n\n--\n-- Table with device-configuration\n--\nCREATE TABLE sccpline (\n id \t\t\t\tvarchar(4) \tDEFAULT NULL,\n pin \t\t\t\tvarchar(45) \tDEFAULT NULL,\n label \t\t\tvarchar(45) \tDEFAULT NULL,\n description \t\t\tvarchar(45) \tDEFAULT NULL,\n context \t\t\tvarchar(45) \tDEFAULT NULL,\n incominglimit\t\t\tvarchar(45) \tDEFAULT NULL,\n transfer \t\t\tvarchar(45) \tDEFAULT NULL,\n mailbox \t\t\tvarchar(45) \tDEFAULT NULL,\n vmnum \t\t\tvarchar(45) \tDEFAULT NULL,\n cid_name \t\t\tvarchar(45) \tDEFAULT NULL,\n cid_num \t\t\tvarchar(45) \tDEFAULT NULL,\n trnsfvm \t\t\tvarchar(45) \tDEFAULT NULL,\n secondary_dialtone_digits \tvarchar(45) \tDEFAULT NULL,\n secondary_dialtone_tone \tvarchar(45) \tDEFAULT NULL,\n musicclass \t\t\tvarchar(45) \tDEFAULT NULL,\n language \t\t\tvarchar(45) \tDEFAULT NULL,\n accountcode \t\t\tvarchar(45) \tDEFAULT NULL,\n echocancel \t\t\tvarchar(45) \tDEFAULT NULL,\n silencesuppression \t\tvarchar(45) \tDEFAULT NULL,\n callgroup \t\t\tvarchar(45) \tDEFAULT NULL,\n pickupgroup \t\t\tvarchar(45) \tDEFAULT NULL,\n namedcallgroup \t\tvarchar(45) \tDEFAULT NULL,\n namedpickupgroup \t\tvarchar(45) \tDEFAULT NULL,\n dnd \t\t\t\tvarchar(7) \tDEFAULT 'reject',\n amaflags \t\t\tvarchar(45) \tDEFAULT NULL,\n defaultSubscriptionId_number \tvarchar(5)\tDEFAULT NULL,\n setvar \t\t\tvarchar(50) \tDEFAULT NULL,\n name \t\t\t\tvarchar(45) \tNOT NULL DEFAULT '',\n PRIMARY KEY (name)\n);\n\nCREATE TABLE buttontype (\n type \t\t\t\tvarchar(9) \tDEFAULT NULL,\n PRIMARY KEY (type)\n);\n\nINSERT INTO buttontype (type) VALUES ('line');\nINSERT INTO buttontype (type) VALUES ('speeddial');\nINSERT INTO buttontype (type) VALUES ('service');\nINSERT INTO buttontype (type) VALUES ('feature');\nINSERT INTO buttontype (type) VALUES ('empty');\n--\n-- Table with button-configuration for device\n--\nCREATE TABLE buttonconfig (\n device \t\t\tvarchar(15) \tNOT NULL DEFAULT '',\n instance \t\t\ttinyint(4) \tNOT NULL DEFAULT '0',\n type \t\t\t\tvarchar(9),\n name \t\t\t\tvarchar(36) \tDEFAULT NULL,\n options\t\t\tvarchar(100) \tDEFAULT NULL,\n PRIMARY KEY (device,instance),\n FOREIGN KEY (device) REFERENCES sccpdevice (device),\n FOREIGN KEY (type) REFERENCES buttontype (type) \n);\n\n--\n-- View for merging device and button configuration\n--\nCREATE VIEW sccpdeviceconfig AS \n\tSELECT \tsccpdevice.*, \n\t\tgroup_concat(buttonconfig.type||\",\"||buttonconfig.name||\",\"||buttonconfig.options,\";\") as button \n\tFROM buttonconfig, sccpdevice \n\tWHERE buttonconfig.device=sccpdevice.name \n\tGROUP BY sccpdevice.name\n\tORDER BY sccpdevice.name, buttonconfig.instance;\n"} +{"text": "#\n# SSLeay example configuration file.\n# This is mostly being used for generation of certificate requests.\n#\n# create RSA certs - Server\n\nRANDFILE = ./.rnd\n\n####################################################################\n[ req ]\ndistinguished_name = req_distinguished_name\nencrypt_key = no\n\n[ req_distinguished_name ]\ncountryName = Country Name (2 letter code)\ncountryName_default = ES\ncountryName_value = ES\n\norganizationName = Organization Name (eg, company)\norganizationName_value = Tortilleras S.A.\n\n0.commonName = Common Name (eg, YOUR name)\n0.commonName_value = Torti\n\n1.commonName = Common Name (eg, YOUR name)\n1.commonName_value = Gordita\n"} +{"text": "package logrus\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\t\"reflect\"\n\t\"runtime\"\n\t\"strings\"\n\t\"sync\"\n\t\"time\"\n)\n\nvar (\n\tbufferPool *sync.Pool\n\n\t// qualified package name, cached at first use\n\tlogrusPackage string\n\n\t// Positions in the call stack when tracing to report the calling method\n\tminimumCallerDepth int\n\n\t// Used for caller information initialisation\n\tcallerInitOnce sync.Once\n)\n\nconst (\n\tmaximumCallerDepth int = 25\n\tknownLogrusFrames int = 4\n)\n\nfunc init() {\n\tbufferPool = &sync.Pool{\n\t\tNew: func() interface{} {\n\t\t\treturn new(bytes.Buffer)\n\t\t},\n\t}\n\n\t// start at the bottom of the stack before the package-name cache is primed\n\tminimumCallerDepth = 1\n}\n\n// Defines the key when adding errors using WithError.\nvar ErrorKey = \"error\"\n\n// An entry is the final or intermediate Logrus logging entry. It contains all\n// the fields passed with WithField{,s}. It's finally logged when Trace, Debug,\n// Info, Warn, Error, Fatal or Panic is called on it. These objects can be\n// reused and passed around as much as you wish to avoid field duplication.\ntype Entry struct {\n\tLogger *Logger\n\n\t// Contains all the fields set by the user.\n\tData Fields\n\n\t// Time at which the log entry was created\n\tTime time.Time\n\n\t// Level the log entry was logged at: Trace, Debug, Info, Warn, Error, Fatal or Panic\n\t// This field will be set on entry firing and the value will be equal to the one in Logger struct field.\n\tLevel Level\n\n\t// Calling method, with package name\n\tCaller *runtime.Frame\n\n\t// Message passed to Trace, Debug, Info, Warn, Error, Fatal or Panic\n\tMessage string\n\n\t// When formatter is called in entry.log(), a Buffer may be set to entry\n\tBuffer *bytes.Buffer\n\n\t// Contains the context set by the user. Useful for hook processing etc.\n\tContext context.Context\n\n\t// err may contain a field formatting error\n\terr string\n}\n\nfunc NewEntry(logger *Logger) *Entry {\n\treturn &Entry{\n\t\tLogger: logger,\n\t\t// Default is three fields, plus one optional. Give a little extra room.\n\t\tData: make(Fields, 6),\n\t}\n}\n\n// Returns the string representation from the reader and ultimately the\n// formatter.\nfunc (entry *Entry) String() (string, error) {\n\tserialized, err := entry.Logger.Formatter.Format(entry)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tstr := string(serialized)\n\treturn str, nil\n}\n\n// Add an error as single field (using the key defined in ErrorKey) to the Entry.\nfunc (entry *Entry) WithError(err error) *Entry {\n\treturn entry.WithField(ErrorKey, err)\n}\n\n// Add a context to the Entry.\nfunc (entry *Entry) WithContext(ctx context.Context) *Entry {\n\treturn &Entry{Logger: entry.Logger, Data: entry.Data, Time: entry.Time, err: entry.err, Context: ctx}\n}\n\n// Add a single field to the Entry.\nfunc (entry *Entry) WithField(key string, value interface{}) *Entry {\n\treturn entry.WithFields(Fields{key: value})\n}\n\n// Add a map of fields to the Entry.\nfunc (entry *Entry) WithFields(fields Fields) *Entry {\n\tdata := make(Fields, len(entry.Data)+len(fields))\n\tfor k, v := range entry.Data {\n\t\tdata[k] = v\n\t}\n\tfieldErr := entry.err\n\tfor k, v := range fields {\n\t\tisErrField := false\n\t\tif t := reflect.TypeOf(v); t != nil {\n\t\t\tswitch t.Kind() {\n\t\t\tcase reflect.Func:\n\t\t\t\tisErrField = true\n\t\t\tcase reflect.Ptr:\n\t\t\t\tisErrField = t.Elem().Kind() == reflect.Func\n\t\t\t}\n\t\t}\n\t\tif isErrField {\n\t\t\ttmp := fmt.Sprintf(\"can not add field %q\", k)\n\t\t\tif fieldErr != \"\" {\n\t\t\t\tfieldErr = entry.err + \", \" + tmp\n\t\t\t} else {\n\t\t\t\tfieldErr = tmp\n\t\t\t}\n\t\t} else {\n\t\t\tdata[k] = v\n\t\t}\n\t}\n\treturn &Entry{Logger: entry.Logger, Data: data, Time: entry.Time, err: fieldErr, Context: entry.Context}\n}\n\n// Overrides the time of the Entry.\nfunc (entry *Entry) WithTime(t time.Time) *Entry {\n\treturn &Entry{Logger: entry.Logger, Data: entry.Data, Time: t, err: entry.err, Context: entry.Context}\n}\n\n// getPackageName reduces a fully qualified function name to the package name\n// There really ought to be to be a better way...\nfunc getPackageName(f string) string {\n\tfor {\n\t\tlastPeriod := strings.LastIndex(f, \".\")\n\t\tlastSlash := strings.LastIndex(f, \"/\")\n\t\tif lastPeriod > lastSlash {\n\t\t\tf = f[:lastPeriod]\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn f\n}\n\n// getCaller retrieves the name of the first non-logrus calling function\nfunc getCaller() *runtime.Frame {\n\n\t// cache this package's fully-qualified name\n\tcallerInitOnce.Do(func() {\n\t\tpcs := make([]uintptr, 2)\n\t\t_ = runtime.Callers(0, pcs)\n\t\tlogrusPackage = getPackageName(runtime.FuncForPC(pcs[1]).Name())\n\n\t\t// now that we have the cache, we can skip a minimum count of known-logrus functions\n\t\t// XXX this is dubious, the number of frames may vary\n\t\tminimumCallerDepth = knownLogrusFrames\n\t})\n\n\t// Restrict the lookback frames to avoid runaway lookups\n\tpcs := make([]uintptr, maximumCallerDepth)\n\tdepth := runtime.Callers(minimumCallerDepth, pcs)\n\tframes := runtime.CallersFrames(pcs[:depth])\n\n\tfor f, again := frames.Next(); again; f, again = frames.Next() {\n\t\tpkg := getPackageName(f.Function)\n\n\t\t// If the caller isn't part of this package, we're done\n\t\tif pkg != logrusPackage {\n\t\t\treturn &f\n\t\t}\n\t}\n\n\t// if we got here, we failed to find the caller's context\n\treturn nil\n}\n\nfunc (entry Entry) HasCaller() (has bool) {\n\treturn entry.Logger != nil &&\n\t\tentry.Logger.ReportCaller &&\n\t\tentry.Caller != nil\n}\n\n// This function is not declared with a pointer value because otherwise\n// race conditions will occur when using multiple goroutines\nfunc (entry Entry) log(level Level, msg string) {\n\tvar buffer *bytes.Buffer\n\n\t// Default to now, but allow users to override if they want.\n\t//\n\t// We don't have to worry about polluting future calls to Entry#log()\n\t// with this assignment because this function is declared with a\n\t// non-pointer receiver.\n\tif entry.Time.IsZero() {\n\t\tentry.Time = time.Now()\n\t}\n\n\tentry.Level = level\n\tentry.Message = msg\n\tif entry.Logger.ReportCaller {\n\t\tentry.Caller = getCaller()\n\t}\n\n\tentry.fireHooks()\n\n\tbuffer = bufferPool.Get().(*bytes.Buffer)\n\tbuffer.Reset()\n\tdefer bufferPool.Put(buffer)\n\tentry.Buffer = buffer\n\n\tentry.write()\n\n\tentry.Buffer = nil\n\n\t// To avoid Entry#log() returning a value that only would make sense for\n\t// panic() to use in Entry#Panic(), we avoid the allocation by checking\n\t// directly here.\n\tif level <= PanicLevel {\n\t\tpanic(&entry)\n\t}\n}\n\nfunc (entry *Entry) fireHooks() {\n\tentry.Logger.mu.Lock()\n\tdefer entry.Logger.mu.Unlock()\n\terr := entry.Logger.Hooks.Fire(entry.Level, entry)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Failed to fire hook: %v\\n\", err)\n\t}\n}\n\nfunc (entry *Entry) write() {\n\tentry.Logger.mu.Lock()\n\tdefer entry.Logger.mu.Unlock()\n\tserialized, err := entry.Logger.Formatter.Format(entry)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Failed to obtain reader, %v\\n\", err)\n\t} else {\n\t\t_, err = entry.Logger.Out.Write(serialized)\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"Failed to write to log, %v\\n\", err)\n\t\t}\n\t}\n}\n\nfunc (entry *Entry) Log(level Level, args ...interface{}) {\n\tif entry.Logger.IsLevelEnabled(level) {\n\t\tentry.log(level, fmt.Sprint(args...))\n\t}\n}\n\nfunc (entry *Entry) Trace(args ...interface{}) {\n\tentry.Log(TraceLevel, args...)\n}\n\nfunc (entry *Entry) Debug(args ...interface{}) {\n\tentry.Log(DebugLevel, args...)\n}\n\nfunc (entry *Entry) Print(args ...interface{}) {\n\tentry.Info(args...)\n}\n\nfunc (entry *Entry) Info(args ...interface{}) {\n\tentry.Log(InfoLevel, args...)\n}\n\nfunc (entry *Entry) Warn(args ...interface{}) {\n\tentry.Log(WarnLevel, args...)\n}\n\nfunc (entry *Entry) Warning(args ...interface{}) {\n\tentry.Warn(args...)\n}\n\nfunc (entry *Entry) Error(args ...interface{}) {\n\tentry.Log(ErrorLevel, args...)\n}\n\nfunc (entry *Entry) Fatal(args ...interface{}) {\n\tentry.Log(FatalLevel, args...)\n\tentry.Logger.Exit(1)\n}\n\nfunc (entry *Entry) Panic(args ...interface{}) {\n\tentry.Log(PanicLevel, args...)\n\tpanic(fmt.Sprint(args...))\n}\n\n// Entry Printf family functions\n\nfunc (entry *Entry) Logf(level Level, format string, args ...interface{}) {\n\tif entry.Logger.IsLevelEnabled(level) {\n\t\tentry.Log(level, fmt.Sprintf(format, args...))\n\t}\n}\n\nfunc (entry *Entry) Tracef(format string, args ...interface{}) {\n\tentry.Logf(TraceLevel, format, args...)\n}\n\nfunc (entry *Entry) Debugf(format string, args ...interface{}) {\n\tentry.Logf(DebugLevel, format, args...)\n}\n\nfunc (entry *Entry) Infof(format string, args ...interface{}) {\n\tentry.Logf(InfoLevel, format, args...)\n}\n\nfunc (entry *Entry) Printf(format string, args ...interface{}) {\n\tentry.Infof(format, args...)\n}\n\nfunc (entry *Entry) Warnf(format string, args ...interface{}) {\n\tentry.Logf(WarnLevel, format, args...)\n}\n\nfunc (entry *Entry) Warningf(format string, args ...interface{}) {\n\tentry.Warnf(format, args...)\n}\n\nfunc (entry *Entry) Errorf(format string, args ...interface{}) {\n\tentry.Logf(ErrorLevel, format, args...)\n}\n\nfunc (entry *Entry) Fatalf(format string, args ...interface{}) {\n\tentry.Logf(FatalLevel, format, args...)\n\tentry.Logger.Exit(1)\n}\n\nfunc (entry *Entry) Panicf(format string, args ...interface{}) {\n\tentry.Logf(PanicLevel, format, args...)\n}\n\n// Entry Println family functions\n\nfunc (entry *Entry) Logln(level Level, args ...interface{}) {\n\tif entry.Logger.IsLevelEnabled(level) {\n\t\tentry.Log(level, entry.sprintlnn(args...))\n\t}\n}\n\nfunc (entry *Entry) Traceln(args ...interface{}) {\n\tentry.Logln(TraceLevel, args...)\n}\n\nfunc (entry *Entry) Debugln(args ...interface{}) {\n\tentry.Logln(DebugLevel, args...)\n}\n\nfunc (entry *Entry) Infoln(args ...interface{}) {\n\tentry.Logln(InfoLevel, args...)\n}\n\nfunc (entry *Entry) Println(args ...interface{}) {\n\tentry.Infoln(args...)\n}\n\nfunc (entry *Entry) Warnln(args ...interface{}) {\n\tentry.Logln(WarnLevel, args...)\n}\n\nfunc (entry *Entry) Warningln(args ...interface{}) {\n\tentry.Warnln(args...)\n}\n\nfunc (entry *Entry) Errorln(args ...interface{}) {\n\tentry.Logln(ErrorLevel, args...)\n}\n\nfunc (entry *Entry) Fatalln(args ...interface{}) {\n\tentry.Logln(FatalLevel, args...)\n\tentry.Logger.Exit(1)\n}\n\nfunc (entry *Entry) Panicln(args ...interface{}) {\n\tentry.Logln(PanicLevel, args...)\n}\n\n// Sprintlnn => Sprint no newline. This is to get the behavior of how\n// fmt.Sprintln where spaces are always added between operands, regardless of\n// their type. Instead of vendoring the Sprintln implementation to spare a\n// string allocation, we do the simplest thing.\nfunc (entry *Entry) sprintlnn(args ...interface{}) string {\n\tmsg := fmt.Sprintln(args...)\n\treturn msg[:len(msg)-1]\n}\n"} +{"text": "## ncform show\n\nThe stage of the ncform show, currently provides Playground and Schema Generator\n\n# How to dev\n\nStep 1: prepare the dependency nc libraries\n```sh\ncd ../../ && npm run build\n```\n\nStep 2: start development\n```sh\nnpm run dev\n```\n"} +{"text": "\n\n\n two\n "} +{"text": "cordova.define(\"org.apache.cordova.contacts.ContactName\", function(require, exports, module) { /*\n *\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n*/\n\n/**\n* Contact name.\n* @constructor\n* @param formatted // NOTE: not part of W3C standard\n* @param familyName\n* @param givenName\n* @param middle\n* @param prefix\n* @param suffix\n*/\nvar ContactName = function(formatted, familyName, givenName, middle, prefix, suffix) {\n this.formatted = formatted || null;\n this.familyName = familyName || null;\n this.givenName = givenName || null;\n this.middleName = middle || null;\n this.honorificPrefix = prefix || null;\n this.honorificSuffix = suffix || null;\n};\n\nmodule.exports = ContactName;\n\n});\n"} +{"text": "\n\n \n \n \n \n \n \n \n \n"} +{"text": "\"\"\"Provide the _gdbm module as a dbm submodule.\"\"\"\n\nfrom _gdbm import *\n"} +{"text": "\n//\n// Mixins\n//\n@mixin control() {\n\tdisplay: block;\n\tposition: absolute;\n\tcolor: white;\n\tborder: 2px solid white;\n\tborder-radius: 16px;\n\ttext-align: center;\n\tline-height: 14px;\n\tbox-shadow: 0 0 3px #444;\n\tbox-sizing: content-box;\n}\n\n@mixin control-open() {\n\tcontent: '+';\n\tbackground-color: #31b131;\n}\n\n@mixin control-close() {\n\tcontent: '-';\n\tbackground-color: #d33333;\n}\n\n\n//\n// Table styles\n//\ntable.dataTable {\n\t// Styling for the `inline` type\n\t&.dtr-inline.collapsed tbody {\n\t\ttd:first-child,\n\t\tth:first-child {\n\t\t\tposition: relative;\n\t\t\tpadding-left: 30px;\n\t\t\tcursor: pointer;\n\n\t\t\t&:before {\n\t\t\t\ttop: 8px;\n\t\t\t\tleft: 4px;\n\t\t\t\theight: 16px;\n\t\t\t\twidth: 16px;\n\t\t\t\t@include control;\n\t\t\t\t@include control-open;\n\t\t\t}\n\n\t\t\t&.dataTables_empty:before {\n\t\t\t\tdisplay: none;\n\t\t\t}\n\t\t}\n\n\t\ttr.parent {\n\t\t\ttd:first-child:before,\n\t\t\tth:first-child:before {\n\t\t\t\t@include control-close;\n\t\t\t}\n\t\t}\n\n\t\ttr.child td:before {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n\n\n\t// Styling for the `column` type\n\t&.dtr-column tbody {\n\t\ttd.control,\n\t\tth.control {\n\t\t\tposition: relative;\n\t\t\tcursor: pointer;\n\n\t\t\t&:before {\n\t\t\t\ttop: 50%;\n\t\t\t\tleft: 50%;\n\t\t\t\theight: 16px;\n\t\t\t\twidth: 16px;\n\t\t\t\tmargin-top: -10px;\n\t\t\t\tmargin-left: -10px;\n\t\t\t\t@include control;\n\t\t\t\t@include control-open;\n\t\t\t}\n\t\t}\n\n\t\ttr.parent {\n\t\t\ttd.control:before,\n\t\t\tth.control:before {\n\t\t\t\t@include control-close;\n\t\t\t}\n\t\t}\n\t}\n\n\n\t// Child row styling\n\ttr.child {\n\t\tpadding: 0.5em 1em;\n\n\t\t&:hover {\n\t\t\tbackground: transparent !important;\n\t\t}\n\n\t\tul {\n\t\t\tdisplay: inline-block;\n\t\t\tlist-style-type: none;\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\n\t\t\tli {\n\t\t\t\tborder-bottom: 1px solid #efefef;\n\t\t\t\tpadding: 0.5em 0;\n\t\t\t\twhite-space: nowrap;\n\n\t\t\t\t&:first-child {\n\t\t\t\t\tpadding-top: 0;\n\t\t\t\t}\n\n\t\t\t\t&:last-child {\n\t\t\t\t\tborder-bottom: none;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tspan.dtr-title {\n\t\t\tdisplay: inline-block;\n\t\t\tmin-width: 75px;\n\t\t\tfont-weight: bold;\n\t\t}\n\n\t\tspan.dtr-data {}\n\t}\n}\n\n"} +{"text": "/*\n\n Slatwall - An Open Source eCommerce Platform\n Copyright (C) ten24, LLC\n\t\n This program is free software: you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\t\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\t\n You should have received a copy of the GNU General Public License\n along with this program. If not, see .\n \n Linking this program statically or dynamically with other modules is\n making a combined work based on this program. Thus, the terms and\n conditions of the GNU General Public License cover the whole\n combination.\n\t\n As a special exception, the copyright holders of this program give you\n permission to combine this program with independent modules and your \n custom code, regardless of the license terms of these independent\n modules, and to copy and distribute the resulting program under terms \n of your choice, provided that you follow these specific guidelines: \n\n\t- You also meet the terms and conditions of the license of each \n\t independent module \n\t- You must not alter the default display of the Slatwall name or logo from \n\t any part of the application \n\t- Your custom code must not alter or create any files inside Slatwall, \n\t except in the following directories:\n\t\t/integrationServices/\n\n\tYou may copy and distribute the modified version of this program that meets \n\tthe above guidelines as a combined work under the terms of GPL for this program, \n\tprovided that you include the source code of that other code when and as the \n\tGNU GPL requires distribution of source code.\n \n If you modify this program, you may extend this exception to your version \n of the program, but you are not obligated to do so.\n\nNotes:\n\n*/\ncomponent output=\"false\" accessors=\"true\" extends=\"HibachiService\" hint=\"Allows for easily checking signatures, keys, uuid, as well as generating them.\"\n{\n\t//list of supported algorithms\n\t\n\tpublic any function newJWT(required string key){\n\t\treturn getHibachiScope().getTransient('HibachiJWT').setup(arguments.key);\n\t}\n\t\n\tpublic any function getJwtByToken(required string token){\n\t\tvar key = getService('settingService').getSettingValue('globalClientSecret');\n\t\tvar jwt = newJwt(key);\n\t\tjwt.setTokenString(arguments.token);\n\t\treturn jwt;\n\t}\n\t\n\tpublic string function createToken(){\n\t\t//create token\n\t\tvar key = getService('settingService').getSettingValue('globalClientSecret');\n\t\tvar jwt = newJwt(key);\n\t\tvar currentTime = getService('hibachiUtilityService').getCurrentUtcTime();\n\t\t//hard coded to 15 minutes\n\t\tvar tokenExpirationTime = 900;\n\t\tvar payload = {};\n\t\tpayload['iat'] = javaCast( \"int\", currentTime );\n\t\tpayload['exp'] = javaCast( \"int\", ( currentTime + tokenExpirationTime));\n\t\tpayload['accountid'] = getHibachiScope().getAccount().getAccountID();\n\t\tpayload['encoding'] = \"UTF-8\";\n\t\tvar token = jwt.encode(payload);\n\t\t\n\t\treturn token;\n\t}\n\t\n}"} +{"text": "// TSLib - A free TeamSpeak 3 and 5 client library\n// Copyright (C) 2017 TSLib contributors\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the Open Software License v. 3.0\n//\n// You should have received a copy of the Open Software License along with this\n// program. If not, see .\n\nusing System;\nusing System.Linq;\n\nnamespace TSLib.Helper\n{\n\tinternal static class DebugUtil\n\t{\n\t\tpublic static string DebugToHex(byte[] bytes) => bytes is null ? \"\" : DebugToHex(bytes.AsSpan());\n\n\t\tpublic static string DebugToHex(ReadOnlySpan bytes)\n\t\t{\n\t\t\tchar[] c = new char[bytes.Length * 3];\n\t\t\tfor (int bx = 0, cx = 0; bx < bytes.Length; ++bx, ++cx)\n\t\t\t{\n\t\t\t\tbyte b = (byte)(bytes[bx] >> 4);\n\t\t\t\tc[cx] = (char)(b > 9 ? b - 10 + 'A' : b + '0');\n\n\t\t\t\tb = (byte)(bytes[bx] & 0x0F);\n\t\t\t\tc[++cx] = (char)(b > 9 ? b - 10 + 'A' : b + '0');\n\t\t\t\tc[++cx] = ' ';\n\t\t\t}\n\t\t\treturn new string(c);\n\t\t}\n\n\t\tpublic static byte[] DebugFromHex(string hex)\n\t\t\t=> hex.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t.Select(x => Convert.ToByte(x, 16)).ToArray();\n\t}\n}\n"} +{"text": "/*\r\n ==============================================================================\r\n\r\n This file is part of the JUCE library.\r\n Copyright (c) 2017 - ROLI Ltd.\r\n\r\n JUCE is an open source library subject to commercial or open-source\r\n licensing.\r\n\r\n By using JUCE, you agree to the terms of both the JUCE 5 End-User License\r\n Agreement and JUCE 5 Privacy Policy (both updated and effective as of the\r\n 27th April 2017).\r\n\r\n End User License Agreement: www.juce.com/juce-5-licence\r\n Privacy Policy: www.juce.com/juce-5-privacy-policy\r\n\r\n Or: You may also use this code under the terms of the GPL v3 (see\r\n www.gnu.org/licenses).\r\n\r\n JUCE IS PROVIDED \"AS IS\" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER\r\n EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE\r\n DISCLAIMED.\r\n\r\n ==============================================================================\r\n*/\r\n\r\nnamespace juce\r\n{\r\n\r\nArrowButton::ArrowButton (const String& name, float arrowDirectionInRadians, Colour arrowColour)\r\n : Button (name), colour (arrowColour)\r\n{\r\n path.addTriangle (0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.5f);\r\n path.applyTransform (AffineTransform::rotation (MathConstants::twoPi * arrowDirectionInRadians, 0.5f, 0.5f));\r\n}\r\n\r\nArrowButton::~ArrowButton() {}\r\n\r\nvoid ArrowButton::paintButton (Graphics& g, bool /*shouldDrawButtonAsHighlighted*/, bool shouldDrawButtonAsDown)\r\n{\r\n Path p (path);\r\n\r\n const float offset = shouldDrawButtonAsDown ? 1.0f : 0.0f;\r\n p.applyTransform (path.getTransformToScaleToFit (offset, offset, getWidth() - 3.0f, getHeight() - 3.0f, false));\r\n\r\n DropShadow (Colours::black.withAlpha (0.3f), shouldDrawButtonAsDown ? 2 : 4, Point()).drawForPath (g, p);\r\n\r\n g.setColour (colour);\r\n g.fillPath (p);\r\n}\r\n\r\n} // namespace juce\r\n"} +{"text": "/*\n * Copyright © 2004 Red Hat, Inc.\n * Copyright © 2008 Chris Wilson\n *\n * Permission to use, copy, modify, distribute, and sell this software\n * and its documentation for any purpose is hereby granted without\n * fee, provided that the above copyright notice appear in all copies\n * and that both that copyright notice and this permission notice\n * appear in supporting documentation, and that the name of\n * Red Hat, Inc. not be used in advertising or publicity pertaining to\n * distribution of the software without specific, written prior\n * permission. Red Hat, Inc. makes no representations about the\n * suitability of this software for any purpose. It is provided \"as\n * is\" without express or implied warranty.\n *\n * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS\n * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND\n * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,\n * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER\n * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION\n * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR\n * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n * Author: Carl D. Worth \n * Chris Wilson \n */\n\n#ifndef _CAIRO_TEST_PRIVATE_H_\n#define _CAIRO_TEST_PRIVATE_H_\n\n#include \"cairo-test.h\"\n\n/* For communication between the core components of cairo-test and not\n * for the tests themselves.\n */\n\nCAIRO_BEGIN_DECLS\n\ntypedef enum {\n DIRECT,\n SIMILAR\n} cairo_test_similar_t;\n\ncairo_test_similar_t\ncairo_test_target_has_similar (const cairo_test_context_t *ctx,\n\t\t\t const cairo_boilerplate_target_t *target);\n\ncairo_test_status_t\n_cairo_test_context_run_for_target (cairo_test_context_t *ctx,\n\t\t\t\t const cairo_boilerplate_target_t *target,\n\t\t\t\t cairo_bool_t similar,\n\t\t\t\t int dev_offset, int dev_scale);\n\nvoid\n_cairo_test_context_init_for_test (cairo_test_context_t *ctx,\n\t\t\t\t const cairo_test_context_t *parent,\n\t\t\t\t const cairo_test_t *test);\n\nvoid\ncairo_test_init (cairo_test_context_t *ctx,\n\t\t const char *test_name,\n\t\t const char *output);\n\nvoid\ncairo_test_fini (cairo_test_context_t *ctx);\n\nvoid\n_cairo_test_runner_register_tests (void);\n\nCAIRO_END_DECLS\n\n#endif /* _CAIRO_TEST_PRIVATE_H_ */\n"} +{"text": "/* =========================================================\n * bootstrap-datetimepicker.js\n * =========================================================\n * Copyright 2012 Stefan Petre\n *\n * Improvements by Andrew Rowls\n * Improvements by Sébastien Malot\n * Improvements by Yun Lai\n * Improvements by Kenneth Henderick\n * Improvements by CuGBabyBeaR\n * Improvements by Christian Vaas \n *\n * Project URL : http://www.malot.fr/bootstrap-datetimepicker\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ========================================================= */\n\n(function(factory){\n if (typeof define === 'function' && define.amd)\n define(['jquery'], factory);\n else if (typeof exports === 'object')\n factory(require('jquery'));\n else\n factory(jQuery);\n\n}(function($, undefined){\n\n // Add ECMA262-5 Array methods if not supported natively (IE8)\n if (!('indexOf' in Array.prototype)) {\n Array.prototype.indexOf = function (find, i) {\n if (i === undefined) i = 0;\n if (i < 0) i += this.length;\n if (i < 0) i = 0;\n for (var n = this.length; i < n; i++) {\n if (i in this && this[i] === find) {\n return i;\n }\n }\n return -1;\n }\n }\n\n function elementOrParentIsFixed (element) {\n var $element = $(element);\n var $checkElements = $element.add($element.parents());\n var isFixed = false;\n $checkElements.each(function(){\n if ($(this).css('position') === 'fixed') {\n isFixed = true;\n return false;\n }\n });\n return isFixed;\n }\n\n function UTCDate() {\n return new Date(Date.UTC.apply(Date, arguments));\n }\n\n function UTCToday() {\n var today = new Date();\n return UTCDate(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate(), today.getUTCHours(), today.getUTCMinutes(), today.getUTCSeconds(), 0);\n }\n\n // Picker object\n var Datetimepicker = function (element, options) {\n var that = this;\n\n this.element = $(element);\n\n // add container for single page application\n // when page switch the datetimepicker div will be removed also.\n this.container = options.container || 'body';\n\n this.language = options.language || this.element.data('date-language') || 'en';\n this.language = this.language in dates ? this.language : this.language.split('-')[0]; // fr-CA fallback to fr\n this.language = this.language in dates ? this.language : 'en';\n this.isRTL = dates[this.language].rtl || false;\n this.formatType = options.formatType || this.element.data('format-type') || 'standard';\n this.format = DPGlobal.parseFormat(options.format || this.element.data('date-format') || dates[this.language].format || DPGlobal.getDefaultFormat(this.formatType, 'input'), this.formatType);\n this.isInline = false;\n this.isVisible = false;\n this.isInput = this.element.is('input');\n this.fontAwesome = options.fontAwesome || this.element.data('font-awesome') || false;\n\n this.bootcssVer = options.bootcssVer || (this.isInput ? (this.element.is('.form-control') ? 3 : 2) : ( this.bootcssVer = this.element.is('.input-group') ? 3 : 2 ));\n\n this.component = this.element.is('.date') ? ( this.bootcssVer == 3 ? this.element.find('.input-group-addon .glyphicon-th, .input-group-addon .glyphicon-time, .input-group-addon .glyphicon-remove, .input-group-addon .glyphicon-calendar, .input-group-addon .fa-calendar, .input-group-addon .fa-clock-o').parent() : this.element.find('.add-on .icon-th, .add-on .icon-time, .add-on .icon-calendar, .add-on .fa-calendar, .add-on .fa-clock-o').parent()) : false;\n this.componentReset = this.element.is('.date') ? ( this.bootcssVer == 3 ? this.element.find('.input-group-addon .glyphicon-remove, .input-group-addon .fa-times').parent():this.element.find('.add-on .icon-remove, .add-on .fa-times').parent()) : false;\n this.hasInput = this.component && this.element.find('input').length;\n if (this.component && this.component.length === 0) {\n this.component = false;\n }\n this.linkField = options.linkField || this.element.data('link-field') || false;\n this.linkFormat = DPGlobal.parseFormat(options.linkFormat || this.element.data('link-format') || DPGlobal.getDefaultFormat(this.formatType, 'link'), this.formatType);\n this.minuteStep = options.minuteStep || this.element.data('minute-step') || 5;\n this.pickerPosition = options.pickerPosition || this.element.data('picker-position') || 'bottom-right';\n this.showMeridian = options.showMeridian || this.element.data('show-meridian') || false;\n this.initialDate = options.initialDate || new Date();\n this.zIndex = options.zIndex || this.element.data('z-index') || undefined;\n this.title = typeof options.title === 'undefined' ? false : options.title;\n\n this.icons = {\n leftArrow: this.fontAwesome ? 'fa-arrow-left' : (this.bootcssVer === 3 ? 'glyphicon-arrow-left' : 'icon-arrow-left'),\n rightArrow: this.fontAwesome ? 'fa-arrow-right' : (this.bootcssVer === 3 ? 'glyphicon-arrow-right' : 'icon-arrow-right')\n }\n this.icontype = this.fontAwesome ? 'fa' : 'glyphicon';\n\n this._attachEvents();\n\n this.clickedOutside = function (e) {\n // Clicked outside the datetimepicker, hide it\n if ($(e.target).closest('.datetimepicker').length === 0) {\n that.hide();\n }\n }\n\n this.formatViewType = 'datetime';\n if ('formatViewType' in options) {\n this.formatViewType = options.formatViewType;\n } else if ('formatViewType' in this.element.data()) {\n this.formatViewType = this.element.data('formatViewType');\n }\n\n this.minView = 0;\n if ('minView' in options) {\n this.minView = options.minView;\n } else if ('minView' in this.element.data()) {\n this.minView = this.element.data('min-view');\n }\n this.minView = DPGlobal.convertViewMode(this.minView);\n\n this.maxView = DPGlobal.modes.length - 1;\n if ('maxView' in options) {\n this.maxView = options.maxView;\n } else if ('maxView' in this.element.data()) {\n this.maxView = this.element.data('max-view');\n }\n this.maxView = DPGlobal.convertViewMode(this.maxView);\n\n this.wheelViewModeNavigation = false;\n if ('wheelViewModeNavigation' in options) {\n this.wheelViewModeNavigation = options.wheelViewModeNavigation;\n } else if ('wheelViewModeNavigation' in this.element.data()) {\n this.wheelViewModeNavigation = this.element.data('view-mode-wheel-navigation');\n }\n\n this.wheelViewModeNavigationInverseDirection = false;\n\n if ('wheelViewModeNavigationInverseDirection' in options) {\n this.wheelViewModeNavigationInverseDirection = options.wheelViewModeNavigationInverseDirection;\n } else if ('wheelViewModeNavigationInverseDirection' in this.element.data()) {\n this.wheelViewModeNavigationInverseDirection = this.element.data('view-mode-wheel-navigation-inverse-dir');\n }\n\n this.wheelViewModeNavigationDelay = 100;\n if ('wheelViewModeNavigationDelay' in options) {\n this.wheelViewModeNavigationDelay = options.wheelViewModeNavigationDelay;\n } else if ('wheelViewModeNavigationDelay' in this.element.data()) {\n this.wheelViewModeNavigationDelay = this.element.data('view-mode-wheel-navigation-delay');\n }\n\n this.startViewMode = 2;\n if ('startView' in options) {\n this.startViewMode = options.startView;\n } else if ('startView' in this.element.data()) {\n this.startViewMode = this.element.data('start-view');\n }\n this.startViewMode = DPGlobal.convertViewMode(this.startViewMode);\n this.viewMode = this.startViewMode;\n\n this.viewSelect = this.minView;\n if ('viewSelect' in options) {\n this.viewSelect = options.viewSelect;\n } else if ('viewSelect' in this.element.data()) {\n this.viewSelect = this.element.data('view-select');\n }\n this.viewSelect = DPGlobal.convertViewMode(this.viewSelect);\n\n this.forceParse = true;\n if ('forceParse' in options) {\n this.forceParse = options.forceParse;\n } else if ('dateForceParse' in this.element.data()) {\n this.forceParse = this.element.data('date-force-parse');\n }\n var template = this.bootcssVer === 3 ? DPGlobal.templateV3 : DPGlobal.template;\n while (template.indexOf('{iconType}') !== -1) {\n template = template.replace('{iconType}', this.icontype);\n }\n while (template.indexOf('{leftArrow}') !== -1) {\n template = template.replace('{leftArrow}', this.icons.leftArrow);\n }\n while (template.indexOf('{rightArrow}') !== -1) {\n template = template.replace('{rightArrow}', this.icons.rightArrow);\n }\n this.picker = $(template)\n .appendTo(this.isInline ? this.element : this.container) // 'body')\n .on({\n click: $.proxy(this.click, this),\n mousedown: $.proxy(this.mousedown, this)\n });\n\n if (this.wheelViewModeNavigation) {\n if ($.fn.mousewheel) {\n this.picker.on({mousewheel: $.proxy(this.mousewheel, this)});\n } else {\n console.log('Mouse Wheel event is not supported. Please include the jQuery Mouse Wheel plugin before enabling this option');\n }\n }\n\n if (this.isInline) {\n this.picker.addClass('datetimepicker-inline');\n } else {\n this.picker.addClass('datetimepicker-dropdown-' + this.pickerPosition + ' dropdown-menu');\n }\n if (this.isRTL) {\n this.picker.addClass('datetimepicker-rtl');\n var selector = this.bootcssVer === 3 ? '.prev span, .next span' : '.prev i, .next i';\n this.picker.find(selector).toggleClass(this.icons.leftArrow + ' ' + this.icons.rightArrow);\n }\n\n $(document).on('mousedown', this.clickedOutside);\n\n this.autoclose = false;\n if ('autoclose' in options) {\n this.autoclose = options.autoclose;\n } else if ('dateAutoclose' in this.element.data()) {\n this.autoclose = this.element.data('date-autoclose');\n }\n\n this.keyboardNavigation = true;\n if ('keyboardNavigation' in options) {\n this.keyboardNavigation = options.keyboardNavigation;\n } else if ('dateKeyboardNavigation' in this.element.data()) {\n this.keyboardNavigation = this.element.data('date-keyboard-navigation');\n }\n\n this.todayBtn = (options.todayBtn || this.element.data('date-today-btn') || false);\n this.clearBtn = (options.clearBtn || this.element.data('date-clear-btn') || false);\n this.todayHighlight = (options.todayHighlight || this.element.data('date-today-highlight') || false);\n\n this.weekStart = ((options.weekStart || this.element.data('date-weekstart') || dates[this.language].weekStart || 0) % 7);\n this.weekEnd = ((this.weekStart + 6) % 7);\n this.startDate = -Infinity;\n this.endDate = Infinity;\n this.datesDisabled = [];\n this.daysOfWeekDisabled = [];\n this.setStartDate(options.startDate || this.element.data('date-startdate'));\n this.setEndDate(options.endDate || this.element.data('date-enddate'));\n this.setDatesDisabled(options.datesDisabled || this.element.data('date-dates-disabled'));\n this.setDaysOfWeekDisabled(options.daysOfWeekDisabled || this.element.data('date-days-of-week-disabled'));\n this.setMinutesDisabled(options.minutesDisabled || this.element.data('date-minute-disabled'));\n this.setHoursDisabled(options.hoursDisabled || this.element.data('date-hour-disabled'));\n this.fillDow();\n this.fillMonths();\n this.update();\n this.showMode();\n\n if (this.isInline) {\n this.show();\n }\n };\n\n Datetimepicker.prototype = {\n constructor: Datetimepicker,\n\n _events: [],\n _attachEvents: function () {\n this._detachEvents();\n if (this.isInput) { // single input\n this._events = [\n [this.element, {\n focus: $.proxy(this.show, this),\n keyup: $.proxy(this.update, this),\n keydown: $.proxy(this.keydown, this)\n }]\n ];\n }\n else if (this.component && this.hasInput) { // component: input + button\n this._events = [\n // For components that are not readonly, allow keyboard nav\n [this.element.find('input'), {\n focus: $.proxy(this.show, this),\n keyup: $.proxy(this.update, this),\n keydown: $.proxy(this.keydown, this)\n }],\n [this.component, {\n click: $.proxy(this.show, this)\n }]\n ];\n if (this.componentReset) {\n this._events.push([\n this.componentReset,\n {click: $.proxy(this.reset, this)}\n ]);\n }\n }\n else if (this.element.is('div')) { // inline datetimepicker\n this.isInline = true;\n }\n else {\n this._events = [\n [this.element, {\n click: $.proxy(this.show, this)\n }]\n ];\n }\n for (var i = 0, el, ev; i < this._events.length; i++) {\n el = this._events[i][0];\n ev = this._events[i][1];\n el.on(ev);\n }\n },\n\n _detachEvents: function () {\n for (var i = 0, el, ev; i < this._events.length; i++) {\n el = this._events[i][0];\n ev = this._events[i][1];\n el.off(ev);\n }\n this._events = [];\n },\n\n show: function (e) {\n this.picker.show();\n this.height = this.component ? this.component.outerHeight() : this.element.outerHeight();\n if (this.forceParse) {\n this.update();\n }\n this.place();\n $(window).on('resize', $.proxy(this.place, this));\n if (e) {\n e.stopPropagation();\n e.preventDefault();\n }\n this.isVisible = true;\n this.element.trigger({\n type: 'show',\n date: this.date\n });\n },\n\n hide: function (e) {\n if (!this.isVisible) return;\n if (this.isInline) return;\n this.picker.hide();\n $(window).off('resize', this.place);\n this.viewMode = this.startViewMode;\n this.showMode();\n if (!this.isInput) {\n $(document).off('mousedown', this.hide);\n }\n\n if (\n this.forceParse &&\n (\n this.isInput && this.element.val() ||\n this.hasInput && this.element.find('input').val()\n )\n )\n this.setValue();\n this.isVisible = false;\n this.element.trigger({\n type: 'hide',\n date: this.date\n });\n },\n\n remove: function () {\n this._detachEvents();\n $(document).off('mousedown', this.clickedOutside);\n this.picker.remove();\n delete this.picker;\n delete this.element.data().datetimepicker;\n },\n\n getDate: function () {\n var d = this.getUTCDate();\n return new Date(d.getTime() + (d.getTimezoneOffset() * 60000));\n },\n\n getUTCDate: function () {\n return this.date;\n },\n\n getInitialDate: function () {\n return this.initialDate\n },\n\n setInitialDate: function (initialDate) {\n this.initialDate = initialDate;\n },\n\n setDate: function (d) {\n this.setUTCDate(new Date(d.getTime() - (d.getTimezoneOffset() * 60000)));\n },\n\n setUTCDate: function (d) {\n if (d >= this.startDate && d <= this.endDate) {\n this.date = d;\n this.setValue();\n this.viewDate = this.date;\n this.fill();\n } else {\n this.element.trigger({\n type: 'outOfRange',\n date: d,\n startDate: this.startDate,\n endDate: this.endDate\n });\n }\n },\n\n setFormat: function (format) {\n this.format = DPGlobal.parseFormat(format, this.formatType);\n var element;\n if (this.isInput) {\n element = this.element;\n } else if (this.component) {\n element = this.element.find('input');\n }\n if (element && element.val()) {\n this.setValue();\n }\n },\n\n setValue: function () {\n var formatted = this.getFormattedDate();\n if (!this.isInput) {\n if (this.component) {\n this.element.find('input').val(formatted);\n }\n this.element.data('date', formatted);\n } else {\n this.element.val(formatted);\n }\n if (this.linkField) {\n $('#' + this.linkField).val(this.getFormattedDate(this.linkFormat));\n }\n },\n\n getFormattedDate: function (format) {\n if (format == undefined) format = this.format;\n return DPGlobal.formatDate(this.date, format, this.language, this.formatType);\n },\n\n setStartDate: function (startDate) {\n this.startDate = startDate || -Infinity;\n if (this.startDate !== -Infinity) {\n this.startDate = DPGlobal.parseDate(this.startDate, this.format, this.language, this.formatType);\n }\n this.update();\n this.updateNavArrows();\n },\n\n setEndDate: function (endDate) {\n this.endDate = endDate || Infinity;\n if (this.endDate !== Infinity) {\n this.endDate = DPGlobal.parseDate(this.endDate, this.format, this.language, this.formatType);\n }\n this.update();\n this.updateNavArrows();\n },\n\n setDatesDisabled: function (datesDisabled) {\n this.datesDisabled = datesDisabled || [];\n if (!$.isArray(this.datesDisabled)) {\n this.datesDisabled = this.datesDisabled.split(/,\\s*/);\n }\n this.datesDisabled = $.map(this.datesDisabled, function (d) {\n return DPGlobal.parseDate(d, this.format, this.language, this.formatType).toDateString();\n });\n this.update();\n this.updateNavArrows();\n },\n\n setTitle: function (selector, value) {\n return this.picker.find(selector)\n .find('th:eq(1)')\n .text(this.title === false ? value : this.title);\n },\n\n setDaysOfWeekDisabled: function (daysOfWeekDisabled) {\n this.daysOfWeekDisabled = daysOfWeekDisabled || [];\n if (!$.isArray(this.daysOfWeekDisabled)) {\n this.daysOfWeekDisabled = this.daysOfWeekDisabled.split(/,\\s*/);\n }\n this.daysOfWeekDisabled = $.map(this.daysOfWeekDisabled, function (d) {\n return parseInt(d, 10);\n });\n this.update();\n this.updateNavArrows();\n },\n\n setMinutesDisabled: function (minutesDisabled) {\n this.minutesDisabled = minutesDisabled || [];\n if (!$.isArray(this.minutesDisabled)) {\n this.minutesDisabled = this.minutesDisabled.split(/,\\s*/);\n }\n this.minutesDisabled = $.map(this.minutesDisabled, function (d) {\n return parseInt(d, 10);\n });\n this.update();\n this.updateNavArrows();\n },\n\n setHoursDisabled: function (hoursDisabled) {\n this.hoursDisabled = hoursDisabled || [];\n if (!$.isArray(this.hoursDisabled)) {\n this.hoursDisabled = this.hoursDisabled.split(/,\\s*/);\n }\n this.hoursDisabled = $.map(this.hoursDisabled, function (d) {\n return parseInt(d, 10);\n });\n this.update();\n this.updateNavArrows();\n },\n\n place: function () {\n if (this.isInline) return;\n\n if (!this.zIndex) {\n var index_highest = 0;\n $('div').each(function () {\n var index_current = parseInt($(this).css('zIndex'), 10);\n if (index_current > index_highest) {\n index_highest = index_current;\n }\n });\n this.zIndex = index_highest + 10;\n }\n\n var offset, top, left, containerOffset;\n if (this.container instanceof $) {\n containerOffset = this.container.offset();\n } else {\n containerOffset = $(this.container).offset();\n }\n\n if (this.component) {\n offset = this.component.offset();\n left = offset.left;\n if (this.pickerPosition == 'bottom-left' || this.pickerPosition == 'top-left') {\n left += this.component.outerWidth() - this.picker.outerWidth();\n }\n } else {\n offset = this.element.offset();\n left = offset.left;\n if (this.pickerPosition == 'bottom-left' || this.pickerPosition == 'top-left') {\n left += this.element.outerWidth() - this.picker.outerWidth();\n }\n }\n\n var bodyWidth = document.body.clientWidth || window.innerWidth;\n if (left + 220 > bodyWidth) {\n left = bodyWidth - 220;\n }\n\n if (this.component) {\n top = top - containerOffset.top + 169;\n left = left - containerOffset.left + 210;\n } else {\n if (this.pickerPosition == 'top-left' || this.pickerPosition == 'top-right') {\n top = offset.top - this.picker.outerHeight();\n } else {\n top = offset.top + this.height;\n }\n }\n\n this.picker.css({\n top: top,\n left: left,\n zIndex: this.zIndex\n });\n },\n\n update: function () {\n var date, fromArgs = false;\n if (arguments && arguments.length && (typeof arguments[0] === 'string' || arguments[0] instanceof Date)) {\n date = arguments[0];\n fromArgs = true;\n } else {\n date = (this.isInput ? this.element.val() : this.element.find('input').val()) || this.element.data('date') || this.initialDate;\n if (typeof date == 'string' || date instanceof String) {\n date = date.replace(/^\\s+|\\s+$/g,'');\n }\n }\n\n if (!date) {\n date = new Date();\n fromArgs = false;\n }\n\n this.date = DPGlobal.parseDate(date, this.format, this.language, this.formatType);\n\n if (fromArgs) this.setValue();\n\n if (this.date < this.startDate) {\n this.viewDate = new Date(this.startDate);\n } else if (this.date > this.endDate) {\n this.viewDate = new Date(this.endDate);\n } else {\n this.viewDate = new Date(this.date);\n }\n this.fill();\n },\n\n fillDow: function () {\n var dowCnt = this.weekStart,\n html = '';\n while (dowCnt < this.weekStart + 7) {\n html += '' + dates[this.language].daysMin[(dowCnt++) % 7] + '';\n }\n html += '';\n this.picker.find('.datetimepicker-days thead').append(html);\n },\n\n fillMonths: function () {\n var html = '',\n i = 0;\n while (i < 12) {\n html += '' + dates[this.language].monthsShort[i++] + '';\n }\n this.picker.find('.datetimepicker-months td').html(html);\n },\n\n fill: function () {\n if (this.date == null || this.viewDate == null) {\n return;\n }\n var d = new Date(this.viewDate),\n year = d.getUTCFullYear(),\n month = d.getUTCMonth(),\n dayMonth = d.getUTCDate(),\n hours = d.getUTCHours(),\n minutes = d.getUTCMinutes(),\n startYear = this.startDate !== -Infinity ? this.startDate.getUTCFullYear() : -Infinity,\n startMonth = this.startDate !== -Infinity ? this.startDate.getUTCMonth() + 1 : -Infinity,\n endYear = this.endDate !== Infinity ? this.endDate.getUTCFullYear() : Infinity,\n endMonth = this.endDate !== Infinity ? this.endDate.getUTCMonth() + 1 : Infinity,\n currentDate = (new UTCDate(this.date.getUTCFullYear(), this.date.getUTCMonth(), this.date.getUTCDate())).valueOf(),\n today = new Date();\n this.setTitle('.datetimepicker-days', dates[this.language].months[month] + ' ' + year)\n if (this.formatViewType == 'time') {\n var formatted = this.getFormattedDate();\n this.setTitle('.datetimepicker-hours', formatted);\n this.setTitle('.datetimepicker-minutes', formatted);\n } else {\n this.setTitle('.datetimepicker-hours', dayMonth + ' ' + dates[this.language].months[month] + ' ' + year);\n this.setTitle('.datetimepicker-minutes', dayMonth + ' ' + dates[this.language].months[month] + ' ' + year);\n }\n this.picker.find('tfoot th.today')\n .text(dates[this.language].today || dates['en'].today)\n .toggle(this.todayBtn !== false);\n this.picker.find('tfoot th.clear')\n .text(dates[this.language].clear || dates['en'].clear)\n .toggle(this.clearBtn !== false);\n this.updateNavArrows();\n this.fillMonths();\n /*var prevMonth = UTCDate(year, month, 0,0,0,0,0);\n prevMonth.setUTCDate(prevMonth.getDate() - (prevMonth.getUTCDay() - this.weekStart + 7)%7);*/\n var prevMonth = UTCDate(year, month - 1, 28, 0, 0, 0, 0),\n day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());\n prevMonth.setUTCDate(day);\n prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.weekStart + 7) % 7);\n var nextMonth = new Date(prevMonth);\n nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);\n nextMonth = nextMonth.valueOf();\n var html = [];\n var clsName;\n while (prevMonth.valueOf() < nextMonth) {\n if (prevMonth.getUTCDay() == this.weekStart) {\n html.push('');\n }\n clsName = '';\n if (prevMonth.getUTCFullYear() < year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() < month)) {\n clsName += ' old';\n } else if (prevMonth.getUTCFullYear() > year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() > month)) {\n clsName += ' new';\n }\n // Compare internal UTC date with local today, not UTC today\n if (this.todayHighlight &&\n prevMonth.getUTCFullYear() == today.getFullYear() &&\n prevMonth.getUTCMonth() == today.getMonth() &&\n prevMonth.getUTCDate() == today.getDate()) {\n clsName += ' today';\n }\n if (prevMonth.valueOf() == currentDate) {\n clsName += ' active';\n }\n if ((prevMonth.valueOf() + 86400000) <= this.startDate || prevMonth.valueOf() > this.endDate ||\n $.inArray(prevMonth.getUTCDay(), this.daysOfWeekDisabled) !== -1 ||\n\t\t\t\t\t$.inArray(prevMonth.toDateString(), this.datesDisabled) !== -1) {\n clsName += ' disabled';\n }\n html.push('' + prevMonth.getUTCDate() + '');\n if (prevMonth.getUTCDay() == this.weekEnd) {\n html.push('');\n }\n prevMonth.setUTCDate(prevMonth.getUTCDate() + 1);\n }\n this.picker.find('.datetimepicker-days tbody').empty().append(html.join(''));\n\n html = [];\n var txt = '', meridian = '', meridianOld = '';\n var hoursDisabled = this.hoursDisabled || [];\n for (var i = 0; i < 24; i++) {\n if (hoursDisabled.indexOf(i) !== -1) continue;\n var actual = UTCDate(year, month, dayMonth, i);\n clsName = '';\n // We want the previous hour for the startDate\n if ((actual.valueOf() + 3600000) <= this.startDate || actual.valueOf() > this.endDate) {\n clsName += ' disabled';\n } else if (hours == i) {\n clsName += ' active';\n }\n if (this.showMeridian && dates[this.language].meridiem.length == 2) {\n meridian = (i < 12 ? dates[this.language].meridiem[0] : dates[this.language].meridiem[1]);\n if (meridian != meridianOld) {\n if (meridianOld != '') {\n html.push('');\n }\n html.push('
    ' + meridian.toUpperCase() + '');\n }\n meridianOld = meridian;\n txt = (i % 12 ? i % 12 : 12);\n html.push('' + txt + '');\n if (i == 23) {\n html.push('
    ');\n }\n } else {\n txt = i + ':00';\n html.push('' + txt + '');\n }\n }\n this.picker.find('.datetimepicker-hours td').html(html.join(''));\n\n html = [];\n txt = '', meridian = '', meridianOld = '';\n var minutesDisabled = this.minutesDisabled || [];\n for (var i = 0; i < 60; i += this.minuteStep) {\n if (minutesDisabled.indexOf(i) !== -1) continue;\n var actual = UTCDate(year, month, dayMonth, hours, i, 0);\n clsName = '';\n if (actual.valueOf() < this.startDate || actual.valueOf() > this.endDate) {\n clsName += ' disabled';\n } else if (Math.floor(minutes / this.minuteStep) == Math.floor(i / this.minuteStep)) {\n clsName += ' active';\n }\n if (this.showMeridian && dates[this.language].meridiem.length == 2) {\n meridian = (hours < 12 ? dates[this.language].meridiem[0] : dates[this.language].meridiem[1]);\n if (meridian != meridianOld) {\n if (meridianOld != '') {\n html.push('');\n }\n html.push('
    ' + meridian.toUpperCase() + '');\n }\n meridianOld = meridian;\n txt = (hours % 12 ? hours % 12 : 12);\n //html.push(''+txt+'');\n html.push('' + txt + ':' + (i < 10 ? '0' + i : i) + '');\n if (i == 59) {\n html.push('
    ');\n }\n } else {\n txt = i + ':00';\n //html.push(''+txt+'');\n html.push('' + hours + ':' + (i < 10 ? '0' + i : i) + '');\n }\n }\n this.picker.find('.datetimepicker-minutes td').html(html.join(''));\n\n var currentYear = this.date.getUTCFullYear();\n var months = this.setTitle('.datetimepicker-months', year)\n .end()\n .find('span').removeClass('active');\n if (currentYear == year) {\n // getUTCMonths() returns 0 based, and we need to select the next one\n // To cater bootstrap 2 we don't need to select the next one\n var offset = months.length - 12;\n months.eq(this.date.getUTCMonth() + offset).addClass('active');\n }\n if (year < startYear || year > endYear) {\n months.addClass('disabled');\n }\n if (year == startYear) {\n months.slice(0, startMonth + 1).addClass('disabled');\n }\n if (year == endYear) {\n months.slice(endMonth).addClass('disabled');\n }\n\n html = '';\n year = parseInt(year / 10, 10) * 10;\n var yearCont = this.setTitle('.datetimepicker-years', year + '-' + (year + 9))\n .end()\n .find('td');\n year -= 1;\n for (var i = -1; i < 11; i++) {\n html += ' endYear ? ' disabled' : '') + '\">' + year + '';\n year += 1;\n }\n yearCont.html(html);\n this.place();\n },\n\n updateNavArrows: function () {\n var d = new Date(this.viewDate),\n year = d.getUTCFullYear(),\n month = d.getUTCMonth(),\n day = d.getUTCDate(),\n hour = d.getUTCHours();\n switch (this.viewMode) {\n case 0:\n if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear()\n && month <= this.startDate.getUTCMonth()\n && day <= this.startDate.getUTCDate()\n && hour <= this.startDate.getUTCHours()) {\n this.picker.find('.prev').css({visibility: 'hidden'});\n } else {\n this.picker.find('.prev').css({visibility: 'visible'});\n }\n if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear()\n && month >= this.endDate.getUTCMonth()\n && day >= this.endDate.getUTCDate()\n && hour >= this.endDate.getUTCHours()) {\n this.picker.find('.next').css({visibility: 'hidden'});\n } else {\n this.picker.find('.next').css({visibility: 'visible'});\n }\n break;\n case 1:\n if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear()\n && month <= this.startDate.getUTCMonth()\n && day <= this.startDate.getUTCDate()) {\n this.picker.find('.prev').css({visibility: 'hidden'});\n } else {\n this.picker.find('.prev').css({visibility: 'visible'});\n }\n if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear()\n && month >= this.endDate.getUTCMonth()\n && day >= this.endDate.getUTCDate()) {\n this.picker.find('.next').css({visibility: 'hidden'});\n } else {\n this.picker.find('.next').css({visibility: 'visible'});\n }\n break;\n case 2:\n if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear()\n && month <= this.startDate.getUTCMonth()) {\n this.picker.find('.prev').css({visibility: 'hidden'});\n } else {\n this.picker.find('.prev').css({visibility: 'visible'});\n }\n if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear()\n && month >= this.endDate.getUTCMonth()) {\n this.picker.find('.next').css({visibility: 'hidden'});\n } else {\n this.picker.find('.next').css({visibility: 'visible'});\n }\n break;\n case 3:\n case 4:\n if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear()) {\n this.picker.find('.prev').css({visibility: 'hidden'});\n } else {\n this.picker.find('.prev').css({visibility: 'visible'});\n }\n if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear()) {\n this.picker.find('.next').css({visibility: 'hidden'});\n } else {\n this.picker.find('.next').css({visibility: 'visible'});\n }\n break;\n }\n },\n\n mousewheel: function (e) {\n\n e.preventDefault();\n e.stopPropagation();\n\n if (this.wheelPause) {\n return;\n }\n\n this.wheelPause = true;\n\n var originalEvent = e.originalEvent;\n\n var delta = originalEvent.wheelDelta;\n\n var mode = delta > 0 ? 1 : (delta === 0) ? 0 : -1;\n\n if (this.wheelViewModeNavigationInverseDirection) {\n mode = -mode;\n }\n\n this.showMode(mode);\n\n setTimeout($.proxy(function () {\n\n this.wheelPause = false\n\n }, this), this.wheelViewModeNavigationDelay);\n\n },\n\n click: function (e) {\n e.stopPropagation();\n e.preventDefault();\n var target = $(e.target).closest('span, td, th, legend');\n if (target.is('.' + this.icontype)) {\n target = $(target).parent().closest('span, td, th, legend');\n }\n if (target.length == 1) {\n if (target.is('.disabled')) {\n this.element.trigger({\n type: 'outOfRange',\n date: this.viewDate,\n startDate: this.startDate,\n endDate: this.endDate\n });\n return;\n }\n switch (target[0].nodeName.toLowerCase()) {\n case 'th':\n switch (target[0].className) {\n case 'switch':\n this.showMode(1);\n break;\n case 'prev':\n case 'next':\n var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className == 'prev' ? -1 : 1);\n switch (this.viewMode) {\n case 0:\n this.viewDate = this.moveHour(this.viewDate, dir);\n break;\n case 1:\n this.viewDate = this.moveDate(this.viewDate, dir);\n break;\n case 2:\n this.viewDate = this.moveMonth(this.viewDate, dir);\n break;\n case 3:\n case 4:\n this.viewDate = this.moveYear(this.viewDate, dir);\n break;\n }\n this.fill();\n this.element.trigger({\n type: target[0].className + ':' + this.convertViewModeText(this.viewMode),\n date: this.viewDate,\n startDate: this.startDate,\n endDate: this.endDate\n });\n break;\n case 'clear':\n this.reset();\n if (this.autoclose) {\n this.hide();\n }\n break;\n case 'today':\n var date = new Date();\n date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0);\n\n // Respect startDate and endDate.\n if (date < this.startDate) date = this.startDate;\n else if (date > this.endDate) date = this.endDate;\n\n this.viewMode = this.startViewMode;\n this.showMode(0);\n this._setDate(date);\n this.fill();\n if (this.autoclose) {\n this.hide();\n }\n break;\n }\n break;\n case 'span':\n if (!target.is('.disabled')) {\n var year = this.viewDate.getUTCFullYear(),\n month = this.viewDate.getUTCMonth(),\n day = this.viewDate.getUTCDate(),\n hours = this.viewDate.getUTCHours(),\n minutes = this.viewDate.getUTCMinutes(),\n seconds = this.viewDate.getUTCSeconds();\n\n if (target.is('.month')) {\n this.viewDate.setUTCDate(1);\n month = target.parent().find('span').index(target);\n day = this.viewDate.getUTCDate();\n this.viewDate.setUTCMonth(month);\n this.element.trigger({\n type: 'changeMonth',\n date: this.viewDate\n });\n if (this.viewSelect >= 3) {\n this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0));\n }\n } else if (target.is('.year')) {\n this.viewDate.setUTCDate(1);\n year = parseInt(target.text(), 10) || 0;\n this.viewDate.setUTCFullYear(year);\n this.element.trigger({\n type: 'changeYear',\n date: this.viewDate\n });\n if (this.viewSelect >= 4) {\n this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0));\n }\n } else if (target.is('.hour')) {\n hours = parseInt(target.text(), 10) || 0;\n if (target.hasClass('hour_am') || target.hasClass('hour_pm')) {\n if (hours == 12 && target.hasClass('hour_am')) {\n hours = 0;\n } else if (hours != 12 && target.hasClass('hour_pm')) {\n hours += 12;\n }\n }\n this.viewDate.setUTCHours(hours);\n this.element.trigger({\n type: 'changeHour',\n date: this.viewDate\n });\n if (this.viewSelect >= 1) {\n this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0));\n }\n } else if (target.is('.minute')) {\n minutes = parseInt(target.text().substr(target.text().indexOf(':') + 1), 10) || 0;\n this.viewDate.setUTCMinutes(minutes);\n this.element.trigger({\n type: 'changeMinute',\n date: this.viewDate\n });\n if (this.viewSelect >= 0) {\n this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0));\n }\n }\n if (this.viewMode != 0) {\n var oldViewMode = this.viewMode;\n this.showMode(-1);\n this.fill();\n if (oldViewMode == this.viewMode && this.autoclose) {\n this.hide();\n }\n } else {\n this.fill();\n if (this.autoclose) {\n this.hide();\n }\n }\n }\n break;\n case 'td':\n if (target.is('.day') && !target.is('.disabled')) {\n var day = parseInt(target.text(), 10) || 1;\n var year = this.viewDate.getUTCFullYear(),\n month = this.viewDate.getUTCMonth(),\n hours = this.viewDate.getUTCHours(),\n minutes = this.viewDate.getUTCMinutes(),\n seconds = this.viewDate.getUTCSeconds();\n if (target.is('.old')) {\n if (month === 0) {\n month = 11;\n year -= 1;\n } else {\n month -= 1;\n }\n } else if (target.is('.new')) {\n if (month == 11) {\n month = 0;\n year += 1;\n } else {\n month += 1;\n }\n }\n this.viewDate.setUTCFullYear(year);\n this.viewDate.setUTCMonth(month, day);\n this.element.trigger({\n type: 'changeDay',\n date: this.viewDate\n });\n if (this.viewSelect >= 2) {\n this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0));\n }\n }\n var oldViewMode = this.viewMode;\n this.showMode(-1);\n this.fill();\n if (oldViewMode == this.viewMode && this.autoclose) {\n this.hide();\n }\n break;\n }\n }\n },\n\n _setDate: function (date, which) {\n if (!which || which == 'date')\n this.date = date;\n if (!which || which == 'view')\n this.viewDate = date;\n this.fill();\n this.setValue();\n var element;\n if (this.isInput) {\n element = this.element;\n } else if (this.component) {\n element = this.element.find('input');\n }\n if (element) {\n element.change();\n if (this.autoclose && (!which || which == 'date')) {\n //this.hide();\n }\n }\n this.element.trigger({\n type: 'changeDate',\n date: this.getDate()\n });\n if(date == null)\n this.date = this.viewDate;\n },\n\n moveMinute: function (date, dir) {\n if (!dir) return date;\n var new_date = new Date(date.valueOf());\n //dir = dir > 0 ? 1 : -1;\n new_date.setUTCMinutes(new_date.getUTCMinutes() + (dir * this.minuteStep));\n return new_date;\n },\n\n moveHour: function (date, dir) {\n if (!dir) return date;\n var new_date = new Date(date.valueOf());\n //dir = dir > 0 ? 1 : -1;\n new_date.setUTCHours(new_date.getUTCHours() + dir);\n return new_date;\n },\n\n moveDate: function (date, dir) {\n if (!dir) return date;\n var new_date = new Date(date.valueOf());\n //dir = dir > 0 ? 1 : -1;\n new_date.setUTCDate(new_date.getUTCDate() + dir);\n return new_date;\n },\n\n moveMonth: function (date, dir) {\n if (!dir) return date;\n var new_date = new Date(date.valueOf()),\n day = new_date.getUTCDate(),\n month = new_date.getUTCMonth(),\n mag = Math.abs(dir),\n new_month, test;\n dir = dir > 0 ? 1 : -1;\n if (mag == 1) {\n test = dir == -1\n // If going back one month, make sure month is not current month\n // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)\n ? function () {\n return new_date.getUTCMonth() == month;\n }\n // If going forward one month, make sure month is as expected\n // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)\n : function () {\n return new_date.getUTCMonth() != new_month;\n };\n new_month = month + dir;\n new_date.setUTCMonth(new_month);\n // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11\n if (new_month < 0 || new_month > 11)\n new_month = (new_month + 12) % 12;\n } else {\n // For magnitudes >1, move one month at a time...\n for (var i = 0; i < mag; i++)\n // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...\n new_date = this.moveMonth(new_date, dir);\n // ...then reset the day, keeping it in the new month\n new_month = new_date.getUTCMonth();\n new_date.setUTCDate(day);\n test = function () {\n return new_month != new_date.getUTCMonth();\n };\n }\n // Common date-resetting loop -- if date is beyond end of month, make it\n // end of month\n while (test()) {\n new_date.setUTCDate(--day);\n new_date.setUTCMonth(new_month);\n }\n return new_date;\n },\n\n moveYear: function (date, dir) {\n return this.moveMonth(date, dir * 12);\n },\n\n dateWithinRange: function (date) {\n return date >= this.startDate && date <= this.endDate;\n },\n\n keydown: function (e) {\n if (this.picker.is(':not(:visible)')) {\n if (e.keyCode == 27) // allow escape to hide and re-show picker\n this.show();\n return;\n }\n var dateChanged = false,\n dir, day, month,\n newDate, newViewDate;\n switch (e.keyCode) {\n case 27: // escape\n this.hide();\n e.preventDefault();\n break;\n case 37: // left\n case 39: // right\n if (!this.keyboardNavigation) break;\n dir = e.keyCode == 37 ? -1 : 1;\n viewMode = this.viewMode;\n if (e.ctrlKey) {\n viewMode += 2;\n } else if (e.shiftKey) {\n viewMode += 1;\n }\n if (viewMode == 4) {\n newDate = this.moveYear(this.date, dir);\n newViewDate = this.moveYear(this.viewDate, dir);\n } else if (viewMode == 3) {\n newDate = this.moveMonth(this.date, dir);\n newViewDate = this.moveMonth(this.viewDate, dir);\n } else if (viewMode == 2) {\n newDate = this.moveDate(this.date, dir);\n newViewDate = this.moveDate(this.viewDate, dir);\n } else if (viewMode == 1) {\n newDate = this.moveHour(this.date, dir);\n newViewDate = this.moveHour(this.viewDate, dir);\n } else if (viewMode == 0) {\n newDate = this.moveMinute(this.date, dir);\n newViewDate = this.moveMinute(this.viewDate, dir);\n }\n if (this.dateWithinRange(newDate)) {\n this.date = newDate;\n this.viewDate = newViewDate;\n this.setValue();\n this.update();\n e.preventDefault();\n dateChanged = true;\n }\n break;\n case 38: // up\n case 40: // down\n if (!this.keyboardNavigation) break;\n dir = e.keyCode == 38 ? -1 : 1;\n viewMode = this.viewMode;\n if (e.ctrlKey) {\n viewMode += 2;\n } else if (e.shiftKey) {\n viewMode += 1;\n }\n if (viewMode == 4) {\n newDate = this.moveYear(this.date, dir);\n newViewDate = this.moveYear(this.viewDate, dir);\n } else if (viewMode == 3) {\n newDate = this.moveMonth(this.date, dir);\n newViewDate = this.moveMonth(this.viewDate, dir);\n } else if (viewMode == 2) {\n newDate = this.moveDate(this.date, dir * 7);\n newViewDate = this.moveDate(this.viewDate, dir * 7);\n } else if (viewMode == 1) {\n if (this.showMeridian) {\n newDate = this.moveHour(this.date, dir * 6);\n newViewDate = this.moveHour(this.viewDate, dir * 6);\n } else {\n newDate = this.moveHour(this.date, dir * 4);\n newViewDate = this.moveHour(this.viewDate, dir * 4);\n }\n } else if (viewMode == 0) {\n newDate = this.moveMinute(this.date, dir * 4);\n newViewDate = this.moveMinute(this.viewDate, dir * 4);\n }\n if (this.dateWithinRange(newDate)) {\n this.date = newDate;\n this.viewDate = newViewDate;\n this.setValue();\n this.update();\n e.preventDefault();\n dateChanged = true;\n }\n break;\n case 13: // enter\n if (this.viewMode != 0) {\n var oldViewMode = this.viewMode;\n this.showMode(-1);\n this.fill();\n if (oldViewMode == this.viewMode && this.autoclose) {\n this.hide();\n }\n } else {\n this.fill();\n if (this.autoclose) {\n this.hide();\n }\n }\n e.preventDefault();\n break;\n case 9: // tab\n this.hide();\n break;\n }\n if (dateChanged) {\n var element;\n if (this.isInput) {\n element = this.element;\n } else if (this.component) {\n element = this.element.find('input');\n }\n if (element) {\n element.change();\n }\n this.element.trigger({\n type: 'changeDate',\n date: this.getDate()\n });\n }\n },\n\n showMode: function (dir) {\n if (dir) {\n var newViewMode = Math.max(0, Math.min(DPGlobal.modes.length - 1, this.viewMode + dir));\n if (newViewMode >= this.minView && newViewMode <= this.maxView) {\n this.element.trigger({\n type: 'changeMode',\n date: this.viewDate,\n oldViewMode: this.viewMode,\n newViewMode: newViewMode\n });\n\n this.viewMode = newViewMode;\n }\n }\n /*\n vitalets: fixing bug of very special conditions:\n jquery 1.7.1 + webkit + show inline datetimepicker in bootstrap popover.\n Method show() does not set display css correctly and datetimepicker is not shown.\n Changed to .css('display', 'block') solve the problem.\n See https://github.com/vitalets/x-editable/issues/37\n\n In jquery 1.7.2+ everything works fine.\n */\n //this.picker.find('>div').hide().filter('.datetimepicker-'+DPGlobal.modes[this.viewMode].clsName).show();\n this.picker.find('>div').hide().filter('.datetimepicker-' + DPGlobal.modes[this.viewMode].clsName).css('display', 'block');\n this.updateNavArrows();\n },\n\n reset: function (e) {\n this._setDate(null, 'date');\n },\n\n convertViewModeText: function (viewMode) {\n switch (viewMode) {\n case 4:\n return 'decade';\n case 3:\n return 'year';\n case 2:\n return 'month';\n case 1:\n return 'day';\n case 0:\n return 'hour';\n }\n }\n };\n\n var old = $.fn.datetimepicker;\n $.fn.datetimepicker = function (option) {\n var args = Array.apply(null, arguments);\n args.shift();\n var internal_return;\n this.each(function () {\n var $this = $(this),\n data = $this.data('datetimepicker'),\n options = typeof option == 'object' && option;\n if (!data) {\n $this.data('datetimepicker', (data = new Datetimepicker(this, $.extend({}, $.fn.datetimepicker.defaults, options))));\n }\n if (typeof option == 'string' && typeof data[option] == 'function') {\n internal_return = data[option].apply(data, args);\n if (internal_return !== undefined) {\n return false;\n }\n }\n });\n if (internal_return !== undefined)\n return internal_return;\n else\n return this;\n };\n\n $.fn.datetimepicker.defaults = {\n };\n $.fn.datetimepicker.Constructor = Datetimepicker;\n var dates = $.fn.datetimepicker.dates = {\n en: {\n days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'],\n daysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],\n daysMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'],\n months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],\n monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\n meridiem: ['am', 'pm'],\n suffix: ['st', 'nd', 'rd', 'th'],\n today: 'Today',\n clear: 'Clear'\n }\n };\n\n var DPGlobal = {\n modes: [\n {\n clsName: 'minutes',\n navFnc: 'Hours',\n navStep: 1\n },\n {\n clsName: 'hours',\n navFnc: 'Date',\n navStep: 1\n },\n {\n clsName: 'days',\n navFnc: 'Month',\n navStep: 1\n },\n {\n clsName: 'months',\n navFnc: 'FullYear',\n navStep: 1\n },\n {\n clsName: 'years',\n navFnc: 'FullYear',\n navStep: 10\n }\n ],\n isLeapYear: function (year) {\n return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0))\n },\n getDaysInMonth: function (year, month) {\n return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]\n },\n getDefaultFormat: function (type, field) {\n if (type == 'standard') {\n if (field == 'input')\n return 'yyyy-mm-dd hh:ii';\n else\n return 'yyyy-mm-dd hh:ii:ss';\n } else if (type == 'php') {\n if (field == 'input')\n return 'Y-m-d H:i';\n else\n return 'Y-m-d H:i:s';\n } else {\n throw new Error('Invalid format type.');\n }\n },\n validParts: function (type) {\n if (type == 'standard') {\n return /t|hh?|HH?|p|P|ii?|ss?|dd?|DD?|mm?|MM?|yy(?:yy)?/g;\n } else if (type == 'php') {\n return /[dDjlNwzFmMnStyYaABgGhHis]/g;\n } else {\n throw new Error('Invalid format type.');\n }\n },\n nonpunctuation: /[^ -\\/:-@\\[-`{-~\\t\\n\\rTZ]+/g,\n parseFormat: function (format, type) {\n // IE treats \\0 as a string end in inputs (truncating the value),\n // so it's a bad format delimiter, anyway\n var separators = format.replace(this.validParts(type), '\\0').split('\\0'),\n parts = format.match(this.validParts(type));\n if (!separators || !separators.length || !parts || parts.length == 0) {\n throw new Error('Invalid date format.');\n }\n return {separators: separators, parts: parts};\n },\n parseDate: function (date, format, language, type) {\n if (date instanceof Date) {\n var dateUTC = new Date(date.valueOf() - date.getTimezoneOffset() * 60000);\n dateUTC.setMilliseconds(0);\n return dateUTC;\n }\n if (/^\\d{4}\\-\\d{1,2}\\-\\d{1,2}$/.test(date)) {\n format = this.parseFormat('yyyy-mm-dd', type);\n }\n if (/^\\d{4}\\-\\d{1,2}\\-\\d{1,2}[T ]\\d{1,2}\\:\\d{1,2}$/.test(date)) {\n format = this.parseFormat('yyyy-mm-dd hh:ii', type);\n }\n if (/^\\d{4}\\-\\d{1,2}\\-\\d{1,2}[T ]\\d{1,2}\\:\\d{1,2}\\:\\d{1,2}[Z]{0,1}$/.test(date)) {\n format = this.parseFormat('yyyy-mm-dd hh:ii:ss', type);\n }\n if (/^[-+]\\d+[dmwy]([\\s,]+[-+]\\d+[dmwy])*$/.test(date)) {\n var part_re = /([-+]\\d+)([dmwy])/,\n parts = date.match(/([-+]\\d+)([dmwy])/g),\n part, dir;\n date = new Date();\n for (var i = 0; i < parts.length; i++) {\n part = part_re.exec(parts[i]);\n dir = parseInt(part[1]);\n switch (part[2]) {\n case 'd':\n date.setUTCDate(date.getUTCDate() + dir);\n break;\n case 'm':\n date = Datetimepicker.prototype.moveMonth.call(Datetimepicker.prototype, date, dir);\n break;\n case 'w':\n date.setUTCDate(date.getUTCDate() + dir * 7);\n break;\n case 'y':\n date = Datetimepicker.prototype.moveYear.call(Datetimepicker.prototype, date, dir);\n break;\n }\n }\n return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), 0);\n }\n var parts = date && date.toString().match(this.nonpunctuation) || [],\n date = new Date(0, 0, 0, 0, 0, 0, 0),\n parsed = {},\n setters_order = ['hh', 'h', 'ii', 'i', 'ss', 's', 'yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'D', 'DD', 'd', 'dd', 'H', 'HH', 'p', 'P'],\n setters_map = {\n hh: function (d, v) {\n return d.setUTCHours(v);\n },\n h: function (d, v) {\n return d.setUTCHours(v);\n },\n HH: function (d, v) {\n return d.setUTCHours(v == 12 ? 0 : v);\n },\n H: function (d, v) {\n return d.setUTCHours(v == 12 ? 0 : v);\n },\n ii: function (d, v) {\n return d.setUTCMinutes(v);\n },\n i: function (d, v) {\n return d.setUTCMinutes(v);\n },\n ss: function (d, v) {\n return d.setUTCSeconds(v);\n },\n s: function (d, v) {\n return d.setUTCSeconds(v);\n },\n yyyy: function (d, v) {\n return d.setUTCFullYear(v);\n },\n yy: function (d, v) {\n return d.setUTCFullYear(2000 + v);\n },\n m: function (d, v) {\n v -= 1;\n while (v < 0) v += 12;\n v %= 12;\n d.setUTCMonth(v);\n while (d.getUTCMonth() != v)\n if (isNaN(d.getUTCMonth()))\n return d;\n else\n d.setUTCDate(d.getUTCDate() - 1);\n return d;\n },\n d: function (d, v) {\n return d.setUTCDate(v);\n },\n p: function (d, v) {\n return d.setUTCHours(v == 1 ? d.getUTCHours() + 12 : d.getUTCHours());\n }\n },\n val, filtered, part;\n setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];\n setters_map['dd'] = setters_map['d'];\n setters_map['P'] = setters_map['p'];\n date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds());\n if (parts.length == format.parts.length) {\n for (var i = 0, cnt = format.parts.length; i < cnt; i++) {\n val = parseInt(parts[i], 10);\n part = format.parts[i];\n if (isNaN(val)) {\n switch (part) {\n case 'MM':\n filtered = $(dates[language].months).filter(function () {\n var m = this.slice(0, parts[i].length),\n p = parts[i].slice(0, m.length);\n return m == p;\n });\n val = $.inArray(filtered[0], dates[language].months) + 1;\n break;\n case 'M':\n filtered = $(dates[language].monthsShort).filter(function () {\n var m = this.slice(0, parts[i].length),\n p = parts[i].slice(0, m.length);\n return m.toLowerCase() == p.toLowerCase();\n });\n val = $.inArray(filtered[0], dates[language].monthsShort) + 1;\n break;\n case 'p':\n case 'P':\n val = $.inArray(parts[i].toLowerCase(), dates[language].meridiem);\n break;\n }\n }\n parsed[part] = val;\n }\n for (var i = 0, s; i < setters_order.length; i++) {\n s = setters_order[i];\n if (s in parsed && !isNaN(parsed[s]))\n setters_map[s](date, parsed[s])\n }\n }\n return date;\n },\n formatDate: function (date, format, language, type) {\n if (date == null) {\n return '';\n }\n var val;\n if (type == 'standard') {\n val = {\n t: date.getTime(),\n // year\n yy: date.getUTCFullYear().toString().substring(2),\n yyyy: date.getUTCFullYear(),\n // month\n m: date.getUTCMonth() + 1,\n M: dates[language].monthsShort[date.getUTCMonth()],\n MM: dates[language].months[date.getUTCMonth()],\n // day\n d: date.getUTCDate(),\n D: dates[language].daysShort[date.getUTCDay()],\n DD: dates[language].days[date.getUTCDay()],\n p: (dates[language].meridiem.length == 2 ? dates[language].meridiem[date.getUTCHours() < 12 ? 0 : 1] : ''),\n // hour\n h: date.getUTCHours(),\n // minute\n i: date.getUTCMinutes(),\n // second\n s: date.getUTCSeconds()\n };\n\n if (dates[language].meridiem.length == 2) {\n val.H = (val.h % 12 == 0 ? 12 : val.h % 12);\n }\n else {\n val.H = val.h;\n }\n val.HH = (val.H < 10 ? '0' : '') + val.H;\n val.P = val.p.toUpperCase();\n val.hh = (val.h < 10 ? '0' : '') + val.h;\n val.ii = (val.i < 10 ? '0' : '') + val.i;\n val.ss = (val.s < 10 ? '0' : '') + val.s;\n val.dd = (val.d < 10 ? '0' : '') + val.d;\n val.mm = (val.m < 10 ? '0' : '') + val.m;\n } else if (type == 'php') {\n // php format\n val = {\n // year\n y: date.getUTCFullYear().toString().substring(2),\n Y: date.getUTCFullYear(),\n // month\n F: dates[language].months[date.getUTCMonth()],\n M: dates[language].monthsShort[date.getUTCMonth()],\n n: date.getUTCMonth() + 1,\n t: DPGlobal.getDaysInMonth(date.getUTCFullYear(), date.getUTCMonth()),\n // day\n j: date.getUTCDate(),\n l: dates[language].days[date.getUTCDay()],\n D: dates[language].daysShort[date.getUTCDay()],\n w: date.getUTCDay(), // 0 -> 6\n N: (date.getUTCDay() == 0 ? 7 : date.getUTCDay()), // 1 -> 7\n S: (date.getUTCDate() % 10 <= dates[language].suffix.length ? dates[language].suffix[date.getUTCDate() % 10 - 1] : ''),\n // hour\n a: (dates[language].meridiem.length == 2 ? dates[language].meridiem[date.getUTCHours() < 12 ? 0 : 1] : ''),\n g: (date.getUTCHours() % 12 == 0 ? 12 : date.getUTCHours() % 12),\n G: date.getUTCHours(),\n // minute\n i: date.getUTCMinutes(),\n // second\n s: date.getUTCSeconds()\n };\n val.m = (val.n < 10 ? '0' : '') + val.n;\n val.d = (val.j < 10 ? '0' : '') + val.j;\n val.A = val.a.toString().toUpperCase();\n val.h = (val.g < 10 ? '0' : '') + val.g;\n val.H = (val.G < 10 ? '0' : '') + val.G;\n val.i = (val.i < 10 ? '0' : '') + val.i;\n val.s = (val.s < 10 ? '0' : '') + val.s;\n } else {\n throw new Error('Invalid format type.');\n }\n var date = [],\n seps = $.extend([], format.separators);\n for (var i = 0, cnt = format.parts.length; i < cnt; i++) {\n if (seps.length) {\n date.push(seps.shift());\n }\n date.push(val[format.parts[i]]);\n }\n if (seps.length) {\n date.push(seps.shift());\n }\n return date.join('');\n },\n convertViewMode: function (viewMode) {\n switch (viewMode) {\n case 4:\n case 'decade':\n viewMode = 4;\n break;\n case 3:\n case 'year':\n viewMode = 3;\n break;\n case 2:\n case 'month':\n viewMode = 2;\n break;\n case 1:\n case 'day':\n viewMode = 1;\n break;\n case 0:\n case 'hour':\n viewMode = 0;\n break;\n }\n\n return viewMode;\n },\n headTemplate: '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '',\n headTemplateV3: '' +\n '' +\n ' ' +\n '' +\n ' ' +\n '' +\n '',\n contTemplate: '',\n footTemplate: '' + \n '' +\n '' +\n ''\n };\n DPGlobal.template = '
    ' +\n '
    ' +\n '' +\n DPGlobal.headTemplate +\n DPGlobal.contTemplate +\n DPGlobal.footTemplate +\n '
    ' +\n '
    ' +\n '
    ' +\n '' +\n DPGlobal.headTemplate +\n DPGlobal.contTemplate +\n DPGlobal.footTemplate +\n '
    ' +\n '
    ' +\n '
    ' +\n '' +\n DPGlobal.headTemplate +\n '' +\n DPGlobal.footTemplate +\n '
    ' +\n '
    ' +\n '
    ' +\n '' +\n DPGlobal.headTemplate +\n DPGlobal.contTemplate +\n DPGlobal.footTemplate +\n '
    ' +\n '
    ' +\n '
    ' +\n '' +\n DPGlobal.headTemplate +\n DPGlobal.contTemplate +\n DPGlobal.footTemplate +\n '
    ' +\n '
    ' +\n '
    ';\n DPGlobal.templateV3 = '
    ' +\n '
    ' +\n '' +\n DPGlobal.headTemplateV3 +\n DPGlobal.contTemplate +\n DPGlobal.footTemplate +\n '
    ' +\n '
    ' +\n '
    ' +\n '' +\n DPGlobal.headTemplateV3 +\n DPGlobal.contTemplate +\n DPGlobal.footTemplate +\n '
    ' +\n '
    ' +\n '
    ' +\n '' +\n DPGlobal.headTemplateV3 +\n '' +\n DPGlobal.footTemplate +\n '
    ' +\n '
    ' +\n '
    ' +\n '' +\n DPGlobal.headTemplateV3 +\n DPGlobal.contTemplate +\n DPGlobal.footTemplate +\n '
    ' +\n '
    ' +\n '
    ' +\n '' +\n DPGlobal.headTemplateV3 +\n DPGlobal.contTemplate +\n DPGlobal.footTemplate +\n '
    ' +\n '
    ' +\n '
    ';\n $.fn.datetimepicker.DPGlobal = DPGlobal;\n\n /* DATETIMEPICKER NO CONFLICT\n * =================== */\n\n $.fn.datetimepicker.noConflict = function () {\n $.fn.datetimepicker = old;\n return this;\n };\n\n /* DATETIMEPICKER DATA-API\n * ================== */\n\n $(document).on(\n 'focus.datetimepicker.data-api click.datetimepicker.data-api',\n '[data-provide=\"datetimepicker\"]',\n function (e) {\n var $this = $(this);\n if ($this.data('datetimepicker')) return;\n e.preventDefault();\n // component click requires us to explicitly show it\n $this.datetimepicker('show');\n }\n );\n $(function () {\n $('[data-provide=\"datetimepicker-inline\"]').datetimepicker();\n });\n\n}));\n"} +{"text": "from chainer_compiler.elichika.typing.types import *\n\n__all__ = [ 'check_dtype'\n ]\n\ndef check_dtype(module, dtype):\n for m in module.parameters():\n assert torch_dtype_to_np_dtype(m.dtype) == dtype, \\\n \"dtype mismatch in {}\".format(type(module).__name__)\n # Checking the first param is enough\n return\n"} +{"text": "{\r\n \"version\": \"4.4.2\",\r\n \"description\": \"Capture directory sizes and memory guzzlers.\",\r\n \"homepage\": \"https://www.jam-software.com/treesize_free\",\r\n \"license\": {\r\n \"identifier\": \"Freeware\",\r\n \"url\": \"https://www.jam-software.de/company/freeware_license.shtml\"\r\n },\r\n \"url\": \"https://downloads.jam-software.de/treesize_free/TreeSizeFree-Portable.zip\",\r\n \"hash\": \"dee01660b32073709a74ed6241fd3454053b68ee046afc8cc413319d906b3cdb\",\r\n \"bin\": \"TreeSizeFree.exe\",\r\n \"shortcuts\": [\r\n [\r\n \"TreeSizeFree.exe\",\r\n \"TreeSize Free\"\r\n ]\r\n ],\r\n \"checkver\": {\r\n \"url\": \"https://www.jam-software.com/treesize_free/changes.shtml\",\r\n \"regex\": \"Version\\\\s+([\\\\d.]+)\"\r\n },\r\n \"autoupdate\": {\r\n \"url\": \"https://downloads.jam-software.de/treesize_free/TreeSizeFree-Portable.zip\"\r\n }\r\n}\r\n"} +{"text": "export { default as CollectionAdd } from './add';\nexport { default as CollectionUtil } from './util';\nexport { default as CollectionConversion } from './conversion';\nexport { default as CollectionFilter } from './filter';\nexport { default as CollectionRename } from './rename';\nexport { default as CollectionValidationRules } from './validation_rules';\nexport { default as ViewPipelineUpdater } from './update_view_pipeline';\n"} +{"text": "..\n Copyright 2009-2017 Ram Rachum. This work is licensed under a Creative\n Commons Attribution-ShareAlike 3.0 Unported License, with attribution to\n \"Ram Rachum at ram.rachum.com\" including link. The license may be obtained\n at http://creativecommons.org/licenses/by-sa/3.0/\n\n.. _topics-exceptions:\n\n:mod:`exceptions` - documentation not written\n======================================\n"} +{"text": "require('../../../modules/es6.array.slice');\nmodule.exports = require('../../../modules/_entry-virtual')('Array').slice;"} +{"text": "function Script_CECLM_menpo()\n\naddpath(genpath('../'));\n\n% Replace this with the location of the 300W data location\nif(exist([getenv('USERPROFILE') '/Dropbox/AAM/test data/'], 'file'))\n root_test_data = [getenv('USERPROFILE') '/Dropbox/AAM/test data/']; \nelse\n root_test_data = 'F:\\Dropbox\\AAM\\test data/';\nend\n[images, detections, labels] = Collect_wild_imgs(root_test_data);\n\n%% loading the CE-CLM model and parameters \n[patches, pdm, clmParams, early_term_params] = Load_CECLM_menpo();\n% Use the multi-hypothesis model, as bounding box tells nothing about\n% orientation\nviews = [0,0,0; 0,-30,0; 0,30,0; 0,0,30; 0,0,-30;];\nviews = views * pi/180; \n\n%% Setup recording\n\nnum_points = numel(pdm.M)/3;\n\nshapes_all = zeros(size(labels,2),size(labels,3), size(labels,1));\nlabels_all = zeros(size(labels,2),size(labels,3), size(labels,1));\nlhoods = zeros(numel(images),1);\nall_lmark_lhoods = zeros(num_points, numel(images));\nall_views_used = zeros(numel(images),1);\n\n% Change if you want to visualize the outputs\nverbose = true;\noutput_img = false;\n\nif(output_img)\n output_root = './ceclm_menpo_out/';\n if(~exist(output_root, 'dir'))\n mkdir(output_root);\n end\nend\nif(verbose)\n f = figure;\nend\n\n\n%% Fitting the model to the provided images\n\ntic\nfor i=1:numel(images)\n\n image = imread(images(i).img);\n image_orig = image;\n \n if(size(image,3) == 3)\n image = rgb2gray(image);\n end \n\n bbox = detections(i,:); \n \n % have a multi-view version\n [shape,~,~,lhood,lmark_lhood,view_used] =...\n Fitting_from_bb_multi_hyp(image, [], bbox, pdm, patches, clmParams, views, early_term_params);\n\n all_lmark_lhoods(:,i) = lmark_lhood;\n all_views_used(i) = view_used;\n\n shapes_all(:,:,i) = shape;\n labels_all(:,:,i) = labels(i,:,:);\n\n if(mod(i, 200)==0)\n fprintf('%d done\\n', i );\n end\n\n lhoods(i) = lhood;\n\n if(output_img)\n v_points = sum(squeeze(labels(i,:,:)),2) > 0;\n DrawFaceOnImg(image_orig, shape, sprintf('%s/%s%d.jpg', output_root, 'fit', i), bbox, v_points);\n end\n \n if(verbose)\n v_points = sum(squeeze(labels(i,:,:)),2) > 0;\n DrawFaceOnFig(image_orig, shape, bbox, v_points);\n end\nend\ntoc\n\nexperiment.errors_normed = compute_error(labels_all, shapes_all + 1.0);\nexperiment.lhoods = lhoods;\nexperiment.shapes = shapes_all;\nexperiment.labels = labels_all;\nexperiment.all_lmark_lhoods = all_lmark_lhoods;\nexperiment.all_views_used = all_views_used;\n\nfprintf('Done: mean normed error %.3f median normed error %.4f\\n', ...\n mean(experiment.errors_normed), median(experiment.errors_normed));\n\n%%\noutput_results = 'results/results_ceclm_menpo.mat';\nsave(output_results, 'experiment');\n \nend\n"} +{"text": "\n\n\n"} +{"text": "/*M///////////////////////////////////////////////////////////////////////////////////////\n//\n// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.\n//\n// By downloading, copying, installing or using the software you agree to this license.\n// If you do not agree to this license, do not download, install,\n// copy or use the software.\n//\n//\n// License Agreement\n// For Open Source Computer Vision Library\n//\n// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.\n// Copyright (C) 2009, Willow Garage Inc., all rights reserved.\n// Third party copyrights are property of their respective owners.\n//\n// Redistribution and use in source and binary forms, with or without modification,\n// are permitted provided that the following conditions are met:\n//\n// * Redistribution's of source code must retain the above copyright notice,\n// this list of conditions and the following disclaimer.\n//\n// * Redistribution's in binary form must reproduce the above copyright notice,\n// this list of conditions and the following disclaimer in the documentation\n// and/or other materials provided with the distribution.\n//\n// * The name of the copyright holders may not be used to endorse or promote products\n// derived from this software without specific prior written permission.\n//\n// This software is provided by the copyright holders and contributors \"as is\" and\n// any express or implied warranties, including, but not limited to, the implied\n// warranties of merchantability and fitness for a particular purpose are disclaimed.\n// In no event shall the Intel Corporation or contributors be liable for any direct,\n// indirect, incidental, special, exemplary, or consequential damages\n// (including, but not limited to, procurement of substitute goods or services;\n// loss of use, data, or profits; or business interruption) however caused\n// and on any theory of liability, whether in contract, strict liability,\n// or tort (including negligence or otherwise) arising in any way out of\n// the use of this software, even if advised of the possibility of such damage.\n//\n//M*/\n\n/*\n * Copyright (c) 2013 NVIDIA Corporation. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * Neither the name of NVIDIA Corporation nor the names of its contributors\n * may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef OPENCV_CUDA_SIMD_FUNCTIONS_HPP\n#define OPENCV_CUDA_SIMD_FUNCTIONS_HPP\n\n#include \"common.hpp\"\n\n/** @file\n * @deprecated Use @ref cudev instead.\n */\n\n//! @cond IGNORED\n\nnamespace cv { namespace cuda { namespace device\n{\n // 2\n\n static __device__ __forceinline__ unsigned int vadd2(unsigned int a, unsigned int b)\n {\n unsigned int r = 0;\n\n #if __CUDA_ARCH__ >= 300\n asm(\"vadd2.u32.u32.u32.sat %0, %1, %2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #elif __CUDA_ARCH__ >= 200\n asm(\"vadd.u32.u32.u32.sat %0.h0, %1.h0, %2.h0, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n asm(\"vadd.u32.u32.u32.sat %0.h1, %1.h1, %2.h1, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #else\n unsigned int s;\n s = a ^ b; // sum bits\n r = a + b; // actual sum\n s = s ^ r; // determine carry-ins for each bit position\n s = s & 0x00010000; // carry-in to high word (= carry-out from low word)\n r = r - s; // subtract out carry-out from low word\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vsub2(unsigned int a, unsigned int b)\n {\n unsigned int r = 0;\n\n #if __CUDA_ARCH__ >= 300\n asm(\"vsub2.u32.u32.u32.sat %0, %1, %2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #elif __CUDA_ARCH__ >= 200\n asm(\"vsub.u32.u32.u32.sat %0.h0, %1.h0, %2.h0, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n asm(\"vsub.u32.u32.u32.sat %0.h1, %1.h1, %2.h1, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #else\n unsigned int s;\n s = a ^ b; // sum bits\n r = a - b; // actual sum\n s = s ^ r; // determine carry-ins for each bit position\n s = s & 0x00010000; // borrow to high word\n r = r + s; // compensate for borrow from low word\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vabsdiff2(unsigned int a, unsigned int b)\n {\n unsigned int r = 0;\n\n #if __CUDA_ARCH__ >= 300\n asm(\"vabsdiff2.u32.u32.u32.sat %0, %1, %2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #elif __CUDA_ARCH__ >= 200\n asm(\"vabsdiff.u32.u32.u32.sat %0.h0, %1.h0, %2.h0, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n asm(\"vabsdiff.u32.u32.u32.sat %0.h1, %1.h1, %2.h1, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #else\n unsigned int s, t, u, v;\n s = a & 0x0000ffff; // extract low halfword\n r = b & 0x0000ffff; // extract low halfword\n u = ::max(r, s); // maximum of low halfwords\n v = ::min(r, s); // minimum of low halfwords\n s = a & 0xffff0000; // extract high halfword\n r = b & 0xffff0000; // extract high halfword\n t = ::max(r, s); // maximum of high halfwords\n s = ::min(r, s); // minimum of high halfwords\n r = u | t; // maximum of both halfwords\n s = v | s; // minimum of both halfwords\n r = r - s; // |a - b| = max(a,b) - min(a,b);\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vavg2(unsigned int a, unsigned int b)\n {\n unsigned int r, s;\n\n // HAKMEM #23: a + b = 2 * (a & b) + (a ^ b) ==>\n // (a + b) / 2 = (a & b) + ((a ^ b) >> 1)\n s = a ^ b;\n r = a & b;\n s = s & 0xfffefffe; // ensure shift doesn't cross halfword boundaries\n s = s >> 1;\n s = r + s;\n\n return s;\n }\n\n static __device__ __forceinline__ unsigned int vavrg2(unsigned int a, unsigned int b)\n {\n unsigned int r = 0;\n\n #if __CUDA_ARCH__ >= 300\n asm(\"vavrg2.u32.u32.u32 %0, %1, %2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #else\n // HAKMEM #23: a + b = 2 * (a | b) - (a ^ b) ==>\n // (a + b + 1) / 2 = (a | b) - ((a ^ b) >> 1)\n unsigned int s;\n s = a ^ b;\n r = a | b;\n s = s & 0xfffefffe; // ensure shift doesn't cross half-word boundaries\n s = s >> 1;\n r = r - s;\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vseteq2(unsigned int a, unsigned int b)\n {\n unsigned int r = 0;\n\n #if __CUDA_ARCH__ >= 300\n asm(\"vset2.u32.u32.eq %0, %1, %2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #else\n // inspired by Alan Mycroft's null-byte detection algorithm:\n // null_byte(x) = ((x - 0x01010101) & (~x & 0x80808080))\n unsigned int c;\n r = a ^ b; // 0x0000 if a == b\n c = r | 0x80008000; // set msbs, to catch carry out\n r = r ^ c; // extract msbs, msb = 1 if r < 0x8000\n c = c - 0x00010001; // msb = 0, if r was 0x0000 or 0x8000\n c = r & ~c; // msb = 1, if r was 0x0000\n r = c >> 15; // convert to bool\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vcmpeq2(unsigned int a, unsigned int b)\n {\n unsigned int r, c;\n\n #if __CUDA_ARCH__ >= 300\n r = vseteq2(a, b);\n c = r << 16; // convert bool\n r = c - r; // into mask\n #else\n // inspired by Alan Mycroft's null-byte detection algorithm:\n // null_byte(x) = ((x - 0x01010101) & (~x & 0x80808080))\n r = a ^ b; // 0x0000 if a == b\n c = r | 0x80008000; // set msbs, to catch carry out\n r = r ^ c; // extract msbs, msb = 1 if r < 0x8000\n c = c - 0x00010001; // msb = 0, if r was 0x0000 or 0x8000\n c = r & ~c; // msb = 1, if r was 0x0000\n r = c >> 15; // convert\n r = c - r; // msbs to\n r = c | r; // mask\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vsetge2(unsigned int a, unsigned int b)\n {\n unsigned int r = 0;\n\n #if __CUDA_ARCH__ >= 300\n asm(\"vset2.u32.u32.ge %0, %1, %2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #else\n unsigned int c;\n asm(\"not.b32 %0, %0;\" : \"+r\"(b));\n c = vavrg2(a, b); // (a + ~b + 1) / 2 = (a - b) / 2\n c = c & 0x80008000; // msb = carry-outs\n r = c >> 15; // convert to bool\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vcmpge2(unsigned int a, unsigned int b)\n {\n unsigned int r, c;\n\n #if __CUDA_ARCH__ >= 300\n r = vsetge2(a, b);\n c = r << 16; // convert bool\n r = c - r; // into mask\n #else\n asm(\"not.b32 %0, %0;\" : \"+r\"(b));\n c = vavrg2(a, b); // (a + ~b + 1) / 2 = (a - b) / 2\n c = c & 0x80008000; // msb = carry-outs\n r = c >> 15; // convert\n r = c - r; // msbs to\n r = c | r; // mask\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vsetgt2(unsigned int a, unsigned int b)\n {\n unsigned int r = 0;\n\n #if __CUDA_ARCH__ >= 300\n asm(\"vset2.u32.u32.gt %0, %1, %2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #else\n unsigned int c;\n asm(\"not.b32 %0, %0;\" : \"+r\"(b));\n c = vavg2(a, b); // (a + ~b) / 2 = (a - b) / 2 [rounded down]\n c = c & 0x80008000; // msbs = carry-outs\n r = c >> 15; // convert to bool\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vcmpgt2(unsigned int a, unsigned int b)\n {\n unsigned int r, c;\n\n #if __CUDA_ARCH__ >= 300\n r = vsetgt2(a, b);\n c = r << 16; // convert bool\n r = c - r; // into mask\n #else\n asm(\"not.b32 %0, %0;\" : \"+r\"(b));\n c = vavg2(a, b); // (a + ~b) / 2 = (a - b) / 2 [rounded down]\n c = c & 0x80008000; // msbs = carry-outs\n r = c >> 15; // convert\n r = c - r; // msbs to\n r = c | r; // mask\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vsetle2(unsigned int a, unsigned int b)\n {\n unsigned int r = 0;\n\n #if __CUDA_ARCH__ >= 300\n asm(\"vset2.u32.u32.le %0, %1, %2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #else\n unsigned int c;\n asm(\"not.b32 %0, %0;\" : \"+r\"(a));\n c = vavrg2(a, b); // (b + ~a + 1) / 2 = (b - a) / 2\n c = c & 0x80008000; // msb = carry-outs\n r = c >> 15; // convert to bool\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vcmple2(unsigned int a, unsigned int b)\n {\n unsigned int r, c;\n\n #if __CUDA_ARCH__ >= 300\n r = vsetle2(a, b);\n c = r << 16; // convert bool\n r = c - r; // into mask\n #else\n asm(\"not.b32 %0, %0;\" : \"+r\"(a));\n c = vavrg2(a, b); // (b + ~a + 1) / 2 = (b - a) / 2\n c = c & 0x80008000; // msb = carry-outs\n r = c >> 15; // convert\n r = c - r; // msbs to\n r = c | r; // mask\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vsetlt2(unsigned int a, unsigned int b)\n {\n unsigned int r = 0;\n\n #if __CUDA_ARCH__ >= 300\n asm(\"vset2.u32.u32.lt %0, %1, %2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #else\n unsigned int c;\n asm(\"not.b32 %0, %0;\" : \"+r\"(a));\n c = vavg2(a, b); // (b + ~a) / 2 = (b - a) / 2 [rounded down]\n c = c & 0x80008000; // msb = carry-outs\n r = c >> 15; // convert to bool\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vcmplt2(unsigned int a, unsigned int b)\n {\n unsigned int r, c;\n\n #if __CUDA_ARCH__ >= 300\n r = vsetlt2(a, b);\n c = r << 16; // convert bool\n r = c - r; // into mask\n #else\n asm(\"not.b32 %0, %0;\" : \"+r\"(a));\n c = vavg2(a, b); // (b + ~a) / 2 = (b - a) / 2 [rounded down]\n c = c & 0x80008000; // msb = carry-outs\n r = c >> 15; // convert\n r = c - r; // msbs to\n r = c | r; // mask\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vsetne2(unsigned int a, unsigned int b)\n {\n unsigned int r = 0;\n\n #if __CUDA_ARCH__ >= 300\n asm (\"vset2.u32.u32.ne %0, %1, %2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #else\n // inspired by Alan Mycroft's null-byte detection algorithm:\n // null_byte(x) = ((x - 0x01010101) & (~x & 0x80808080))\n unsigned int c;\n r = a ^ b; // 0x0000 if a == b\n c = r | 0x80008000; // set msbs, to catch carry out\n c = c - 0x00010001; // msb = 0, if r was 0x0000 or 0x8000\n c = r | c; // msb = 1, if r was not 0x0000\n c = c & 0x80008000; // extract msbs\n r = c >> 15; // convert to bool\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vcmpne2(unsigned int a, unsigned int b)\n {\n unsigned int r, c;\n\n #if __CUDA_ARCH__ >= 300\n r = vsetne2(a, b);\n c = r << 16; // convert bool\n r = c - r; // into mask\n #else\n // inspired by Alan Mycroft's null-byte detection algorithm:\n // null_byte(x) = ((x - 0x01010101) & (~x & 0x80808080))\n r = a ^ b; // 0x0000 if a == b\n c = r | 0x80008000; // set msbs, to catch carry out\n c = c - 0x00010001; // msb = 0, if r was 0x0000 or 0x8000\n c = r | c; // msb = 1, if r was not 0x0000\n c = c & 0x80008000; // extract msbs\n r = c >> 15; // convert\n r = c - r; // msbs to\n r = c | r; // mask\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vmax2(unsigned int a, unsigned int b)\n {\n unsigned int r = 0;\n\n #if __CUDA_ARCH__ >= 300\n asm(\"vmax2.u32.u32.u32 %0, %1, %2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #elif __CUDA_ARCH__ >= 200\n asm(\"vmax.u32.u32.u32 %0.h0, %1.h0, %2.h0, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n asm(\"vmax.u32.u32.u32 %0.h1, %1.h1, %2.h1, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #else\n unsigned int s, t, u;\n r = a & 0x0000ffff; // extract low halfword\n s = b & 0x0000ffff; // extract low halfword\n t = ::max(r, s); // maximum of low halfwords\n r = a & 0xffff0000; // extract high halfword\n s = b & 0xffff0000; // extract high halfword\n u = ::max(r, s); // maximum of high halfwords\n r = t | u; // combine halfword maximums\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vmin2(unsigned int a, unsigned int b)\n {\n unsigned int r = 0;\n\n #if __CUDA_ARCH__ >= 300\n asm(\"vmin2.u32.u32.u32 %0, %1, %2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #elif __CUDA_ARCH__ >= 200\n asm(\"vmin.u32.u32.u32 %0.h0, %1.h0, %2.h0, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n asm(\"vmin.u32.u32.u32 %0.h1, %1.h1, %2.h1, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #else\n unsigned int s, t, u;\n r = a & 0x0000ffff; // extract low halfword\n s = b & 0x0000ffff; // extract low halfword\n t = ::min(r, s); // minimum of low halfwords\n r = a & 0xffff0000; // extract high halfword\n s = b & 0xffff0000; // extract high halfword\n u = ::min(r, s); // minimum of high halfwords\n r = t | u; // combine halfword minimums\n #endif\n\n return r;\n }\n\n // 4\n\n static __device__ __forceinline__ unsigned int vadd4(unsigned int a, unsigned int b)\n {\n unsigned int r = 0;\n\n #if __CUDA_ARCH__ >= 300\n asm(\"vadd4.u32.u32.u32.sat %0, %1, %2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #elif __CUDA_ARCH__ >= 200\n asm(\"vadd.u32.u32.u32.sat %0.b0, %1.b0, %2.b0, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n asm(\"vadd.u32.u32.u32.sat %0.b1, %1.b1, %2.b1, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n asm(\"vadd.u32.u32.u32.sat %0.b2, %1.b2, %2.b2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n asm(\"vadd.u32.u32.u32.sat %0.b3, %1.b3, %2.b3, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #else\n unsigned int s, t;\n s = a ^ b; // sum bits\n r = a & 0x7f7f7f7f; // clear msbs\n t = b & 0x7f7f7f7f; // clear msbs\n s = s & 0x80808080; // msb sum bits\n r = r + t; // add without msbs, record carry-out in msbs\n r = r ^ s; // sum of msb sum and carry-in bits, w/o carry-out\n #endif /* __CUDA_ARCH__ >= 300 */\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vsub4(unsigned int a, unsigned int b)\n {\n unsigned int r = 0;\n\n #if __CUDA_ARCH__ >= 300\n asm(\"vsub4.u32.u32.u32.sat %0, %1, %2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #elif __CUDA_ARCH__ >= 200\n asm(\"vsub.u32.u32.u32.sat %0.b0, %1.b0, %2.b0, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n asm(\"vsub.u32.u32.u32.sat %0.b1, %1.b1, %2.b1, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n asm(\"vsub.u32.u32.u32.sat %0.b2, %1.b2, %2.b2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n asm(\"vsub.u32.u32.u32.sat %0.b3, %1.b3, %2.b3, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #else\n unsigned int s, t;\n s = a ^ ~b; // inverted sum bits\n r = a | 0x80808080; // set msbs\n t = b & 0x7f7f7f7f; // clear msbs\n s = s & 0x80808080; // inverted msb sum bits\n r = r - t; // subtract w/o msbs, record inverted borrows in msb\n r = r ^ s; // combine inverted msb sum bits and borrows\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vavg4(unsigned int a, unsigned int b)\n {\n unsigned int r, s;\n\n // HAKMEM #23: a + b = 2 * (a & b) + (a ^ b) ==>\n // (a + b) / 2 = (a & b) + ((a ^ b) >> 1)\n s = a ^ b;\n r = a & b;\n s = s & 0xfefefefe; // ensure following shift doesn't cross byte boundaries\n s = s >> 1;\n s = r + s;\n\n return s;\n }\n\n static __device__ __forceinline__ unsigned int vavrg4(unsigned int a, unsigned int b)\n {\n unsigned int r = 0;\n\n #if __CUDA_ARCH__ >= 300\n asm(\"vavrg4.u32.u32.u32 %0, %1, %2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #else\n // HAKMEM #23: a + b = 2 * (a | b) - (a ^ b) ==>\n // (a + b + 1) / 2 = (a | b) - ((a ^ b) >> 1)\n unsigned int c;\n c = a ^ b;\n r = a | b;\n c = c & 0xfefefefe; // ensure following shift doesn't cross byte boundaries\n c = c >> 1;\n r = r - c;\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vseteq4(unsigned int a, unsigned int b)\n {\n unsigned int r = 0;\n\n #if __CUDA_ARCH__ >= 300\n asm(\"vset4.u32.u32.eq %0, %1, %2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #else\n // inspired by Alan Mycroft's null-byte detection algorithm:\n // null_byte(x) = ((x - 0x01010101) & (~x & 0x80808080))\n unsigned int c;\n r = a ^ b; // 0x00 if a == b\n c = r | 0x80808080; // set msbs, to catch carry out\n r = r ^ c; // extract msbs, msb = 1 if r < 0x80\n c = c - 0x01010101; // msb = 0, if r was 0x00 or 0x80\n c = r & ~c; // msb = 1, if r was 0x00\n r = c >> 7; // convert to bool\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vcmpeq4(unsigned int a, unsigned int b)\n {\n unsigned int r, t;\n\n #if __CUDA_ARCH__ >= 300\n r = vseteq4(a, b);\n t = r << 8; // convert bool\n r = t - r; // to mask\n #else\n // inspired by Alan Mycroft's null-byte detection algorithm:\n // null_byte(x) = ((x - 0x01010101) & (~x & 0x80808080))\n t = a ^ b; // 0x00 if a == b\n r = t | 0x80808080; // set msbs, to catch carry out\n t = t ^ r; // extract msbs, msb = 1 if t < 0x80\n r = r - 0x01010101; // msb = 0, if t was 0x00 or 0x80\n r = t & ~r; // msb = 1, if t was 0x00\n t = r >> 7; // build mask\n t = r - t; // from\n r = t | r; // msbs\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vsetle4(unsigned int a, unsigned int b)\n {\n unsigned int r = 0;\n\n #if __CUDA_ARCH__ >= 300\n asm(\"vset4.u32.u32.le %0, %1, %2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #else\n unsigned int c;\n asm(\"not.b32 %0, %0;\" : \"+r\"(a));\n c = vavrg4(a, b); // (b + ~a + 1) / 2 = (b - a) / 2\n c = c & 0x80808080; // msb = carry-outs\n r = c >> 7; // convert to bool\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vcmple4(unsigned int a, unsigned int b)\n {\n unsigned int r, c;\n\n #if __CUDA_ARCH__ >= 300\n r = vsetle4(a, b);\n c = r << 8; // convert bool\n r = c - r; // to mask\n #else\n asm(\"not.b32 %0, %0;\" : \"+r\"(a));\n c = vavrg4(a, b); // (b + ~a + 1) / 2 = (b - a) / 2\n c = c & 0x80808080; // msbs = carry-outs\n r = c >> 7; // convert\n r = c - r; // msbs to\n r = c | r; // mask\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vsetlt4(unsigned int a, unsigned int b)\n {\n unsigned int r = 0;\n\n #if __CUDA_ARCH__ >= 300\n asm(\"vset4.u32.u32.lt %0, %1, %2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #else\n unsigned int c;\n asm(\"not.b32 %0, %0;\" : \"+r\"(a));\n c = vavg4(a, b); // (b + ~a) / 2 = (b - a) / 2 [rounded down]\n c = c & 0x80808080; // msb = carry-outs\n r = c >> 7; // convert to bool\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vcmplt4(unsigned int a, unsigned int b)\n {\n unsigned int r, c;\n\n #if __CUDA_ARCH__ >= 300\n r = vsetlt4(a, b);\n c = r << 8; // convert bool\n r = c - r; // to mask\n #else\n asm(\"not.b32 %0, %0;\" : \"+r\"(a));\n c = vavg4(a, b); // (b + ~a) / 2 = (b - a) / 2 [rounded down]\n c = c & 0x80808080; // msbs = carry-outs\n r = c >> 7; // convert\n r = c - r; // msbs to\n r = c | r; // mask\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vsetge4(unsigned int a, unsigned int b)\n {\n unsigned int r = 0;\n\n #if __CUDA_ARCH__ >= 300\n asm(\"vset4.u32.u32.ge %0, %1, %2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #else\n unsigned int c;\n asm(\"not.b32 %0, %0;\" : \"+r\"(b));\n c = vavrg4(a, b); // (a + ~b + 1) / 2 = (a - b) / 2\n c = c & 0x80808080; // msb = carry-outs\n r = c >> 7; // convert to bool\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vcmpge4(unsigned int a, unsigned int b)\n {\n unsigned int r, s;\n\n #if __CUDA_ARCH__ >= 300\n r = vsetge4(a, b);\n s = r << 8; // convert bool\n r = s - r; // to mask\n #else\n asm (\"not.b32 %0,%0;\" : \"+r\"(b));\n r = vavrg4 (a, b); // (a + ~b + 1) / 2 = (a - b) / 2\n r = r & 0x80808080; // msb = carry-outs\n s = r >> 7; // build mask\n s = r - s; // from\n r = s | r; // msbs\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vsetgt4(unsigned int a, unsigned int b)\n {\n unsigned int r = 0;\n\n #if __CUDA_ARCH__ >= 300\n asm(\"vset4.u32.u32.gt %0, %1, %2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #else\n unsigned int c;\n asm(\"not.b32 %0, %0;\" : \"+r\"(b));\n c = vavg4(a, b); // (a + ~b) / 2 = (a - b) / 2 [rounded down]\n c = c & 0x80808080; // msb = carry-outs\n r = c >> 7; // convert to bool\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vcmpgt4(unsigned int a, unsigned int b)\n {\n unsigned int r, c;\n\n #if __CUDA_ARCH__ >= 300\n r = vsetgt4(a, b);\n c = r << 8; // convert bool\n r = c - r; // to mask\n #else\n asm(\"not.b32 %0, %0;\" : \"+r\"(b));\n c = vavg4(a, b); // (a + ~b) / 2 = (a - b) / 2 [rounded down]\n c = c & 0x80808080; // msb = carry-outs\n r = c >> 7; // convert\n r = c - r; // msbs to\n r = c | r; // mask\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vsetne4(unsigned int a, unsigned int b)\n {\n unsigned int r = 0;\n\n #if __CUDA_ARCH__ >= 300\n asm(\"vset4.u32.u32.ne %0, %1, %2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #else\n // inspired by Alan Mycroft's null-byte detection algorithm:\n // null_byte(x) = ((x - 0x01010101) & (~x & 0x80808080))\n unsigned int c;\n r = a ^ b; // 0x00 if a == b\n c = r | 0x80808080; // set msbs, to catch carry out\n c = c - 0x01010101; // msb = 0, if r was 0x00 or 0x80\n c = r | c; // msb = 1, if r was not 0x00\n c = c & 0x80808080; // extract msbs\n r = c >> 7; // convert to bool\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vcmpne4(unsigned int a, unsigned int b)\n {\n unsigned int r, c;\n\n #if __CUDA_ARCH__ >= 300\n r = vsetne4(a, b);\n c = r << 8; // convert bool\n r = c - r; // to mask\n #else\n // inspired by Alan Mycroft's null-byte detection algorithm:\n // null_byte(x) = ((x - 0x01010101) & (~x & 0x80808080))\n r = a ^ b; // 0x00 if a == b\n c = r | 0x80808080; // set msbs, to catch carry out\n c = c - 0x01010101; // msb = 0, if r was 0x00 or 0x80\n c = r | c; // msb = 1, if r was not 0x00\n c = c & 0x80808080; // extract msbs\n r = c >> 7; // convert\n r = c - r; // msbs to\n r = c | r; // mask\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vabsdiff4(unsigned int a, unsigned int b)\n {\n unsigned int r = 0;\n\n #if __CUDA_ARCH__ >= 300\n asm(\"vabsdiff4.u32.u32.u32.sat %0, %1, %2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #elif __CUDA_ARCH__ >= 200\n asm(\"vabsdiff.u32.u32.u32.sat %0.b0, %1.b0, %2.b0, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n asm(\"vabsdiff.u32.u32.u32.sat %0.b1, %1.b1, %2.b1, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n asm(\"vabsdiff.u32.u32.u32.sat %0.b2, %1.b2, %2.b2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n asm(\"vabsdiff.u32.u32.u32.sat %0.b3, %1.b3, %2.b3, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #else\n unsigned int s;\n s = vcmpge4(a, b); // mask = 0xff if a >= b\n r = a ^ b; //\n s = (r & s) ^ b; // select a when a >= b, else select b => max(a,b)\n r = s ^ r; // select a when b >= a, else select b => min(a,b)\n r = s - r; // |a - b| = max(a,b) - min(a,b);\n #endif\n\n return r;\n }\n\n static __device__ __forceinline__ unsigned int vmax4(unsigned int a, unsigned int b)\n {\n unsigned int r = 0;\n\n #if __CUDA_ARCH__ >= 300\n asm(\"vmax4.u32.u32.u32 %0, %1, %2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #elif __CUDA_ARCH__ >= 200\n asm(\"vmax.u32.u32.u32 %0.b0, %1.b0, %2.b0, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n asm(\"vmax.u32.u32.u32 %0.b1, %1.b1, %2.b1, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n asm(\"vmax.u32.u32.u32 %0.b2, %1.b2, %2.b2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n asm(\"vmax.u32.u32.u32 %0.b3, %1.b3, %2.b3, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #else\n unsigned int s;\n s = vcmpge4(a, b); // mask = 0xff if a >= b\n r = a & s; // select a when b >= a\n s = b & ~s; // select b when b < a\n r = r | s; // combine byte selections\n #endif\n\n return r; // byte-wise unsigned maximum\n }\n\n static __device__ __forceinline__ unsigned int vmin4(unsigned int a, unsigned int b)\n {\n unsigned int r = 0;\n\n #if __CUDA_ARCH__ >= 300\n asm(\"vmin4.u32.u32.u32 %0, %1, %2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #elif __CUDA_ARCH__ >= 200\n asm(\"vmin.u32.u32.u32 %0.b0, %1.b0, %2.b0, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n asm(\"vmin.u32.u32.u32 %0.b1, %1.b1, %2.b1, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n asm(\"vmin.u32.u32.u32 %0.b2, %1.b2, %2.b2, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n asm(\"vmin.u32.u32.u32 %0.b3, %1.b3, %2.b3, %3;\" : \"=r\"(r) : \"r\"(a), \"r\"(b), \"r\"(r));\n #else\n unsigned int s;\n s = vcmpge4(b, a); // mask = 0xff if a >= b\n r = a & s; // select a when b >= a\n s = b & ~s; // select b when b < a\n r = r | s; // combine byte selections\n #endif\n\n return r;\n }\n}}}\n\n//! @endcond\n\n#endif // OPENCV_CUDA_SIMD_FUNCTIONS_HPP\n"} +{"text": "\n\n \n \n\n \n\n \n\n\n \n\n \n\n\n \n\n \n\n\n \n\n \n\n"} +{"text": "/*=============================================================================\n Copyright (c) 2001-2008 Joel de Guzman\n Copyright (c) 2001-2008 Hartmut Kaiser\n http://spirit.sourceforge.net/\n\n Distributed under the Boost Software License, Version 1.0. (See accompanying\n file LICENSE_1_0.txt or copy at http://www.lslboost.org/LICENSE_1_0.txt)\n=============================================================================*/\n#ifndef BOOST_SPIRIT_INCLUDE_CLASSIC_SCANNER_FWD\n#define BOOST_SPIRIT_INCLUDE_CLASSIC_SCANNER_FWD\n#include \n#endif\n"} +{"text": "# node-http-proxy [![Build Status](https://secure.travis-ci.org/nodejitsu/node-http-proxy.png)](http://travis-ci.org/nodejitsu/node-http-proxy)\n\n\n\n## Battle-hardened node.js http proxy\n\n### Features\n\n* Reverse proxies incoming http.ServerRequest streams\n* Can be used as a CommonJS module in node.js\n* Reverse or Forward Proxy based on simple JSON-based configuration\n* Supports [WebSockets][1]\n* Supports [HTTPS][2]\n* Minimal request overhead and latency\n* Full suite of functional tests\n* Battled-hardened through __production usage__ @ [nodejitsu.com][0]\n* Written entirely in Javascript\n* Easy to use API\n\n\nnode-http-proxy is `<= 0.8.x` compatible, if you're looking for a `>= 0.10` compatible version please check [caronte](https://github.com/nodejitsu/node-http-proxy/tree/caronte)\n\n### When to use node-http-proxy\n\nLet's suppose you were running multiple http application servers, but you only wanted to expose one machine to the internet. You could setup node-http-proxy on that one machine and then reverse-proxy the incoming http requests to locally running services which were not exposed to the outside network. \n\n### Installing npm (node package manager)\n\n```\ncurl https://npmjs.org/install.sh | sh\n```\n\n### Installing node-http-proxy\n\n```\nnpm install http-proxy\n```\n\n## Using node-http-proxy\n\nThere are several ways to use node-http-proxy; the library is designed to be flexible so that it can be used by itself, or in conjunction with other node.js libraries / tools:\n\n1. Standalone HTTP Proxy server\n2. Inside of another HTTP server (like Connect)\n3. In conjunction with a Proxy Routing Table\n4. As a forward-proxy with a reverse proxy \n5. From the command-line as a long running process\n6. customized with 3rd party middleware.\n\nIn each of these scenarios node-http-proxy can handle any of these types of requests:\n\n1. HTTP Requests (http://)\n2. HTTPS Requests (https://)\n3. WebSocket Requests (ws://)\n4. Secure WebSocket Requests (wss://)\n\nSee the [examples][3] for more working sample code.\n\n### Setup a basic stand-alone proxy server\n\n``` js\nvar http = require('http'),\n httpProxy = require('http-proxy');\n//\n// Create your proxy server\n//\nhttpProxy.createServer(9000, 'localhost').listen(8000);\n\n//\n// Create your target server\n//\nhttp.createServer(function (req, res) {\n res.writeHead(200, { 'Content-Type': 'text/plain' });\n res.write('request successfully proxied!' + '\\n' + JSON.stringify(req.headers, true, 2));\n res.end();\n}).listen(9000);\n```\n\n### Setup a stand-alone proxy server with custom server logic\n\n``` js\nvar http = require('http'),\n httpProxy = require('http-proxy');\n \n//\n// Create a proxy server with custom application logic\n//\nhttpProxy.createServer(function (req, res, proxy) {\n //\n // Put your custom server logic here\n //\n proxy.proxyRequest(req, res, {\n host: 'localhost',\n port: 9000\n });\n}).listen(8000);\n\nhttp.createServer(function (req, res) {\n res.writeHead(200, { 'Content-Type': 'text/plain' });\n res.write('request successfully proxied: ' + req.url +'\\n' + JSON.stringify(req.headers, true, 2));\n res.end();\n}).listen(9000);\n```\n\n### Setup a stand-alone proxy server with latency (e.g. IO, etc)\n\n``` js\nvar http = require('http'),\n httpProxy = require('http-proxy');\n\n//\n// Create a proxy server with custom application logic\n//\nhttpProxy.createServer(function (req, res, proxy) {\n //\n // Buffer the request so that `data` and `end` events\n // are not lost during async operation(s).\n //\n var buffer = httpProxy.buffer(req);\n \n //\n // Wait for two seconds then respond: this simulates\n // performing async actions before proxying a request\n //\n setTimeout(function () {\n proxy.proxyRequest(req, res, {\n host: 'localhost',\n port: 9000, \n buffer: buffer\n }); \n }, 2000);\n}).listen(8000);\n\nhttp.createServer(function (req, res) {\n res.writeHead(200, { 'Content-Type': 'text/plain' });\n res.write('request successfully proxied: ' + req.url +'\\n' + JSON.stringify(req.headers, true, 2));\n res.end();\n}).listen(9000);\n```\n\n### Proxy requests within another http server\n\n``` js\nvar http = require('http'),\n httpProxy = require('http-proxy');\n \n//\n// Create a new instance of HttProxy to use in your server\n//\nvar proxy = new httpProxy.RoutingProxy();\n\n//\n// Create a regular http server and proxy its handler\n//\nhttp.createServer(function (req, res) {\n //\n // Put your custom server logic here, then proxy\n //\n proxy.proxyRequest(req, res, {\n host: 'localhost',\n port: 9000\n });\n}).listen(8001);\n\nhttp.createServer(function (req, res) {\n res.writeHead(200, { 'Content-Type': 'text/plain' });\n res.write('request successfully proxied: ' + req.url +'\\n' + JSON.stringify(req.headers, true, 2));\n res.end();\n}).listen(9000); \n```\n\n### Proxy requests using a ProxyTable\nA Proxy Table is a simple lookup table that maps incoming requests to proxy target locations. Take a look at an example of the options you need to pass to httpProxy.createServer:\n\n``` js\nvar options = {\n router: {\n 'foo.com/baz': '127.0.0.1:8001',\n 'foo.com/buz': '127.0.0.1:8002',\n 'bar.com/buz': '127.0.0.1:8003'\n }\n};\n```\n\nThe above route table will take incoming requests to 'foo.com/baz' and forward them to '127.0.0.1:8001'. Likewise it will take incoming requests to 'foo.com/buz' and forward them to '127.0.0.1:8002'. The routes themselves are later converted to regular expressions to enable more complex matching functionality. We can create a proxy server with these options by using the following code:\n\n``` js\nvar proxyServer = httpProxy.createServer(options);\nproxyServer.listen(80);\n```\n\n### Proxy requests using a 'Hostname Only' ProxyTable\nAs mentioned in the previous section, all routes passes to the ProxyTable are by default converted to regular expressions that are evaluated at proxy-time. This is good for complex URL rewriting of proxy requests, but less efficient when one simply wants to do pure hostname routing based on the HTTP 'Host' header. If you are only concerned with hostname routing, you change the lookup used by the internal ProxyTable:\n\n``` js\nvar options = {\n hostnameOnly: true,\n router: {\n 'foo.com': '127.0.0.1:8001',\n 'bar.com': '127.0.0.1:8002'\n }\n}\n```\n\nNotice here that I have not included paths on the individual domains because this is not possible when using only the HTTP 'Host' header. Care to learn more? See [RFC2616: HTTP/1.1, Section 14.23, \"Host\"][4].\n\n### Proxy requests using a 'Pathname Only' ProxyTable\n\nIf you dont care about forwarding to different hosts, you can redirect based on the request path.\n\n``` js\nvar options = {\n pathnameOnly: true,\n router: {\n '/wiki': '127.0.0.1:8001',\n '/blog': '127.0.0.1:8002',\n '/api': '127.0.0.1:8003'\n }\n}\n```\n\nThis comes in handy if you are running separate services or applications on separate paths. Note, using this option disables routing by hostname entirely.\n\n\n### Proxy requests with an additional forward proxy\nSometimes in addition to a reverse proxy, you may want your front-facing server to forward traffic to another location. For example, if you wanted to load test your staging environment. This is possible when using node-http-proxy using similar JSON-based configuration to a proxy table: \n\n``` js\nvar proxyServerWithForwarding = httpProxy.createServer(9000, 'localhost', {\n forward: {\n port: 9000,\n host: 'staging.com'\n }\n});\nproxyServerWithForwarding.listen(80);\n```\n\nThe forwarding option can be used in conjunction with the proxy table options by simply including both the 'forward' and 'router' properties in the options passed to 'createServer'.\n\n### Listening for proxy events\nSometimes you want to listen to an event on a proxy. For example, you may want to listen to the 'end' event, which represents when the proxy has finished proxying a request.\n\n``` js\nvar httpProxy = require('http-proxy');\n\nvar server = httpProxy.createServer(function (req, res, proxy) {\n var buffer = httpProxy.buffer(req);\n\n proxy.proxyRequest(req, res, {\n host: '127.0.0.1',\n port: 9000,\n buffer: buffer\n });\n});\n\nserver.proxy.on('end', function () {\n console.log(\"The request was proxied.\");\n});\n\nserver.listen(8000);\n```\n\nIt's important to remember not to listen for events on the proxy object in the function passed to `httpProxy.createServer`. Doing so would add a new listener on every request, which would end up being a disaster.\n\n## Using HTTPS\nYou have all the full flexibility of node-http-proxy offers in HTTPS as well as HTTP. The two basic scenarios are: with a stand-alone proxy server or in conjunction with another HTTPS server.\n\n### Proxying to HTTP from HTTPS\nThis is probably the most common use-case for proxying in conjunction with HTTPS. You have some front-facing HTTPS server, but all of your internal traffic is HTTP. In this way, you can reduce the number of servers to which your CA and other important security files are deployed and reduce the computational overhead from HTTPS traffic. \n\nUsing HTTPS in `node-http-proxy` is relatively straight-forward:\n \n``` js\nvar fs = require('fs'),\n http = require('http'),\n https = require('https'),\n httpProxy = require('http-proxy');\n \nvar options = {\n https: {\n key: fs.readFileSync('path/to/your/key.pem', 'utf8'),\n cert: fs.readFileSync('path/to/your/cert.pem', 'utf8')\n }\n};\n\n//\n// Create a standalone HTTPS proxy server\n//\nhttpProxy.createServer(8000, 'localhost', options).listen(8001);\n\n//\n// Create an instance of HttpProxy to use with another HTTPS server\n//\nvar proxy = new httpProxy.HttpProxy({\n target: {\n host: 'localhost', \n port: 8000\n }\n});\nhttps.createServer(options.https, function (req, res) {\n proxy.proxyRequest(req, res)\n}).listen(8002);\n\n//\n// Create the target HTTPS server for both cases\n//\nhttp.createServer(function (req, res) {\n res.writeHead(200, { 'Content-Type': 'text/plain' });\n res.write('hello https\\n');\n res.end();\n}).listen(8000);\n```\n\n### Using two certificates\n\nSuppose that your reverse proxy will handle HTTPS traffic for two different domains `fobar.com` and `barbaz.com`.\nIf you need to use two different certificates you can take advantage of [Server Name Indication](http://en.wikipedia.org/wiki/Server_Name_Indication).\n\n``` js\nvar https = require('https'),\n path = require(\"path\"),\n fs = require(\"fs\"),\n crypto = require(\"crypto\");\n\n//\n// generic function to load the credentials context from disk\n//\nfunction getCredentialsContext (cer) {\n return crypto.createCredentials({\n key: fs.readFileSync(path.join(__dirname, 'certs', cer + '.key')),\n cert: fs.readFileSync(path.join(__dirname, 'certs', cer + '.crt'))\n }).context;\n}\n\n//\n// A certificate per domain hash\n//\nvar certs = {\n \"fobar.com\": getCredentialsContext(\"foobar\"),\n \"barbaz.com\": getCredentialsContext(\"barbaz\")\n};\n\n//\n// Proxy options\n//\n// This section assumes that myCert, myKey and myCa are defined (they are not\n// in this example). With a SNICallback, the proxy needs a default set of\n// certificates to use.\n//\nvar options = {\n https: {\n SNICallback: function (hostname) {\n return certs[hostname];\n },\n cert: myCert,\n key: myKey,\n ca: [myCa]\n },\n hostnameOnly: true,\n router: {\n 'fobar.com': '127.0.0.1:8001',\n 'barbaz.com': '127.0.0.1:8002'\n }\n};\n\n//\n// Create a standalone HTTPS proxy server\n//\nhttpProxy.createServer(options).listen(8001);\n\n//\n// Create the target HTTPS server\n//\nhttp.createServer(function (req, res) {\n res.writeHead(200, { 'Content-Type': 'text/plain' });\n res.write('hello https\\n');\n res.end();\n}).listen(8000);\n\n```\n\n### Proxying to HTTPS from HTTPS\nProxying from HTTPS to HTTPS is essentially the same as proxying from HTTPS to HTTP, but you must include the `target` option in when calling `httpProxy.createServer` or instantiating a new instance of `HttpProxy`.\n\n``` js\nvar fs = require('fs'),\n https = require('https'),\n httpProxy = require('http-proxy');\n \nvar options = {\n https: {\n key: fs.readFileSync('path/to/your/key.pem', 'utf8'),\n cert: fs.readFileSync('path/to/your/cert.pem', 'utf8')\n },\n target: {\n https: true // This could also be an Object with key and cert properties\n }\n};\n\n//\n// Create a standalone HTTPS proxy server\n//\nhttpProxy.createServer(8000, 'localhost', options).listen(8001);\n\n//\n// Create an instance of HttpProxy to use with another HTTPS server\n//\nvar proxy = new httpProxy.HttpProxy({ \n target: {\n host: 'localhost', \n port: 8000,\n https: true\n }\n});\n\nhttps.createServer(options.https, function (req, res) {\n proxy.proxyRequest(req, res);\n}).listen(8002);\n\n//\n// Create the target HTTPS server for both cases\n//\nhttps.createServer(options.https, function (req, res) {\n res.writeHead(200, { 'Content-Type': 'text/plain' });\n res.write('hello https\\n');\n res.end();\n}).listen(8000);\n```\n## Middleware\n\n`node-http-proxy` now supports connect middleware. Add middleware functions to your createServer call:\n\n``` js\nhttpProxy.createServer(\n require('connect-gzip').gzip(),\n 9000, 'localhost'\n).listen(8000);\n```\n\nA regular request we receive is to support the modification of html/xml content that is returned in the response from an upstream server. \n\n[Harmon](https://github.com/No9/harmon/) is a stream based middleware plugin that is designed to solve that problem in the most effective way possible. \n\nIf you would like to handle errors passed to `next()` then attach a listener to the proxy:\n\n server = httpProxy.createServer(\n myMiddleWare,\n 9000, 'localhost'\n ).listen(8000);\n\n server.proxy.on('middlewareError', function (err, req, res) {\n // handle the error here and call res.end()\n });\n\n## Proxying WebSockets\nWebsockets are handled automatically when using `httpProxy.createServer()`, however, if you supply a callback inside the createServer call, you will need to handle the 'upgrade' proxy event yourself. Here's how:\n\n```js\n\nvar options = {\n ....\n};\n\nvar server = httpProxy.createServer(\n callback/middleware, \n options\n);\n\nserver.listen(port, function () { ... });\nserver.on('upgrade', function (req, socket, head) {\n server.proxy.proxyWebSocketRequest(req, socket, head);\n});\n```\n\nIf you would rather not use createServer call, and create the server that proxies yourself, see below:\n\n``` js\nvar http = require('http'),\n httpProxy = require('http-proxy');\n \n//\n// Create an instance of node-http-proxy\n//\nvar proxy = new httpProxy.HttpProxy({\n target: {\n host: 'localhost',\n port: 8000\n }\n});\n\nvar server = http.createServer(function (req, res) {\n //\n // Proxy normal HTTP requests\n //\n proxy.proxyRequest(req, res);\n});\n\nserver.on('upgrade', function (req, socket, head) {\n //\n // Proxy websocket requests too\n //\n proxy.proxyWebSocketRequest(req, socket, head);\n});\n\nserver.listen(8080);\n```\n\n### with custom server logic\n\n``` js\nvar httpProxy = require('http-proxy')\n\nvar server = httpProxy.createServer(function (req, res, proxy) {\n //\n // Put your custom server logic here\n //\n proxy.proxyRequest(req, res, {\n host: 'localhost',\n port: 9000\n });\n})\n\nserver.on('upgrade', function (req, socket, head) {\n //\n // Put your custom server logic here\n //\n server.proxy.proxyWebSocketRequest(req, socket, head, {\n host: 'localhost',\n port: 9000\n });\n});\n\nserver.listen(8080);\n```\n\n### Configuring your Socket limits\n\nBy default, `node-http-proxy` will set a 100 socket limit for all `host:port` proxy targets. You can change this in two ways: \n\n1. By passing the `maxSockets` option to `httpProxy.createServer()`\n2. By calling `httpProxy.setMaxSockets(n)`, where `n` is the number of sockets you with to use. \n\n## POST requests and buffering\n\nexpress.bodyParser will interfere with proxying of POST requests (and other methods that have a request \nbody). With bodyParser active, proxied requests will never send anything to the upstream server, and \nthe original client will just hang. See https://github.com/nodejitsu/node-http-proxy/issues/180 for options.\n\n## Using node-http-proxy from the command line\nWhen you install this package with npm, a node-http-proxy binary will become available to you. Using this binary is easy with some simple options:\n\n``` js\nusage: node-http-proxy [options] \n\nAll options should be set with the syntax --option=value\n\noptions:\n --port PORT Port that the proxy server should run on\n --target HOST:PORT Location of the server the proxy will target\n --config OUTFILE Location of the configuration file for the proxy server\n --silent Silence the log output from the proxy server\n -h, --help You're staring at it\n```\n\n
    \n## Why doesn't node-http-proxy have more advanced features like x, y, or z?\n\nIf you have a suggestion for a feature currently not supported, feel free to open a [support issue][6]. node-http-proxy is designed to just proxy http requests from one server to another, but we will be soon releasing many other complimentary projects that can be used in conjunction with node-http-proxy.\n\n## Options\n\n### Http Proxy\n\n`createServer()` supports the following options\n\n```javascript\n{\n forward: { // options for forward-proxy\n port: 8000,\n host: 'staging.com'\n },\n target : { // options for proxy target\n port : 8000, \n host : 'localhost',\n };\n source : { // additional options for websocket proxying \n host : 'localhost',\n port : 8000,\n https: true\n },\n enable : {\n xforward: true // enables X-Forwarded-For\n },\n changeOrigin: false, // changes the origin of the host header to the target URL\n timeout: 120000 // override the default 2 minute http socket timeout value in milliseconds\n}\n```\n\n## Run Tests\nThe test suite is designed to fully cover the combinatoric possibilities of HTTP and HTTPS proxying:\n\n1. HTTP --> HTTP\n2. HTTPS --> HTTP\n3. HTTPS --> HTTPS\n4. HTTP --> HTTPS\n\n```\nvows test/*-test.js --spec\nvows test/*-test.js --spec --https\nvows test/*-test.js --spec --https --target=https\nvows test/*-test.js --spec --target=https\n```\n\n
    \n### License\n\n(The MIT License)\n\nCopyright (c) 2010 Charlie Robbins, Mikeal Rogers, Fedor Indutny, & Marak Squires\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n[0]: http://nodejitsu.com\n[1]: https://github.com/nodejitsu/node-http-proxy/blob/master/examples/websocket/websocket-proxy.js\n[2]: https://github.com/nodejitsu/node-http-proxy/blob/master/examples/http/proxy-https-to-http.js\n[3]: https://github.com/nodejitsu/node-http-proxy/tree/master/examples\n[4]: http://www.ietf.org/rfc/rfc2616.txt\n[5]: http://socket.io\n[6]: http://github.com/nodejitsu/node-http-proxy/issues\n"} +{"text": "// This file is part of Eigen, a lightweight C++ template library\n// for linear algebra.\n//\n// Mehdi Goli Codeplay Software Ltd.\n// Ralph Potter Codeplay Software Ltd.\n// Luke Iwanski Codeplay Software Ltd.\n// Contact: \n//\n// This Source Code Form is subject to the terms of the Mozilla\n// Public License v. 2.0. If a copy of the MPL was not distributed\n// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.\n\n/*****************************************************************\n * TensorSyclextractFunctors.h\n *\n * \\brief:\n * Used to extract all the functors allocated to each node of the expression\n*tree.\n *\n*****************************************************************/\n\n#ifndef UNSUPPORTED_EIGEN_CXX11_SRC_TENSOR_TENSORSYCL_EXTRACT_FUNCTORS_HPP\n#define UNSUPPORTED_EIGEN_CXX11_SRC_TENSOR_TENSORSYCL_EXTRACT_FUNCTORS_HPP\n\nnamespace Eigen {\nnamespace TensorSycl {\nnamespace internal {\n/// \\struct FunctorExtractor: This struct is used to extract the functors\n/// constructed on\n/// the host-side, to pack them and reuse them in reconstruction of the\n/// expression on the device.\n/// We have to do that as in Eigen the functors are not stateless so we cannot\n/// re-instantiate them on the device.\n/// We have to pass instantiated functors to the device.\n// This struct is used for leafNode (TensorMap) and nodes behaving like leafNode (TensorForcedEval).\n#define DEFALTACTION(Evaluator)\\\ntypedef typename Evaluator::Dimensions Dimensions;\\\nconst Dimensions m_dimensions;\\\nEIGEN_STRONG_INLINE const Dimensions& dimensions() const { return m_dimensions; }\\\nFunctorExtractor(const Evaluator& expr): m_dimensions(expr.dimensions()) {}\n\ntemplate struct FunctorExtractor{\n DEFALTACTION(Evaluator)\n};\n\n\n/// specialisation of the \\ref FunctorExtractor struct when the node type does not require anything\n///TensorConversionOp\n#define SYCLEXTRFUNCCONVERSION(ExprNode, CVQual)\\\ntemplate \\\nstruct FunctorExtractor, Dev> > {\\\n FunctorExtractor > subExpr;\\\n FunctorExtractor(const TensorEvaluator, Dev>& expr)\\\n : subExpr(expr.impl()) {}\\\n};\n\nSYCLEXTRFUNCCONVERSION(TensorConversionOp, const)\nSYCLEXTRFUNCCONVERSION(TensorConversionOp, )\n#undef SYCLEXTRFUNCCONVERSION\n\n#define SYCLEXTRTENSORMAPFIXEDSIZE(CVQual)\\\ntemplate class MakePointer_, typename Dev>\\\nstruct FunctorExtractor< TensorEvaluator , Options_, MakePointer_> , Dev> >{\\\nFunctorExtractor(const TensorEvaluator , Options_, MakePointer_> , Dev>& ){}\\\n};\n\nSYCLEXTRTENSORMAPFIXEDSIZE(const)\nSYCLEXTRTENSORMAPFIXEDSIZE()\n#undef SYCLEXTRTENSORMAPFIXEDSIZE\n\n/// specialisation of the \\ref FunctorExtractor struct when the node type is\n/// TensorCwiseNullaryOp, TensorCwiseUnaryOp, and TensorBroadcastingOp\n#define SYCLEXTRFUNCUNARY(CVQual)\\\ntemplate