text
stringlengths
2
99k
meta
dict
password: <?= config('ixp_api.rir.password') ?> as-set: AS-SET-IXP-CONNECTED descr: ASNs connected to the IXP admin-c: XYZ-RIPE tech-c: XYZ-RIPE notify: ripe-notify@example.com remarks: IXP member ASNs connected to the route servers are listed in AS-SET-IXP-CONNECTED mnt-by: IXP-NOC <?php foreach( $t->asns as $asn => $details ): ?> members: <?= $details[ "asmacro" ] ?> <?php endforeach; ?> source: RIPE
{ "pile_set_name": "Github" }
{ "adult-2": "Adulte + 1", "age": "Âge", "agility": "Agilité", "agility-abbr": " Agi", "agility-abbr-u": "AGI", "animal-handling": "Dressage", "api-dice": "dé API", "api-dice-title": "Utilisez API Dice Roller (API est une fonctionnalité Pro). Le Script « Forbidden Lands Year-Zero Die Roller » doit être installé.", "appearance-u": "APPARENCE", "armor": "Armure", "armor-helmet": "ARMURE/HEAUME", "armor-rating": "Indice d'armure", "armor-rating-abbr": "IA", "armor-rating-total": "Total des dés d'ÉQUIPEMENT inclus pour armure1 + armure2 + armure3 + armure4. @{ar}", "armor-rating-u": "INDICE D'ARMURE", "armor-roll": "Jet d'armure", "armor-type": "Type d'Armure", "armor1-bonus": "Enregistre les bonus ACTUELS de l'armure jusqu'au MAX (ajuste les dés d'ÉQUIPEMENT). @{armor1_bonus}", "armor1-bonus-max": "Enregistre les bonus NON RÉDUITS de l'armure. @{armor1_bonus_max}", "armor1-bonus-misc": "Modificateur de bonus divers (ajuste les dés de COMPÉTENCE). @{armor1_damage}", "armor1-bonus-total": "Total des dés d'ÉQUIPEMENT et de COMPÉTENCE inclus pour l'armure1. @{armor1_ar}", "armor2-bonus": "Enregistre les bonus ACTUELS de l'armure jusqu'au MAX (ajuste les dés d'ÉQUIPEMENT). @{armor2_bonus}", "armor2-bonus-max": "Enregistre les bonus NON RÉDUITS de l'armure. @{armor2_bonus_max}", "armor2-bonus-misc": "Modificateur de bonus divers (ajuste les dés de COMPÉTENCE). @{armor2_damage}", "armor2-bonus-total": "Total des dés d'ÉQUIPEMENT et de COMPÉTENCE inclus pour l'armure2. @{armor2_ar}", "armor3-bonus": "Record the armor's CURRENT bonus up to MAX (adjusts GEAR dice). @{armor3_bonus}", "armor3-bonus-max": "Record the armor's UNDAMAGED bonus. @{armor3_bonus_max}", "armor3-bonus-misc": "Miscellaneous bonus modifier (adjusts SKILL dice). @{armor3_damage}", "armor3-bonus-total": "Total GEAR and SKILL dice included for armor3. @{armor3_ar}", "armor4-bonus": "Record the armor's CURRENT bonus up to MAX (adjusts GEAR dice). @{armor4_bonus}", "armor4-bonus-max": "Record the armor's UNDAMAGED bonus. @{armor4_bonus_max}", "armor4-bonus-misc": "Miscellaneous bonus modifier (adjusts SKILL dice). @{armor4_damage}", "armor4-bonus-total": "Total GEAR and SKILL dice included for armor4. @{armor4_ar}", "arms-length-abbr": "Long. Bras", "arrows": "Flèches", "artifact": "Artéfact", "artifact-bonus": "Bonus d'artefact", "attack": "Attaque", "attack-abbrv": "Attq", "attr-abbr": "Attr", "attribute-score": "Score d'attribut", "attribute-u": "ATTRIBUTS", "bane": "Fléau", "base": "Base", "base-attr-abbr": "Base/Attr", "base-attribute-dice": "Dé d'Attribut/de base", "base-dice": "Dé de base", "beasts-u": "BÊTES", "body": "Corps", "bonus": "Bonus", "bonus-abbr": "Bon", "bread": "Pain", "carried": "Porté", "carried-abbr": "Port", "carry": "Porter", "character": "Personnage", "clear-dice-pool": "Vider la réserve de dés", "close": "[fermer]", "close-announcements": "Fermer les annonces", "cloth": "Tissu", "clothing": "Vêtements", "coins-carried": "Argent transporté", "coins-u": "ARGENT", "cold": "Frigorifié", "condition-cold": "Lorsque le froid est glacial et que vous n'avez pas assez d'abris, vous devez faire des tests d'ENDURANCE régulièrement. @{cold}", "condition-hungry": "Vous devez manger une ration de nourriture au moins une fois par jour. Après un jour sans nourriture, vous devenez AFFAMÉ. @{hungry}", "condition-sleepy": "Vous devez dormir au moins 6 heures par jour. Après une journée sans dormir, vous devenez SOMNOLENT. @{sleepy}", "condition-thirsty": "Vous devez boire une ration d'eau au moins une fois par jour. Après un jour sans eau, vous devenez ASSOIFFÉ. @{thirsty}", "condition-u": "CONDITIONS", "consumable": "Consommable", "consumable-note": "**note** assurez vous de réduire manuellement le dé consommable sur la feuille si vous lancez le dé de fléau.", "consumable-u": "CONSOMMABLES", "copper": "Cuivre", "crafting": "Artisanat", "crafting-monster": "Artisanat", "critical-injuries": "Blessures Critique", "critical-u": "BLESSURES CRITIQUES", "current": "Actuel", "current-preset": "Sélection actuelle", "custom-roll": "Jet modifié", "d66-roll": "Jet du D66", "damage": "Dégâts", "damage-abbr": "Dég", "dark-secret": "Noir secret", "defense-rating": "Indice de défense", "description": "Description", "dice-only": "Dé seulement", "dice-pool": "Réserve de Dés", "dice-pool-u": "RÉSERVE DE DÉS", "die": "Dé", "die-10": "d10", "die-10-u": "D10", "die-12": "d12", "die-12-u": "D12", "die-6": "d6", "die-6-u": "D6", "die-66": "d66", "die-66-u": "D66", "die-8": "d8", "die-8-u": "D8", "distant": "Distant", "dmg-abbr": "Dég", "don": "Porté", "duration": "Durée", "effects": "Effets", "empathy": "Empathie", "empathy-abbr": " Emp", "encumbrance": "Encombrement", "encumbrance-current-abbr": "Encombrement actuel", "endurance": "Endurance", "endurance-monster": "Endurance", "epic": "Épique", "experience-u": "EXPÉRIENCE", "extra-damage": "Basculer le suivi des dégâts extra (25-48)", "face": "Visage", "features": "Fonctionnalités", "fish": "Poisson", "flour": "Farine", "food": "Nourriture", "function-u": "FONCTIONS", "fur": "Fourrure", "gea-u": "ÉQUIPEMENT", "gear": "Équipement", "gear-bonus": "Bonus d'équipement", "gear-dice": "Dé d'équipement", "gear-notes": "Équipement/Notes", "gear-weight": "Poids équip", "general-abbrv": "Gén", "glass": "Verre", "gold": "Or", "grain": "Céréales", "grip": "Prise", "healing": "Guérison", "healing-time": "Temps de guérison", "heavy-abbr": "LO", "herbs": "Herbes", "hirelings-u": "LAQUAIS", "hungry": "Affamé", "ingredients": "Ingrédients", "injury": "Blessure", "insight": "Perspicacité", "iron": "Fer", "iron-ore": "Minerai de fer", "item": "Objet", "kin": "Espèce", "latest-announcements": "Dernières annonces", "leather": "Cuir", "legendary": "Légendaire", "lethal": "Létal", "light-abbr": "LE", "location": "Emplacement", "logo-forbidden-lands": "FORBIDDEN LANDS", "long": "Long", "lore": "Connaissances", "lvl-abbr": "Niv", "manipulation": "Manipulation", "marksmanship": "Tir de précision", "marksmanship-abbr": "Tir préc.", "max-abbr": "Max", "meat": "Viande", "melee-as-distance": "Mêlée", "melee-as-skill": "Mêlée", "melee-monster": "Mêlée", "might": "Puissance", "might-monster": "Puissance", "mighty": "Puissant", "misc-abbr": "Divers", "misc-gear-abbr": "Équipement divers", "misc-skill-abbr": "Compétence diverse", "monster": "Monstre", "monster-attack": "Attaque du monstre", "monster-attacks-u": "ATTAQUES DU MONSTRE", "monster-name": "Nom/Type de monstre", "moun-u": "MONTURE", "mount": "Fontes de la monture", "mounted": "Monté", "mounts-gear": "Fontes de la monture", "move": "Manœuvres", "move-type": "Type de mouvement", "movement": "Mouvement", "name": "Nom", "near": "Près", "no": "Non", "no-damage": "Pas de dégâts", "no-willpower": "Pas de Volonté", "normal-abbr": "N", "not-applicable-abbr": "n/a", "note-description": "Description de la Note", "note-name": "Nom de la Note", "notes": "Notes", "notes-text": "notes...", "notes-u": "NOTES", "number-abbr": "Nb", "of-arrows": "de flèches", "of-food": "de nourriture", "of-torches": "de torches", "of-water": "d'eau", "old-3": "Vieux +2", "old-announcements": "Vielles annonces", "older": "[anciennes]", "on-mount": "Sur la monture", "one-hand-abbr": "1M", "other": "Autre", "out-of-arrows": "Sans flèches", "out-of-food": "Sans nourriture", "out-of-torches": "Sans torches", "out-of-water": "Sans eau", "pack-rat": "Talent d'accumulateur compulsif?", "pack-rat-title": "Vous pouvez porter des items supplémentaires.", "parry": "Parade", "pc-name": "Nom du PJ", "performance": "Représentation", "personal": "Personnel", "pride": "Fierté", "pride-roll": "Jet de Fierté", "production-outcome": "Production/Résultat", "profession": "Profession", "profession-abbrv": "Maît", "push": " Pousser ", "push-dice": "Pousser les dés !", "push-query": "Le jeu de dés est-il correct... ? (Indice : supprimer les succès et les fléaux) |Oui - Soumettre au jet de dé, le jeu de dés est correct. |Non - Annuler, le jeu de dés a besoin d'être corrigé.", "pushes-the-roll": "Pousser les dés ", "quantity-abbr": "Qté", "range": "Portée", "ranged": "À distance", "rank": "Rang", "rank-1-pack-rat": "Rang 1 (+2)", "rank-2-pack-rat": "Rang 2 (+5)", "rank-3-pack-rat": "Rang 3 (+10)", "rating": "Indice", "rating-abbr": "Eval", "relationship-description": "Décrit la relation.", "relationships-u": "RELATIONS", "reputation": "Réputation", "reputation-bonus": "À quel point êtes vous connu? @{reputation}", "reputation-roll": "Jet de Réputation", "reset-dice": "Réinitialiser la réserve de dés.", "roll": " Jet ", "roll-agility": "Jet d'Agilité", "roll-dice": "Jeter les dés !", "roll-dice-66": "Lancer d66!", "roll-dice-api": "Jeter les dés API!", "roll-empathy": "Jet d'Empathie", "roll-strength": "Jet de Force", "roll-wits": "Jet d'Esprit", "salary": "Salaire", "scouting": "Éclaireur", "selected": "Sélectionné ", "settings": "Paramètres", "sheet-version-announcements": "Version de la fiche et annonces", "shield": "Bouclier", "shield-bonus": "Enregistre les bonus ACTUELS du bouclier jusqu'au MAX (ajuste les dés d'ÉQUIPEMENT). @{shield1_bonus}", "shield-bonus-max": "Enregistre les bonus NON RÉDUITS du bouclier. @{shield1_bonus_max}", "shield-bonus-misc": "Modificateur de bonus divers (ajuste les dé de COMPÉTENCE). @{shield1_bonus_misc}", "shield-bonus-total": "Dés de BASE, d'ÉQUIPEMENT et de COMPÉTENCE totaux inclus pour Parer|Bousculer. @{shield1_bonus_total}", "shield-u": "BOUCLIER", "short": "Court", "shove": "Pousser", "show-hide": "afficher/masquer", "silver": "Argent", "skill": "Compétence", "skill-dice": "Dé de compétence", "skill-level": "Niveau de Compétence", "skill-u": "COMPÉTENCES", "skills-list": "crafting,lore,animal-handling,scouting,endurance,sleight-of-hand,stealth,healing,manipulation,move,melee,insight,might,performance,survival,marksmanship", "sleepy": "Somnolent", "sleight-of-hand": "Escamotage", "sort-skills": "Trier les compétences par attribut :", "sort-stockpile": "Trier les piles de ressources alphabétiquement :", "spell": "Sort", "spell-name": "Nom du Sort", "spell-u": "SORTS", "stealth": "Furtivité", "stockpile-list": "silver,wood,leather,water,flour,iron,fur,grain,herbs,wool,vegetables,iron-ore,food,gold,bread,stone,fish,tallow,cloth,glass,meat", "stockpile-u": "STOCKS", "stone": "Pierre", "strength": "Force", "strength-abbr": "For", "strength-abbr-u": "FOR", "stronghold": "Forteresse", "stronghold-notes-u": "NOTES DE FORTERESSE", "stronghold-u": "FORTERESSE", "success": "Succès", "success-1": "1 succès", "success-2": "2 succès", "success-3": "3 succès", "success-4": "4 succès", "survival": "Survie", "talent-u": "TALENTS", "tallow": "Suif", "thirsty": "Assoiffé", "time-limit": "Limite de temps", "tiny-abbr": "MI", "torches": "Torches", "total": "Total", "total-abbr": "Tot", "two-hand-abbr": "2M", "type": "Type", "type-name": "Type/Nom", "units": "Unités", "update-dice-pool": "Mette à jour la réserve de dés. Utilisez le bouton \"Jet\" pour lancer les dés.", "vegetables": "Légumes", "version-announcements": "Version de la fiche et annonces", "water": "Eau", "weapon": "Arme", "weapon-bonus": "Enregistre les bonus ACTUELS de l'arme jusqu'au MAX. @{repeating_weapons_$X_weapon_bonus}", "weapon-bonus-max": "Enregistre les bonus non réduits de l'arme. @{repeating_weapons_$X_weapon_bonus|max}", "weapon-bonus-misc": "Modificateur de bonus divers (ajuste les dés d'ÉQUIPEMENT). @{repeating_weapons_$X_weapon_bonus_misc}", "weapon-bonus-total": "Total des dés d'ÉQUIPEMENT inclus avec l'attaque. @{repeating_weapons_$X_weapon_bonus_total}", "weapon-damage": "Dégâts suivant les tables d'armes. @{repeating_weapons_$X_weapon_damage}", "weapon-damage-misc": "Modificateur divers aux dégâts. @{repeating_weapons_$X_weapon_damage_misc}", "weapon-damage-total": "Total des dégâts inclus avec l'attaque. @{repeating_weapons_$X_weapon_damage_total}", "weapon-skill-misc": "Modificateur d'attaque divers (ajuste les dés de COMPÉTENCE). @{repeating_weapons_$X_weapon_skill_misc}", "weapon-skill-total": "Total des dés de COMPÉTENCE inclus avec l'attaque. @{repeating_weapons_$X_weapon_skill_total}", "weapon-type-base": "Dé de BASE suivant le type d'arme/de compétence. @{repeating_weapons_$X_weapon_base_total}", "weapon-type-skill": "Dés de COMPÉTENCE par type d'arme/compétence. @{repeating_weapons_$X_weapon_skill_value}", "weapon-u": "ARMES", "weapons": "Armes", "weight-abbr": "Pds", "whisper-macro": "Murmurer le jet ?", "whisper-nothing": "Ne pas murmurer les jets (défaut).", "whisper-options": "Options de murmure :", "whisper-options-api": "Options d'API murmure :", "whisper-query": "Demander.", "whisper-rolls": "Murmurer tous les jets au MJ.", "willpower": "Volonté", "willpower-abbr": "Vol", "willpower-spent-abbr": "VOL dépensée", "willpower-total-abbr": "VOL Total", "willpower-u": "VOLONTÉ", "wits": "Esprit", "wits-abbr": "Esp", "wood": "Bois", "wool": "Laine", "yes": "Oui", "yes-1": "Oui,-1", "young-1": "Jeune" }
{ "pile_set_name": "Github" }
{ "id": "b08f022a-37f2-4191-bbef-d348f1330beb", "name": "user", "request": { "url": "/user", "method": "GET", "headers": { "Accept": { "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" } } }, "response": { "status": 200, "bodyFileName": "user-1.json", "headers": { "Date": "Sun, 08 Sep 2019 07:25:07 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4831", "X-RateLimit-Reset": "1567929276", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", "Accept-Encoding" ], "ETag": "W/\"3ba1de3523043df743651bd23efc7def\"", "Last-Modified": "Mon, 03 Jun 2019 17:47:20 GMT", "X-OAuth-Scopes": "gist, notifications, repo", "X-Accepted-OAuth-Scopes": "", "X-GitHub-Media-Type": "unknown, github.v3", "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", "Access-Control-Allow-Origin": "*", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-Frame-Options": "deny", "X-Content-Type-Options": "nosniff", "X-XSS-Protection": "1; mode=block", "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", "Content-Security-Policy": "default-src 'none'", "X-GitHub-Request-Id": "FFA3:15CE:D30D1E:F6758F:5D74ACD3" } }, "uuid": "b08f022a-37f2-4191-bbef-d348f1330beb", "persistent": true, "insertionIndex": 1 }
{ "pile_set_name": "Github" }
module Travis module Github module Services class FindOrCreateRepo < Travis::Services::Base register :github_find_or_create_repo def run repo = find || create repo.update_attributes(params) repo end private def find unless params[:github_id] message = "No github_id passed to FindOrCreateRepo#find, params: #{params.inspect}" ActiveSupport::Deprecation.warn(message) Travis.logger.info(message) end query = if params[:github_id] { github_id: params[:github_id] } else { owner_name: params[:owner_name], name: params[:name] } end run_service(:find_repo, query) end def create unless params[:github_id] message = "No github_id passed to FindOrCreateRepo#find, params: #{params.inspect}" ActiveSupport::Deprecation.warn(message) Travis.logger.info(message) end Repository.create!(:owner_name => params[:owner_name], :name => params[:name], github_id: params[:github_id]) rescue ActiveRecord::RecordNotUnique find end end end end end
{ "pile_set_name": "Github" }
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifndef OPENSSL_HEADER_CAST_H #define OPENSSL_HEADER_CAST_H #include "CNIOBoringSSL_base.h" #ifdef __cplusplus extern "C" { #endif #define CAST_ENCRYPT 1 #define CAST_DECRYPT 0 #define CAST_BLOCK 8 #define CAST_KEY_LENGTH 16 typedef struct cast_key_st { uint32_t data[32]; int short_key; // Use reduced rounds for short key } CAST_KEY; OPENSSL_EXPORT void CAST_set_key(CAST_KEY *key, size_t len, const uint8_t *data); OPENSSL_EXPORT void CAST_ecb_encrypt(const uint8_t *in, uint8_t *out, const CAST_KEY *key, int enc); OPENSSL_EXPORT void CAST_encrypt(uint32_t *data, const CAST_KEY *key); OPENSSL_EXPORT void CAST_decrypt(uint32_t *data, const CAST_KEY *key); OPENSSL_EXPORT void CAST_cbc_encrypt(const uint8_t *in, uint8_t *out, size_t length, const CAST_KEY *ks, uint8_t *iv, int enc); OPENSSL_EXPORT void CAST_cfb64_encrypt(const uint8_t *in, uint8_t *out, size_t length, const CAST_KEY *schedule, uint8_t *ivec, int *num, int enc); #ifdef __cplusplus } #endif #endif // OPENSSL_HEADER_CAST_H
{ "pile_set_name": "Github" }
/****************************************************************************** * * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * ******************************************************************************/ /****************************************************************************** * * * Module: rtl8192c_rf6052.c ( Source C File) * * Note: Provide RF 6052 series relative API. * * Function: * * Export: * * Abbrev: * * History: * Data Who Remark * * 09/25/2008 MHC Create initial version. * 11/05/2008 MHC Add API for tw power setting. * * ******************************************************************************/ #define _RTL8188E_RF6052_C_ #include <drv_conf.h> #include <osdep_service.h> #include <drv_types.h> #include <rtw_byteorder.h> #include <rtl8188e_hal.h> /*---------------------------Define Local Constant---------------------------*/ // Define local structure for debug!!!!! typedef struct RF_Shadow_Compare_Map { // Shadow register value u32 Value; // Compare or not flag u8 Compare; // Record If it had ever modified unpredicted u8 ErrorOrNot; // Recorver Flag u8 Recorver; // u8 Driver_Write; }RF_SHADOW_T; /*---------------------------Define Local Constant---------------------------*/ /*------------------------Define global variable-----------------------------*/ /*------------------------Define global variable-----------------------------*/ /*------------------------Define local variable------------------------------*/ // 2008/11/20 MH For Debug only, RF //static RF_SHADOW_T RF_Shadow[RF6052_MAX_PATH][RF6052_MAX_REG] = {0}; static RF_SHADOW_T RF_Shadow[RF6052_MAX_PATH][RF6052_MAX_REG]; /*------------------------Define local variable------------------------------*/ /*----------------------------------------------------------------------------- * Function: RF_ChangeTxPath * * Overview: For RL6052, we must change some RF settign for 1T or 2T. * * Input: u2Byte DataRate // 0x80-8f, 0x90-9f * * Output: NONE * * Return: NONE * * Revised History: * When Who Remark * 09/25/2008 MHC Create Version 0. * Firmwaer support the utility later. * *---------------------------------------------------------------------------*/ void rtl8188e_RF_ChangeTxPath( IN PADAPTER Adapter, IN u16 DataRate) { // We do not support gain table change inACUT now !!!! Delete later !!! #if 0//(RTL92SE_FPGA_VERIFY == 0) static u1Byte RF_Path_Type = 2; // 1 = 1T 2= 2T static u4Byte tx_gain_tbl1[6] = {0x17f50, 0x11f40, 0x0cf30, 0x08720, 0x04310, 0x00100}; static u4Byte tx_gain_tbl2[6] = {0x15ea0, 0x10e90, 0x0c680, 0x08250, 0x04040, 0x00030}; u1Byte i; if (RF_Path_Type == 2 && (DataRate&0xF) <= 0x7) { // Set TX SYNC power G2G3 loop filter PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)RF_PATH_A, RF_TXPA_G2, bRFRegOffsetMask, 0x0f000); PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)RF_PATH_A, RF_TXPA_G3, bRFRegOffsetMask, 0xeacf1); // Change TX AGC gain table for (i = 0; i < 6; i++) PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)RF_PATH_A, RF_TX_AGC, bRFRegOffsetMask, tx_gain_tbl1[i]); // Set PA to high value PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)RF_PATH_A, RF_TXPA_G2, bRFRegOffsetMask, 0x01e39); } else if (RF_Path_Type == 1 && (DataRate&0xF) >= 0x8) { // Set TX SYNC power G2G3 loop filter PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)RF_PATH_A, RF_TXPA_G2, bRFRegOffsetMask, 0x04440); PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)RF_PATH_A, RF_TXPA_G3, bRFRegOffsetMask, 0xea4f1); // Change TX AGC gain table for (i = 0; i < 6; i++) PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)RF_PATH_A, RF_TX_AGC, bRFRegOffsetMask, tx_gain_tbl2[i]); // Set PA low gain PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)RF_PATH_A, RF_TXPA_G2, bRFRegOffsetMask, 0x01e19); } #endif } /* RF_ChangeTxPath */ /*----------------------------------------------------------------------------- * Function: PHY_RF6052SetBandwidth() * * Overview: This function is called by SetBWModeCallback8190Pci() only * * Input: PADAPTER Adapter * WIRELESS_BANDWIDTH_E Bandwidth //20M or 40M * * Output: NONE * * Return: NONE * * Note: For RF type 0222D *---------------------------------------------------------------------------*/ VOID rtl8188e_PHY_RF6052SetBandwidth( IN PADAPTER Adapter, IN HT_CHANNEL_WIDTH Bandwidth) //20M or 40M { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); switch(Bandwidth) { case HT_CHANNEL_WIDTH_20: pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffff3ff) | BIT(10) | BIT(11)); PHY_SetRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]); break; case HT_CHANNEL_WIDTH_40: pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffff3ff)| BIT(10)); PHY_SetRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]); break; default: //RT_TRACE(COMP_DBG, DBG_LOUD, ("PHY_SetRF8225Bandwidth(): unknown Bandwidth: %#X\n",Bandwidth )); break; } } /*----------------------------------------------------------------------------- * Function: PHY_RF6052SetCckTxPower * * Overview: * * Input: NONE * * Output: NONE * * Return: NONE * * Revised History: * When Who Remark * 11/05/2008 MHC Simulate 8192series.. * *---------------------------------------------------------------------------*/ VOID rtl8188e_PHY_RF6052SetCckTxPower( IN PADAPTER Adapter, IN u8* pPowerlevel) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; struct dm_priv *pdmpriv = &pHalData->dmpriv; struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv; //PMGNT_INFO pMgntInfo=&Adapter->MgntInfo; u32 TxAGC[2]={0, 0}, tmpval=0,pwrtrac_value; BOOLEAN TurboScanOff = _FALSE; u8 idx1, idx2; u8* ptr; u8 direction; //FOR CE ,must disable turbo scan TurboScanOff = _TRUE; if(pmlmeext->sitesurvey_res.state == SCAN_PROCESS) { TxAGC[RF_PATH_A] = 0x3f3f3f3f; TxAGC[RF_PATH_B] = 0x3f3f3f3f; TurboScanOff = _TRUE;//disable turbo scan if(TurboScanOff) { for(idx1=RF_PATH_A; idx1<=RF_PATH_B; idx1++) { TxAGC[idx1] = pPowerlevel[idx1] | (pPowerlevel[idx1]<<8) | (pPowerlevel[idx1]<<16) | (pPowerlevel[idx1]<<24); #ifdef CONFIG_USB_HCI // 2010/10/18 MH For external PA module. We need to limit power index to be less than 0x20. if (TxAGC[idx1] > 0x20 && pHalData->ExternalPA) TxAGC[idx1] = 0x20; #endif } } } else { // 20100427 Joseph: Driver dynamic Tx power shall not affect Tx power. It shall be determined by power training mechanism. // Currently, we cannot fully disable driver dynamic tx power mechanism because it is referenced by BT coexist mechanism. // In the future, two mechanism shall be separated from each other and maintained independantly. Thanks for Lanhsin's reminder. if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1) { TxAGC[RF_PATH_A] = 0x10101010; TxAGC[RF_PATH_B] = 0x10101010; } else if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level2) { TxAGC[RF_PATH_A] = 0x00000000; TxAGC[RF_PATH_B] = 0x00000000; } else { for(idx1=RF_PATH_A; idx1<=RF_PATH_B; idx1++) { TxAGC[idx1] = pPowerlevel[idx1] | (pPowerlevel[idx1]<<8) | (pPowerlevel[idx1]<<16) | (pPowerlevel[idx1]<<24); } if(pHalData->EEPROMRegulatory==0) { tmpval = (pHalData->MCSTxPowerLevelOriginalOffset[0][6]) + (pHalData->MCSTxPowerLevelOriginalOffset[0][7]<<8); TxAGC[RF_PATH_A] += tmpval; tmpval = (pHalData->MCSTxPowerLevelOriginalOffset[0][14]) + (pHalData->MCSTxPowerLevelOriginalOffset[0][15]<<24); TxAGC[RF_PATH_B] += tmpval; } } } for(idx1=RF_PATH_A; idx1<=RF_PATH_B; idx1++) { ptr = (u8*)(&(TxAGC[idx1])); for(idx2=0; idx2<4; idx2++) { if(*ptr > RF6052_MAX_TX_PWR) *ptr = RF6052_MAX_TX_PWR; ptr++; } } ODM_TxPwrTrackAdjust88E(&pHalData->odmpriv, 1, &direction, &pwrtrac_value); if (direction == 1) // Increase TX pwoer { TxAGC[0] += pwrtrac_value; TxAGC[1] += pwrtrac_value; } else if (direction == 2) // Decrease TX pwoer { TxAGC[0] -= pwrtrac_value; TxAGC[1] -= pwrtrac_value; } // rf-A cck tx power tmpval = TxAGC[RF_PATH_A]&0xff; PHY_SetBBReg(Adapter, rTxAGC_A_CCK1_Mcs32, bMaskByte1, tmpval); //RTPRINT(FPHY, PHY_TXPWR, ("CCK PWR 1M (rf-A) = 0x%x (reg 0x%x)\n", tmpval, rTxAGC_A_CCK1_Mcs32)); tmpval = TxAGC[RF_PATH_A]>>8; PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, 0xffffff00, tmpval); //RTPRINT(FPHY, PHY_TXPWR, ("CCK PWR 2~11M (rf-A) = 0x%x (reg 0x%x)\n", tmpval, rTxAGC_B_CCK11_A_CCK2_11)); // rf-B cck tx power tmpval = TxAGC[RF_PATH_B]>>24; PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, bMaskByte0, tmpval); //RTPRINT(FPHY, PHY_TXPWR, ("CCK PWR 11M (rf-B) = 0x%x (reg 0x%x)\n", tmpval, rTxAGC_B_CCK11_A_CCK2_11)); tmpval = TxAGC[RF_PATH_B]&0x00ffffff; PHY_SetBBReg(Adapter, rTxAGC_B_CCK1_55_Mcs32, 0xffffff00, tmpval); //RTPRINT(FPHY, PHY_TXPWR, ("CCK PWR 1~5.5M (rf-B) = 0x%x (reg 0x%x)\n", // tmpval, rTxAGC_B_CCK1_55_Mcs32)); } /* PHY_RF6052SetCckTxPower */ #if 0 // // powerbase0 for OFDM rates // powerbase1 for HT MCS rates // static void getPowerBase( IN PADAPTER Adapter, IN u8* pPowerLevel, IN u8 Channel, IN OUT u32* OfdmBase, IN OUT u32* MCSBase ) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); u32 powerBase0, powerBase1; u8 Legacy_pwrdiff=0, HT20_pwrdiff=0; u8 i, powerlevel[2]; for(i=0; i<2; i++) { powerlevel[i] = pPowerLevel[i]; Legacy_pwrdiff = pHalData->TxPwrLegacyHtDiff[i][Channel-1]; powerBase0 = powerlevel[i] + Legacy_pwrdiff; powerBase0 = (powerBase0<<24) | (powerBase0<<16) |(powerBase0<<8) |powerBase0; *(OfdmBase+i) = powerBase0; //RTPRINT(FPHY, PHY_TXPWR, (" [OFDM power base index rf(%c) = 0x%x]\n", ((i==0)?'A':'B'), *(OfdmBase+i))); } for(i=0; i<2; i++) { //Check HT20 to HT40 diff if(pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) { HT20_pwrdiff = pHalData->TxPwrHt20Diff[i][Channel-1]; powerlevel[i] += HT20_pwrdiff; } powerBase1 = powerlevel[i]; powerBase1 = (powerBase1<<24) | (powerBase1<<16) |(powerBase1<<8) |powerBase1; *(MCSBase+i) = powerBase1; //RTPRINT(FPHY, PHY_TXPWR, (" [MCS power base index rf(%c) = 0x%x]\n", ((i==0)?'A':'B'), *(MCSBase+i))); } } #endif // // powerbase0 for OFDM rates // powerbase1 for HT MCS rates // void getPowerBase88E( IN PADAPTER Adapter, IN u8* pPowerLevelOFDM, IN u8* pPowerLevelBW20, IN u8* pPowerLevelBW40, IN u8 Channel, IN OUT u32* OfdmBase, IN OUT u32* MCSBase ) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); u32 powerBase0, powerBase1; u8 Legacy_pwrdiff=0; s8 HT20_pwrdiff=0; u8 i, powerlevel[2]; for(i=0; i<2; i++) { powerBase0 = pPowerLevelOFDM[i]; powerBase0 = (powerBase0<<24) | (powerBase0<<16) |(powerBase0<<8) |powerBase0; *(OfdmBase+i) = powerBase0; //DBG_871X(" [OFDM power base index rf(%c) = 0x%x]\n", ((i==0)?'A':'B'), *(OfdmBase+i)); } for(i=0; i<pHalData->NumTotalRFPath; i++) { //Check HT20 to HT40 diff if(pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) { powerlevel[i] = pPowerLevelBW20[i]; } else { powerlevel[i] = pPowerLevelBW40[i]; } powerBase1 = powerlevel[i]; powerBase1 = (powerBase1<<24) | (powerBase1<<16) |(powerBase1<<8) |powerBase1; *(MCSBase+i) = powerBase1; //DBG_871X(" [MCS power base index rf(%c) = 0x%x]\n", ((i==0)?'A':'B'), *(MCSBase+i)); } } #if 0 static void getTxPowerWriteValByRegulatory( IN PADAPTER Adapter, IN u8 Channel, IN u8 index, IN u32* powerBase0, IN u32* powerBase1, OUT u32* pOutWriteVal ) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; u8 i, chnlGroup, pwr_diff_limit[4]; u32 writeVal, customer_limit, rf; // // Index 0 & 1= legacy OFDM, 2-5=HT_MCS rate // for(rf=0; rf<2; rf++) { switch(pHalData->EEPROMRegulatory) { case 0: // Realtek better performance // increase power diff defined by Realtek for large power chnlGroup = 0; //RTPRINT(FPHY, PHY_TXPWR, ("MCSTxPowerLevelOriginalOffset[%d][%d] = 0x%x\n", // chnlGroup, index, pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)])); writeVal = pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)] + ((index<2)?powerBase0[rf]:powerBase1[rf]); //RTPRINT(FPHY, PHY_TXPWR, ("RTK better performance, writeVal(%c) = 0x%x\n", ((rf==0)?'A':'B'), writeVal)); break; case 1: // Realtek regulatory // increase power diff defined by Realtek for regulatory { if(pHalData->pwrGroupCnt == 1) chnlGroup = 0; if(pHalData->pwrGroupCnt >= 3) { if(Channel <= 3) chnlGroup = 0; else if(Channel >= 4 && Channel <= 9) chnlGroup = 1; else if(Channel > 9) chnlGroup = 2; if(pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) chnlGroup++; else chnlGroup+=4; } //RTPRINT(FPHY, PHY_TXPWR, ("MCSTxPowerLevelOriginalOffset[%d][%d] = 0x%x\n", //chnlGroup, index, pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)])); writeVal = pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)] + ((index<2)?powerBase0[rf]:powerBase1[rf]); //RTPRINT(FPHY, PHY_TXPWR, ("Realtek regulatory, 20MHz, writeVal(%c) = 0x%x\n", ((rf==0)?'A':'B'), writeVal)); } break; case 2: // Better regulatory // don't increase any power diff writeVal = ((index<2)?powerBase0[rf]:powerBase1[rf]); //RTPRINT(FPHY, PHY_TXPWR, ("Better regulatory, writeVal(%c) = 0x%x\n", ((rf==0)?'A':'B'), writeVal)); break; case 3: // Customer defined power diff. // increase power diff defined by customer. chnlGroup = 0; //RTPRINT(FPHY, PHY_TXPWR, ("MCSTxPowerLevelOriginalOffset[%d][%d] = 0x%x\n", // chnlGroup, index, pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)])); if (pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_40) { //RTPRINT(FPHY, PHY_TXPWR, ("customer's limit, 40MHz rf(%c) = 0x%x\n", // ((rf==0)?'A':'B'), pHalData->PwrGroupHT40[rf][Channel-1])); } else { //RTPRINT(FPHY, PHY_TXPWR, ("customer's limit, 20MHz rf(%c) = 0x%x\n", // ((rf==0)?'A':'B'), pHalData->PwrGroupHT20[rf][Channel-1])); } for (i=0; i<4; i++) { pwr_diff_limit[i] = (u8)((pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)]&(0x7f<<(i*8)))>>(i*8)); if (pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_40) { if(pwr_diff_limit[i] > pHalData->PwrGroupHT40[rf][Channel-1]) pwr_diff_limit[i] = pHalData->PwrGroupHT40[rf][Channel-1]; } else { if(pwr_diff_limit[i] > pHalData->PwrGroupHT20[rf][Channel-1]) pwr_diff_limit[i] = pHalData->PwrGroupHT20[rf][Channel-1]; } } customer_limit = (pwr_diff_limit[3]<<24) | (pwr_diff_limit[2]<<16) | (pwr_diff_limit[1]<<8) | (pwr_diff_limit[0]); //RTPRINT(FPHY, PHY_TXPWR, ("Customer's limit rf(%c) = 0x%x\n", ((rf==0)?'A':'B'), customer_limit)); writeVal = customer_limit + ((index<2)?powerBase0[rf]:powerBase1[rf]); //RTPRINT(FPHY, PHY_TXPWR, ("Customer, writeVal rf(%c)= 0x%x\n", ((rf==0)?'A':'B'), writeVal)); break; default: chnlGroup = 0; writeVal = pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)] + ((index<2)?powerBase0[rf]:powerBase1[rf]); //RTPRINT(FPHY, PHY_TXPWR, ("RTK better performance, writeVal rf(%c) = 0x%x\n", ((rf==0)?'A':'B'), writeVal)); break; } // 20100427 Joseph: Driver dynamic Tx power shall not affect Tx power. It shall be determined by power training mechanism. // Currently, we cannot fully disable driver dynamic tx power mechanism because it is referenced by BT coexist mechanism. // In the future, two mechanism shall be separated from each other and maintained independantly. Thanks for Lanhsin's reminder. if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1) writeVal = 0x14141414; else if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level2) writeVal = 0x00000000; // 20100628 Joseph: High power mode for BT-Coexist mechanism. // This mechanism is only applied when Driver-Highpower-Mechanism is OFF. if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_BT1) { //RTPRINT(FBT, BT_TRACE, ("Tx Power (-6)\n")); writeVal = writeVal - 0x06060606; } else if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_BT2) { //RTPRINT(FBT, BT_TRACE, ("Tx Power (-0)\n")); writeVal = writeVal; } *(pOutWriteVal+rf) = writeVal; } } #endif void getTxPowerWriteValByRegulatory88E( IN PADAPTER Adapter, IN u8 Channel, IN u8 index, IN u32* powerBase0, IN u32* powerBase1, OUT u32* pOutWriteVal ) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; u1Byte i, chnlGroup=0, pwr_diff_limit[4], customer_pwr_limit; s1Byte pwr_diff=0; u4Byte writeVal, customer_limit, rf; u1Byte Regulatory = pHalData->EEPROMRegulatory; // // Index 0 & 1= legacy OFDM, 2-5=HT_MCS rate // #if 0 // (INTEL_PROXIMITY_SUPPORT == 1) if(pMgntInfo->IntelProximityModeInfo.PowerOutput > 0) Regulatory = 2; #endif for(rf=0; rf<2; rf++) { switch(Regulatory) { case 0: // Realtek better performance // increase power diff defined by Realtek for large power chnlGroup = 0; //RTPRINT(FPHY, PHY_TXPWR, ("MCSTxPowerLevelOriginalOffset[%d][%d] = 0x%x\n", // chnlGroup, index, pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)])); writeVal = pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)] + ((index<2)?powerBase0[rf]:powerBase1[rf]); //RTPRINT(FPHY, PHY_TXPWR, ("RTK better performance, writeVal(%c) = 0x%x\n", ((rf==0)?'A':'B'), writeVal)); break; case 1: // Realtek regulatory // increase power diff defined by Realtek for regulatory { if(pHalData->pwrGroupCnt == 1) chnlGroup = 0; //if(pHalData->pwrGroupCnt >= pHalData->PGMaxGroup) { if (Channel < 3) // Chanel 1-2 chnlGroup = 0; else if (Channel < 6) // Channel 3-5 chnlGroup = 1; else if(Channel <9) // Channel 6-8 chnlGroup = 2; else if(Channel <12) // Channel 9-11 chnlGroup = 3; else if(Channel <14) // Channel 12-13 chnlGroup = 4; else if(Channel ==14) // Channel 14 chnlGroup = 4; if(pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) chnlGroup++; else chnlGroup+=6; /* if(Channel <= 3) chnlGroup = 0; else if(Channel >= 4 && Channel <= 9) chnlGroup = 1; else if(Channel > 9) chnlGroup = 2; if(pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) chnlGroup++; else chnlGroup+=4; */ } //RTPRINT(FPHY, PHY_TXPWR, ("MCSTxPowerLevelOriginalOffset[%d][%d] = 0x%x\n", //chnlGroup, index, pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)])); writeVal = pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)] + ((index<2)?powerBase0[rf]:powerBase1[rf]); //RTPRINT(FPHY, PHY_TXPWR, ("Realtek regulatory, 20MHz, writeVal(%c) = 0x%x\n", ((rf==0)?'A':'B'), writeVal)); } break; case 2: // Better regulatory // don't increase any power diff writeVal = ((index<2)?powerBase0[rf]:powerBase1[rf]); //RTPRINT(FPHY, PHY_TXPWR, ("Better regulatory, writeVal(%c) = 0x%x\n", ((rf==0)?'A':'B'), writeVal)); break; case 3: // Customer defined power diff. // increase power diff defined by customer. chnlGroup = 0; //RTPRINT(FPHY, PHY_TXPWR, ("MCSTxPowerLevelOriginalOffset[%d][%d] = 0x%x\n", // chnlGroup, index, pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)])); /* if (pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20_40) { RTPRINT(FPHY, PHY_TXPWR, ("customer's limit, 40MHz rf(%c) = 0x%x\n", ((rf==0)?'A':'B'), pHalData->PwrGroupHT40[rf][Channel-1])); } else { RTPRINT(FPHY, PHY_TXPWR, ("customer's limit, 20MHz rf(%c) = 0x%x\n", ((rf==0)?'A':'B'), pHalData->PwrGroupHT20[rf][Channel-1])); }*/ if(index < 2) pwr_diff = pHalData->TxPwrLegacyHtDiff[rf][Channel-1]; else if (pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) pwr_diff = pHalData->TxPwrHt20Diff[rf][Channel-1]; //RTPRINT(FPHY, PHY_TXPWR, ("power diff rf(%c) = 0x%x\n", ((rf==0)?'A':'B'), pwr_diff)); if (pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_40) customer_pwr_limit = pHalData->PwrGroupHT40[rf][Channel-1]; else customer_pwr_limit = pHalData->PwrGroupHT20[rf][Channel-1]; //RTPRINT(FPHY, PHY_TXPWR, ("customer pwr limit rf(%c) = 0x%x\n", ((rf==0)?'A':'B'), customer_pwr_limit)); if(pwr_diff >= customer_pwr_limit) pwr_diff = 0; else pwr_diff = customer_pwr_limit - pwr_diff; for (i=0; i<4; i++) { pwr_diff_limit[i] = (u1Byte)((pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)]&(0x7f<<(i*8)))>>(i*8)); if(pwr_diff_limit[i] > pwr_diff) pwr_diff_limit[i] = pwr_diff; } customer_limit = (pwr_diff_limit[3]<<24) | (pwr_diff_limit[2]<<16) | (pwr_diff_limit[1]<<8) | (pwr_diff_limit[0]); //RTPRINT(FPHY, PHY_TXPWR, ("Customer's limit rf(%c) = 0x%x\n", ((rf==0)?'A':'B'), customer_limit)); writeVal = customer_limit + ((index<2)?powerBase0[rf]:powerBase1[rf]); //RTPRINT(FPHY, PHY_TXPWR, ("Customer, writeVal rf(%c)= 0x%x\n", ((rf==0)?'A':'B'), writeVal)); break; default: chnlGroup = 0; writeVal = pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)] + ((index<2)?powerBase0[rf]:powerBase1[rf]); //RTPRINT(FPHY, PHY_TXPWR, ("RTK better performance, writeVal rf(%c) = 0x%x\n", ((rf==0)?'A':'B'), writeVal)); break; } // 20100427 Joseph: Driver dynamic Tx power shall not affect Tx power. It shall be determined by power training mechanism. // Currently, we cannot fully disable driver dynamic tx power mechanism because it is referenced by BT coexist mechanism. // In the future, two mechanism shall be separated from each other and maintained independantly. Thanks for Lanhsin's reminder. //92d do not need this if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1) writeVal = 0x14141414; else if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level2) writeVal = 0x00000000; // 20100628 Joseph: High power mode for BT-Coexist mechanism. // This mechanism is only applied when Driver-Highpower-Mechanism is OFF. if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_BT1) { //RTPRINT(FBT, BT_TRACE, ("Tx Power (-6)\n")); writeVal = writeVal - 0x06060606; } else if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_BT2) { //RTPRINT(FBT, BT_TRACE, ("Tx Power (-0)\n")); writeVal = writeVal ; } /* if(pMgntInfo->bDisableTXPowerByRate) { // add for OID_RT_11N_TX_POWER_BY_RATE ,disable tx powre change by rate writeVal = 0x2c2c2c2c; } */ *(pOutWriteVal+rf) = writeVal; } } static void writeOFDMPowerReg88E( IN PADAPTER Adapter, IN u8 index, IN u32* pValue ) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); u16 RegOffset_A[6] = { rTxAGC_A_Rate18_06, rTxAGC_A_Rate54_24, rTxAGC_A_Mcs03_Mcs00, rTxAGC_A_Mcs07_Mcs04, rTxAGC_A_Mcs11_Mcs08, rTxAGC_A_Mcs15_Mcs12}; u16 RegOffset_B[6] = { rTxAGC_B_Rate18_06, rTxAGC_B_Rate54_24, rTxAGC_B_Mcs03_Mcs00, rTxAGC_B_Mcs07_Mcs04, rTxAGC_B_Mcs11_Mcs08, rTxAGC_B_Mcs15_Mcs12}; u8 i, rf, pwr_val[4]; u32 writeVal; u16 RegOffset; for(rf=0; rf<2; rf++) { writeVal = pValue[rf]; for(i=0; i<4; i++) { pwr_val[i] = (u8)((writeVal & (0x7f<<(i*8)))>>(i*8)); if (pwr_val[i] > RF6052_MAX_TX_PWR) pwr_val[i] = RF6052_MAX_TX_PWR; } writeVal = (pwr_val[3]<<24) | (pwr_val[2]<<16) |(pwr_val[1]<<8) |pwr_val[0]; if(rf == 0) RegOffset = RegOffset_A[index]; else RegOffset = RegOffset_B[index]; PHY_SetBBReg(Adapter, RegOffset, bMaskDWord, writeVal); //RTPRINT(FPHY, PHY_TXPWR, ("Set 0x%x = %08x\n", RegOffset, writeVal)); // 201005115 Joseph: Set Tx Power diff for Tx power training mechanism. if(((pHalData->rf_type == RF_2T2R) && (RegOffset == rTxAGC_A_Mcs15_Mcs12 || RegOffset == rTxAGC_B_Mcs15_Mcs12))|| ((pHalData->rf_type != RF_2T2R) && (RegOffset == rTxAGC_A_Mcs07_Mcs04 || RegOffset == rTxAGC_B_Mcs07_Mcs04)) ) { writeVal = pwr_val[3]; if(RegOffset == rTxAGC_A_Mcs15_Mcs12 || RegOffset == rTxAGC_A_Mcs07_Mcs04) RegOffset = 0xc90; if(RegOffset == rTxAGC_B_Mcs15_Mcs12 || RegOffset == rTxAGC_B_Mcs07_Mcs04) RegOffset = 0xc98; for(i=0; i<3; i++) { if(i!=2) writeVal = (writeVal>8)?(writeVal-8):0; else writeVal = (writeVal>6)?(writeVal-6):0; rtw_write8(Adapter, (u32)(RegOffset+i), (u8)writeVal); } } } } /*----------------------------------------------------------------------------- * Function: PHY_RF6052SetOFDMTxPower * * Overview: For legacy and HY OFDM, we must read EEPROM TX power index for * different channel and read original value in TX power register area from * 0xe00. We increase offset and original value to be correct tx pwr. * * Input: NONE * * Output: NONE * * Return: NONE * * Revised History: * When Who Remark * 11/05/2008 MHC Simulate 8192 series method. * 01/06/2009 MHC 1. Prevent Path B tx power overflow or underflow dure to * A/B pwr difference or legacy/HT pwr diff. * 2. We concern with path B legacy/HT OFDM difference. * 01/22/2009 MHC Support new EPRO format from SD3. * *---------------------------------------------------------------------------*/ VOID rtl8188e_PHY_RF6052SetOFDMTxPower( IN PADAPTER Adapter, IN u8* pPowerLevelOFDM, IN u8* pPowerLevelBW20, IN u8* pPowerLevelBW40, IN u8 Channel) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); u32 writeVal[2], powerBase0[2], powerBase1[2], pwrtrac_value; u8 direction; u8 index = 0; //DBG_871X("PHY_RF6052SetOFDMTxPower, channel(%d) \n", Channel); getPowerBase88E(Adapter, pPowerLevelOFDM,pPowerLevelBW20,pPowerLevelBW40, Channel, &powerBase0[0], &powerBase1[0]); // // 2012/04/23 MH According to power tracking value, we need to revise OFDM tx power. // This is ued to fix unstable power tracking mode. // ODM_TxPwrTrackAdjust88E(&pHalData->odmpriv, 0, &direction, &pwrtrac_value); for(index=0; index<6; index++) { getTxPowerWriteValByRegulatory88E(Adapter, Channel, index, &powerBase0[0], &powerBase1[0], &writeVal[0]); if (direction == 1) { writeVal[0] += pwrtrac_value; writeVal[1] += pwrtrac_value; } else if (direction == 2) { writeVal[0] -= pwrtrac_value; writeVal[1] -= pwrtrac_value; } writeOFDMPowerReg88E(Adapter, index, &writeVal[0]); } } static VOID phy_RF6052_Config_HardCode( IN PADAPTER Adapter ) { // Set Default Bandwidth to 20M //Adapter->HalFunc .SetBWModeHandler(Adapter, HT_CHANNEL_WIDTH_20); // TODO: Set Default Channel to channel one for RTL8225 } static int phy_RF6052_Config_ParaFile( IN PADAPTER Adapter ) { u32 u4RegValue; u8 eRFPath; BB_REGISTER_DEFINITION_T *pPhyReg; int rtStatus = _SUCCESS; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); static char sz88eRadioAFile[] = RTL8188E_PHY_RADIO_A; static char sz88eRadioBFile[] = RTL8188E_PHY_RADIO_B; char *pszRadioAFile, *pszRadioBFile; pszRadioAFile = sz88eRadioAFile; pszRadioBFile = sz88eRadioBFile; //3//----------------------------------------------------------------- //3// <2> Initialize RF //3//----------------------------------------------------------------- //for(eRFPath = RF_PATH_A; eRFPath <pHalData->NumTotalRFPath; eRFPath++) for(eRFPath = 0; eRFPath <pHalData->NumTotalRFPath; eRFPath++) { pPhyReg = &pHalData->PHYRegDef[eRFPath]; /*----Store original RFENV control type----*/ switch(eRFPath) { case RF_PATH_A: case RF_PATH_C: u4RegValue = PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV); break; case RF_PATH_B : case RF_PATH_D: u4RegValue = PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV<<16); break; } /*----Set RF_ENV enable----*/ PHY_SetBBReg(Adapter, pPhyReg->rfintfe, bRFSI_RFENV<<16, 0x1); rtw_udelay_os(1);//PlatformStallExecution(1); /*----Set RF_ENV output high----*/ PHY_SetBBReg(Adapter, pPhyReg->rfintfo, bRFSI_RFENV, 0x1); rtw_udelay_os(1);//PlatformStallExecution(1); /* Set bit number of Address and Data for RF register */ PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, b3WireAddressLength, 0x0); // Set 1 to 4 bits for 8255 rtw_udelay_os(1);//PlatformStallExecution(1); PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, b3WireDataLength, 0x0); // Set 0 to 12 bits for 8255 rtw_udelay_os(1);//PlatformStallExecution(1); /*----Initialize RF fom connfiguration file----*/ switch(eRFPath) { case RF_PATH_A: #ifdef CONFIG_EMBEDDED_FWIMG #ifdef CONFIG_PHY_SETTING_WITH_ODM if(HAL_STATUS_FAILURE ==ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv,(ODM_RF_RADIO_PATH_E)eRFPath, (ODM_RF_RADIO_PATH_E)eRFPath)) rtStatus= _FAIL; #else rtStatus= rtl8188e_PHY_ConfigRFWithHeaderFile(Adapter,(RF_RADIO_PATH_E)eRFPath); #endif//#ifdef CONFIG_PHY_SETTING_WITH_ODM #else rtStatus = rtl8188e_PHY_ConfigRFWithParaFile(Adapter, pszRadioAFile, (RF_RADIO_PATH_E)eRFPath); #endif//#ifdef CONFIG_EMBEDDED_FWIMG break; case RF_PATH_B: #ifdef CONFIG_EMBEDDED_FWIMG #ifdef CONFIG_PHY_SETTING_WITH_ODM if(HAL_STATUS_FAILURE ==ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv,(ODM_RF_RADIO_PATH_E)eRFPath, (ODM_RF_RADIO_PATH_E)eRFPath)) rtStatus= _FAIL; #else rtStatus = rtl8188e_PHY_ConfigRFWithHeaderFile(Adapter,(RF_RADIO_PATH_E)eRFPath); #endif //#ifdef CONFIG_PHY_SETTING_WITH_ODM #else rtStatus =rtl8188e_PHY_ConfigRFWithParaFile(Adapter, pszRadioBFile, (RF_RADIO_PATH_E)eRFPath); #endif break; case RF_PATH_C: break; case RF_PATH_D: break; } /*----Restore RFENV control type----*/; switch(eRFPath) { case RF_PATH_A: case RF_PATH_C: PHY_SetBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV, u4RegValue); break; case RF_PATH_B : case RF_PATH_D: PHY_SetBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV<<16, u4RegValue); break; } if(rtStatus != _SUCCESS){ //RT_TRACE(COMP_FPGA, DBG_LOUD, ("phy_RF6052_Config_ParaFile():Radio[%d] Fail!!", eRFPath)); goto phy_RF6052_Config_ParaFile_Fail; } } //RT_TRACE(COMP_INIT, DBG_LOUD, ("<---phy_RF6052_Config_ParaFile()\n")); return rtStatus; phy_RF6052_Config_ParaFile_Fail: return rtStatus; } int PHY_RF6052_Config8188E( IN PADAPTER Adapter) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); int rtStatus = _SUCCESS; // // Initialize general global value // // TODO: Extend RF_PATH_C and RF_PATH_D in the future if(pHalData->rf_type == RF_1T1R) pHalData->NumTotalRFPath = 1; else pHalData->NumTotalRFPath = 2; // // Config BB and RF // rtStatus = phy_RF6052_Config_ParaFile(Adapter); #if 0 switch( Adapter->MgntInfo.bRegHwParaFile ) { case 0: phy_RF6052_Config_HardCode(Adapter); break; case 1: rtStatus = phy_RF6052_Config_ParaFile(Adapter); break; case 2: // Partial Modify. phy_RF6052_Config_HardCode(Adapter); phy_RF6052_Config_ParaFile(Adapter); break; default: phy_RF6052_Config_HardCode(Adapter); break; } #endif return rtStatus; } // // ==> RF shadow Operation API Code Section!!! // /*----------------------------------------------------------------------------- * Function: PHY_RFShadowRead * PHY_RFShadowWrite * PHY_RFShadowCompare * PHY_RFShadowRecorver * PHY_RFShadowCompareAll * PHY_RFShadowRecorverAll * PHY_RFShadowCompareFlagSet * PHY_RFShadowRecorverFlagSet * * Overview: When we set RF register, we must write shadow at first. * When we are running, we must compare shadow abd locate error addr. * Decide to recorver or not. * * Input: NONE * * Output: NONE * * Return: NONE * * Revised History: * When Who Remark * 11/20/2008 MHC Create Version 0. * *---------------------------------------------------------------------------*/ u32 PHY_RFShadowRead( IN PADAPTER Adapter, IN RF_RADIO_PATH_E eRFPath, IN u32 Offset) { return RF_Shadow[eRFPath][Offset].Value; } /* PHY_RFShadowRead */ VOID PHY_RFShadowWrite( IN PADAPTER Adapter, IN RF_RADIO_PATH_E eRFPath, IN u32 Offset, IN u32 Data) { RF_Shadow[eRFPath][Offset].Value = (Data & bRFRegOffsetMask); RF_Shadow[eRFPath][Offset].Driver_Write = _TRUE; } /* PHY_RFShadowWrite */ BOOLEAN PHY_RFShadowCompare( IN PADAPTER Adapter, IN RF_RADIO_PATH_E eRFPath, IN u32 Offset) { u32 reg; // Check if we need to check the register if (RF_Shadow[eRFPath][Offset].Compare == _TRUE) { reg = PHY_QueryRFReg(Adapter, eRFPath, Offset, bRFRegOffsetMask); // Compare shadow and real rf register for 20bits!! if (RF_Shadow[eRFPath][Offset].Value != reg) { // Locate error position. RF_Shadow[eRFPath][Offset].ErrorOrNot = _TRUE; //RT_TRACE(COMP_INIT, DBG_LOUD, //("PHY_RFShadowCompare RF-%d Addr%02lx Err = %05lx\n", //eRFPath, Offset, reg)); } return RF_Shadow[eRFPath][Offset].ErrorOrNot ; } return _FALSE; } /* PHY_RFShadowCompare */ VOID PHY_RFShadowRecorver( IN PADAPTER Adapter, IN RF_RADIO_PATH_E eRFPath, IN u32 Offset) { // Check if the address is error if (RF_Shadow[eRFPath][Offset].ErrorOrNot == _TRUE) { // Check if we need to recorver the register. if (RF_Shadow[eRFPath][Offset].Recorver == _TRUE) { PHY_SetRFReg(Adapter, eRFPath, Offset, bRFRegOffsetMask, RF_Shadow[eRFPath][Offset].Value); //RT_TRACE(COMP_INIT, DBG_LOUD, //("PHY_RFShadowRecorver RF-%d Addr%02lx=%05lx", //eRFPath, Offset, RF_Shadow[eRFPath][Offset].Value)); } } } /* PHY_RFShadowRecorver */ VOID PHY_RFShadowCompareAll( IN PADAPTER Adapter) { u32 eRFPath; u32 Offset; for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) { for (Offset = 0; Offset <= RF6052_MAX_REG; Offset++) { PHY_RFShadowCompare(Adapter, (RF_RADIO_PATH_E)eRFPath, Offset); } } } /* PHY_RFShadowCompareAll */ VOID PHY_RFShadowRecorverAll( IN PADAPTER Adapter) { u32 eRFPath; u32 Offset; for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) { for (Offset = 0; Offset <= RF6052_MAX_REG; Offset++) { PHY_RFShadowRecorver(Adapter, (RF_RADIO_PATH_E)eRFPath, Offset); } } } /* PHY_RFShadowRecorverAll */ VOID PHY_RFShadowCompareFlagSet( IN PADAPTER Adapter, IN RF_RADIO_PATH_E eRFPath, IN u32 Offset, IN u8 Type) { // Set True or False!!! RF_Shadow[eRFPath][Offset].Compare = Type; } /* PHY_RFShadowCompareFlagSet */ VOID PHY_RFShadowRecorverFlagSet( IN PADAPTER Adapter, IN RF_RADIO_PATH_E eRFPath, IN u32 Offset, IN u8 Type) { // Set True or False!!! RF_Shadow[eRFPath][Offset].Recorver= Type; } /* PHY_RFShadowRecorverFlagSet */ VOID PHY_RFShadowCompareFlagSetAll( IN PADAPTER Adapter) { u32 eRFPath; u32 Offset; for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) { for (Offset = 0; Offset <= RF6052_MAX_REG; Offset++) { // 2008/11/20 MH For S3S4 test, we only check reg 26/27 now!!!! if (Offset != 0x26 && Offset != 0x27) PHY_RFShadowCompareFlagSet(Adapter, (RF_RADIO_PATH_E)eRFPath, Offset, _FALSE); else PHY_RFShadowCompareFlagSet(Adapter, (RF_RADIO_PATH_E)eRFPath, Offset, _TRUE); } } } /* PHY_RFShadowCompareFlagSetAll */ VOID PHY_RFShadowRecorverFlagSetAll( IN PADAPTER Adapter) { u32 eRFPath; u32 Offset; for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) { for (Offset = 0; Offset <= RF6052_MAX_REG; Offset++) { // 2008/11/20 MH For S3S4 test, we only check reg 26/27 now!!!! if (Offset != 0x26 && Offset != 0x27) PHY_RFShadowRecorverFlagSet(Adapter, (RF_RADIO_PATH_E)eRFPath, Offset, _FALSE); else PHY_RFShadowRecorverFlagSet(Adapter, (RF_RADIO_PATH_E)eRFPath, Offset, _TRUE); } } } /* PHY_RFShadowCompareFlagSetAll */ VOID PHY_RFShadowRefresh( IN PADAPTER Adapter) { u32 eRFPath; u32 Offset; for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) { for (Offset = 0; Offset <= RF6052_MAX_REG; Offset++) { RF_Shadow[eRFPath][Offset].Value = 0; RF_Shadow[eRFPath][Offset].Compare = _FALSE; RF_Shadow[eRFPath][Offset].Recorver = _FALSE; RF_Shadow[eRFPath][Offset].ErrorOrNot = _FALSE; RF_Shadow[eRFPath][Offset].Driver_Write = _FALSE; } } } /* PHY_RFShadowRead */ /* End of HalRf6052.c */
{ "pile_set_name": "Github" }
// Copyright 2018-2020 Twitter, Inc. // Licensed under the MoPub SDK License Agreement // http://www.mopub.com/legal/sdk-license-agreement/ package com.mopub.mobileads; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Handler; import androidx.localbroadcastmanager.content.LocalBroadcastManager; import com.mopub.common.CacheServiceTest; import com.mopub.common.DataKeys; import com.mopub.common.FullAdType; import com.mopub.common.test.support.SdkTestRunner; import com.mopub.common.util.Utils; import com.mopub.mobileads.test.support.TestVastManagerFactory; import com.mopub.mobileads.test.support.VastUtils; import org.apache.http.HttpResponse; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; import org.robolectric.Robolectric; import org.robolectric.Shadows; import org.robolectric.shadows.ShadowActivity; import org.robolectric.shadows.ShadowApplication; import org.robolectric.shadows.httpclient.FakeHttp; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import static com.mopub.common.Constants.FOUR_HOURS_MILLIS; import static com.mopub.common.DataKeys.HTML_RESPONSE_BODY_KEY; import static com.mopub.common.IntentActions.ACTION_FULLSCREEN_CLICK; import static com.mopub.common.IntentActions.ACTION_FULLSCREEN_DISMISS; import static com.mopub.common.IntentActions.ACTION_FULLSCREEN_SHOW; import static com.mopub.common.IntentActions.ACTION_REWARDED_AD_COMPLETE; import static com.mopub.mobileads.EventForwardingBroadcastReceiverTest.getIntentForActionAndIdentifier; import static org.fest.assertions.api.Assertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyString; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.withSettings; @RunWith(SdkTestRunner.class) public class MoPubFullscreenTest { private static final String EXPECTED_HTML_DATA = "<html> html </html>"; private static final String EXPECTED_VAST_DATA = "<VAST></VAST>"; private static final String DSP_CREATIVE_ID = "dsp_creative_id"; private static final String AD_UNIT = "ad_unit"; private static final int REWARDED_DURATION_S = 22; private static final String CURRENCY_NAME = "currency_name"; private static final int CURRENCY_AMOUNT = 10; private long broadcastIdentifier; private Activity context; private AdData adData; private MoPubFullscreen subject; private VastManager mockVastManager; private MoPubAd moPubAd; @Mock private AdLifecycleListener.LoadListener loadListener; @Mock private AdLifecycleListener.InteractionListener interactionListener; @Mock private Handler mockHandler; @Before public void setUp() throws Exception { broadcastIdentifier = 15243; mockVastManager = TestVastManagerFactory.getSingletonMock(); moPubAd = mock(MoPubAd.class); final Map<String, String> serverExtras = new HashMap<>(); serverExtras.put(HTML_RESPONSE_BODY_KEY, EXPECTED_HTML_DATA); adData = new AdData.Builder() .extras(serverExtras) .broadcastIdentifier(broadcastIdentifier) .dspCreativeId(DSP_CREATIVE_ID) .adType("mraid") .build(); context = Robolectric.buildActivity(Activity.class).create().get(); subject = new MoPubFullscreen(); subject.setVastManager(mockVastManager); subject.mLoadListener = loadListener; subject.mInteractionListener = interactionListener; } @Test public void show_shouldConnectListenerToBroadcastReceiver() throws Exception { subject.internalLoad(context, loadListener, adData); subject.markReady(); subject.show(); Intent intent = getIntentForActionAndIdentifier(ACTION_FULLSCREEN_SHOW, broadcastIdentifier); LocalBroadcastManager.getInstance(context).sendBroadcast(intent); verify(interactionListener).onAdShown(); verify(interactionListener).onAdImpression(); verifyNoMoreInteractions(interactionListener); Mockito.reset(interactionListener); intent = getIntentForActionAndIdentifier(ACTION_FULLSCREEN_CLICK, broadcastIdentifier); LocalBroadcastManager.getInstance(context).sendBroadcast(intent); verify(interactionListener).onAdClicked(); verifyNoMoreInteractions(interactionListener); Mockito.reset(interactionListener); intent = getIntentForActionAndIdentifier(ACTION_REWARDED_AD_COMPLETE, broadcastIdentifier); LocalBroadcastManager.getInstance(context).sendBroadcast(intent); verify(interactionListener).onAdComplete(null); verifyNoMoreInteractions(interactionListener); Mockito.reset(interactionListener); intent = getIntentForActionAndIdentifier(ACTION_FULLSCREEN_DISMISS, broadcastIdentifier); LocalBroadcastManager.getInstance(context).sendBroadcast(intent); verify(interactionListener).onAdDismissed(); } @Test public void onInvalidate_shouldDisconnectListenerToBroadcastReceiver() throws Exception { subject.internalLoad(context, loadListener, adData); subject.onInvalidate(); Intent intent; intent = new Intent(ACTION_FULLSCREEN_SHOW); LocalBroadcastManager.getInstance(context).sendBroadcast(intent); verify(interactionListener, never()).onAdShown(); intent = new Intent(ACTION_REWARDED_AD_COMPLETE); LocalBroadcastManager.getInstance(context).sendBroadcast(intent); verify(interactionListener, never()).onAdComplete(null); intent = getIntentForActionAndIdentifier(ACTION_FULLSCREEN_CLICK, broadcastIdentifier); LocalBroadcastManager.getInstance(context).sendBroadcast(intent); verify(interactionListener, never()).onAdClicked(); intent = new Intent(ACTION_FULLSCREEN_DISMISS); LocalBroadcastManager.getInstance(context).sendBroadcast(intent); verify(interactionListener, never()).onAdDismissed(); } @Test public void show_shouldStartActivityWithIntent() throws Exception { subject.internalLoad(context, loadListener, adData); subject.setReady(true); subject.show(); ShadowActivity shadowActivity = Shadows.shadowOf(context); Intent intent = shadowActivity.getNextStartedActivityForResult().intent; assertThat(intent.getComponent().getClassName()) .isEqualTo("com.mopub.mobileads.MoPubFullscreenActivity"); assertThat((Object) intent.getParcelableExtra("com_mopub_ad_data")).isNotNull(); } @Test public void load_withDefaultAdData_shouldUseDefaultData() throws Exception { subject.internalLoad(context, loadListener, adData); AdData adData = subject.mAdData; assertThat(adData.getCurrencyAmount()).isEqualTo(0); assertThat(adData.getCurrencyName()).isNull(); assertThat(adData.getRewardedDurationSeconds()).isEqualTo(30); } @Test public void load_withRewardedFields_shouldSetRewardedFields() throws Exception { adData.setRewarded(true); adData.setRewardedDurationSeconds(REWARDED_DURATION_S); adData.setCurrencyName(CURRENCY_NAME); adData.setCurrencyAmount(CURRENCY_AMOUNT); subject.internalLoad(context, loadListener, adData); AdData result = subject.mAdData; assertThat(result.isRewarded()).isTrue(); assertThat(result.getRewardedDurationSeconds()).isEqualTo(REWARDED_DURATION_S); assertThat(result.getCurrencyName()).isEqualTo(CURRENCY_NAME); assertThat(result.getCurrencyAmount()).isEqualTo(CURRENCY_AMOUNT); } @Test public void preRenderHtml_whenCreatingVideoCache_butItHasInitializationErrors_shouldSignalOnInterstitialFailedOnError() throws Exception { // context is null when load is not called, which causes DiskLruCache to not be created subject.preRender(); verify(loadListener).onAdLoadFailed(eq(MoPubErrorCode.VIDEO_CACHE_ERROR)); verify(mockVastManager, never()).prepareVastVideoConfiguration(anyString(), any(VastManager.VastManagerListener.class), any(String.class), any(Context.class)); } @Test public void load_shouldInitializeDiskCache() throws Exception { FakeHttp.addPendingHttpResponse(mock(HttpResponse.class)); CacheServiceTest.assertDiskCacheIsUninitialized(); subject.internalLoad(context, loadListener, adData); CacheServiceTest.assertDiskCacheIsEmpty(); } @Test public void load_withFullAdTypeVast_shouldCreateVastManagerAndProcessVast() throws Exception { loadVast(); verify(mockVastManager).prepareVastVideoConfiguration(eq(EXPECTED_VAST_DATA), eq(subject), eq(DSP_CREATIVE_ID), eq(context)); } @Test public void show_shouldStartVideoPlayerActivityWithAllValidTrackers() throws Exception { VastCompanionAdConfig vastCompanionAdConfig = mock(VastCompanionAdConfig.class, withSettings().serializable()); VastVideoConfig vastVideoConfig = new VastVideoConfig(); vastVideoConfig.setNetworkMediaFileUrl("video_url"); vastVideoConfig.addAbsoluteTrackers(Arrays.asList(new VastAbsoluteProgressTracker.Builder ("start", 2000).build())); vastVideoConfig.addFractionalTrackers(Arrays.asList( new VastFractionalProgressTracker.Builder("first", 0.25f).build(), new VastFractionalProgressTracker.Builder("mid", 0.5f).build(), new VastFractionalProgressTracker.Builder("third", 0.75f).build())); vastVideoConfig.addCompleteTrackers(VastUtils.stringsToVastTrackers("complete")); vastVideoConfig.addImpressionTrackers(VastUtils.stringsToVastTrackers("imp")); vastVideoConfig.setClickThroughUrl("clickThrough"); vastVideoConfig.addClickTrackers(VastUtils.stringsToVastTrackers("click")); vastVideoConfig.setVastCompanionAd(vastCompanionAdConfig, vastCompanionAdConfig); loadVast(); subject.onVastVideoConfigurationPrepared(vastVideoConfig); subject.show(); final Intent intent = ShadowApplication.getInstance().getNextStartedActivity(); assertThat(intent.getComponent().getClassName()).isEqualTo(MoPubFullscreenActivity.class.getCanonicalName()); assertThat(Utils.bitMaskContainsFlag(intent.getFlags(), Intent.FLAG_ACTIVITY_NEW_TASK)).isTrue(); AdData adDataFromActivity = intent.getParcelableExtra(DataKeys.AD_DATA_KEY); assertThat(adData).isEqualsToByComparingFields(adDataFromActivity); assertThat(adDataFromActivity.isRewarded()).isFalse(); } @Test public void onInvalidate_shouldCancelVastManager() throws Exception { subject.onInvalidate(); verify(mockVastManager).cancel(); } @Test public void onInvalidate_whenVastManagerIsNull_shouldNotBlowUp() throws Exception { loadVast(); subject.setVastManager(null); subject.onInvalidate(); // pass } @Test public void onInvalidate_whenFirstCall_shouldDoNothing() { subject.onInvalidate(); // pass } @Test public void onInvalidate_shouldClearRunnable() throws Exception { adData.setRewarded(true); subject.internalLoad(context, loadListener, adData); subject.setHandler(mockHandler); final VastVideoConfig mockVastVideoConfig = mock(VastVideoConfig.class); subject.onVastVideoConfigurationPrepared(mockVastVideoConfig); subject.onInvalidate(); verify(mockHandler).removeCallbacks(any(Runnable.class)); } @Test public void onVastVideoConfigurationPrepared_withVastVideoConfiguration_shouldSignalOnAdLoaded() throws Exception { loadVast(); subject.onVastVideoConfigurationPrepared(mock(VastVideoConfig.class)); verify(loadListener).onAdLoaded(); } @Test public void onVastVideoConfigurationPrepared_withNullVastVideoConfiguration_shouldSignalOnAdFailed() throws Exception { loadVast(); subject.onVastVideoConfigurationPrepared(null); verify(loadListener).onAdLoadFailed(MoPubErrorCode.VIDEO_DOWNLOAD_ERROR); } @Test public void onVastVideoConfigurationPrepared_withProperVastConfig_withRewardedFlag_shouldSetRewardedVideoFlag() throws Exception { adData.setRewarded(true); subject.internalLoad(context, loadListener, adData); final VastVideoConfig mockVastVideoConfig = mock(VastVideoConfig.class); subject.onVastVideoConfigurationPrepared(mockVastVideoConfig); verify(mockVastVideoConfig).setRewarded(true); } @Test public void load_withAdUnitId_shouldSetAdNetworkId() throws Exception { adData.setAdUnit(AD_UNIT); subject.internalLoad(context, loadListener, adData); assertThat(subject.getAdNetworkId()).isEqualTo(AD_UNIT); } @Test public void load_withNoAdUnitId_shouldUseDefaultAdNetworkId() throws Exception { subject.internalLoad(context, loadListener, adData); assertThat(subject.getAdNetworkId()).isEqualTo("com.mopub.mobileads.MoPubFullscreen"); } @Test public void show_withVideoNotLoaded_shouldDoNothing() { subject.show(); ShadowActivity shadowActivity = Shadows.shadowOf(context); ShadowActivity.IntentForResult intentForResult = shadowActivity.getNextStartedActivityForResult(); assertThat(intentForResult).isNull(); } @Test public void show_whenInvalidated_shouldDoNothing() throws Exception { subject.internalLoad(context, loadListener, adData); subject.onInvalidate(); subject.show(); ShadowActivity shadowActivity = Shadows.shadowOf(context); ShadowActivity.IntentForResult intentForResult = shadowActivity.getNextStartedActivityForResult(); assertThat(intentForResult).isNull(); } @Test public void markReady_withRewardedTrue_shouldPostExpirationRunnable() throws Exception { adData.setRewarded(true); subject.internalLoad(context, loadListener, adData); subject.setHandler(mockHandler); subject.markReady(); verify(mockHandler).postDelayed(any(Runnable.class), eq((long) FOUR_HOURS_MILLIS)); } @Test public void markReady_withRewardedFalse_shouldNotPostExpirationRunnable() throws Exception { subject.internalLoad(context, loadListener, adData); subject.setHandler(mockHandler); subject.markReady(); verifyZeroInteractions(mockHandler); } @Test public void markNotReady_withRewardedTrue_shouldClearRunnable() throws Exception { adData.setRewarded(true); subject.internalLoad(context, loadListener, adData); subject.setHandler(mockHandler); subject.markNotReady(); verify(mockHandler).removeCallbacks(any(Runnable.class)); } @Test public void onVastVideoConfigurationPrepared_withRewardedTrue_shouldPostExpirationRunnable() throws Exception { VastVideoConfig vastVideoConfig = new VastVideoConfig(); adData.setRewarded(true); loadVast(); subject.setHandler(mockHandler); subject.onVastVideoConfigurationPrepared(vastVideoConfig); verify(mockHandler).postDelayed(any(Runnable.class), eq((long) FOUR_HOURS_MILLIS)); } private void loadVast() throws Exception { adData.setAdPayload(EXPECTED_VAST_DATA); adData.setFullAdType(FullAdType.VAST); subject.internalLoad(context, loadListener, adData); } }
{ "pile_set_name": "Github" }
/* Pawn compiler * * Drafted after the Small-C compiler Version 2.01, originally created * by Ron Cain, july 1980, and enhanced by James E. Hendrix. * * This version comes close to a complete rewrite. * * Copyright R. Cain, 1980 * Copyright J.E. Hendrix, 1982, 1983 * Copyright ITB CompuPhase, 1997-2005 * * This software is provided "as-is", without any express or implied warranty. * In no event will the authors be held liable for any damages arising from * the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software in * a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. */ #ifndef SC_H_INCLUDED #define SC_H_INCLUDED #include <limits.h> #include <stdarg.h> #include <stdio.h> #if defined __BORLANDC__ && defined _Windows && !(defined __32BIT__ || defined __WIN32__) /* setjmp() and longjmp() not well supported in 16-bit windows */ #include <windows.h> typedef int jmp_buf[9]; #define setjmp(b) Catch(b) #define longjmp(b,e) Throw(b,e) #else #include <setjmp.h> #endif #include "osdefs.h" #include "amx.h" #if PAWN_CELL_SIZE==64 && !defined _I64_MIN #define _I64_MIN (-9223372036854775807ULL - 1) #define _I64_MAX 9223372036854775807ULL #endif /* Note: the "cell" and "ucell" types are defined in AMX.H */ #define PUBLIC_CHAR '@' /* character that defines a function "public" */ #define CTRL_CHAR '^' /* default control character */ #define sCHARBITS 8 /* size of a packed character */ #define sDIMEN_MAX 4 /* maximum number of array dimensions */ #define sLINEMAX 4095 /* input line length (in characters) */ #define sCOMP_STACK 32 /* maximum nesting of #if .. #endif sections */ #define sDEF_LITMAX 500 /* initial size of the literal pool, in "cells" */ #define sDEF_AMXSTACK 4096 /* default stack size for AMX files */ #define PREPROC_TERM '\x7f'/* termination character for preprocessor expressions (the "DEL" code) */ #define sDEF_PREFIX "default.inc" /* default prefix filename */ #if defined WIN32 || defined __clang__ #define INVISIBLE #else #define INVISIBLE __attribute__((visibility("protected"))) #endif typedef union { void *pv; /* e.g. a name */ int i; } stkitem; /* type of items stored on the compiler stack */ typedef struct s_arginfo { /* function argument info */ char name[sNAMEMAX+1]; char ident; /* iVARIABLE, iREFERENCE, iREFARRAY or iVARARGS */ char usage; /* uCONST */ int *tags; /* argument tag id. list */ int numtags; /* number of tags in the tag list */ int dim[sDIMEN_MAX]; int idxtag[sDIMEN_MAX]; int numdim; /* number of dimensions */ unsigned char hasdefault; /* bit0: is there a default value? bit6: "tagof"; bit7: "sizeof" */ union { cell val; /* default value */ struct { char *symname; /* name of another symbol */ short level; /* indirection level for that symbol */ } size; /* used for "sizeof" default value */ struct { cell *data; /* values of default array */ int size; /* complete length of default array */ int arraysize; /* size to reserve on the heap */ cell addr; /* address of the default array in the data segment */ } array; } defvalue; /* default value, or pointer to default array */ int defvalue_tag; /* tag of the default value */ } arginfo; /* Equate table, tagname table, library table */ typedef struct s_constvalue { struct s_constvalue *next; char name[sNAMEMAX+1]; cell value; short index; /* index level, for constants referring to array sizes/tags * automaton id. for states and automatons */ } constvalue; /* Symbol table format * * The symbol name read from the input file is stored in "name", the * value of "addr" is written to the output file. The address in "addr" * depends on the class of the symbol: * global offset into the data segment * local offset relative to the stack frame * label generated hexadecimal number * function offset into code segment */ typedef struct s_symbol { struct s_symbol *next; struct s_symbol *parent; /* hierarchical types (multi-dimensional arrays) */ char name[sNAMEMAX+1]; uint32_t hash; /* value derived from name, for quicker searching */ cell addr; /* address or offset (or value for constant, index for native function) */ cell codeaddr; /* address (in the code segment) where the symbol declaration starts */ char vclass; /* sLOCAL if "addr" refers to a local symbol */ char ident; /* see below for possible values */ short usage; /* see below for possible values */ char flags; /* see below for possible values */ int compound; /* compound level (braces nesting level) */ int tag; /* tagname id */ int fieldtag; /* enumeration fields, where a size is attached to the field */ union { int declared; /* label: how many local variables are declared */ int idxtag; /* array & enum: tag of array indices or the enum item */ constvalue *lib; /* native function: library it is part of */ long stacksize; /* normal/public function: stack requirements */ } x; /* 'x' for 'extra' */ union { arginfo *arglist; /* types of all parameters for functions */ constvalue *enumlist;/* list of names for the "root" of an enumeration */ struct { cell length; /* arrays: length (size) */ short level; /* number of dimensions below this level */ } array; } dim; /* for 'dimension', both functions and arrays */ constvalue *states; /* list of state function addresses */ int fnumber; /* static global variables: file number in which the declaration is visible */ int lnumber; /* line number (in the current source file) for the declaration */ struct s_symbol **refer; /* referrer list, functions that "use" this symbol */ int numrefers; /* number of entries in the referrer list */ char *documentation; /* optional documentation string */ } symbol; /* Possible entries for "ident". These are used in the "symbol", "value" * and arginfo structures. Not every constant is valid for every use. * In an argument list, the list is terminated with a "zero" ident; labels * cannot be passed as function arguments, so the value 0 is overloaded. */ #define iLABEL 0 #define iVARIABLE 1 /* cell that has an address and that can be fetched directly (lvalue) */ #define iREFERENCE 2 /* iVARIABLE, but must be dereferenced */ #define iARRAY 3 #define iREFARRAY 4 /* an array passed by reference (i.e. a pointer) */ #define iARRAYCELL 5 /* array element, cell that must be fetched indirectly */ #define iARRAYCHAR 6 /* array element, character from cell from array */ #define iEXPRESSION 7 /* expression result, has no address (rvalue) */ #define iCONSTEXPR 8 /* constant expression (or constant symbol) */ #define iFUNCTN 9 #define iREFFUNC 10 #define iVARARGS 11 /* function specified ... as argument(s) */ /* Possible entries for "usage" * * This byte is used as a serie of bits, the syntax is different for * functions and other symbols: * * VARIABLE * bits: 0 (uDEFINE) the variable is defined in the source file * 1 (uREAD) the variable is "read" (accessed) in the source file * 2 (uWRITTEN) the variable is altered (assigned a value) * 3 (uCONST) the variable is constant (may not be assigned to) * 4 (uPUBLIC) the variable is public * 6 (uSTOCK) the variable is discardable (without warning) * * FUNCTION * bits: 0 (uDEFINE) the function is defined ("implemented") in the source file * 1 (uREAD) the function is invoked in the source file * 2 (uRETVALUE) the function returns a value (or should return a value) * 3 (uPROTOTYPED) the function was prototyped * 4 (uPUBLIC) the function is public * 5 (uNATIVE) the function is native * 6 (uSTOCK) the function is discardable (without warning) * 7 (uMISSING) the function is not implemented in this source file * * CONSTANT * bits: 0 (uDEFINE) the symbol is defined in the source file * 1 (uREAD) the constant is "read" (accessed) in the source file * 2 (uWRITTEN) redundant, but may be set for constants passed by reference * 3 (uPREDEF) the constant is pre-defined and should be kept between passes * 5 (uENUMROOT) the constant is the "root" of an enumeration * 6 (uENUMFIELD) the constant is a field in a named enumeration */ #define uDEFINE 0x01 #define uREAD 0x02 #define uWRITTEN 0x04 #define uRETVALUE 0x04 /* function returns (or should return) a value */ #define uCONST 0x08 #define uPROTOTYPED 0x08 #define uPREDEF 0x08 /* constant is pre-defined */ #define uPUBLIC 0x10 #define uNATIVE 0x20 #define uENUMROOT 0x20 #define uSTOCK 0x40 #define uENUMFIELD 0x40 #define uMISSING 0x80 #define uVISITED 0x100 /* temporary flag, to mark fields as "visited" in recursive loops */ /* uRETNONE is not stored in the "usage" field of a symbol. It is * used during parsing a function, to detect a mix of "return;" and * "return value;" in a few special cases. */ #define uRETNONE 0x10 #define flgDEPRECATED 0x01 /* symbol is deprecated (avoid use) */ #define uTAGOF 0x40 /* set in the "hasdefault" field of the arginfo struct */ #define uSIZEOF 0x80 /* set in the "hasdefault" field of the arginfo struct */ #define uMAINFUNC "main" #define uENTRYFUNC "entry" #define sGLOBAL 0 /* global/local variable/constant class */ #define sLOCAL 1 #define sSTATIC 2 /* global life, local scope */ typedef struct s_value { symbol *sym; /* symbol in symbol table, NULL for (constant) expression */ cell constval; /* value of the constant expression (if ident==iCONSTEXPR) * also used for the size of a literal array */ int tag; /* tagname id (of the expression) */ char forceuntag; /* whether expression is untagged using _: */ char ident; /* iCONSTEXPR, iVARIABLE, iARRAY, iARRAYCELL, * iEXPRESSION or iREFERENCE */ char boolresult; /* boolean result for relational operators */ cell *arrayidx; /* last used array indices, for checking self assignment */ } value; /* "while" statement queue (also used for "for" and "do - while" loops) */ enum { wqBRK, /* used to restore stack for "break" */ wqCONT, /* used to restore stack for "continue" */ wqLOOP, /* loop start label number */ wqEXIT, /* loop exit label number (jump if false) */ /* --- */ wqSIZE /* "while queue" size */ }; #define wqTABSZ (24*wqSIZE) /* 24 nested loop statements */ enum { statIDLE, /* not compiling yet */ statFIRST, /* first pass */ statWRITE, /* writing output */ statSKIP, /* skipping output */ }; typedef struct s_stringlist { struct s_stringlist *next; char *line; } stringlist; typedef struct s_stringpair { struct s_stringpair *next; char *first; char *second; int matchlength; char flags; char *documentation; } stringpair; typedef struct s_valuepair { struct s_valuepair *next; long first; long second; } valuepair; /* macros for code generation */ #define opcodes(n) ((n)*sizeof(cell)) /* opcode size */ #define opargs(n) ((n)*sizeof(cell)) /* size of typical argument */ /* Tokens recognized by lex() * Some of these constants are assigned as well to the variable "lastst" */ #define tFIRST 256 /* value of first multi-character operator */ #define tMIDDLE 280 /* value of last multi-character operator */ #define tLAST 325 /* value of last multi-character match-able token */ /* multi-character operators */ #define taMULT 256 /* *= */ #define taDIV 257 /* /= */ #define taMOD 258 /* %= */ #define taADD 259 /* += */ #define taSUB 260 /* -= */ #define taSHL 261 /* <<= */ #define taSHRU 262 /* >>>= */ #define taSHR 263 /* >>= */ #define taAND 264 /* &= */ #define taXOR 265 /* ^= */ #define taOR 266 /* |= */ #define tlOR 267 /* || */ #define tlAND 268 /* && */ #define tlEQ 269 /* == */ #define tlNE 270 /* != */ #define tlLE 271 /* <= */ #define tlGE 272 /* >= */ #define tSHL 273 /* << */ #define tSHRU 274 /* >>> */ #define tSHR 275 /* >> */ #define tINC 276 /* ++ */ #define tDEC 277 /* -- */ #define tELLIPS 278 /* ... */ #define tDBLDOT 279 /* .. */ #define tDBLCOLON 280 /* :: */ /* reserved words (statements) */ #define tASSERT 281 #define tBREAK 282 #define tCASE 283 #define tCHAR 284 #define tCONST 285 #define tCONTINUE 286 #define tDEFAULT 287 #define tDEFINED 288 #define tDO 289 #define tELSE 290 #define tENUM 291 #define tEXIT 292 #define tFOR 293 #define tFORWARD 294 #define tGOTO 295 #define tIF 296 #define tNATIVE 297 #define tNEW 298 #define tOPERATOR 299 #define tPUBLIC 300 #define tRETURN 301 #define tSIZEOF 302 #define tSLEEP 303 #define tSTATE 304 #define tSTATIC 305 #define tSTOCK 306 #define tSWITCH 307 #define tTAGOF 308 #define tWHILE 309 /* compiler directives */ #define tpASSERT 310 /* #assert */ #define tpDEFINE 311 #define tpELSE 312 /* #else */ #define tpELSEIF 313 /* #elseif */ #define tpEMIT 314 #define tpENDIF 315 #define tpENDINPUT 316 #define tpENDSCRPT 317 #define tpERROR 318 #define tpFILE 319 #define tpIF 320 /* #if */ #define tINCLUDE 321 #define tpLINE 322 #define tpPRAGMA 323 #define tpTRYINCLUDE 324 #define tpUNDEF 325 /* semicolon is a special case, because it can be optional */ #define tTERM 326 /* semicolon or newline */ #define tENDEXPR 327 /* forced end of expression */ /* other recognized tokens */ #define tNUMBER 328 /* integer number */ #define tRATIONAL 329 /* rational number */ #define tSYMBOL 330 #define tLABEL 331 #define tSTRING 332 #define tPENDING_STRING 333 #define tEXPR 334 /* for assigment to "lastst" only */ #define tEMPTYBLOCK 335 /* empty blocks for AM bug 4825 */ /* (reversed) evaluation of staging buffer */ #define sSTARTREORDER 0x01 #define sENDREORDER 0x02 #define sEXPRSTART 0x80 /* top bit set, rest is free */ #define sMAXARGS 127 /* relates to the bit pattern of sEXPRSTART */ #define sDOCSEP 0x01 /* to separate documentation comments between functions */ /* codes for ffabort() */ #define xEXIT 1 /* exit code in PRI */ #define xASSERTION 2 /* abort caused by failing assertion */ #define xSTACKERROR 3 /* stack/heap overflow */ #define xBOUNDSERROR 4 /* array index out of bounds */ #define xMEMACCESS 5 /* data access error */ #define xINVINSTR 6 /* invalid instruction */ #define xSTACKUNDERFLOW 7 /* stack underflow */ #define xHEAPUNDERFLOW 8 /* heap underflow */ #define xCALLBACKERR 9 /* no, or invalid, callback */ #define xSLEEP 12 /* sleep, exit code in PRI, tag in ALT */ /* Miscellaneous */ #if !defined TRUE #define FALSE 0 #define TRUE 1 #endif #define sIN_CSEG 1 /* if parsing CODE */ #define sIN_DSEG 2 /* if parsing DATA */ #define sCHKBOUNDS 1 /* bit position in "debug" variable: check bounds */ #define sSYMBOLIC 2 /* bit position in "debug" variable: symbolic info */ #define sNOOPTIMIZE 4 /* bit position in "debug" variable: no optimization */ #define sRESET 0 /* reset error flag */ #define sFORCESET 1 /* force error flag on */ #define sEXPRMARK 2 /* mark start of expression */ #define sEXPRRELEASE 3 /* mark end of expression */ #define sSETLINE 4 /* set line number for the error */ #define sSETFILE 5 /* set file number for the error */ typedef enum s_regid { sPRI, /* indicates the primary register */ sALT, /* indicates the secundary register */ } regid; typedef enum s_optmark { sEXPR, /* end of expression (for expressions that form a statement) */ sPARM, /* end of parameter (in a function parameter list) */ sLDECL, /* start of local declaration (variable) */ } optmark; #if INT_MAX<0x8000u #define PUBLICTAG 0x8000u #define FIXEDTAG 0x4000u #else #define PUBLICTAG 0x80000000Lu #define FIXEDTAG 0x40000000Lu #endif #define TAGMASK (~PUBLICTAG) /* interface functions */ #if defined __cplusplus extern "C" { #endif /* * Functions you call from the "driver" program */ int pc_compile(int argc, char **argv); int pc_addconstant(char *name,cell value,int tag); int pc_addtag(char *name); int pc_enablewarning(int number,int enable); /* * Functions called from the compiler (to be implemented by you) */ /* general console output */ #if PAWN_CELL_SIZE==32 #if defined __WIN32__ || defined _WIN32 || defined WIN32 __declspec (dllexport) int pc_printf(const char *message,...); #else extern int __attribute__((visibility("default"))) pc_printf(const char *message,...); #endif #else int pc_printf(const char *message, ...) INVISIBLE; #endif /* error report function */ int pc_error(int number,char *message,char *filename,int firstline,int lastline,va_list argptr); /* input from source file */ void *pc_opensrc(char *filename); /* reading only */ void *pc_createsrc(char *filename); void pc_closesrc(void *handle); /* never delete */ void pc_resetsrc(void *handle,void *position); /* reset to a position marked earlier */ char *pc_readsrc(void *handle,unsigned char *target,int maxchars); int pc_writesrc(void *handle,unsigned char *source); void *pc_getpossrc(void *handle); /* mark the current position */ int pc_eofsrc(void *handle); /* output to intermediate (.ASM) file */ void *pc_openasm(char *filename); /* read/write */ void pc_closeasm(void *handle,int deletefile); void pc_resetasm(void *handle); int pc_writeasm(void *handle,char *str); char *pc_readasm(void *handle,char *target,int maxchars); /* output to binary (.AMX) file */ void *pc_openbin(char *filename); void pc_closebin(void *handle,int deletefile); void pc_resetbin(void *handle,long offset); int pc_writebin(void *handle,void *buffer,int size); long pc_lengthbin(void *handle); /* return the length of the file */ #if defined __cplusplus } #endif /* by default, functions and variables used in throughout the compiler * files are "external" */ #if !defined SC_FUNC #define SC_FUNC #endif #if !defined SC_VDECL #define SC_VDECL extern #endif #if !defined SC_VDEFINE #define SC_VDEFINE #endif /* function prototypes in SC1.C */ SC_FUNC void set_extension(char *filename,char *extension,int force); SC_FUNC symbol *fetchfunc(char *name,int tag); SC_FUNC char *operator_symname(char *symname,char *opername,int tag1,int tag2,int numtags,int resulttag); SC_FUNC char *funcdisplayname(char *dest,char *funcname); SC_FUNC int constexpr(cell *val,int *tag,symbol **symptr); SC_FUNC constvalue *append_constval(constvalue *table,const char *name,cell val,short index); SC_FUNC constvalue *find_constval(constvalue *table,char *name,short index); SC_FUNC void delete_consttable(constvalue *table); SC_FUNC symbol *add_constant(char *name,cell val,int vclass,int tag); SC_FUNC void exporttag(int tag); SC_FUNC void sc_attachdocumentation(symbol *sym); SC_FUNC int get_actual_compound(symbol *sym); #if !defined NO_DEFINE SC_FUNC void inst_file_name(char* filename, int strip_path); #endif /* function prototypes in SC2.C */ #define PUSHSTK_P(v) { stkitem s_; s_.pv=(v); pushstk(s_); } #define PUSHSTK_I(v) { stkitem s_; s_.i=(v); pushstk(s_); } #define POPSTK_P() (popstk().pv) #define POPSTK_I() (popstk().i) SC_FUNC void pushstk(stkitem val); SC_FUNC stkitem popstk(void); SC_FUNC void clearstk(void); SC_FUNC int plungequalifiedfile(char *name); /* explicit path included */ SC_FUNC int plungefile(char *name,int try_currentpath,int try_includepaths); /* search through "include" paths */ SC_FUNC void preprocess(void); SC_FUNC void lexinit(void); SC_FUNC int lex(cell *lexvalue,char **lexsym); SC_FUNC void lexpush(void); SC_FUNC void lexclr(int clreol); SC_FUNC int matchtoken(int token); SC_FUNC int tokeninfo(cell *val,char **str); SC_FUNC int needtoken(int token); SC_FUNC void litadd(cell value); SC_FUNC void litinsert(cell value,int pos); SC_FUNC int alphanum(char c); SC_FUNC int ishex(char c); SC_FUNC void delete_symbol(symbol *root,symbol *sym); SC_FUNC void delete_symbols(symbol *root,int level,int del_labels,int delete_functions); SC_FUNC int refer_symbol(symbol *entry,symbol *bywhom); SC_FUNC void markusage(symbol *sym,int usage); SC_FUNC symbol *findglb(const char *name); SC_FUNC symbol *findloc(const char *name); SC_FUNC symbol *findconst(const char *name); SC_FUNC symbol *finddepend(const symbol *parent); SC_FUNC symbol *addsym(const char *name,cell addr,int ident,int vclass,int tag, int usage); SC_FUNC symbol *addvariable(const char *name,cell addr,int ident,int vclass,int tag, int dim[],int numdim,int idxtag[]); SC_FUNC int getlabel(void); SC_FUNC char *itoh(ucell val); /* function prototypes in SC3.C */ SC_FUNC int check_userop(void (*oper)(void),int tag1,int tag2,int numparam, value *lval,int *resulttag); SC_FUNC int matchtag(int formaltag,int actualtag,int allowcoerce); SC_FUNC int expression(cell *val,int *tag,symbol **symptr,int chkfuncresult); /* function prototypes in SC4.C */ SC_FUNC void writeleader(symbol *root); SC_FUNC void writetrailer(void); SC_FUNC void begcseg(void); SC_FUNC void begdseg(void); SC_FUNC void setline(int chkbounds); SC_FUNC void setfiledirect(char *name); SC_FUNC void setlinedirect(int line); SC_FUNC void setlabel(int index); SC_FUNC void markexpr(optmark type,const char *name,cell offset); SC_FUNC void startfunc(char *fname); SC_FUNC void endfunc(void); SC_FUNC void alignframe(int numbytes); SC_FUNC void rvalue(value *lval); SC_FUNC void address(symbol *ptr,regid reg); SC_FUNC void store(value *lval); SC_FUNC void storereg(cell address,regid reg); SC_FUNC void memcopy(cell size); SC_FUNC void copyarray(symbol *sym,cell size); SC_FUNC void fillarray(symbol *sym,cell size,cell value); SC_FUNC void ldconst(cell val,regid reg); SC_FUNC void moveto1(void); SC_FUNC void pushreg(regid reg); SC_FUNC void pushval(cell val); SC_FUNC void popreg(regid reg); SC_FUNC void swap1(void); SC_FUNC void ffswitch(int label); SC_FUNC void ffcase(cell value,char *labelname,int newtable); SC_FUNC void ffcall(symbol *sym,const char *label,int numargs); SC_FUNC void ffret(void); SC_FUNC void ffabort(int reason); SC_FUNC void ffbounds(cell size); SC_FUNC void jumplabel(int number); SC_FUNC void defstorage(void); SC_FUNC void modstk(int delta); SC_FUNC void setstk(cell value); SC_FUNC void modheap(int delta); SC_FUNC void setheap_pri(void); SC_FUNC void setheap(cell value); SC_FUNC void cell2addr(void); SC_FUNC void cell2addr_alt(void); SC_FUNC void addr2cell(void); SC_FUNC void char2addr(void); SC_FUNC void charalign(void); SC_FUNC void addconst(cell value); SC_FUNC void move_alt(void); SC_FUNC void load_hidden_arg(); /* Code generation functions for arithmetic operators. * * Syntax: o[u|s|b]_name * | | | +--- name of operator * | | +----- underscore * | +--------- "u"nsigned operator, "s"igned operator or "b"oth * +------------- "o"perator */ SC_FUNC void os_mult(void); /* multiplication (signed) */ SC_FUNC void os_div(void); /* division (signed) */ SC_FUNC void os_mod(void); /* modulus (signed) */ SC_FUNC void ob_add(void); /* addition */ SC_FUNC void ob_sub(void); /* subtraction */ SC_FUNC void ob_sal(void); /* shift left (arithmetic) */ SC_FUNC void os_sar(void); /* shift right (arithmetic, signed) */ SC_FUNC void ou_sar(void); /* shift right (logical, unsigned) */ SC_FUNC void ob_or(void); /* bitwise or */ SC_FUNC void ob_xor(void); /* bitwise xor */ SC_FUNC void ob_and(void); /* bitwise and */ SC_FUNC void ob_eq(void); /* equality */ SC_FUNC void ob_ne(void); /* inequality */ SC_FUNC void relop_prefix(void); SC_FUNC void relop_suffix(void); SC_FUNC void os_le(void); /* less or equal (signed) */ SC_FUNC void os_ge(void); /* greater or equal (signed) */ SC_FUNC void os_lt(void); /* less (signed) */ SC_FUNC void os_gt(void); /* greater (signed) */ SC_FUNC void lneg(void); SC_FUNC void neg(void); SC_FUNC void invert(void); SC_FUNC void nooperation(void); SC_FUNC void inc(value *lval); SC_FUNC void dec(value *lval); SC_FUNC void jmp_ne0(int number); SC_FUNC void jmp_eq0(int number); SC_FUNC void outval(cell val,int newline); /* function prototypes in SC5.C */ SC_FUNC int error(int number,...) INVISIBLE; SC_FUNC void errorset(int code, int line); /* function prototypes in SC6.C */ SC_FUNC int assemble(FILE *fout,FILE *fin); /* function prototypes in SC7.C */ SC_FUNC void stgbuffer_cleanup(void); SC_FUNC void stgmark(char mark); SC_FUNC void stgwrite(const char *st); SC_FUNC void stgout(int index); SC_FUNC void stgdel(int index,cell code_index); SC_FUNC int stgget(int *index,cell *code_index); SC_FUNC void stgset(int onoff); SC_FUNC int phopt_init(void); SC_FUNC int phopt_cleanup(void); /* function prototypes in SCLIST.C */ SC_FUNC char* duplicatestring(const char* sourcestring); SC_FUNC stringpair *insert_alias(char *name,char *alias); SC_FUNC stringpair *find_alias(char *name); SC_FUNC int lookup_alias(char *target,char *name); SC_FUNC void delete_aliastable(void); SC_FUNC stringlist *insert_path(char *path); SC_FUNC char *get_path(int index); SC_FUNC void delete_pathtable(void); SC_FUNC stringpair *insert_subst(char *pattern,char *substitution,int prefixlen); SC_FUNC int get_subst(int index,char **pattern,char **substitution); SC_FUNC stringpair *find_subst(char *name,int length); SC_FUNC int delete_subst(char *name,int length); SC_FUNC void delete_substtable(void); SC_FUNC stringlist *insert_sourcefile(char *string); SC_FUNC char *get_sourcefile(int index); SC_FUNC void delete_sourcefiletable(void); SC_FUNC stringlist *insert_inputfile(char *string); SC_FUNC char *get_inputfile(int index); SC_FUNC void delete_inputfiletable(void); SC_FUNC stringlist *insert_docstring(char *string); SC_FUNC char *get_docstring(int index); SC_FUNC void delete_docstring(int index); SC_FUNC void delete_docstringtable(void); SC_FUNC stringlist *insert_autolist(char *string); SC_FUNC char *get_autolist(int index); SC_FUNC void delete_autolisttable(void); SC_FUNC valuepair *push_heaplist(long first, long second); SC_FUNC int popfront_heaplist(long *first, long *second); SC_FUNC void delete_heaplisttable(void); SC_FUNC stringlist *insert_dbgfile(const char *filename); SC_FUNC stringlist *insert_dbgline(int linenr); SC_FUNC stringlist *insert_dbgsymbol(symbol *sym); SC_FUNC char *get_dbgstring(int index); SC_FUNC void delete_dbgstringtable(void); /* function prototypes in SCMEMFILE.C */ #if !defined tMEMFILE typedef unsigned char MEMFILE; #define tMEMFILE 1 #endif MEMFILE *mfcreate(char *filename); void mfclose(MEMFILE *mf); int mfdump(MEMFILE *mf); long mflength(MEMFILE *mf); long mfseek(MEMFILE *mf,long offset,int whence); unsigned int mfwrite(MEMFILE *mf,unsigned char *buffer,unsigned int size); unsigned int mfread(MEMFILE *mf,unsigned char *buffer,unsigned int size); char *mfgets(MEMFILE *mf,char *string,unsigned int size); int mfputs(MEMFILE *mf,char *string); /* function prototypes in SCI18N.C */ #define MAXCODEPAGE 12 SC_FUNC int cp_path(const char *root,const char *directory); SC_FUNC int cp_set(const char *name); SC_FUNC cell cp_translate(const unsigned char *string,const unsigned char **endptr); /* function prototypes in SCSTATE.C */ SC_FUNC constvalue *automaton_add(const char *name); SC_FUNC constvalue *automaton_find(const char *name); SC_FUNC constvalue *automaton_findid(int id); SC_FUNC constvalue *state_add(const char *name,int fsa_id); SC_FUNC constvalue *state_find(const char *name,int fsa_id); SC_FUNC constvalue *state_findid(int id); SC_FUNC void state_buildlist(int **list,int *listsize,int *count,int stateid); SC_FUNC int state_addlist(int *list,int count,int fsa_id); SC_FUNC void state_deletetable(void); SC_FUNC int state_getfsa(int listid); SC_FUNC int state_count(int listid); SC_FUNC int state_inlist(int listid,int state); SC_FUNC int state_listitem(int listid,int index); SC_FUNC void state_conflict(symbol *root); /* external variables (defined in scvars.c) */ #if !defined SC_SKIP_VDECL typedef struct HashTable HashTable; SC_VDECL struct HashTable *sp_Globals; SC_VDECL symbol loctab; /* local symbol table */ SC_VDECL symbol glbtab; /* global symbol table */ SC_VDECL cell *litq; /* the literal queue */ SC_VDECL unsigned char pline[]; /* the line read from the input file */ SC_VDECL const unsigned char *lptr;/* points to the current position in "pline" */ SC_VDECL constvalue tagname_tab;/* tagname table */ SC_VDECL constvalue libname_tab;/* library table (#pragma library "..." syntax) */ SC_VDECL constvalue *curlibrary;/* current library */ SC_VDECL int pc_addlibtable; /* is the library table added to the AMX file? */ SC_VDECL symbol *curfunc; /* pointer to current function */ SC_VDECL char *inpfname; /* name of the file currently read from */ SC_VDECL char outfname[]; /* intermediate (assembler) file name */ SC_VDECL char binfname[]; /* binary file name */ SC_VDECL char errfname[]; /* error file name */ SC_VDECL char sc_ctrlchar; /* the control character (or escape character) */ SC_VDECL char sc_ctrlchar_org;/* the default control character */ SC_VDECL int litidx; /* index to literal table */ SC_VDECL int litmax; /* current size of the literal table */ SC_VDECL int stgidx; /* index to the staging buffer */ SC_VDECL int sc_labnum; /* number of (internal) labels */ SC_VDECL int staging; /* true if staging output */ SC_VDECL cell declared; /* number of local cells declared */ SC_VDECL cell glb_declared; /* number of global cells declared */ SC_VDECL cell code_idx; /* number of bytes with generated code */ SC_VDECL int ntv_funcid; /* incremental number of native function */ SC_VDECL int errnum; /* number of errors */ SC_VDECL int warnnum; /* number of warnings */ SC_VDECL int sc_debug; /* debug/optimization options (bit field) */ SC_VDECL int sc_packstr; /* strings are packed by default? */ SC_VDECL int sc_asmfile; /* create .ASM file? */ SC_VDECL int sc_listing; /* create .LST file? */ SC_VDECL int sc_compress; /* compress bytecode? */ SC_VDECL int sc_needsemicolon;/* semicolon required to terminate expressions? */ SC_VDECL int sc_dataalign; /* data alignment value */ SC_VDECL int sc_alignnext; /* must frame of the next function be aligned? */ SC_VDECL int pc_docexpr; /* must expression be attached to documentation comment? */ SC_VDECL int sc_showincludes; /* show include files? */ SC_VDECL int curseg; /* 1 if currently parsing CODE, 2 if parsing DATA */ SC_VDECL cell sc_stksize; /* stack size */ SC_VDECL cell sc_amxlimit; /* abstract machine size limit */ SC_VDECL int freading; /* is there an input file ready for reading? */ SC_VDECL int fline; /* the line number in the current file */ SC_VDECL short fnumber; /* number of files in the input file table */ SC_VDECL short fcurrent; /* current file being processed */ SC_VDECL short sc_intest; /* true if inside a test */ SC_VDECL int sideeffect; /* true if an expression causes a side-effect */ SC_VDECL int stmtindent; /* current indent of the statement */ SC_VDECL int indent_nowarn; /* skip warning "217 loose indentation" */ SC_VDECL int sc_tabsize; /* number of spaces that a TAB represents */ SC_VDECL short sc_allowtags; /* allow/detect tagnames in lex() */ SC_VDECL int sc_status; /* read/write status */ SC_VDECL int sc_rationaltag; /* tag for rational numbers */ SC_VDECL int rational_digits; /* number of fractional digits */ SC_VDECL int sc_allowproccall;/* allow/detect tagnames in lex() */ SC_VDECL char *pc_deprecate; /* if non-NULL, mark next declaration as deprecated */ SC_VDECL int sc_warnings_are_errors; SC_VDECL constvalue sc_automaton_tab; /* automaton table */ SC_VDECL constvalue sc_state_tab; /* state table */ SC_VDECL int pc_anytag; SC_VDECL FILE *inpf; /* file read from (source or include) */ SC_VDECL FILE *inpf_org; /* main source file */ SC_VDECL FILE *outf; /* file written to */ SC_VDECL jmp_buf errbuf; /* target of longjmp() on a fatal error */ SC_VDECL SC_VDEFINE char sLiteralQueueDisabled; #if !defined SC_LIGHT SC_VDECL int sc_makereport; /* generate a cross-reference report */ #endif #endif /* SC_SKIP_VDECL */ #endif /* SC_H_INCLUDED */
{ "pile_set_name": "Github" }
#include "led_medium.h" #include <argos3/core/simulator/simulator.h> #include <argos3/core/simulator/space/space.h> #include <argos3/core/simulator/space/positional_indices/grid.h> #include <argos3/core/utility/configuration/argos_exception.h> #include <argos3/core/utility/logging/argos_log.h> namespace argos { /****************************************/ /****************************************/ CLEDMedium::CLEDMedium() { } /****************************************/ /****************************************/ CLEDMedium::~CLEDMedium() { } /****************************************/ /****************************************/ void CLEDMedium::Init(TConfigurationNode& t_tree) { try { CMedium::Init(t_tree); /* Get the positional index method */ std::string strPosIndexMethod("grid"); GetNodeAttributeOrDefault(t_tree, "index", strPosIndexMethod, strPosIndexMethod); /* Get the arena center and size */ CVector3 cArenaCenter; CVector3 cArenaSize; TConfigurationNode& tArena = GetNode(CSimulator::GetInstance().GetConfigurationRoot(), "arena"); GetNodeAttribute(tArena, "size", cArenaSize); GetNodeAttributeOrDefault(tArena, "center", cArenaCenter, cArenaCenter); /* Create the positional index for LED entities */ if(strPosIndexMethod == "grid") { size_t punGridSize[3]; if(!NodeAttributeExists(t_tree, "grid_size")) { punGridSize[0] = cArenaSize.GetX(); punGridSize[1] = cArenaSize.GetY(); punGridSize[2] = cArenaSize.GetZ(); } else { std::string strPosGridSize; GetNodeAttribute(t_tree, "grid_size", strPosGridSize); ParseValues<size_t>(strPosGridSize, 3, punGridSize, ','); } CGrid<CLEDEntity>* pcGrid = new CGrid<CLEDEntity>( cArenaCenter - cArenaSize * 0.5f, cArenaCenter + cArenaSize * 0.5f, punGridSize[0], punGridSize[1], punGridSize[2]); m_pcLEDEntityGridUpdateOperation = new CLEDEntityGridUpdater(*pcGrid); pcGrid->SetUpdateEntityOperation(m_pcLEDEntityGridUpdateOperation); m_pcLEDEntityIndex = pcGrid; } else { THROW_ARGOSEXCEPTION("Unknown method \"" << strPosIndexMethod << "\" for the positional index."); } } catch(CARGoSException& ex) { THROW_ARGOSEXCEPTION_NESTED("Error in initialization of the LED medium", ex); } } /****************************************/ /****************************************/ void CLEDMedium::PostSpaceInit() { Update(); } /****************************************/ /****************************************/ void CLEDMedium::Reset() { m_pcLEDEntityIndex->Reset(); } /****************************************/ /****************************************/ void CLEDMedium::Destroy() { delete m_pcLEDEntityIndex; if(m_pcLEDEntityGridUpdateOperation != NULL) { delete m_pcLEDEntityGridUpdateOperation; } } /****************************************/ /****************************************/ void CLEDMedium::Update() { m_pcLEDEntityIndex->Update(); } /****************************************/ /****************************************/ void CLEDMedium::AddEntity(CLEDEntity& c_entity) { m_pcLEDEntityIndex->AddEntity(c_entity); } /****************************************/ /****************************************/ void CLEDMedium::RemoveEntity(CLEDEntity& c_entity) { m_pcLEDEntityIndex->RemoveEntity(c_entity); } /****************************************/ /****************************************/ REGISTER_MEDIUM(CLEDMedium, "led", "Carlo Pinciroli [ilpincy@gmail.com]", "1.0", "Manages the LEDs.", "This medium is required to manage the LED entities, thus allowing the\n" "associated camera sensors to work properly. If you intend to use a camera\n" "sensor that detects colored blobs, you must add this medium to the XML\n" "configuration file.\n\n" "REQUIRED XML CONFIGURATION\n\n" "<led id=\"led\" />\n\n" "OPTIONAL XML CONFIGURATION\n\n" "None for the time being\n", "Under development" ); /****************************************/ /****************************************/ }
{ "pile_set_name": "Github" }
/* * Copyright (c) 2018-2020 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/fs/fs_common.hpp> #include <stratosphere/fs/impl/fs_newable.hpp> #include <stratosphere/fs/fsa/fs_ifile.hpp> #include <stratosphere/fs/fsa/fs_idirectory.hpp> #include <stratosphere/fs/fsa/fs_ifilesystem.hpp> #include <stratosphere/fs/fs_query_range.hpp> #include <stratosphere/fs/fs_path_tool.hpp> #include <stratosphere/fs/fs_path_utils.hpp> namespace ams::fs { class RemoteFile : public fsa::IFile, public impl::Newable { private: ::FsFile base_file; public: RemoteFile(const ::FsFile &f) : base_file(f) { /* ... */ } virtual ~RemoteFile() { fsFileClose(std::addressof(this->base_file)); } public: virtual Result ReadImpl(size_t *out, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) override final { return fsFileRead(std::addressof(this->base_file), offset, buffer, size, option.value, out); } virtual Result GetSizeImpl(s64 *out) override final { return fsFileGetSize(std::addressof(this->base_file), out); } virtual Result FlushImpl() override final { return fsFileFlush(std::addressof(this->base_file)); } virtual Result WriteImpl(s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) override final { return fsFileWrite(std::addressof(this->base_file), offset, buffer, size, option.value); } virtual Result SetSizeImpl(s64 size) override final { return fsFileSetSize(std::addressof(this->base_file), size); } virtual Result OperateRangeImpl(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override final { R_UNLESS(op_id == OperationId::QueryRange, fs::ResultUnsupportedOperationInFileServiceObjectAdapterA()); R_UNLESS(dst_size == sizeof(FileQueryRangeInfo), fs::ResultInvalidSize()); return fsFileOperateRange(std::addressof(this->base_file), static_cast<::FsOperationId>(op_id), offset, size, reinterpret_cast<::FsRangeInfo *>(dst)); } public: virtual sf::cmif::DomainObjectId GetDomainObjectId() const override { return sf::cmif::DomainObjectId{serviceGetObjectId(const_cast<::Service *>(std::addressof(this->base_file.s)))}; } }; class RemoteDirectory : public fsa::IDirectory, public impl::Newable { private: ::FsDir base_dir; public: RemoteDirectory(const ::FsDir &d) : base_dir(d) { /* ... */ } virtual ~RemoteDirectory() { fsDirClose(std::addressof(this->base_dir)); } public: virtual Result ReadImpl(s64 *out_count, DirectoryEntry *out_entries, s64 max_entries) override final { return fsDirRead(std::addressof(this->base_dir), out_count, max_entries, out_entries); } virtual Result GetEntryCountImpl(s64 *out) override final { return fsDirGetEntryCount(std::addressof(this->base_dir), out); } public: virtual sf::cmif::DomainObjectId GetDomainObjectId() const override { return sf::cmif::DomainObjectId{serviceGetObjectId(const_cast<::Service *>(std::addressof(this->base_dir.s)))}; } }; class RemoteFileSystem : public fsa::IFileSystem, public impl::Newable { private: ::FsFileSystem base_fs; public: RemoteFileSystem(const ::FsFileSystem &fs) : base_fs(fs) { /* ... */ } virtual ~RemoteFileSystem() { fsFsClose(std::addressof(this->base_fs)); } private: Result GetPathForServiceObject(fssrv::sf::Path *out_path, const char *path) { /* Copy and null terminate. */ std::strncpy(out_path->str, path, sizeof(out_path->str) - 1); out_path->str[sizeof(out_path->str) - 1] = '\x00'; /* Replace directory separators. */ Replace(out_path->str, sizeof(out_path->str) - 1, StringTraits::AlternateDirectorySeparator, StringTraits::DirectorySeparator); /* Get lengths. */ const auto mount_name_len = PathTool::IsWindowsAbsolutePath(path) ? 2 : 0; const auto rel_path = out_path->str + mount_name_len; const auto max_len = fs::EntryNameLengthMax - mount_name_len; return VerifyPath(rel_path, max_len, max_len); } public: virtual Result CreateFileImpl(const char *path, s64 size, int flags) override final { fssrv::sf::Path sf_path; R_TRY(GetPathForServiceObject(std::addressof(sf_path), path)); return fsFsCreateFile(std::addressof(this->base_fs), sf_path.str, size, flags); } virtual Result DeleteFileImpl(const char *path) override final { fssrv::sf::Path sf_path; R_TRY(GetPathForServiceObject(std::addressof(sf_path), path)); return fsFsDeleteFile(std::addressof(this->base_fs), sf_path.str); } virtual Result CreateDirectoryImpl(const char *path) override final { fssrv::sf::Path sf_path; R_TRY(GetPathForServiceObject(std::addressof(sf_path), path)); return fsFsCreateDirectory(std::addressof(this->base_fs), sf_path.str); } virtual Result DeleteDirectoryImpl(const char *path) override final { fssrv::sf::Path sf_path; R_TRY(GetPathForServiceObject(std::addressof(sf_path), path)); return fsFsDeleteDirectory(std::addressof(this->base_fs), sf_path.str); } virtual Result DeleteDirectoryRecursivelyImpl(const char *path) override final { fssrv::sf::Path sf_path; R_TRY(GetPathForServiceObject(std::addressof(sf_path), path)); return fsFsDeleteDirectoryRecursively(std::addressof(this->base_fs), sf_path.str); } virtual Result RenameFileImpl(const char *old_path, const char *new_path) override final { fssrv::sf::Path old_sf_path; fssrv::sf::Path new_sf_path; R_TRY(GetPathForServiceObject(std::addressof(old_sf_path), old_path)); R_TRY(GetPathForServiceObject(std::addressof(new_sf_path), new_path)); return fsFsRenameFile(std::addressof(this->base_fs), old_sf_path.str, new_sf_path.str); } virtual Result RenameDirectoryImpl(const char *old_path, const char *new_path) override final { fssrv::sf::Path old_sf_path; fssrv::sf::Path new_sf_path; R_TRY(GetPathForServiceObject(std::addressof(old_sf_path), old_path)); R_TRY(GetPathForServiceObject(std::addressof(new_sf_path), new_path)); return fsFsRenameDirectory(std::addressof(this->base_fs), old_sf_path.str, new_sf_path.str); } virtual Result GetEntryTypeImpl(DirectoryEntryType *out, const char *path) override final { fssrv::sf::Path sf_path; R_TRY(GetPathForServiceObject(std::addressof(sf_path), path)); static_assert(sizeof(::FsDirEntryType) == sizeof(DirectoryEntryType)); return fsFsGetEntryType(std::addressof(this->base_fs), sf_path.str, reinterpret_cast<::FsDirEntryType *>(out)); } virtual Result OpenFileImpl(std::unique_ptr<fsa::IFile> *out_file, const char *path, OpenMode mode) override final { fssrv::sf::Path sf_path; R_TRY(GetPathForServiceObject(std::addressof(sf_path), path)); FsFile f; R_TRY(fsFsOpenFile(std::addressof(this->base_fs), sf_path.str, mode, &f)); auto file = std::make_unique<RemoteFile>(f); R_UNLESS(file != nullptr, fs::ResultAllocationFailureInNew()); *out_file = std::move(file); return ResultSuccess(); } virtual Result OpenDirectoryImpl(std::unique_ptr<fsa::IDirectory> *out_dir, const char *path, OpenDirectoryMode mode) override final { fssrv::sf::Path sf_path; R_TRY(GetPathForServiceObject(std::addressof(sf_path), path)); FsDir d; R_TRY(fsFsOpenDirectory(std::addressof(this->base_fs), sf_path.str, mode, &d)); auto dir = std::make_unique<RemoteDirectory>(d); R_UNLESS(dir != nullptr, fs::ResultAllocationFailureInNew()); *out_dir = std::move(dir); return ResultSuccess(); } virtual Result CommitImpl() override final { return fsFsCommit(std::addressof(this->base_fs)); } virtual Result GetFreeSpaceSizeImpl(s64 *out, const char *path) { fssrv::sf::Path sf_path; R_TRY(GetPathForServiceObject(std::addressof(sf_path), path)); return fsFsGetFreeSpace(std::addressof(this->base_fs), sf_path.str, out); } virtual Result GetTotalSpaceSizeImpl(s64 *out, const char *path) { fssrv::sf::Path sf_path; R_TRY(GetPathForServiceObject(std::addressof(sf_path), path)); return fsFsGetTotalSpace(std::addressof(this->base_fs), sf_path.str, out); } virtual Result CleanDirectoryRecursivelyImpl(const char *path) { fssrv::sf::Path sf_path; R_TRY(GetPathForServiceObject(std::addressof(sf_path), path)); return fsFsCleanDirectoryRecursively(std::addressof(this->base_fs), sf_path.str); } virtual Result GetFileTimeStampRawImpl(FileTimeStampRaw *out, const char *path) { fssrv::sf::Path sf_path; R_TRY(GetPathForServiceObject(std::addressof(sf_path), path)); static_assert(sizeof(FileTimeStampRaw) == sizeof(::FsTimeStampRaw)); return fsFsGetFileTimeStampRaw(std::addressof(this->base_fs), sf_path.str, reinterpret_cast<::FsTimeStampRaw *>(out)); } virtual Result QueryEntryImpl(char *dst, size_t dst_size, const char *src, size_t src_size, fsa::QueryId query, const char *path) { fssrv::sf::Path sf_path; R_TRY(GetPathForServiceObject(std::addressof(sf_path), path)); return fsFsQueryEntry(std::addressof(this->base_fs), dst, dst_size, src, src_size, sf_path.str, static_cast<FsFileSystemQueryId>(query)); } }; }
{ "pile_set_name": "Github" }
while(a)
{ "pile_set_name": "Github" }
--- title: Test network policy description: Verify that network policy works correctly. canonical_url: '/getting-started/kubernetes/hardway/test-network-policy' --- In this lab we will test network policy. Follow the instructions in the [Simple policy tutorial](/security/tutorials/kubernetes-policy-basic) to verify policy works correctly. ## Next [End user RBAC](./end-user-rbac)
{ "pile_set_name": "Github" }
<component name="libraryTable"> <library name="Maven: commons-lang:commons-lang:2.4"> <CLASSES> <root url="jar:///david/spark15/commons-lang/commons-lang/2.4/commons-lang-2.4.jar!/" /> </CLASSES> <JAVADOC> <root url="jar:///david/spark15/commons-lang/commons-lang/2.4/commons-lang-2.4-javadoc.jar!/" /> </JAVADOC> <SOURCES> <root url="jar:///david/spark15/commons-lang/commons-lang/2.4/commons-lang-2.4-sources.jar!/" /> </SOURCES> </library> </component>
{ "pile_set_name": "Github" }
{ "id": "gov_bc_ca_bcgnws", "title": "BC Geographical Names Web Service -", "description": "This REST API provides searchable access to information about geographical names in the province of British Columbia, including name status and details about the corresponding geographic feature.", "security": {}, "logo": { "url": "https://s3-us-west-2.amazonaws.com/datafire-logos/gov_bc_ca_bcgnws.jpeg" }, "actionCount": 14, "actions": [ { "id": "featureCategories.get", "title": "featureCategories.get", "description": "Gets a list of all feature categories used by the BC Geographical Names Information System (BCGNIS). Note: there are three levels of classification in the BCGNIS feature taxonomy: classes, categories and types. A type is a subset of a category, and a category is a subset of a class.", "inputSchema": { "type": "object", "properties": { "outputFormat": { "type": "string", "description": "The format of the output.", "enum": [ "json", "xml" ], "default": "json" } }, "additionalProperties": false, "required": [ "outputFormat" ] }, "outputSchema": {} }, { "id": "featureClasses.get", "title": "featureClasses.get", "description": "Gets a list of all feature classes used by the BC Geographical Names Information System (BCGNIS). Note: there are three levels of classification in the BCGNIS feature taxonomy: classes, categories and types. A type is a subset of a category, and a category is a subset of a class.", "inputSchema": { "type": "object", "properties": { "outputFormat": { "type": "string", "description": "The format of the output.", "enum": [ "json", "xml" ], "default": "json" } }, "additionalProperties": false, "required": [ "outputFormat" ] }, "outputSchema": {} }, { "id": "featureTypes.get", "title": "featureTypes.get", "description": "Gets a list of all feature types used by the BC Geographical Names Information System (BCGNIS). Note: there are three levels of classification in the BCGNIS feature taxonomy: classes, categories and types. A type is a subset of a category, and a category is a subset of a class.", "inputSchema": { "type": "object", "properties": { "outputFormat": { "type": "string", "description": "The format of the output.", "enum": [ "json", "xml" ], "default": "json" } }, "additionalProperties": false, "required": [ "outputFormat" ] }, "outputSchema": {} }, { "id": "features.featureId.get", "title": "features.featureId.get", "description": "Get information about the geographical feature with the specified featureId.", "inputSchema": { "type": "object", "properties": { "featureId": { "type": "integer", "description": "The unique identifier for a feature" } }, "additionalProperties": false, "required": [ "featureId" ] }, "outputSchema": {} }, { "id": "nameAuthorities.get", "title": "nameAuthorities.get", "description": "Gets a list of all name authorities responsible for naming decisions of the geographical names in the BC Geographical Names Information System (BCGNIS)", "inputSchema": { "type": "object", "properties": { "outputFormat": { "type": "string", "description": "The format of the output.", "enum": [ "json", "xml" ], "default": "json" } }, "additionalProperties": false, "required": [ "outputFormat" ] }, "outputSchema": {} }, { "id": "names.changes.get", "title": "names.changes.get", "description": "Search for information about geographical names which have changed most recently within a specified time window. Changes may include status cupdates and metadata corrections.", "inputSchema": { "type": "object", "properties": { "outputFormat": { "type": "string", "description": "The format of the output.", "enum": [ "json", "xml", "kml", "csv" ], "default": "json" }, "fromDate": { "type": "integer", "description": "Defines the earliest date (YYYY-MM-DD format) of the change time window for the search" }, "toDate": { "type": "integer", "description": "Defines the latest date (YYYY-MM-DD format) of the change time window for the search" }, "featureClass": { "type": "string", "description": "A filter to limit the search to names associated with features of a certain 'class' The value of this parameter should be a 'featureClassCode' value returned by the /featureClasses resource, or an asterisk (*) to request that all feature classes be included.", "default": "*" }, "featureCategory": { "type": "string", "description": "A filter to limit the search to names associated with features of a certain 'category' The value of this parameter should be a 'featureCategoryCode' value returned by the /featureCategories resource, or an asterisk (*) to request that all feature categories be included.", "default": "*" }, "featureType": { "type": "string", "description": "A filter to limit the search to names associated with features of a certain 'type' The value of this parameter should be a 'featureTypeCode' value returned by the /featureTypes resource, or an asterisk (*) to request that all feature types be included", "default": "*" }, "sortBy": { "type": "string", "description": "The distance to move the accessPoint away from the curb and towards the inside of the parcel (in metres). Ignored if locationDescriptor not set to accessPoint.", "enum": [ "name", "featureType", "decisionDate" ], "default": "name" }, "outputSRS": { "type": "integer", "description": "The EPSG code of the spatial reference system (SRS) to use for output geometries.", "enum": [ 4326, 4269, 3005, 3857, 26907, 26908, 26909, 26910, 26911 ], "default": 4326 }, "embed": { "type": "integer", "description": "A flag to indicate whether to embed the corresponding 'feature' into each matching name", "enum": [ 0, 1 ] }, "outputStyle": { "type": "string", "description": "A flag indicating whether to include with each matching name a succinct list of attributes (summary), or a comprehensive list of attributes (detail)", "enum": [ "summary", "detail" ], "default": "summary" }, "itemsPerPage": { "type": "integer", "description": "The number of search results to return (1-200)", "default": 20 }, "startIndex": { "type": "integer", "description": "The index of the first record to be returned (>= 1)", "default": 1 } }, "additionalProperties": false, "required": [ "outputFormat", "fromDate", "toDate" ] }, "outputSchema": {} }, { "id": "names.decisions.recent.get", "title": "names.decisions.recent.get", "description": "Search for information about geographical names affected by naming 'decisions' made by the BC Geographical Names Office (naming authority) within the last X days.", "inputSchema": { "type": "object", "properties": { "outputFormat": { "type": "string", "description": "The format of the output.", "enum": [ "json", "xml", "kml", "csv" ], "default": "json" }, "days": { "type": "integer", "description": "The number of days used to define the time window of naming decisions to search. The number is interpreted as searching for 'names affected by decisions within the last X days'.", "default": 30 }, "featureClass": { "type": "string", "description": "A filter to limit the search to names associated with features of a certain 'class' The value of this parameter should be a 'featureClassCode' value returned by the /featureClasses resource, or an asterisk (*) to request that all feature classes be included.", "default": "*" }, "featureCategory": { "type": "string", "description": "A filter to limit the search to names associated with features of a certain 'category' The value of this parameter should be a 'featureCategoryCode' value returned by the /featureCategories resource, or an asterisk (*) to request that all feature categories be included.", "default": "*" }, "featureType": { "type": "string", "description": "A filter to limit the search to names associated with features of a certain 'type' The value of this parameter should be a 'featureTypeCode' value returned by the /featureTypes resource, or an asterisk (*) to request that all feature types be included", "default": "*" }, "sortBy": { "type": "string", "description": "The distance to move the accessPoint away from the curb and towards the inside of the parcel (in metres). Ignored if locationDescriptor not set to accessPoint.", "enum": [ "name", "featureType", "decisionDate" ], "default": "name" }, "outputSRS": { "type": "integer", "description": "The EPSG code of the spatial reference system (SRS) to use for output geometries.", "enum": [ 4326, 4269, 3005, 3857, 26907, 26908, 26909, 26910, 26911 ], "default": 4326 }, "embed": { "type": "integer", "description": "A flag to indicate whether to embed the corresponding 'feature' into each matching name", "enum": [ 0, 1 ] }, "outputStyle": { "type": "string", "description": "A flag indicating whether to include with each matching name a succinct list of attributes (summary), or a comprehensive list of attributes (detail)", "enum": [ "summary", "detail" ], "default": "summary" }, "itemsPerPage": { "type": "integer", "description": "The number of search results to return (1-200)", "default": 20 }, "startIndex": { "type": "integer", "description": "The index of the first record to be returned (>= 1)", "default": 1 } }, "additionalProperties": false, "required": [ "outputFormat", "days" ] }, "outputSchema": {} }, { "id": "names.decisions.year.get", "title": "names.decisions.year.get", "description": "Search for information about geographical names affected by naming 'decisions' made by the BC Geographical Names Office (naming authority) in a given year.", "inputSchema": { "type": "object", "properties": { "outputFormat": { "type": "string", "description": "The format of the output.", "enum": [ "json", "xml", "kml", "csv" ], "default": "json" }, "year": { "type": "integer", "description": "The year in which to search for names affected by naming decisions'." }, "featureClass": { "type": "string", "description": "A filter to limit the search to names associated with features of a certain 'class' The value of this parameter should be a 'featureClassCode' value returned by the /featureClasses resource, or an asterisk (*) to request that all feature classes be included.", "default": "*" }, "featureCategory": { "type": "string", "description": "A filter to limit the search to names associated with features of a certain 'category' The value of this parameter should be a 'featureCategoryCode' value returned by the /featureCategories resource, or an asterisk (*) to request that all feature categories be included.", "default": "*" }, "featureType": { "type": "string", "description": "A filter to limit the search to names associated with features of a certain 'type' The value of this parameter should be a 'featureTypeCode' value returned by the /featureTypes resource, or an asterisk (*) to request that all feature types be included", "default": "*" }, "sortBy": { "type": "string", "description": "The distance to move the accessPoint away from the curb and towards the inside of the parcel (in metres). Ignored if locationDescriptor not set to accessPoint.", "enum": [ "name", "featureType", "decisionDate" ], "default": "name" }, "outputSRS": { "type": "integer", "description": "The EPSG code of the spatial reference system (SRS) to use for output geometries.", "enum": [ 4326, 4269, 3005, 3857, 26907, 26908, 26909, 26910, 26911 ], "default": 4326 }, "embed": { "type": "integer", "description": "A flag to indicate whether to embed the corresponding 'feature' into each matching name", "enum": [ 0, 1 ] }, "outputStyle": { "type": "string", "description": "A flag indicating whether to include with each matching name a succinct list of attributes (summary), or a comprehensive list of attributes (detail)", "enum": [ "summary", "detail" ], "default": "summary" }, "itemsPerPage": { "type": "integer", "description": "The number of search results to return (1-200)", "default": 20 }, "startIndex": { "type": "integer", "description": "The index of the first record to be returned (>= 1)", "default": 1 } }, "additionalProperties": false, "required": [ "outputFormat", "year" ] }, "outputSchema": {} }, { "id": "names.inside.get", "title": "names.inside.get", "description": "Search for information about geographical names that correspond to features within a geographic bounding box. Various options and filter parameters are available to refine the search.", "inputSchema": { "type": "object", "properties": { "outputFormat": { "type": "string", "description": "The format of the output.", "enum": [ "json", "xml", "kml", "csv" ], "default": "json" }, "bbox": { "type": "string", "description": "A geographic bounding box defining the search area. Must be specified as a string of the form 'minLongitude,minLatitude,maxLongitude,maxLatitude' (WGS84). e.g. -119,49,-118,50" }, "featureClass": { "type": "string", "description": "A filter to limit the search to names associated with features of a certain 'class' The value of this parameter should be a 'featureClassCode' value returned by the /featureClasses resource, or an asterisk (*) to request that all feature classes be included.", "default": "*" }, "featureCategory": { "type": "string", "description": "A filter to limit the search to names associated with features of a certain 'category' The value of this parameter should be a 'featureCategoryCode' value returned by the /featureCategories resource, or an asterisk (*) to request that all feature categories be included.", "default": "*" }, "featureType": { "type": "string", "description": "A filter to limit the search to names associated with features of a certain 'type' The value of this parameter should be a 'featureTypeCode' value returned by the /featureTypes resource, or an asterisk (*) to request that all feature types be included", "default": "*" }, "sortBy": { "type": "string", "description": "The distance to move the accessPoint away from the curb and towards the inside of the parcel (in metres). Ignored if locationDescriptor not set to accessPoint.", "enum": [ "name", "featureType", "decisionDate" ], "default": "name" }, "outputSRS": { "type": "integer", "description": "The EPSG code of the spatial reference system (SRS) to use for output geometries.", "enum": [ 4326, 4269, 3005, 3857, 26907, 26908, 26909, 26910, 26911 ], "default": 4326 }, "embed": { "type": "integer", "description": "A flag to indicate whether to embed the corresponding 'feature' into each matching name", "enum": [ 0, 1 ] }, "outputStyle": { "type": "string", "description": "A flag indicating whether to include with each matching name a succinct list of attributes (summary), or a comprehensive list of attributes (detail)", "enum": [ "summary", "detail" ], "default": "summary" }, "itemsPerPage": { "type": "integer", "description": "The number of search results to return (1-200)", "default": 20 }, "startIndex": { "type": "integer", "description": "The index of the first record to be returned (>= 1)", "default": 1 } }, "additionalProperties": false, "required": [ "outputFormat", "bbox" ] }, "outputSchema": {} }, { "id": "names.near.get", "title": "names.near.get", "description": "Search for information about geographical names that correspond to features within a geographic area defined by a centre point and a radius. Various options and filter parameters are available to refine the search.", "inputSchema": { "type": "object", "properties": { "outputFormat": { "type": "string", "description": "The format of the output.", "enum": [ "json", "xml", "kml", "csv" ], "default": "json" }, "featurePoint": { "type": "string", "description": "A geographic coordinate specifying the centre point of the search area. Must be specified as a string of the form 'longitude,latitude' (WGS84). e.g. -120,51" }, "distance": { "type": "string", "description": "A radius (in kilometres) around the centre point." }, "featureClass": { "type": "string", "description": "A filter to limit the search to names associated with features of a certain 'class' The value of this parameter should be a 'featureClassCode' value returned by the /featureClasses resource, or an asterisk (*) to request that all feature classes be included.", "default": "*" }, "featureCategory": { "type": "string", "description": "A filter to limit the search to names associated with features of a certain 'category' The value of this parameter should be a 'featureCategoryCode' value returned by the /featureCategories resource, or an asterisk (*) to request that all feature categories be included.", "default": "*" }, "featureType": { "type": "string", "description": "A filter to limit the search to names associated with features of a certain 'type' The value of this parameter should be a 'featureTypeCode' value returned by the /featureTypes resource, or an asterisk (*) to request that all feature types be included", "default": "*" }, "sortBy": { "type": "string", "description": "The distance to move the accessPoint away from the curb and towards the inside of the parcel (in metres). Ignored if locationDescriptor not set to accessPoint.", "enum": [ "name", "featureType", "decisionDate" ], "default": "name" }, "outputSRS": { "type": "integer", "description": "The EPSG code of the spatial reference system (SRS) to use for output geometries.", "enum": [ 4326, 4269, 3005, 3857, 26907, 26908, 26909, 26910, 26911 ], "default": 4326 }, "embed": { "type": "integer", "description": "A flag to indicate whether to embed the corresponding 'feature' into each matching name", "enum": [ 0, 1 ] }, "outputStyle": { "type": "string", "description": "A flag indicating whether to include with each matching name a succinct list of attributes (summary), or a comprehensive list of attributes (detail)", "enum": [ "summary", "detail" ], "default": "summary" }, "itemsPerPage": { "type": "integer", "description": "The number of search results to return (1-200)", "default": 20 }, "startIndex": { "type": "integer", "description": "The index of the first record to be returned (>= 1)", "default": 1 } }, "additionalProperties": false, "required": [ "outputFormat", "featurePoint", "distance" ] }, "outputSchema": {} }, { "id": "names.notOfficial.search.get", "title": "names.notOfficial.search.get", "description": "Search for information about unofficial geographical names by the text of the name itself. Various options and filter parameters are available to refine the search.", "inputSchema": { "type": "object", "properties": { "outputFormat": { "type": "string", "description": "The format of the output.", "enum": [ "json", "xml", "kml", "csv" ], "default": "json" }, "name": { "type": "string", "description": "A filter to search based on the the text of the name itself. Use the asterisk (*) as a wildcard character. For example 'vancouv*'" }, "exactSpelling": { "type": "integer", "description": "If the 'name' parameter is specified, 'exactSpelling' specifies whether to include only names that exactly match the search text (exactSpelling=1), or whether to also include names with similar spellings (exactSpelling=0)", "enum": [ 0, 1 ], "default": 0 }, "featureClass": { "type": "string", "description": "A filter to limit the search to names associated with features of a certain 'class' The value of this parameter should be a 'featureClassCode' value returned by the /featureClasses resource, or an asterisk (*) to request that all feature classes be included.", "default": "*" }, "featureCategory": { "type": "string", "description": "A filter to limit the search to names associated with features of a certain 'category' The value of this parameter should be a 'featureCategoryCode' value returned by the /featureCategories resource, or an asterisk (*) to request that all feature categories be included.", "default": "*" }, "featureType": { "type": "string", "description": "A filter to limit the search to names associated with features of a certain 'type' The value of this parameter should be a 'featureTypeCode' value returned by the /featureTypes resource, or an asterisk (*) to request that all feature types be included", "default": "*" }, "sortBy": { "type": "string", "description": "The distance to move the accessPoint away from the curb and towards the inside of the parcel (in metres). Ignored if locationDescriptor not set to accessPoint.", "enum": [ "relevance", "name", "featureType", "decisionDate" ], "default": "relevance" }, "outputSRS": { "type": "integer", "description": "The EPSG code of the spatial reference system (SRS) to use for output geometries.", "enum": [ 4326, 4269, 3005, 3857, 26907, 26908, 26909, 26910, 26911 ], "default": 4326 }, "embed": { "type": "integer", "description": "A flag to indicate whether to embed the corresponding 'feature' into each matching name", "enum": [ 0, 1 ] }, "outputStyle": { "type": "string", "description": "A flag indicating whether to include with each matching name a succinct list of attributes (summary), or a comprehensive list of attributes (detail)", "enum": [ "summary", "detail" ], "default": "summary" }, "itemsPerPage": { "type": "integer", "description": "The number of search results to return (1-200)", "default": 20 }, "startIndex": { "type": "integer", "description": "The index of the first record to be returned (>= 1)", "default": 1 } }, "additionalProperties": false, "required": [ "outputFormat", "name" ] }, "outputSchema": {} }, { "id": "names.official.search.get", "title": "names.official.search.get", "description": "Search for information about official geographical names by the text of the name itself. Various options and filter parameters are available to refine the search.", "inputSchema": { "type": "object", "properties": { "outputFormat": { "type": "string", "description": "The format of the output.", "enum": [ "json", "xml", "kml", "csv" ], "default": "json" }, "name": { "type": "string", "description": "A filter to search based on the the text of the name itself. Use the asterisk (*) as a wildcard character. For example 'vancouv*'" }, "exactSpelling": { "type": "integer", "description": "If the 'name' parameter is specified, 'exactSpelling' specifies whether to include only names that exactly match the search text (exactSpelling=1), or whether to also include names with similar spellings (exactSpelling=0)", "enum": [ 0, 1 ], "default": 0 }, "featureClass": { "type": "string", "description": "A filter to limit the search to names associated with features of a certain 'class' The value of this parameter should be a 'featureClassCode' value returned by the /featureClasses resource, or an asterisk (*) to request that all feature classes be included.", "default": "*" }, "featureCategory": { "type": "string", "description": "A filter to limit the search to names associated with features of a certain 'category' The value of this parameter should be a 'featureCategoryCode' value returned by the /featureCategories resource, or an asterisk (*) to request that all feature categories be included.", "default": "*" }, "featureType": { "type": "string", "description": "A filter to limit the search to names associated with features of a certain 'type' The value of this parameter should be a 'featureTypeCode' value returned by the /featureTypes resource, or an asterisk (*) to request that all feature types be included", "default": "*" }, "sortBy": { "type": "string", "description": "The distance to move the accessPoint away from the curb and towards the inside of the parcel (in metres). Ignored if locationDescriptor not set to accessPoint.", "enum": [ "relevance", "name", "featureType", "decisionDate" ], "default": "relevance" }, "outputSRS": { "type": "integer", "description": "The EPSG code of the spatial reference system (SRS) to use for output geometries.", "enum": [ 4326, 4269, 3005, 3857, 26907, 26908, 26909, 26910, 26911 ], "default": 4326 }, "embed": { "type": "integer", "description": "A flag to indicate whether to embed the corresponding 'feature' into each matching name", "enum": [ 0, 1 ] }, "outputStyle": { "type": "string", "description": "A flag indicating whether to include with each matching name a succinct list of attributes (summary), or a comprehensive list of attributes (detail)", "enum": [ "summary", "detail" ], "default": "summary" }, "itemsPerPage": { "type": "integer", "description": "The number of search results to return (1-200)", "default": 20 }, "startIndex": { "type": "integer", "description": "The index of the first record to be returned (>= 1)", "default": 1 } }, "additionalProperties": false, "required": [ "outputFormat", "name" ] }, "outputSchema": {} }, { "id": "names.search.get", "title": "names.search.get", "description": "Search for information about geographical names by the text of the name itself. The response will include both official and unofficial names. Various options and filter parameters are available to refine the search.", "inputSchema": { "type": "object", "properties": { "outputFormat": { "type": "string", "description": "The format of the output.", "enum": [ "json", "xml", "kml", "csv" ], "default": "json" }, "name": { "type": "string", "description": "A filter to search based on the the text of the name itself. Use the asterisk (*) as a wildcard character. For example 'vancouv*'" }, "exactSpelling": { "type": "integer", "description": "If the 'name' parameter is specified, 'exactSpelling' specifies whether to include only names that exactly match the search text (exactSpelling=1), or whether to also include names with similar spellings (exactSpelling=0)", "enum": [ 0, 1 ], "default": 0 }, "featureClass": { "type": "string", "description": "A filter to limit the search to names associated with features of a certain 'class' The value of this parameter should be a 'featureClassCode' value returned by the /featureClasses resource, or an asterisk (*) to request that all feature classes be included.", "default": "*" }, "featureCategory": { "type": "string", "description": "A filter to limit the search to names associated with features of a certain 'category' The value of this parameter should be a 'featureCategoryCode' value returned by the /featureCategories resource, or an asterisk (*) to request that all feature categories be included.", "default": "*" }, "featureType": { "type": "string", "description": "A filter to limit the search to names associated with features of a certain 'type' The value of this parameter should be a 'featureTypeCode' value returned by the /featureTypes resource, or an asterisk (*) to request that all feature types be included", "default": "*" }, "sortBy": { "type": "string", "description": "The distance to move the accessPoint away from the curb and towards the inside of the parcel (in metres). Ignored if locationDescriptor not set to accessPoint.", "enum": [ "relevance", "name", "featureType", "decisionDate" ], "default": "relevance" }, "outputSRS": { "type": "integer", "description": "The EPSG code of the spatial reference system (SRS) to use for output geometries.", "enum": [ 4326, 4269, 3005, 3857, 26907, 26908, 26909, 26910, 26911 ], "default": 4326 }, "embed": { "type": "integer", "description": "A flag to indicate whether to embed the corresponding 'feature' into each matching name", "enum": [ 0, 1 ] }, "outputStyle": { "type": "string", "description": "A flag indicating whether to include with each matching name a succinct list of attributes (summary), or a comprehensive list of attributes (detail)", "enum": [ "summary", "detail" ], "default": "summary" }, "itemsPerPage": { "type": "integer", "description": "The number of search results to return (1-200)", "default": 20 }, "startIndex": { "type": "integer", "description": "The index of the first record to be returned (>= 1)", "default": 1 } }, "additionalProperties": false, "required": [ "outputFormat", "name" ] }, "outputSchema": {} }, { "id": "names.nameId.outputFormat.get", "title": "names.nameId.outputFormat.get", "description": "Get information about the geographical name with the specified nameId.", "inputSchema": { "type": "object", "properties": { "nameId": { "type": "integer", "description": "The unique identifier for a name" }, "outputFormat": { "type": "string", "description": "The format of the output.", "enum": [ "json", "xml", "kml", "csv", "html" ], "default": "json" } }, "additionalProperties": false, "required": [ "nameId", "outputFormat" ] }, "outputSchema": {} } ], "directory": "generated", "tags": [ "open data" ] }
{ "pile_set_name": "Github" }
// REQUIRES: powerpc-registered-target // RUN: %clang -x c++ -target powerpc64le-unknown-linux-gnu -o - %s \ // RUN: -emit-interface-stubs -emit-merged-ifs -S | \ // RUN: FileCheck -check-prefix=CHECK-IFS %s // CHECK-IFS: --- !experimental-ifs-v1 // CHECK-IFS: IfsVersion: 1.0 // CHECK-IFS: Triple: powerpc64le // CHECK-IFS: Symbols: // CHECK-IFS: _Z8helloPPCv: { Type: Func } // CHECK-IFS: ... int helloPPC();
{ "pile_set_name": "Github" }
#include <thread> int main() { std::this_thread::yield(); } // https://github.com/ukoethe/vigra/issues/220
{ "pile_set_name": "Github" }
// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* * Copyright (C) 2016, International Business Machines * Corporation and others. All Rights Reserved. * * file name: visibledigits.cpp */ #include <math.h> #include "unicode/utypes.h" #if !UCONFIG_NO_FORMATTING #include "cstring.h" #include "decNumber.h" #include "digitlst.h" #include "uassert.h" #include "visibledigits.h" static const int32_t kNegative = 1; static const int32_t kInfinite = 2; static const int32_t kNaN = 4; U_NAMESPACE_BEGIN void VisibleDigits::setNegative() { fFlags |= kNegative; } void VisibleDigits::setNaN() { fFlags |= kNaN; } void VisibleDigits::setInfinite() { fFlags |= kInfinite; } void VisibleDigits::clear() { fInterval.clear(); fDigits.clear(); fExponent = 0; fFlags = 0; fAbsIntValue = 0LL; fAbsIntValueSet = FALSE; fAbsDoubleValue = 0.0; fAbsDoubleValueSet = FALSE; } UBool VisibleDigits::isNegative() const { return (fFlags & kNegative); } UBool VisibleDigits::isNaN() const { return (fFlags & kNaN); } UBool VisibleDigits::isInfinite() const { return (fFlags & kInfinite); } int32_t VisibleDigits::getDigitByExponent(int32_t digitPos) const { if (digitPos < fExponent || digitPos >= fExponent + fDigits.length()) { return 0; } const char *ptr = fDigits.data(); return ptr[digitPos - fExponent]; } UBool VisibleDigits::isOverMaxDigits() const { return (fExponent + fDigits.length() > fInterval.getMostSignificantExclusive()); } UBool VisibleDigits::isNaNOrInfinity() const { return (fFlags & (kInfinite | kNaN)) != 0; } double VisibleDigits::computeAbsDoubleValue() const { // Take care of NaN and infinity if (isNaN()) { return uprv_getNaN(); } if (isInfinite()) { return uprv_getInfinity(); } // stack allocate a decNumber to hold MAX_DBL_DIGITS+3 significant digits struct { decNumber decNum; char digits[MAX_DBL_DIGITS+3]; } decNumberWithStorage; decNumber *numberPtr = &decNumberWithStorage.decNum; int32_t mostSig = fInterval.getMostSignificantExclusive(); int32_t mostSigNonZero = fExponent + fDigits.length(); int32_t end = mostSig > mostSigNonZero ? mostSigNonZero : mostSig; int32_t leastSig = fInterval.getLeastSignificantInclusive(); int32_t start = leastSig > fExponent ? leastSig : fExponent; if (end <= start) { return 0.0; } if (start < end - (MAX_DBL_DIGITS+3)) { start = end - (MAX_DBL_DIGITS+3); } uint8_t *pos = numberPtr->lsu; const char *src = &(fDigits.data()[start - fExponent]); for (int32_t i = start; i < end; ++i) { *pos++ = (uint8_t) (*src++); } numberPtr->exponent = start; numberPtr->bits = 0; numberPtr->digits = end - start; char str[MAX_DBL_DIGITS+18]; uprv_decNumberToString(numberPtr, str); U_ASSERT(uprv_strlen(str) < MAX_DBL_DIGITS+18); char *unused = NULL; return DigitList::decimalStrToDouble(str, &unused); } void VisibleDigits::getFixedDecimal( double &source, int64_t &intValue, int64_t &f, int64_t &t, int32_t &v, UBool &hasIntValue) const { source = 0.0; intValue = 0; f = 0; t = 0; v = 0; hasIntValue = FALSE; if (isNaNOrInfinity()) { return; } // source if (fAbsDoubleValueSet) { source = fAbsDoubleValue; } else { source = computeAbsDoubleValue(); } // visible decimal digits v = fInterval.getFracDigitCount(); // intValue // If we initialized from an int64 just use that instead of // calculating if (fAbsIntValueSet) { intValue = fAbsIntValue; } else { int32_t startPos = fInterval.getMostSignificantExclusive(); if (startPos > 18) { startPos = 18; } // process the integer digits for (int32_t i = startPos - 1; i >= 0; --i) { intValue = intValue * 10LL + getDigitByExponent(i); } if (intValue == 0LL && startPos > 0) { intValue = 100000000000000000LL; } } // f (decimal digits) // skip over any leading 0's in fraction digits. int32_t idx = -1; for (; idx >= -v && getDigitByExponent(idx) == 0; --idx) ; // Only process up to first 18 non zero fraction digits for decimalDigits // since that is all we can fit into an int64. for (int32_t i = idx; i >= -v && i > idx - 18; --i) { f = f * 10LL + getDigitByExponent(i); } // If we have no decimal digits, we don't have an integer value hasIntValue = (f == 0LL); // t (decimal digits without trailing zeros) t = f; while (t > 0 && t % 10LL == 0) { t /= 10; } } U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */
{ "pile_set_name": "Github" }
# Sample localization file for English. Add more files in this directory for other locales. # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. en: hello: "Hello world"
{ "pile_set_name": "Github" }
vti_encoding:SR|utf8-nl vti_author:SR|RCG-P4\\RCG vti_modifiedby:SR|RCG-P4\\RCG vti_timelastmodified:TR|29 Jun 2003 04:01:54 -0000 vti_timecreated:TR|29 Jun 2003 04:01:54 -0000 vti_lineageid:SR|{4452A399-668D-49A2-90BC-4160BB61BEB5} vti_cacheddtm:TX|29 Jun 2003 04:01:54 -0000 vti_filesize:IR|262558 vti_extenderversion:SR|5.0.2.2623 vti_backlinkinfo:VX| vti_donotpublish:BW|true
{ "pile_set_name": "Github" }
%YAML 1.1 %TAG !u! tag:unity3d.com,2011: --- !u!1 &3691887641913671224 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 1749581104624286704} - component: {fileID: 3162003442189416517} m_Layer: 5 m_Name: ButtonRow m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &1749581104624286704 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 3691887641913671224} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 956388772858572084} - {fileID: 1093255859136528568} m_Father: {fileID: 4153264261279501447} m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &3162003442189416517 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 3691887641913671224} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: -405508275, guid: f70555f144d8491a825f0804e09c671c, type: 3} m_Name: m_EditorClassIdentifier: m_Padding: m_Left: 0 m_Right: 0 m_Top: 0 m_Bottom: 0 m_ChildAlignment: 0 m_Spacing: 10 m_ChildForceExpandWidth: 0 m_ChildForceExpandHeight: 0 m_ChildControlWidth: 1 m_ChildControlHeight: 1 --- !u!1 &4153264261279501446 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 4153264261279501447} - component: {fileID: 4153264261279501445} - component: {fileID: 4153264261279501444} - component: {fileID: 5847183262131601518} - component: {fileID: 117913619939887074} m_Layer: 5 m_Name: TerrainPreImportDialog m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &4153264261279501447 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4153264261279501446} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 4050628322365125319} - {fileID: 4153264261330621393} - {fileID: 7540165296281443320} - {fileID: 5123245634172989880} - {fileID: 1749581104624286704} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 480, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &4153264261279501445 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4153264261279501446} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 1741964061, guid: f70555f144d8491a825f0804e09c671c, type: 3} m_Name: m_EditorClassIdentifier: m_HorizontalFit: 0 m_VerticalFit: 2 --- !u!114 &4153264261279501444 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4153264261279501446} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 1297475563, guid: f70555f144d8491a825f0804e09c671c, type: 3} m_Name: m_EditorClassIdentifier: m_Padding: m_Left: 10 m_Right: 10 m_Top: 10 m_Bottom: 10 m_ChildAlignment: 0 m_Spacing: 16 m_ChildForceExpandWidth: 0 m_ChildForceExpandHeight: 0 m_ChildControlWidth: 1 m_ChildControlHeight: 1 --- !u!222 &5847183262131601518 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4153264261279501446} m_CullTransparentMesh: 0 --- !u!114 &117913619939887074 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4153264261279501446} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 2be6fe85972c2184b864c1e95edb6715, type: 3} m_Name: m_EditorClassIdentifier: okButton: {fileID: 2310727790410682723} closeButton: {fileID: 2483904802973023471} nameField: {fileID: 4403153595967029429} --- !u!1 &4153264261330621392 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 4153264261330621393} - component: {fileID: 4153264261330621422} - component: {fileID: 9202018738381062176} m_Layer: 5 m_Name: Header m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 0 --- !u!224 &4153264261330621393 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4153264261330621392} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 7335350715391774470} m_Father: {fileID: 4153264261279501447} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} m_AnchoredPosition: {x: 240, y: -25} m_SizeDelta: {x: 460, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &4153264261330621422 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4153264261330621392} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: -405508275, guid: f70555f144d8491a825f0804e09c671c, type: 3} m_Name: m_EditorClassIdentifier: m_Padding: m_Left: 0 m_Right: 0 m_Top: 0 m_Bottom: 0 m_ChildAlignment: 2 m_Spacing: 16 m_ChildForceExpandWidth: 0 m_ChildForceExpandHeight: 0 m_ChildControlWidth: 1 m_ChildControlHeight: 1 --- !u!114 &9202018738381062176 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4153264261330621392} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 1679637790, guid: f70555f144d8491a825f0804e09c671c, type: 3} m_Name: m_EditorClassIdentifier: m_IgnoreLayout: 0 m_MinWidth: -1 m_MinHeight: -1 m_PreferredWidth: -1 m_PreferredHeight: -1 m_FlexibleWidth: 1 m_FlexibleHeight: -1 m_LayoutPriority: 1 --- !u!1 &6544541619121283411 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 4050628322365125319} - component: {fileID: 533694186527792081} - component: {fileID: 5343060445797975860} - component: {fileID: 4901496528780876147} m_Layer: 5 m_Name: Divider m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 0 --- !u!224 &4050628322365125319 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6544541619121283411} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 4153264261279501447} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} m_AnchoredPosition: {x: 240, y: -1} m_SizeDelta: {x: 480, y: 2} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &533694186527792081 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6544541619121283411} m_CullTransparentMesh: 0 --- !u!114 &5343060445797975860 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6544541619121283411} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.4, g: 0.6, b: 0.8, a: 1} m_RaycastTarget: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_Sprite: {fileID: 0} m_Type: 0 m_PreserveAspect: 0 m_FillCenter: 1 m_FillMethod: 4 m_FillAmount: 1 m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 --- !u!114 &4901496528780876147 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6544541619121283411} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 1679637790, guid: f70555f144d8491a825f0804e09c671c, type: 3} m_Name: m_EditorClassIdentifier: m_IgnoreLayout: 0 m_MinWidth: -1 m_MinHeight: -1 m_PreferredWidth: -1 m_PreferredHeight: 2 m_FlexibleWidth: 1 m_FlexibleHeight: -1 m_LayoutPriority: 1 --- !u!1 &8164632549414063899 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 7540165296281443320} - component: {fileID: 5180022913099980619} - component: {fileID: 8839143297831761377} m_Layer: 5 m_Name: Message m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &7540165296281443320 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8164632549414063899} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 4153264261279501447} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &5180022913099980619 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8164632549414063899} m_CullTransparentMesh: 0 --- !u!114 &8839143297831761377 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8164632549414063899} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_text: Give your terrain texture a name! m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_fontSharedMaterials: [] m_fontMaterial: {fileID: 0} m_fontMaterials: [] m_fontColor32: serializedVersion: 2 rgba: 4291820027 m_fontColor: {r: 0.9843137, g: 0.9764706, b: 0.8117647, a: 1} m_enableVertexGradient: 0 m_colorMode: 3 m_fontColorGradient: topLeft: {r: 1, g: 1, b: 1, a: 1} topRight: {r: 1, g: 1, b: 1, a: 1} bottomLeft: {r: 1, g: 1, b: 1, a: 1} bottomRight: {r: 1, g: 1, b: 1, a: 1} m_fontColorGradientPreset: {fileID: 0} m_spriteAsset: {fileID: 0} m_tintAllSprites: 0 m_overrideHtmlColors: 0 m_faceColor: serializedVersion: 2 rgba: 4294967295 m_outlineColor: serializedVersion: 2 rgba: 4278190080 m_fontSize: 18 m_fontSizeBase: 18 m_fontWeight: 400 m_enableAutoSizing: 0 m_fontSizeMin: 18 m_fontSizeMax: 72 m_fontStyle: 0 m_textAlignment: 257 m_characterSpacing: 0 m_wordSpacing: 0 m_lineSpacing: 0 m_lineSpacingMax: 0 m_paragraphSpacing: 0 m_charWidthMaxAdj: 0 m_enableWordWrapping: 1 m_wordWrappingRatios: 0.4 m_overflowMode: 0 m_firstOverflowCharacterIndex: -1 m_linkedTextComponent: {fileID: 0} m_isLinkedTextComponent: 0 m_isTextTruncated: 0 m_enableKerning: 1 m_enableExtraPadding: 0 checkPaddingRequired: 0 m_isRichText: 1 m_parseCtrlCharacters: 1 m_isOrthographic: 1 m_isCullingEnabled: 0 m_ignoreRectMaskCulling: 0 m_ignoreCulling: 1 m_horizontalMapping: 0 m_verticalMapping: 0 m_uvLineOffset: 0 m_geometrySortingOrder: 0 m_VertexBufferAutoSizeReduction: 1 m_firstVisibleCharacter: 0 m_useMaxVisibleDescender: 1 m_pageToDisplay: 1 m_margin: {x: 0, y: 0, z: 0, w: 0} m_textInfo: textComponent: {fileID: 8839143297831761377} characterCount: 33 spriteCount: 0 spaceCount: 5 wordCount: 6 linkCount: 0 lineCount: 1 pageCount: 1 materialCount: 1 m_isUsingLegacyAnimationComponent: 0 m_isVolumetricText: 0 m_spriteAnimator: {fileID: 0} m_hasFontAssetChanged: 0 m_subTextObjects: - {fileID: 0} - {fileID: 0} - {fileID: 0} - {fileID: 0} - {fileID: 0} - {fileID: 0} - {fileID: 0} - {fileID: 0} m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} --- !u!1001 &2394534739825395366 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: m_TransformParent: {fileID: 1749581104624286704} m_Modifications: - target: {fileID: 5378799052751929778, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_Name value: TextButton objectReference: {fileID: 0} - target: {fileID: 1479800314232047194, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_Color.r value: 0.3137255 objectReference: {fileID: 0} - target: {fileID: 1479800314232047194, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_Color.g value: 0.31764707 objectReference: {fileID: 0} - target: {fileID: 1479800314232047194, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_Color.b value: 0.30980393 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_LocalPosition.x value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_LocalRotation.x value: -0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_LocalRotation.y value: -0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_LocalRotation.z value: -0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_RootOrder value: 1 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_AnchoredPosition.x value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_SizeDelta.x value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_SizeDelta.y value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_AnchorMin.x value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_AnchorMin.y value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_AnchorMax.x value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_AnchorMax.y value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_Pivot.x value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_Pivot.y value: 1 objectReference: {fileID: 0} - target: {fileID: 1208266180855391641, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_PreferredHeight value: 40 objectReference: {fileID: 0} - target: {fileID: 8042467681023276156, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_havePropertiesChanged value: 0 objectReference: {fileID: 0} - target: {fileID: 8042467681023276156, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_isInputParsingRequired value: 0 objectReference: {fileID: 0} - target: {fileID: 8042467681023276156, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_text value: OK objectReference: {fileID: 0} - target: {fileID: 8042467681023276156, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_textInfo.characterCount value: 2 objectReference: {fileID: 0} - target: {fileID: 8042467681023276156, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_textInfo.spaceCount value: 0 objectReference: {fileID: 0} - target: {fileID: 8042467681023276156, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_textInfo.wordCount value: 1 objectReference: {fileID: 0} - target: {fileID: 8042467681023276156, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_textInfo.lineCount value: 1 objectReference: {fileID: 0} - target: {fileID: 8042467681023276156, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_textInfo.pageCount value: 1 objectReference: {fileID: 0} - target: {fileID: 8042467681023276156, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_firstOverflowCharacterIndex value: -1 objectReference: {fileID: 0} - target: {fileID: 8042467681023276156, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_enableAutoSizing value: 1 objectReference: {fileID: 0} - target: {fileID: 8042467681023276156, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_fontSize value: 17.1 objectReference: {fileID: 0} - target: {fileID: 3759142112673032445, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_padding value: 0 objectReference: {fileID: 0} - target: {fileID: 2925752997128898584, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_Material value: objectReference: {fileID: 0} - target: {fileID: 2925752997128898584, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_Color.r value: 0.3137255 objectReference: {fileID: 0} - target: {fileID: 2925752997128898584, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_Color.g value: 0.31764707 objectReference: {fileID: 0} - target: {fileID: 2925752997128898584, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_Color.b value: 0.30980393 objectReference: {fileID: 0} - target: {fileID: 7592762545067635800, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: radius value: 6 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} --- !u!224 &1093255859136528568 stripped RectTransform: m_CorrespondingSourceObject: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} m_PrefabInstance: {fileID: 2394534739825395366} m_PrefabAsset: {fileID: 0} --- !u!114 &2310727790410682723 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 83952138638415813, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} m_PrefabInstance: {fileID: 2394534739825395366} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3} m_Name: m_EditorClassIdentifier: --- !u!1001 &2545334527945517866 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: m_TransformParent: {fileID: 1749581104624286704} m_Modifications: - target: {fileID: 5378799052751929778, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_Name value: TextButton (1) objectReference: {fileID: 0} - target: {fileID: 1479800314232047194, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_Color.r value: 0.3137255 objectReference: {fileID: 0} - target: {fileID: 1479800314232047194, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_Color.g value: 0.31764707 objectReference: {fileID: 0} - target: {fileID: 1479800314232047194, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_Color.b value: 0.30980393 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_LocalPosition.x value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_LocalRotation.x value: -0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_LocalRotation.y value: -0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_LocalRotation.z value: -0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_RootOrder value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_AnchoredPosition.x value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_SizeDelta.x value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_SizeDelta.y value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_AnchorMin.x value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_AnchorMin.y value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_AnchorMax.x value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_AnchorMax.y value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_Pivot.x value: 0 objectReference: {fileID: 0} - target: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_Pivot.y value: 1 objectReference: {fileID: 0} - target: {fileID: 1208266180855391641, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_PreferredHeight value: 40 objectReference: {fileID: 0} - target: {fileID: 1208266180855391641, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_FlexibleWidth value: 1 objectReference: {fileID: 0} - target: {fileID: 8042467681023276156, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_havePropertiesChanged value: 0 objectReference: {fileID: 0} - target: {fileID: 8042467681023276156, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_isInputParsingRequired value: 0 objectReference: {fileID: 0} - target: {fileID: 8042467681023276156, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_text value: Cancel objectReference: {fileID: 0} - target: {fileID: 8042467681023276156, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_textInfo.characterCount value: 6 objectReference: {fileID: 0} - target: {fileID: 8042467681023276156, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_textInfo.spaceCount value: 0 objectReference: {fileID: 0} - target: {fileID: 8042467681023276156, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_textInfo.wordCount value: 1 objectReference: {fileID: 0} - target: {fileID: 8042467681023276156, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_textInfo.lineCount value: 1 objectReference: {fileID: 0} - target: {fileID: 8042467681023276156, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_textInfo.pageCount value: 1 objectReference: {fileID: 0} - target: {fileID: 8042467681023276156, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_enableAutoSizing value: 1 objectReference: {fileID: 0} - target: {fileID: 8042467681023276156, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_firstOverflowCharacterIndex value: -1 objectReference: {fileID: 0} - target: {fileID: 8042467681023276156, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_fontSize value: 17.1 objectReference: {fileID: 0} - target: {fileID: 3759142112673032445, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_padding value: 0 objectReference: {fileID: 0} - target: {fileID: 2925752997128898584, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_Material value: objectReference: {fileID: 0} - target: {fileID: 2925752997128898584, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_Color.r value: 0.3137255 objectReference: {fileID: 0} - target: {fileID: 2925752997128898584, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_Color.g value: 0.31764707 objectReference: {fileID: 0} - target: {fileID: 2925752997128898584, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: m_Color.b value: 0.30980393 objectReference: {fileID: 0} - target: {fileID: 7592762545067635800, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} propertyPath: radius value: 6 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} --- !u!224 &956388772858572084 stripped RectTransform: m_CorrespondingSourceObject: {fileID: 3321157068342330910, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} m_PrefabInstance: {fileID: 2545334527945517866} m_PrefabAsset: {fileID: 0} --- !u!114 &2483904802973023471 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 83952138638415813, guid: 598805c720ef32d4fa5e313276529cd3, type: 3} m_PrefabInstance: {fileID: 2545334527945517866} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3} m_Name: m_EditorClassIdentifier: --- !u!1001 &4153264261717023845 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: m_TransformParent: {fileID: 4153264261330621393} m_Modifications: - target: {fileID: 8732058293161486459, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_Name value: CloseButton objectReference: {fileID: 0} - target: {fileID: 7753949821495507838, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_Color.r value: 0.4 objectReference: {fileID: 0} - target: {fileID: 7753949821495507838, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_Color.g value: 0.6 objectReference: {fileID: 0} - target: {fileID: 7753949821495507838, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_Color.b value: 0.8 objectReference: {fileID: 0} - target: {fileID: 6660609766976541539, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_LocalPosition.x value: 0 objectReference: {fileID: 0} - target: {fileID: 6660609766976541539, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - target: {fileID: 6660609766976541539, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - target: {fileID: 6660609766976541539, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_LocalRotation.x value: -0 objectReference: {fileID: 0} - target: {fileID: 6660609766976541539, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_LocalRotation.y value: -0 objectReference: {fileID: 0} - target: {fileID: 6660609766976541539, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_LocalRotation.z value: -0 objectReference: {fileID: 0} - target: {fileID: 6660609766976541539, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - target: {fileID: 6660609766976541539, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_RootOrder value: 0 objectReference: {fileID: 0} - target: {fileID: 6660609766976541539, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - target: {fileID: 6660609766976541539, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - target: {fileID: 6660609766976541539, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - target: {fileID: 6660609766976541539, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_AnchoredPosition.x value: 460 objectReference: {fileID: 0} - target: {fileID: 6660609766976541539, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} - target: {fileID: 6660609766976541539, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_SizeDelta.x value: 30 objectReference: {fileID: 0} - target: {fileID: 6660609766976541539, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_SizeDelta.y value: 30 objectReference: {fileID: 0} - target: {fileID: 6660609766976541539, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_AnchorMin.x value: 0 objectReference: {fileID: 0} - target: {fileID: 6660609766976541539, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_AnchorMin.y value: 1 objectReference: {fileID: 0} - target: {fileID: 6660609766976541539, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_AnchorMax.x value: 0 objectReference: {fileID: 0} - target: {fileID: 6660609766976541539, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_AnchorMax.y value: 1 objectReference: {fileID: 0} - target: {fileID: 6660609766976541539, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_Pivot.x value: 1 objectReference: {fileID: 0} - target: {fileID: 6660609766976541539, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_Pivot.y value: 1 objectReference: {fileID: 0} - target: {fileID: 7357386075552011529, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_IgnoreLayout value: 0 objectReference: {fileID: 0} - target: {fileID: 7357386075552011529, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_PreferredHeight value: 30 objectReference: {fileID: 0} - target: {fileID: 7357386075552011529, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_PreferredWidth value: 30 objectReference: {fileID: 0} - target: {fileID: 7357386075552011529, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_FlexibleWidth value: -1 objectReference: {fileID: 0} - target: {fileID: 7357386075552011529, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} propertyPath: m_FlexibleHeight value: -1 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} --- !u!224 &7335350715391774470 stripped RectTransform: m_CorrespondingSourceObject: {fileID: 6660609766976541539, guid: b367a7dbfda1ae249843776e21232d4b, type: 3} m_PrefabInstance: {fileID: 4153264261717023845} m_PrefabAsset: {fileID: 0} --- !u!1001 &6885557603678681849 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: m_TransformParent: {fileID: 4153264261279501447} m_Modifications: - target: {fileID: 6258128341235689163, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_fontAsset value: objectReference: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} - target: {fileID: 6258128341235689163, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_sharedMaterial value: objectReference: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} - target: {fileID: 6258128341235689163, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_textInfo.materialCount value: 1 objectReference: {fileID: 0} - target: {fileID: 2800697708764036826, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_fontAsset value: objectReference: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} - target: {fileID: 2800697708764036826, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_sharedMaterial value: objectReference: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} - target: {fileID: 5321015225614398905, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_Material value: objectReference: {fileID: 0} - target: {fileID: 5321015225614398905, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_sharedMaterial value: objectReference: {fileID: 0} - target: {fileID: 5321015225614398905, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_padding value: 0 objectReference: {fileID: 0} - target: {fileID: 4250229368836075453, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_AnchorMin.y value: 0 objectReference: {fileID: 0} - target: {fileID: 4250229368836075453, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_AnchorMax.y value: 0 objectReference: {fileID: 0} - target: {fileID: 4250229368836075453, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_AnchoredPosition.x value: 0 objectReference: {fileID: 0} - target: {fileID: 4250229368836075453, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} - target: {fileID: 4250229368836075453, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_SizeDelta.x value: 0 objectReference: {fileID: 0} - target: {fileID: 4250229368836075453, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_SizeDelta.y value: 0 objectReference: {fileID: 0} - target: {fileID: 1771892582066047809, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_AnchorMin.x value: 0 objectReference: {fileID: 0} - target: {fileID: 1771892582066047809, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_AnchorMin.y value: 0 objectReference: {fileID: 0} - target: {fileID: 1771892582066047809, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_AnchorMax.x value: 0 objectReference: {fileID: 0} - target: {fileID: 1771892582066047809, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_AnchorMax.y value: 0 objectReference: {fileID: 0} - target: {fileID: 1771892582066047809, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_AnchoredPosition.x value: 0 objectReference: {fileID: 0} - target: {fileID: 1771892582066047809, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} - target: {fileID: 1771892582066047809, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_SizeDelta.x value: 0 objectReference: {fileID: 0} - target: {fileID: 1771892582066047809, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_SizeDelta.y value: 0 objectReference: {fileID: 0} - target: {fileID: 1771892582066047809, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_RootOrder value: 3 objectReference: {fileID: 0} - target: {fileID: 1771892581888439675, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_AnchorMin.y value: 0 objectReference: {fileID: 0} - target: {fileID: 1771892581888439675, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_AnchorMax.y value: 0 objectReference: {fileID: 0} - target: {fileID: 1771892581888439675, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_AnchoredPosition.x value: 0 objectReference: {fileID: 0} - target: {fileID: 1771892581888439675, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} - target: {fileID: 1771892581888439675, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_SizeDelta.x value: 0 objectReference: {fileID: 0} - target: {fileID: 1771892581888439675, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_SizeDelta.y value: 0 objectReference: {fileID: 0} - target: {fileID: 1771892581888439674, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_text value: Name objectReference: {fileID: 0} - target: {fileID: 1771892581888439674, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_textInfo.characterCount value: 4 objectReference: {fileID: 0} - target: {fileID: 1771892581888439674, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_fontAsset value: objectReference: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} - target: {fileID: 1771892581888439674, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_sharedMaterial value: objectReference: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} - target: {fileID: 5168647803870263437, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} propertyPath: m_Material value: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} --- !u!224 &5123245634172989880 stripped RectTransform: m_CorrespondingSourceObject: {fileID: 1771892582066047809, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} m_PrefabInstance: {fileID: 6885557603678681849} m_PrefabAsset: {fileID: 0} --- !u!114 &4403153595967029429 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 7103670801904745036, guid: 000f1a7818c5dd848a195cf888e421d2, type: 3} m_PrefabInstance: {fileID: 6885557603678681849} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 2da0c512f12947e489f739169773d7ca, type: 3} m_Name: m_EditorClassIdentifier:
{ "pile_set_name": "Github" }
/* Checking macros for poll functions. Copyright (C) 2012-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_POLL_H # error "Never include <bits/poll2.h> directly; use <sys/poll.h> instead." #endif __BEGIN_DECLS extern int __REDIRECT (__poll_alias, (struct pollfd *__fds, nfds_t __nfds, int __timeout), poll); extern int __poll_chk (struct pollfd *__fds, nfds_t __nfds, int __timeout, __SIZE_TYPE__ __fdslen); extern int __REDIRECT (__poll_chk_warn, (struct pollfd *__fds, nfds_t __nfds, int __timeout, __SIZE_TYPE__ __fdslen), __poll_chk) __warnattr ("poll called with fds buffer too small file nfds entries"); __fortify_function int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout) { if (__bos (__fds) != (__SIZE_TYPE__) -1) { if (! __builtin_constant_p (__nfds)) return __poll_chk (__fds, __nfds, __timeout, __bos (__fds)); else if (__bos (__fds) / sizeof (*__fds) < __nfds) return __poll_chk_warn (__fds, __nfds, __timeout, __bos (__fds)); } return __poll_alias (__fds, __nfds, __timeout); } #ifdef __USE_GNU extern int __REDIRECT (__ppoll_alias, (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, const __sigset_t *__ss), ppoll); extern int __ppoll_chk (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, const __sigset_t *__ss, __SIZE_TYPE__ __fdslen); extern int __REDIRECT (__ppoll_chk_warn, (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, const __sigset_t *__ss, __SIZE_TYPE__ __fdslen), __ppoll_chk) __warnattr ("ppoll called with fds buffer too small file nfds entries"); __fortify_function int ppoll (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, const __sigset_t *__ss) { if (__bos (__fds) != (__SIZE_TYPE__) -1) { if (! __builtin_constant_p (__nfds)) return __ppoll_chk (__fds, __nfds, __timeout, __ss, __bos (__fds)); else if (__bos (__fds) / sizeof (*__fds) < __nfds) return __ppoll_chk_warn (__fds, __nfds, __timeout, __ss, __bos (__fds)); } return __ppoll_alias (__fds, __nfds, __timeout, __ss); } #endif __END_DECLS
{ "pile_set_name": "Github" }
/* Created (MFS based): * February 2010 (Evgeniy Ivanov) */ #include "fs.h" #include "buf.h" #include "inode.h" #include "super.h" #include <stdlib.h> #include <minix/vfsif.h> #include <minix/bdev.h> /*===========================================================================* * fs_mount * *===========================================================================*/ int fs_mount(dev_t dev, unsigned int flags, struct fsdriver_node *root_node, unsigned int *res_flags) { /* This function reads the superblock of the partition, gets the root inode * and sends back the details of them. */ struct inode *root_ip; int r, readonly; u32_t mask; fs_dev = dev; readonly = (flags & REQ_RDONLY) ? 1 : 0; /* Open the device the file system lives on. */ if (bdev_open(fs_dev, readonly ? BDEV_R_BIT : (BDEV_R_BIT|BDEV_W_BIT)) != OK) { return(EINVAL); } /* Fill in the super block. */ if(!(superblock = malloc(sizeof(*superblock)))) panic("Can't allocate memory for superblock."); superblock->s_dev = fs_dev; /* read_super() needs to know which dev */ r = read_super(superblock); /* Is it recognized as a Minix filesystem? */ if (r != OK) { superblock->s_dev = NO_DEV; bdev_close(fs_dev); return(r); } if (superblock->s_rev_level != EXT2_GOOD_OLD_REV) { struct super_block *sp = superblock; /* just shorter name */ mask = ~SUPPORTED_INCOMPAT_FEATURES; if (HAS_INCOMPAT_FEATURE(sp, mask)) { if (HAS_INCOMPAT_FEATURE(sp, INCOMPAT_COMPRESSION & mask)) printf("ext2: fs compression is not supported by server\n"); if (HAS_INCOMPAT_FEATURE(sp, INCOMPAT_FILETYPE & mask)) printf("ext2: fs in dir filetype is not supported by server\n"); if (HAS_INCOMPAT_FEATURE(sp, INCOMPAT_RECOVER & mask)) printf("ext2: fs recovery is not supported by server\n"); if (HAS_INCOMPAT_FEATURE(sp, INCOMPAT_JOURNAL_DEV & mask)) printf("ext2: fs journal dev is not supported by server\n"); if (HAS_INCOMPAT_FEATURE(sp, INCOMPAT_META_BG & mask)) printf("ext2: fs meta bg is not supported by server\n"); return(EINVAL); } mask = ~SUPPORTED_RO_COMPAT_FEATURES; if (HAS_RO_COMPAT_FEATURE(sp, mask)) { if (HAS_RO_COMPAT_FEATURE(sp, RO_COMPAT_SPARSE_SUPER & mask)) { printf("ext2: sparse super is not supported by server, \ remount read-only\n"); } if (HAS_RO_COMPAT_FEATURE(sp, RO_COMPAT_LARGE_FILE & mask)) { printf("ext2: large files are not supported by server, \ remount read-only\n"); } if (HAS_RO_COMPAT_FEATURE(sp, RO_COMPAT_BTREE_DIR & mask)) { printf("ext2: dir's btree is not supported by server, \ remount read-only\n"); } return(EINVAL); } } if (superblock->s_state == EXT2_ERROR_FS) { printf("ext2: filesystem wasn't cleanly unmounted last time\n"); superblock->s_dev = NO_DEV; bdev_close(fs_dev); return(EINVAL); } lmfs_set_blocksize(superblock->s_block_size); lmfs_set_blockusage(superblock->s_blocks_count, superblock->s_blocks_count - superblock->s_free_blocks_count); /* Get the root inode of the mounted file system. */ if ( (root_ip = get_inode(fs_dev, ROOT_INODE)) == NULL) { printf("ext2: couldn't get root inode\n"); superblock->s_dev = NO_DEV; bdev_close(fs_dev); return(EINVAL); } if (root_ip != NULL && root_ip->i_mode == 0) { printf("%s:%d zero mode for root inode?\n", __FILE__, __LINE__); put_inode(root_ip); superblock->s_dev = NO_DEV; bdev_close(fs_dev); return(EINVAL); } if (root_ip != NULL && (root_ip->i_mode & I_TYPE) != I_DIRECTORY) { printf("%s:%d root inode has wrong type, it's not a DIR\n", __FILE__, __LINE__); put_inode(root_ip); superblock->s_dev = NO_DEV; bdev_close(fs_dev); return(EINVAL); } superblock->s_rd_only = readonly; if (!readonly) { superblock->s_state = EXT2_ERROR_FS; superblock->s_mnt_count++; superblock->s_mtime = clock_time(NULL); write_super(superblock); /* Commit info, we just set above */ } /* Root inode properties */ root_node->fn_ino_nr = root_ip->i_num; root_node->fn_mode = root_ip->i_mode; root_node->fn_size = root_ip->i_size; root_node->fn_uid = root_ip->i_uid; root_node->fn_gid = root_ip->i_gid; root_node->fn_dev = NO_DEV; *res_flags = RES_NOFLAGS; return(r); } /*===========================================================================* * fs_mountpt * *===========================================================================*/ int fs_mountpt(ino_t ino_nr) { /* This function looks up the mount point, it checks the condition whether * the partition can be mounted on the inode or not. */ register struct inode *rip; int r = OK; mode_t bits; /* Temporarily open the file. */ if( (rip = get_inode(fs_dev, ino_nr)) == NULL) return(EINVAL); if(rip->i_mountpoint) r = EBUSY; /* It may not be special. */ bits = rip->i_mode & I_TYPE; if (bits == I_BLOCK_SPECIAL || bits == I_CHAR_SPECIAL) r = ENOTDIR; put_inode(rip); if(r == OK) rip->i_mountpoint = TRUE; return(r); } /*===========================================================================* * fs_unmount * *===========================================================================*/ void fs_unmount(void) { /* Unmount a file system by device number. */ int count; struct inode *rip, *root_ip; /* See if the mounted device is busy. Only 1 inode using it should be * open --the root inode-- and that inode only 1 time. This is an integrity * check only: VFS expects the unmount to succeed either way. */ count = 0; for (rip = &inode[0]; rip < &inode[NR_INODES]; rip++) if (rip->i_count > 0 && rip->i_dev == fs_dev) count += rip->i_count; if (count != 1) printf("ext2: file system has %d in-use inodes!\n", count); if ((root_ip = find_inode(fs_dev, ROOT_INODE)) == NULL) panic("ext2: couldn't find root inode"); /* Sync fs data before checking count. In some cases VFS can force unmounting * and it will damage unsynced FS. We don't sync before checking root_ip since * if it is missing then something strange happened with FS, so it's better * to not use possibly corrupted data for syncing. */ if (!superblock->s_rd_only) { /* force any cached blocks out of memory */ fs_sync(); } put_inode(root_ip); if (!superblock->s_rd_only) { superblock->s_wtime = clock_time(NULL); superblock->s_state = EXT2_VALID_FS; write_super(superblock); /* Commit info, we just set above */ } /* Close the device the file system lives on. */ bdev_close(fs_dev); /* Throw all blocks out of the VM cache, to prevent corruption later. */ lmfs_invalidate(fs_dev); /* Finish off the unmount. */ superblock->s_dev = NO_DEV; }
{ "pile_set_name": "Github" }
BINARIES=yget.exe !INCLUDE "..\config\common.mk" !IF $(PDB)==1 LINKPDB=/Pdb:yget.pdb !ENDIF CFLAGS=$(CFLAGS) -DGET_VER_MAJOR=$(GET_VER_MAJOR) -DGET_VER_MINOR=$(GET_VER_MINOR) BIN_OBJS=\ get.obj \ MOD_OBJS=\ mod_get.obj \ compile: $(BIN_OBJS) builtins.lib yget.exe: $(BIN_OBJS) ..\lib\yorilib.lib ..\crt\yoricrt.lib @echo $@ @$(LINK) $(LDFLAGS) -entry:$(YENTRY) $(BIN_OBJS) $(LIBS) $(CRTLIB) ..\lib\yorilib.lib -version:$(GET_VER_MAJOR).$(GET_VER_MINOR) $(LINKPDB) -out:$@ mod_get.obj: get.c @echo $@ @$(CC) -c -DYORI_BUILTIN=1 $(CFLAGS) -Fo$@ get.c builtins.lib: $(MOD_OBJS) @echo $@ @$(LIB32) $(LIBFLAGS) $(MOD_OBJS) -out:$@
{ "pile_set_name": "Github" }
package example.imagetaskgang; import android.annotation.SuppressLint; import java.io.File; import java.io.FileOutputStream; /** * @class OutputFilterDecorator * * @brief A Decorator whose inherited applyFilter() template method * calls the filter() method on the Filter object passed to its * constructor and whose decorate() hook method then writes the * results of the filtered image to an output file. Plays the * role of the "Concrete Decorator" in the Decorator pattern * and the role of the "Concrete Class" in the Template Method * pattern. */ public class OutputFilterDecorator extends FilterDecorator { /** * Constructor passes the @a filter parameter up to the superclass * constructor, which stores it in a data member for subsequent * use in applyFilter(), which is both a hook method and a * template method. */ public OutputFilterDecorator(Filter filter) { super(filter); } /** * This hook method is called with the @a imageEntity parameter * after it has been filtered with mFilter in the inherited * applyFilter() method. decorate() stores the filtered * ImageEntity in a file. */ @SuppressLint("NewApi") @Override protected ImageEntity decorate(ImageEntity imageEntity) { // Make a directory for the filtered image if it does not // exist already. File externalFile = new File(PlatformStrategy.instance().getDirectoryPath(), this.getName()); externalFile.mkdirs(); // Store the filtered image as its filename (which is derived // from its URL), within the appropriate filter directory to // organize the filtered results. File newImage = new File(externalFile, imageEntity.getFileName()); // Write the image to the file in the appropriate directory. // The close() method of the outputFile is automatically // called via the Java "try-with-resources" feature. try (FileOutputStream outputFile = new FileOutputStream(newImage)) { PlatformStrategy.instance().storeImage (imageEntity.getImage(), outputFile); } catch (Exception e) { e.printStackTrace(); return null; } return imageEntity; } }
{ "pile_set_name": "Github" }
activeProfiles= eclipse.preferences.version=1 resolveWorkspaceProjects=true version=1
{ "pile_set_name": "Github" }
!RANCID-CONTENT-TYPE: cisco-nx ! hostname nxos_port_channel_references ! ! referenced interface port-channel1 ! interface Ethernet1/1 channel-group 1 ! ! unreferenced interface port-channel2
{ "pile_set_name": "Github" }
using System; using Akkme.Shared.Infrastructure.Domain; using Akkme.Shared.Infrastructure.Serializers; using Bond; namespace Akkme.Shared.Domain.Events.V2 { public interface IAccountEvent : IDomainEvent { } [Schema] public struct ModifiedBalance : IBond, IAccountEvent { [Id(0), Required] public readonly string TransactionId; [Id(1), Required] public readonly decimal Delta; [Id(2), Required] public readonly DateTime CreatedAt; public ModifiedBalance(string transactionId, decimal delta, DateTime createdAt) { TransactionId = transactionId; Delta = delta; CreatedAt = createdAt; } } }
{ "pile_set_name": "Github" }
{ "images" : [ { "idiom" : "universal", "scale" : "1x" }, { "idiom" : "universal", "filename" : "emptyStar.png", "scale" : "2x" }, { "idiom" : "universal", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" } }
{ "pile_set_name": "Github" }
// +build acceptance identity roles package v2 import ( "testing" "github.com/rackspace/gophercloud" os "github.com/rackspace/gophercloud/openstack/identity/v2/extensions/admin/roles" "github.com/rackspace/gophercloud/pagination" "github.com/rackspace/gophercloud/rackspace/identity/v2/roles" th "github.com/rackspace/gophercloud/testhelper" ) func TestRoles(t *testing.T) { client := authenticatedClient(t) userID := createUser(t, client) roleID := listRoles(t, client) addUserRole(t, client, userID, roleID) deleteUserRole(t, client, userID, roleID) deleteUser(t, client, userID) } func listRoles(t *testing.T, client *gophercloud.ServiceClient) string { var roleID string err := roles.List(client).EachPage(func(page pagination.Page) (bool, error) { roleList, err := os.ExtractRoles(page) th.AssertNoErr(t, err) for _, role := range roleList { t.Logf("Listing role: ID [%s] Name [%s]", role.ID, role.Name) roleID = role.ID } return true, nil }) th.AssertNoErr(t, err) return roleID } func addUserRole(t *testing.T, client *gophercloud.ServiceClient, userID, roleID string) { err := roles.AddUserRole(client, userID, roleID).ExtractErr() th.AssertNoErr(t, err) t.Logf("Added role %s to user %s", roleID, userID) } func deleteUserRole(t *testing.T, client *gophercloud.ServiceClient, userID, roleID string) { err := roles.DeleteUserRole(client, userID, roleID).ExtractErr() th.AssertNoErr(t, err) t.Logf("Removed role %s from user %s", roleID, userID) }
{ "pile_set_name": "Github" }
#ifndef __PINCTRL_MTK_MT8127_H #define __PINCTRL_MTK_MT8127_H #include <linux/pinctrl/pinctrl.h> #include "pinctrl-mtk-common.h" static const struct mtk_desc_pin mtk_pins_mt8127[] = { MTK_PIN( PINCTRL_PIN(0, "PWRAP_SPI0_MI"), "P22", "mt8127", MTK_EINT_FUNCTION(0, 22), MTK_FUNCTION(0, "GPIO0"), MTK_FUNCTION(1, "PWRAP_SPIDO"), MTK_FUNCTION(2, "PWRAP_SPIDI") ), MTK_PIN( PINCTRL_PIN(1, "PWRAP_SPI0_MO"), "M22", "mt8127", MTK_EINT_FUNCTION(0, 23), MTK_FUNCTION(0, "GPIO1"), MTK_FUNCTION(1, "PWRAP_SPIDI"), MTK_FUNCTION(2, "PWRAP_SPIDO") ), MTK_PIN( PINCTRL_PIN(2, "PWRAP_INT"), "L23", "mt8127", MTK_EINT_FUNCTION(0, 24), MTK_FUNCTION(0, "GPIO2") ), MTK_PIN( PINCTRL_PIN(3, "PWRAP_SPI0_CK"), "N23", "mt8127", MTK_EINT_FUNCTION(0, 25), MTK_FUNCTION(0, "GPIO3"), MTK_FUNCTION(1, "PWRAP_SPICK_I") ), MTK_PIN( PINCTRL_PIN(4, "PWRAP_SPI0_CSN"), "N22", "mt8127", MTK_EINT_FUNCTION(0, 26), MTK_FUNCTION(0, "GPIO4"), MTK_FUNCTION(1, "PWRAP_SPICS_B_I") ), MTK_PIN( PINCTRL_PIN(5, "PWRAP_SPI0_CK2"), "L19", "mt8127", MTK_EINT_FUNCTION(0, 27), MTK_FUNCTION(0, "GPIO5"), MTK_FUNCTION(1, "PWRAP_SPICK2_I"), MTK_FUNCTION(2, "ANT_SEL1"), MTK_FUNCTION(3, "VDEC_TEST_CK"), MTK_FUNCTION(7, "DBG_MON_B[0]") ), MTK_PIN( PINCTRL_PIN(6, "PWRAP_SPI0_CSN2"), "M23", "mt8127", MTK_EINT_FUNCTION(0, 28), MTK_FUNCTION(0, "GPIO6"), MTK_FUNCTION(1, "PWRAP_SPICS2_B_I"), MTK_FUNCTION(2, "ANT_SEL0"), MTK_FUNCTION(3, "MM_TEST_CK"), MTK_FUNCTION(7, "DBG_MON_B[1]") ), MTK_PIN( PINCTRL_PIN(7, "AUD_CLK_MOSI"), "K23", "mt8127", MTK_EINT_FUNCTION(0, 29), MTK_FUNCTION(0, "GPIO7"), MTK_FUNCTION(1, "AUD_CLK"), MTK_FUNCTION(2, "ADC_CK") ), MTK_PIN( PINCTRL_PIN(8, "AUD_DAT_MISO"), "K24", "mt8127", MTK_EINT_FUNCTION(0, 30), MTK_FUNCTION(0, "GPIO8"), MTK_FUNCTION(1, "AUD_MISO"), MTK_FUNCTION(2, "ADC_DAT_IN"), MTK_FUNCTION(3, "AUD_MOSI") ), MTK_PIN( PINCTRL_PIN(9, "AUD_DAT_MOSI"), "K22", "mt8127", MTK_EINT_FUNCTION(0, 31), MTK_FUNCTION(0, "GPIO9"), MTK_FUNCTION(1, "AUD_MOSI"), MTK_FUNCTION(2, "ADC_WS"), MTK_FUNCTION(3, "AUD_MISO") ), MTK_PIN( PINCTRL_PIN(10, "RTC32K_CK"), "R21", "mt8127", MTK_EINT_FUNCTION(0, 32), MTK_FUNCTION(0, "GPIO10"), MTK_FUNCTION(1, "RTC32K_CK") ), MTK_PIN( PINCTRL_PIN(11, "WATCHDOG"), "P24", "mt8127", MTK_EINT_FUNCTION(0, 33), MTK_FUNCTION(0, "GPIO11"), MTK_FUNCTION(1, "WATCHDOG") ), MTK_PIN( PINCTRL_PIN(12, "SRCLKENA"), "R22", "mt8127", MTK_EINT_FUNCTION(0, 34), MTK_FUNCTION(0, "GPIO12"), MTK_FUNCTION(1, "SRCLKENA") ), MTK_PIN( PINCTRL_PIN(13, "SRCLKENAI"), "P23", "mt8127", MTK_EINT_FUNCTION(0, 35), MTK_FUNCTION(0, "GPIO13"), MTK_FUNCTION(1, "SRCLKENAI") ), MTK_PIN( PINCTRL_PIN(14, "URXD2"), "U19", "mt8127", MTK_EINT_FUNCTION(0, 36), MTK_FUNCTION(0, "GPIO14"), MTK_FUNCTION(1, "URXD2"), MTK_FUNCTION(2, "DPI_D5"), MTK_FUNCTION(3, "UTXD2"), MTK_FUNCTION(5, "SRCCLKENAI2"), MTK_FUNCTION(6, "KROW4") ), MTK_PIN( PINCTRL_PIN(15, "UTXD2"), "U20", "mt8127", MTK_EINT_FUNCTION(0, 37), MTK_FUNCTION(0, "GPIO15"), MTK_FUNCTION(1, "UTXD2"), MTK_FUNCTION(2, "DPI_HSYNC"), MTK_FUNCTION(3, "URXD2"), MTK_FUNCTION(6, "KROW5") ), MTK_PIN( PINCTRL_PIN(16, "URXD3"), "U18", "mt8127", MTK_EINT_FUNCTION(0, 38), MTK_FUNCTION(0, "GPIO16"), MTK_FUNCTION(1, "URXD3"), MTK_FUNCTION(2, "DPI_DE"), MTK_FUNCTION(3, "UTXD3"), MTK_FUNCTION(4, "UCTS2"), MTK_FUNCTION(5, "PWM3"), MTK_FUNCTION(6, "KROW6") ), MTK_PIN( PINCTRL_PIN(17, "UTXD3"), "R18", "mt8127", MTK_EINT_FUNCTION(0, 39), MTK_FUNCTION(0, "GPIO17"), MTK_FUNCTION(1, "UTXD3"), MTK_FUNCTION(2, "DPI_VSYNC"), MTK_FUNCTION(3, "URXD3"), MTK_FUNCTION(4, "URTS2"), MTK_FUNCTION(5, "PWM4"), MTK_FUNCTION(6, "KROW7") ), MTK_PIN( PINCTRL_PIN(18, "PCM_CLK"), "U22", "mt8127", MTK_EINT_FUNCTION(0, 40), MTK_FUNCTION(0, "GPIO18"), MTK_FUNCTION(1, "PCM_CLK0"), MTK_FUNCTION(2, "DPI_D4"), MTK_FUNCTION(3, "I2SIN1_BCK0"), MTK_FUNCTION(4, "I2SOUT_BCK"), MTK_FUNCTION(5, "CONN_DSP_JCK"), MTK_FUNCTION(6, "IR"), MTK_FUNCTION(7, "DBG_MON_A[0]") ), MTK_PIN( PINCTRL_PIN(19, "PCM_SYNC"), "U23", "mt8127", MTK_EINT_FUNCTION(0, 41), MTK_FUNCTION(0, "GPIO19"), MTK_FUNCTION(1, "PCM_SYNC"), MTK_FUNCTION(2, "DPI_D3"), MTK_FUNCTION(3, "I2SIN1_LRCK"), MTK_FUNCTION(4, "I2SOUT_LRCK"), MTK_FUNCTION(5, "CONN_DSP_JINTP"), MTK_FUNCTION(6, "EXT_COL"), MTK_FUNCTION(7, "DBG_MON_A[1]") ), MTK_PIN( PINCTRL_PIN(20, "PCM_RX"), "V22", "mt8127", MTK_EINT_FUNCTION(0, 42), MTK_FUNCTION(0, "GPIO20"), MTK_FUNCTION(1, "PCM_RX"), MTK_FUNCTION(2, "DPI_D1"), MTK_FUNCTION(3, "I2SIN1_DATA_IN"), MTK_FUNCTION(4, "PCM_TX"), MTK_FUNCTION(5, "CONN_DSP_JDI"), MTK_FUNCTION(6, "EXT_MDIO"), MTK_FUNCTION(7, "DBG_MON_A[2]") ), MTK_PIN( PINCTRL_PIN(21, "PCM_TX"), "U21", "mt8127", MTK_EINT_FUNCTION(0, 43), MTK_FUNCTION(0, "GPIO21"), MTK_FUNCTION(1, "PCM_TX"), MTK_FUNCTION(2, "DPI_D2"), MTK_FUNCTION(3, "I2SOUT_DATA_OUT"), MTK_FUNCTION(4, "PCM_RX"), MTK_FUNCTION(5, "CONN_DSP_JMS"), MTK_FUNCTION(6, "EXT_MDC"), MTK_FUNCTION(7, "DBG_MON_A[3]") ), MTK_PIN( PINCTRL_PIN(22, "EINT0"), "AB19", "mt8127", MTK_EINT_FUNCTION(0, 0), MTK_FUNCTION(0, "GPIO22"), MTK_FUNCTION(1, "PWM1"), MTK_FUNCTION(2, "DPI_CK"), MTK_FUNCTION(4, "EXT_TXD0"), MTK_FUNCTION(5, "CONN_DSP_JDO"), MTK_FUNCTION(7, "DBG_MON_A[4]") ), MTK_PIN( PINCTRL_PIN(23, "EINT1"), "AA21", "mt8127", MTK_EINT_FUNCTION(0, 1), MTK_FUNCTION(0, "GPIO23"), MTK_FUNCTION(1, "PWM2"), MTK_FUNCTION(2, "DPI_D12"), MTK_FUNCTION(4, "EXT_TXD1"), MTK_FUNCTION(5, "CONN_MCU_TDO"), MTK_FUNCTION(7, "DBG_MON_A[5]") ), MTK_PIN( PINCTRL_PIN(24, "EINT2"), "AA19", "mt8127", MTK_EINT_FUNCTION(0, 2), MTK_FUNCTION(0, "GPIO24"), MTK_FUNCTION(1, "CLKM0"), MTK_FUNCTION(2, "DPI_D13"), MTK_FUNCTION(4, "EXT_TXD2"), MTK_FUNCTION(5, "CONN_MCU_DBGACK_N"), MTK_FUNCTION(6, "KCOL4"), MTK_FUNCTION(7, "DBG_MON_A[6]") ), MTK_PIN( PINCTRL_PIN(25, "EINT3"), "Y19", "mt8127", MTK_EINT_FUNCTION(0, 3), MTK_FUNCTION(0, "GPIO25"), MTK_FUNCTION(1, "CLKM1"), MTK_FUNCTION(2, "DPI_D14"), MTK_FUNCTION(3, "SPI_MI"), MTK_FUNCTION(4, "EXT_TXD3"), MTK_FUNCTION(5, "CONN_MCU_DBGI_N"), MTK_FUNCTION(6, "KCOL5"), MTK_FUNCTION(7, "DBG_MON_A[7]") ), MTK_PIN( PINCTRL_PIN(26, "EINT4"), "V21", "mt8127", MTK_EINT_FUNCTION(0, 4), MTK_FUNCTION(0, "GPIO26"), MTK_FUNCTION(1, "CLKM2"), MTK_FUNCTION(2, "DPI_D15"), MTK_FUNCTION(3, "SPI_MO"), MTK_FUNCTION(4, "EXT_TXC"), MTK_FUNCTION(5, "CONN_MCU_TCK0"), MTK_FUNCTION(6, "CONN_MCU_AICE_JCKC"), MTK_FUNCTION(7, "DBG_MON_A[8]") ), MTK_PIN( PINCTRL_PIN(27, "EINT5"), "AB22", "mt8127", MTK_EINT_FUNCTION(0, 5), MTK_FUNCTION(0, "GPIO27"), MTK_FUNCTION(1, "UCTS2"), MTK_FUNCTION(2, "DPI_D16"), MTK_FUNCTION(3, "SPI_CS"), MTK_FUNCTION(4, "EXT_RXER"), MTK_FUNCTION(5, "CONN_MCU_TDI"), MTK_FUNCTION(6, "KCOL6"), MTK_FUNCTION(7, "DBG_MON_A[9]") ), MTK_PIN( PINCTRL_PIN(28, "EINT6"), "AA23", "mt8127", MTK_EINT_FUNCTION(0, 6), MTK_FUNCTION(0, "GPIO28"), MTK_FUNCTION(1, "URTS2"), MTK_FUNCTION(2, "DPI_D17"), MTK_FUNCTION(3, "SPI_CK"), MTK_FUNCTION(4, "EXT_RXC"), MTK_FUNCTION(5, "CONN_MCU_TRST_B"), MTK_FUNCTION(6, "KCOL7"), MTK_FUNCTION(7, "DBG_MON_A[10]") ), MTK_PIN( PINCTRL_PIN(29, "EINT7"), "Y23", "mt8127", MTK_EINT_FUNCTION(0, 7), MTK_FUNCTION(0, "GPIO29"), MTK_FUNCTION(1, "UCTS3"), MTK_FUNCTION(2, "DPI_D6"), MTK_FUNCTION(3, "SDA1"), MTK_FUNCTION(4, "EXT_RXDV"), MTK_FUNCTION(5, "CONN_MCU_TMS"), MTK_FUNCTION(6, "CONN_MCU_AICE_JMSC"), MTK_FUNCTION(7, "DBG_MON_A[11]") ), MTK_PIN( PINCTRL_PIN(30, "EINT8"), "Y24", "mt8127", MTK_EINT_FUNCTION(0, 8), MTK_FUNCTION(0, "GPIO30"), MTK_FUNCTION(1, "URTS3"), MTK_FUNCTION(2, "CLKM3"), MTK_FUNCTION(3, "SCL1"), MTK_FUNCTION(4, "EXT_RXD0"), MTK_FUNCTION(5, "ANT_SEL0"), MTK_FUNCTION(6, "DPI_D7"), MTK_FUNCTION(7, "DBG_MON_B[2]") ), MTK_PIN( PINCTRL_PIN(31, "EINT9"), "W23", "mt8127", MTK_EINT_FUNCTION(0, 9), MTK_FUNCTION(0, "GPIO31"), MTK_FUNCTION(1, "CLKM4"), MTK_FUNCTION(2, "SDA2"), MTK_FUNCTION(3, "EXT_FRAME_SYNC"), MTK_FUNCTION(4, "EXT_RXD1"), MTK_FUNCTION(5, "ANT_SEL1"), MTK_FUNCTION(6, "DPI_D8"), MTK_FUNCTION(7, "DBG_MON_B[3]") ), MTK_PIN( PINCTRL_PIN(32, "EINT10"), "W24", "mt8127", MTK_EINT_FUNCTION(0, 10), MTK_FUNCTION(0, "GPIO32"), MTK_FUNCTION(1, "CLKM5"), MTK_FUNCTION(2, "SCL2"), MTK_FUNCTION(3, "EXT_FRAME_SYNC"), MTK_FUNCTION(4, "EXT_RXD2"), MTK_FUNCTION(5, "ANT_SEL2"), MTK_FUNCTION(6, "DPI_D9"), MTK_FUNCTION(7, "DBG_MON_B[4]") ), MTK_PIN( PINCTRL_PIN(33, "KPROW0"), "AB24", "mt8127", MTK_EINT_FUNCTION(0, 44), MTK_FUNCTION(0, "GPIO33"), MTK_FUNCTION(1, "KROW0"), MTK_FUNCTION(4, "IMG_TEST_CK"), MTK_FUNCTION(7, "DBG_MON_A[12]") ), MTK_PIN( PINCTRL_PIN(34, "KPROW1"), "AC24", "mt8127", MTK_EINT_FUNCTION(0, 45), MTK_FUNCTION(0, "GPIO34"), MTK_FUNCTION(1, "KROW1"), MTK_FUNCTION(2, "IDDIG"), MTK_FUNCTION(3, "EXT_FRAME_SYNC"), MTK_FUNCTION(4, "MFG_TEST_CK"), MTK_FUNCTION(7, "DBG_MON_B[5]") ), MTK_PIN( PINCTRL_PIN(35, "KPROW2"), "AD24", "mt8127", MTK_EINT_FUNCTION(0, 46), MTK_FUNCTION(0, "GPIO35"), MTK_FUNCTION(1, "KROW2"), MTK_FUNCTION(2, "DRV_VBUS"), MTK_FUNCTION(3, "EXT_FRAME_SYNC"), MTK_FUNCTION(4, "CONN_TEST_CK"), MTK_FUNCTION(7, "DBG_MON_B[6]") ), MTK_PIN( PINCTRL_PIN(36, "KPCOL0"), "AB23", "mt8127", MTK_EINT_FUNCTION(0, 47), MTK_FUNCTION(0, "GPIO36"), MTK_FUNCTION(1, "KCOL0"), MTK_FUNCTION(7, "DBG_MON_A[13]") ), MTK_PIN( PINCTRL_PIN(37, "KPCOL1"), "AC22", "mt8127", MTK_EINT_FUNCTION(0, 48), MTK_FUNCTION(0, "GPIO37"), MTK_FUNCTION(1, "KCOL1"), MTK_FUNCTION(7, "DBG_MON_B[7]") ), MTK_PIN( PINCTRL_PIN(38, "KPCOL2"), "AC23", "mt8127", MTK_EINT_FUNCTION(0, 49), MTK_FUNCTION(0, "GPIO38"), MTK_FUNCTION(1, "KCOL2"), MTK_FUNCTION(2, "IDDIG"), MTK_FUNCTION(3, "EXT_FRAME_SYNC"), MTK_FUNCTION(7, "DBG_MON_B[8]") ), MTK_PIN( PINCTRL_PIN(39, "JTMS"), "V18", "mt8127", MTK_EINT_FUNCTION(0, 50), MTK_FUNCTION(0, "GPIO39"), MTK_FUNCTION(1, "JTMS"), MTK_FUNCTION(2, "CONN_MCU_TMS"), MTK_FUNCTION(3, "CONN_MCU_AICE_JMSC") ), MTK_PIN( PINCTRL_PIN(40, "JTCK"), "AA18", "mt8127", MTK_EINT_FUNCTION(0, 51), MTK_FUNCTION(0, "GPIO40"), MTK_FUNCTION(1, "JTCK"), MTK_FUNCTION(2, "CONN_MCU_TCK1"), MTK_FUNCTION(3, "CONN_MCU_AICE_JCKC") ), MTK_PIN( PINCTRL_PIN(41, "JTDI"), "W18", "mt8127", MTK_EINT_FUNCTION(0, 52), MTK_FUNCTION(0, "GPIO41"), MTK_FUNCTION(1, "JTDI"), MTK_FUNCTION(2, "CONN_MCU_TDI") ), MTK_PIN( PINCTRL_PIN(42, "JTDO"), "Y18", "mt8127", MTK_EINT_FUNCTION(0, 53), MTK_FUNCTION(0, "GPIO42"), MTK_FUNCTION(1, "JTDO"), MTK_FUNCTION(2, "CONN_MCU_TDO") ), MTK_PIN( PINCTRL_PIN(43, "EINT11"), "W22", "mt8127", MTK_EINT_FUNCTION(0, 11), MTK_FUNCTION(0, "GPIO43"), MTK_FUNCTION(1, "CLKM4"), MTK_FUNCTION(2, "PWM2"), MTK_FUNCTION(3, "KROW3"), MTK_FUNCTION(4, "ANT_SEL3"), MTK_FUNCTION(5, "DPI_D10"), MTK_FUNCTION(6, "EXT_RXD3"), MTK_FUNCTION(7, "DBG_MON_B[9]") ), MTK_PIN( PINCTRL_PIN(44, "EINT12"), "V23", "mt8127", MTK_EINT_FUNCTION(NO_EINT_SUPPORT, NO_EINT_SUPPORT), MTK_FUNCTION(0, "GPIO44"), MTK_FUNCTION(1, "CLKM5"), MTK_FUNCTION(2, "PWM0"), MTK_FUNCTION(3, "KCOL3"), MTK_FUNCTION(4, "ANT_SEL4"), MTK_FUNCTION(5, "DPI_D11"), MTK_FUNCTION(6, "EXT_TXEN"), MTK_FUNCTION(7, "DBG_MON_B[10]") ), MTK_PIN( PINCTRL_PIN(45, "EINT13"), "Y21", "mt8127", MTK_EINT_FUNCTION(NO_EINT_SUPPORT, NO_EINT_SUPPORT), MTK_FUNCTION(0, "GPIO45"), MTK_FUNCTION(4, "ANT_SEL5"), MTK_FUNCTION(5, "DPI_D0"), MTK_FUNCTION(6, "SPDIF"), MTK_FUNCTION(7, "DBG_MON_B[11]") ), MTK_PIN( PINCTRL_PIN(46, "EINT14"), "F23", "mt8127", MTK_EINT_FUNCTION(0, 14), MTK_FUNCTION(0, "GPIO46"), MTK_FUNCTION(2, "DAC_DAT_OUT"), MTK_FUNCTION(4, "ANT_SEL1"), MTK_FUNCTION(5, "CONN_MCU_DBGACK_N"), MTK_FUNCTION(6, "NCLE"), MTK_FUNCTION(7, "DBG_MON_A[14]") ), MTK_PIN( PINCTRL_PIN(47, "EINT15"), "G23", "mt8127", MTK_EINT_FUNCTION(0, 15), MTK_FUNCTION(0, "GPIO47"), MTK_FUNCTION(2, "DAC_WS"), MTK_FUNCTION(4, "ANT_SEL2"), MTK_FUNCTION(5, "CONN_MCU_DBGI_N"), MTK_FUNCTION(6, "NCEB1"), MTK_FUNCTION(7, "DBG_MON_A[15]") ), MTK_PIN( PINCTRL_PIN(48, "EINT16"), "H23", "mt8127", MTK_EINT_FUNCTION(0, 16), MTK_FUNCTION(0, "GPIO48"), MTK_FUNCTION(2, "DAC_CK"), MTK_FUNCTION(4, "ANT_SEL3"), MTK_FUNCTION(5, "CONN_MCU_TRST_B"), MTK_FUNCTION(6, "NCEB0"), MTK_FUNCTION(7, "DBG_MON_A[16]") ), MTK_PIN( PINCTRL_PIN(49, "EINT17"), "J22", "mt8127", MTK_EINT_FUNCTION(0, 17), MTK_FUNCTION(0, "GPIO49"), MTK_FUNCTION(1, "UCTS0"), MTK_FUNCTION(3, "CLKM0"), MTK_FUNCTION(4, "IDDIG"), MTK_FUNCTION(5, "ANT_SEL4"), MTK_FUNCTION(6, "NREB"), MTK_FUNCTION(7, "DBG_MON_A[17]") ), MTK_PIN( PINCTRL_PIN(50, "EINT18"), "AD20", "mt8127", MTK_EINT_FUNCTION(0, 18), MTK_FUNCTION(0, "GPIO50"), MTK_FUNCTION(1, "URTS0"), MTK_FUNCTION(2, "CLKM3"), MTK_FUNCTION(3, "I2SOUT_LRCK"), MTK_FUNCTION(4, "DRV_VBUS"), MTK_FUNCTION(5, "ANT_SEL3"), MTK_FUNCTION(6, "ADC_CK"), MTK_FUNCTION(7, "DBG_MON_B[12]") ), MTK_PIN( PINCTRL_PIN(51, "EINT19"), "AC21", "mt8127", MTK_EINT_FUNCTION(0, 19), MTK_FUNCTION(0, "GPIO51"), MTK_FUNCTION(1, "UCTS1"), MTK_FUNCTION(3, "I2SOUT_BCK"), MTK_FUNCTION(4, "CLKM1"), MTK_FUNCTION(5, "ANT_SEL4"), MTK_FUNCTION(6, "ADC_DAT_IN"), MTK_FUNCTION(7, "DBG_MON_B[13]") ), MTK_PIN( PINCTRL_PIN(52, "EINT20"), "V20", "mt8127", MTK_EINT_FUNCTION(0, 20), MTK_FUNCTION(0, "GPIO52"), MTK_FUNCTION(1, "URTS1"), MTK_FUNCTION(2, "PCM_TX"), MTK_FUNCTION(3, "I2SOUT_DATA_OUT"), MTK_FUNCTION(4, "CLKM2"), MTK_FUNCTION(5, "ANT_SEL5"), MTK_FUNCTION(6, "ADC_WS"), MTK_FUNCTION(7, "DBG_MON_B[14]") ), MTK_PIN( PINCTRL_PIN(53, "SPI_CS"), "AD19", "mt8127", MTK_EINT_FUNCTION(0, 54), MTK_FUNCTION(0, "GPIO53"), MTK_FUNCTION(1, "SPI_CS"), MTK_FUNCTION(3, "I2SIN1_DATA_IN"), MTK_FUNCTION(4, "ADC_CK"), MTK_FUNCTION(7, "DBG_MON_B[15]") ), MTK_PIN( PINCTRL_PIN(54, "SPI_CK"), "AC18", "mt8127", MTK_EINT_FUNCTION(0, 55), MTK_FUNCTION(0, "GPIO54"), MTK_FUNCTION(1, "SPI_CK"), MTK_FUNCTION(3, "I2SIN1_LRCK"), MTK_FUNCTION(4, "ADC_DAT_IN"), MTK_FUNCTION(7, "DBG_MON_B[16]") ), MTK_PIN( PINCTRL_PIN(55, "SPI_MI"), "AC19", "mt8127", MTK_EINT_FUNCTION(0, 56), MTK_FUNCTION(0, "GPIO55"), MTK_FUNCTION(1, "SPI_MI"), MTK_FUNCTION(2, "SPI_MO"), MTK_FUNCTION(3, "I2SIN1_BCK1"), MTK_FUNCTION(4, "ADC_WS"), MTK_FUNCTION(7, "DBG_MON_B[17]") ), MTK_PIN( PINCTRL_PIN(56, "SPI_MO"), "AD18", "mt8127", MTK_EINT_FUNCTION(0, 57), MTK_FUNCTION(0, "GPIO56"), MTK_FUNCTION(1, "SPI_MO"), MTK_FUNCTION(2, "SPI_MI"), MTK_FUNCTION(7, "DBG_MON_B[18]") ), MTK_PIN( PINCTRL_PIN(57, "SDA1"), "AE23", "mt8127", MTK_EINT_FUNCTION(0, 58), MTK_FUNCTION(0, "GPIO57"), MTK_FUNCTION(1, "SDA1") ), MTK_PIN( PINCTRL_PIN(58, "SCL1"), "AD23", "mt8127", MTK_EINT_FUNCTION(0, 59), MTK_FUNCTION(0, "GPIO58"), MTK_FUNCTION(1, "SCL1") ), MTK_PIN( PINCTRL_PIN(59, "DISP_PWM"), "AC20", "mt8127", MTK_EINT_FUNCTION(0, 60), MTK_FUNCTION(0, "GPIO59"), MTK_FUNCTION(1, "DISP_PWM"), MTK_FUNCTION(2, "PWM1"), MTK_FUNCTION(7, "DBG_MON_A[18]") ), MTK_PIN( PINCTRL_PIN(60, "WB_RSTB"), "AD7", "mt8127", MTK_EINT_FUNCTION(0, 61), MTK_FUNCTION(0, "GPIO60"), MTK_FUNCTION(1, "WB_RSTB"), MTK_FUNCTION(7, "DBG_MON_A[19]") ), MTK_PIN( PINCTRL_PIN(61, "F2W_DATA"), "Y10", "mt8127", MTK_EINT_FUNCTION(0, 62), MTK_FUNCTION(0, "GPIO61"), MTK_FUNCTION(1, "F2W_DATA"), MTK_FUNCTION(7, "DBG_MON_A[20]") ), MTK_PIN( PINCTRL_PIN(62, "F2W_CLK"), "W10", "mt8127", MTK_EINT_FUNCTION(0, 63), MTK_FUNCTION(0, "GPIO62"), MTK_FUNCTION(1, "F2W_CK"), MTK_FUNCTION(7, "DBG_MON_A[21]") ), MTK_PIN( PINCTRL_PIN(63, "WB_SCLK"), "AB7", "mt8127", MTK_EINT_FUNCTION(0, 64), MTK_FUNCTION(0, "GPIO63"), MTK_FUNCTION(1, "WB_SCLK"), MTK_FUNCTION(7, "DBG_MON_A[22]") ), MTK_PIN( PINCTRL_PIN(64, "WB_SDATA"), "AA7", "mt8127", MTK_EINT_FUNCTION(0, 65), MTK_FUNCTION(0, "GPIO64"), MTK_FUNCTION(1, "WB_SDATA"), MTK_FUNCTION(7, "DBG_MON_A[23]") ), MTK_PIN( PINCTRL_PIN(65, "WB_SEN"), "Y7", "mt8127", MTK_EINT_FUNCTION(0, 66), MTK_FUNCTION(0, "GPIO65"), MTK_FUNCTION(1, "WB_SEN"), MTK_FUNCTION(7, "DBG_MON_A[24]") ), MTK_PIN( PINCTRL_PIN(66, "WB_CRTL0"), "AA1", "mt8127", MTK_EINT_FUNCTION(0, 67), MTK_FUNCTION(0, "GPIO66"), MTK_FUNCTION(1, "WB_CRTL0"), MTK_FUNCTION(2, "DFD_NTRST_XI"), MTK_FUNCTION(7, "DBG_MON_A[25]") ), MTK_PIN( PINCTRL_PIN(67, "WB_CRTL1"), "AA2", "mt8127", MTK_EINT_FUNCTION(0, 68), MTK_FUNCTION(0, "GPIO67"), MTK_FUNCTION(1, "WB_CRTL1"), MTK_FUNCTION(2, "DFD_TMS_XI"), MTK_FUNCTION(7, "DBG_MON_A[26]") ), MTK_PIN( PINCTRL_PIN(68, "WB_CRTL2"), "Y1", "mt8127", MTK_EINT_FUNCTION(0, 69), MTK_FUNCTION(0, "GPIO68"), MTK_FUNCTION(1, "WB_CRTL2"), MTK_FUNCTION(2, "DFD_TCK_XI"), MTK_FUNCTION(7, "DBG_MON_A[27]") ), MTK_PIN( PINCTRL_PIN(69, "WB_CRTL3"), "Y2", "mt8127", MTK_EINT_FUNCTION(0, 70), MTK_FUNCTION(0, "GPIO69"), MTK_FUNCTION(1, "WB_CRTL3"), MTK_FUNCTION(2, "DFD_TDI_XI"), MTK_FUNCTION(7, "DBG_MON_A[28]") ), MTK_PIN( PINCTRL_PIN(70, "WB_CRTL4"), "Y3", "mt8127", MTK_EINT_FUNCTION(0, 71), MTK_FUNCTION(0, "GPIO70"), MTK_FUNCTION(1, "WB_CRTL4"), MTK_FUNCTION(2, "DFD_TDO"), MTK_FUNCTION(7, "DBG_MON_A[29]") ), MTK_PIN( PINCTRL_PIN(71, "WB_CRTL5"), "Y4", "mt8127", MTK_EINT_FUNCTION(0, 72), MTK_FUNCTION(0, "GPIO71"), MTK_FUNCTION(1, "WB_CRTL5"), MTK_FUNCTION(7, "DBG_MON_A[30]") ), MTK_PIN( PINCTRL_PIN(72, "I2S_DATA_IN"), "K21", "mt8127", MTK_EINT_FUNCTION(0, 73), MTK_FUNCTION(0, "GPIO72"), MTK_FUNCTION(1, "I2SIN1_DATA_IN"), MTK_FUNCTION(2, "PCM_RX"), MTK_FUNCTION(3, "I2SOUT_DATA_OUT"), MTK_FUNCTION(4, "DAC_DAT_OUT"), MTK_FUNCTION(5, "PWM0"), MTK_FUNCTION(6, "ADC_CK"), MTK_FUNCTION(7, "DBG_MON_B[19]") ), MTK_PIN( PINCTRL_PIN(73, "I2S_LRCK"), "L21", "mt8127", MTK_EINT_FUNCTION(0, 74), MTK_FUNCTION(0, "GPIO73"), MTK_FUNCTION(1, "I2SIN1_LRCK"), MTK_FUNCTION(2, "PCM_SYNC"), MTK_FUNCTION(3, "I2SOUT_LRCK"), MTK_FUNCTION(4, "DAC_WS"), MTK_FUNCTION(5, "PWM3"), MTK_FUNCTION(6, "ADC_DAT_IN"), MTK_FUNCTION(7, "DBG_MON_B[20]") ), MTK_PIN( PINCTRL_PIN(74, "I2S_BCK"), "L20", "mt8127", MTK_EINT_FUNCTION(0, 75), MTK_FUNCTION(0, "GPIO74"), MTK_FUNCTION(1, "I2SIN1_BCK2"), MTK_FUNCTION(2, "PCM_CLK1"), MTK_FUNCTION(3, "I2SOUT_BCK"), MTK_FUNCTION(4, "DAC_CK"), MTK_FUNCTION(5, "PWM4"), MTK_FUNCTION(6, "ADC_WS"), MTK_FUNCTION(7, "DBG_MON_B[21]") ), MTK_PIN( PINCTRL_PIN(75, "SDA0"), "W3", "mt8127", MTK_EINT_FUNCTION(0, 76), MTK_FUNCTION(0, "GPIO75"), MTK_FUNCTION(1, "SDA0") ), MTK_PIN( PINCTRL_PIN(76, "SCL0"), "W4", "mt8127", MTK_EINT_FUNCTION(0, 77), MTK_FUNCTION(0, "GPIO76"), MTK_FUNCTION(1, "SCL0") ), MTK_PIN( PINCTRL_PIN(77, "SDA2"), "K19", "mt8127", MTK_EINT_FUNCTION(0, 78), MTK_FUNCTION(0, "GPIO77"), MTK_FUNCTION(1, "SDA2"), MTK_FUNCTION(2, "PWM1") ), MTK_PIN( PINCTRL_PIN(78, "SCL2"), "K20", "mt8127", MTK_EINT_FUNCTION(0, 79), MTK_FUNCTION(0, "GPIO78"), MTK_FUNCTION(1, "SCL2"), MTK_FUNCTION(2, "PWM2") ), MTK_PIN( PINCTRL_PIN(79, "URXD0"), "K18", "mt8127", MTK_EINT_FUNCTION(0, 80), MTK_FUNCTION(0, "GPIO79"), MTK_FUNCTION(1, "URXD0"), MTK_FUNCTION(2, "UTXD0") ), MTK_PIN( PINCTRL_PIN(80, "UTXD0"), "K17", "mt8127", MTK_EINT_FUNCTION(0, 81), MTK_FUNCTION(0, "GPIO80"), MTK_FUNCTION(1, "UTXD0"), MTK_FUNCTION(2, "URXD0") ), MTK_PIN( PINCTRL_PIN(81, "URXD1"), "L17", "mt8127", MTK_EINT_FUNCTION(0, 82), MTK_FUNCTION(0, "GPIO81"), MTK_FUNCTION(1, "URXD1"), MTK_FUNCTION(2, "UTXD1") ), MTK_PIN( PINCTRL_PIN(82, "UTXD1"), "L18", "mt8127", MTK_EINT_FUNCTION(0, 83), MTK_FUNCTION(0, "GPIO82"), MTK_FUNCTION(1, "UTXD1"), MTK_FUNCTION(2, "URXD1") ), MTK_PIN( PINCTRL_PIN(83, "LCM_RST"), "W5", "mt8127", MTK_EINT_FUNCTION(0, 84), MTK_FUNCTION(0, "GPIO83"), MTK_FUNCTION(1, "LCM_RST"), MTK_FUNCTION(2, "VDAC_CK_XI"), MTK_FUNCTION(7, "DBG_MON_A[31]") ), MTK_PIN( PINCTRL_PIN(84, "DSI_TE"), "W6", "mt8127", MTK_EINT_FUNCTION(0, 85), MTK_FUNCTION(0, "GPIO84"), MTK_FUNCTION(1, "DSI_TE"), MTK_FUNCTION(7, "DBG_MON_A[32]") ), MTK_PIN( PINCTRL_PIN(85, "MSDC2_CMD"), "U7", "mt8127", MTK_EINT_FUNCTION(0, 86), MTK_FUNCTION(0, "GPIO85"), MTK_FUNCTION(1, "MSDC2_CMD"), MTK_FUNCTION(2, "ANT_SEL0"), MTK_FUNCTION(3, "SDA1"), MTK_FUNCTION(6, "I2SOUT_BCK"), MTK_FUNCTION(7, "DBG_MON_B[22]") ), MTK_PIN( PINCTRL_PIN(86, "MSDC2_CLK"), "T8", "mt8127", MTK_EINT_FUNCTION(0, 87), MTK_FUNCTION(0, "GPIO86"), MTK_FUNCTION(1, "MSDC2_CLK"), MTK_FUNCTION(2, "ANT_SEL1"), MTK_FUNCTION(3, "SCL1"), MTK_FUNCTION(6, "I2SOUT_LRCK"), MTK_FUNCTION(7, "DBG_MON_B[23]") ), MTK_PIN( PINCTRL_PIN(87, "MSDC2_DAT0"), "V3", "mt8127", MTK_EINT_FUNCTION(0, 88), MTK_FUNCTION(0, "GPIO87"), MTK_FUNCTION(1, "MSDC2_DAT0"), MTK_FUNCTION(2, "ANT_SEL2"), MTK_FUNCTION(5, "UTXD0"), MTK_FUNCTION(6, "I2SOUT_DATA_OUT"), MTK_FUNCTION(7, "DBG_MON_B[24]") ), MTK_PIN( PINCTRL_PIN(88, "MSDC2_DAT1"), "V4", "mt8127", MTK_EINT_FUNCTION(0, 89), MTK_FUNCTION(0, "GPIO88"), MTK_FUNCTION(1, "MSDC2_DAT1"), MTK_FUNCTION(2, "ANT_SEL3"), MTK_FUNCTION(3, "PWM0"), MTK_FUNCTION(5, "URXD0"), MTK_FUNCTION(6, "PWM1"), MTK_FUNCTION(7, "DBG_MON_B[25]") ), MTK_PIN( PINCTRL_PIN(89, "MSDC2_DAT2"), "U5", "mt8127", MTK_EINT_FUNCTION(0, 90), MTK_FUNCTION(0, "GPIO89"), MTK_FUNCTION(1, "MSDC2_DAT2"), MTK_FUNCTION(2, "ANT_SEL4"), MTK_FUNCTION(3, "SDA2"), MTK_FUNCTION(5, "UTXD1"), MTK_FUNCTION(6, "PWM2"), MTK_FUNCTION(7, "DBG_MON_B[26]") ), MTK_PIN( PINCTRL_PIN(90, "MSDC2_DAT3"), "U6", "mt8127", MTK_EINT_FUNCTION(0, 91), MTK_FUNCTION(0, "GPIO90"), MTK_FUNCTION(1, "MSDC2_DAT3"), MTK_FUNCTION(2, "ANT_SEL5"), MTK_FUNCTION(3, "SCL2"), MTK_FUNCTION(4, "EXT_FRAME_SYNC"), MTK_FUNCTION(5, "URXD1"), MTK_FUNCTION(6, "PWM3"), MTK_FUNCTION(7, "DBG_MON_B[27]") ), MTK_PIN( PINCTRL_PIN(91, "TDN3"), "U2", "mt8127", MTK_EINT_FUNCTION(0, 92), MTK_FUNCTION(0, "GPI91"), MTK_FUNCTION(1, "TDN3") ), MTK_PIN( PINCTRL_PIN(92, "TDP3"), "U1", "mt8127", MTK_EINT_FUNCTION(0, 93), MTK_FUNCTION(0, "GPI92"), MTK_FUNCTION(1, "TDP3") ), MTK_PIN( PINCTRL_PIN(93, "TDN2"), "T2", "mt8127", MTK_EINT_FUNCTION(0, 94), MTK_FUNCTION(0, "GPI93"), MTK_FUNCTION(1, "TDN2") ), MTK_PIN( PINCTRL_PIN(94, "TDP2"), "T1", "mt8127", MTK_EINT_FUNCTION(0, 95), MTK_FUNCTION(0, "GPI94"), MTK_FUNCTION(1, "TDP2") ), MTK_PIN( PINCTRL_PIN(95, "TCN"), "R5", "mt8127", MTK_EINT_FUNCTION(0, 96), MTK_FUNCTION(0, "GPI95"), MTK_FUNCTION(1, "TCN") ), MTK_PIN( PINCTRL_PIN(96, "TCP"), "R4", "mt8127", MTK_EINT_FUNCTION(0, 97), MTK_FUNCTION(0, "GPI96"), MTK_FUNCTION(1, "TCP") ), MTK_PIN( PINCTRL_PIN(97, "TDN1"), "R3", "mt8127", MTK_EINT_FUNCTION(0, 98), MTK_FUNCTION(0, "GPI97"), MTK_FUNCTION(1, "TDN1") ), MTK_PIN( PINCTRL_PIN(98, "TDP1"), "R2", "mt8127", MTK_EINT_FUNCTION(0, 99), MTK_FUNCTION(0, "GPI98"), MTK_FUNCTION(1, "TDP1") ), MTK_PIN( PINCTRL_PIN(99, "TDN0"), "P3", "mt8127", MTK_EINT_FUNCTION(0, 100), MTK_FUNCTION(0, "GPI99"), MTK_FUNCTION(1, "TDN0") ), MTK_PIN( PINCTRL_PIN(100, "TDP0"), "P2", "mt8127", MTK_EINT_FUNCTION(0, 101), MTK_FUNCTION(0, "GPI100"), MTK_FUNCTION(1, "TDP0") ), MTK_PIN( PINCTRL_PIN(101, "RDN0"), "K1", "mt8127", MTK_EINT_FUNCTION(0, 102), MTK_FUNCTION(0, "GPI101"), MTK_FUNCTION(1, "RDN0") ), MTK_PIN( PINCTRL_PIN(102, "RDP0"), "K2", "mt8127", MTK_EINT_FUNCTION(0, 103), MTK_FUNCTION(0, "GPI102"), MTK_FUNCTION(1, "RDP0") ), MTK_PIN( PINCTRL_PIN(103, "RDN1"), "L2", "mt8127", MTK_EINT_FUNCTION(0, 104), MTK_FUNCTION(0, "GPI103"), MTK_FUNCTION(1, "RDN1") ), MTK_PIN( PINCTRL_PIN(104, "RDP1"), "L3", "mt8127", MTK_EINT_FUNCTION(0, 105), MTK_FUNCTION(0, "GPI104"), MTK_FUNCTION(1, "RDP1") ), MTK_PIN( PINCTRL_PIN(105, "RCN"), "M4", "mt8127", MTK_EINT_FUNCTION(0, 106), MTK_FUNCTION(0, "GPI105"), MTK_FUNCTION(1, "RCN") ), MTK_PIN( PINCTRL_PIN(106, "RCP"), "M5", "mt8127", MTK_EINT_FUNCTION(0, 107), MTK_FUNCTION(0, "GPI106"), MTK_FUNCTION(1, "RCP") ), MTK_PIN( PINCTRL_PIN(107, "RDN2"), "M2", "mt8127", MTK_EINT_FUNCTION(0, 108), MTK_FUNCTION(0, "GPI107"), MTK_FUNCTION(1, "RDN2"), MTK_FUNCTION(2, "CMDAT8") ), MTK_PIN( PINCTRL_PIN(108, "RDP2"), "M3", "mt8127", MTK_EINT_FUNCTION(0, 109), MTK_FUNCTION(0, "GPI108"), MTK_FUNCTION(1, "RDP2"), MTK_FUNCTION(2, "CMDAT9") ), MTK_PIN( PINCTRL_PIN(109, "RDN3"), "N2", "mt8127", MTK_EINT_FUNCTION(0, 110), MTK_FUNCTION(0, "GPI109"), MTK_FUNCTION(1, "RDN3"), MTK_FUNCTION(2, "CMDAT4") ), MTK_PIN( PINCTRL_PIN(110, "RDP3"), "N3", "mt8127", MTK_EINT_FUNCTION(0, 111), MTK_FUNCTION(0, "GPI110"), MTK_FUNCTION(1, "RDP3"), MTK_FUNCTION(2, "CMDAT5") ), MTK_PIN( PINCTRL_PIN(111, "RCN_A"), "J5", "mt8127", MTK_EINT_FUNCTION(0, 112), MTK_FUNCTION(0, "GPI111"), MTK_FUNCTION(1, "RCN_A"), MTK_FUNCTION(2, "CMDAT6") ), MTK_PIN( PINCTRL_PIN(112, "RCP_A"), "J4", "mt8127", MTK_EINT_FUNCTION(0, 113), MTK_FUNCTION(0, "GPI112"), MTK_FUNCTION(1, "RCP_A"), MTK_FUNCTION(2, "CMDAT7") ), MTK_PIN( PINCTRL_PIN(113, "RDN1_A"), "J2", "mt8127", MTK_EINT_FUNCTION(0, 114), MTK_FUNCTION(0, "GPI113"), MTK_FUNCTION(1, "RDN1_A"), MTK_FUNCTION(2, "CMDAT2"), MTK_FUNCTION(3, "CMCSD2") ), MTK_PIN( PINCTRL_PIN(114, "RDP1_A"), "J3", "mt8127", MTK_EINT_FUNCTION(0, 115), MTK_FUNCTION(0, "GPI114"), MTK_FUNCTION(1, "RDP1_A"), MTK_FUNCTION(2, "CMDAT3"), MTK_FUNCTION(3, "CMCSD3") ), MTK_PIN( PINCTRL_PIN(115, "RDN0_A"), "H2", "mt8127", MTK_EINT_FUNCTION(0, 116), MTK_FUNCTION(0, "GPI115"), MTK_FUNCTION(1, "RDN0_A"), MTK_FUNCTION(2, "CMHSYNC") ), MTK_PIN( PINCTRL_PIN(116, "RDP0_A"), "H3", "mt8127", MTK_EINT_FUNCTION(0, 117), MTK_FUNCTION(0, "GPI116"), MTK_FUNCTION(1, "RDP0_A"), MTK_FUNCTION(2, "CMVSYNC") ), MTK_PIN( PINCTRL_PIN(117, "CMDAT0"), "G5", "mt8127", MTK_EINT_FUNCTION(0, 118), MTK_FUNCTION(0, "GPIO117"), MTK_FUNCTION(1, "CMDAT0"), MTK_FUNCTION(2, "CMCSD0"), MTK_FUNCTION(3, "ANT_SEL2"), MTK_FUNCTION(7, "DBG_MON_B[28]") ), MTK_PIN( PINCTRL_PIN(118, "CMDAT1"), "G4", "mt8127", MTK_EINT_FUNCTION(0, 119), MTK_FUNCTION(0, "GPIO118"), MTK_FUNCTION(1, "CMDAT1"), MTK_FUNCTION(2, "CMCSD1"), MTK_FUNCTION(3, "ANT_SEL3"), MTK_FUNCTION(7, "DBG_MON_B[29]") ), MTK_PIN( PINCTRL_PIN(119, "CMMCLK"), "F3", "mt8127", MTK_EINT_FUNCTION(0, 120), MTK_FUNCTION(0, "GPIO119"), MTK_FUNCTION(1, "CMMCLK"), MTK_FUNCTION(3, "ANT_SEL4"), MTK_FUNCTION(7, "DBG_MON_B[30]") ), MTK_PIN( PINCTRL_PIN(120, "CMPCLK"), "G6", "mt8127", MTK_EINT_FUNCTION(0, 121), MTK_FUNCTION(0, "GPIO120"), MTK_FUNCTION(1, "CMPCLK"), MTK_FUNCTION(2, "CMCSK"), MTK_FUNCTION(3, "ANT_SEL5"), MTK_FUNCTION(7, "DBG_MON_B[31]") ), MTK_PIN( PINCTRL_PIN(121, "MSDC1_CMD"), "E3", "mt8127", MTK_EINT_FUNCTION(0, 122), MTK_FUNCTION(0, "GPIO121"), MTK_FUNCTION(1, "MSDC1_CMD") ), MTK_PIN( PINCTRL_PIN(122, "MSDC1_CLK"), "D1", "mt8127", MTK_EINT_FUNCTION(0, 123), MTK_FUNCTION(0, "GPIO122"), MTK_FUNCTION(1, "MSDC1_CLK") ), MTK_PIN( PINCTRL_PIN(123, "MSDC1_DAT0"), "D2", "mt8127", MTK_EINT_FUNCTION(0, 124), MTK_FUNCTION(0, "GPIO123"), MTK_FUNCTION(1, "MSDC1_DAT0") ), MTK_PIN( PINCTRL_PIN(124, "MSDC1_DAT1"), "D3", "mt8127", MTK_EINT_FUNCTION(0, 125), MTK_FUNCTION(0, "GPIO124"), MTK_FUNCTION(1, "MSDC1_DAT1") ), MTK_PIN( PINCTRL_PIN(125, "MSDC1_DAT2"), "F2", "mt8127", MTK_EINT_FUNCTION(0, 126), MTK_FUNCTION(0, "GPIO125"), MTK_FUNCTION(1, "MSDC1_DAT2") ), MTK_PIN( PINCTRL_PIN(126, "MSDC1_DAT3"), "E2", "mt8127", MTK_EINT_FUNCTION(0, 127), MTK_FUNCTION(0, "GPIO126"), MTK_FUNCTION(1, "MSDC1_DAT3") ), MTK_PIN( PINCTRL_PIN(127, "MSDC0_DAT7"), "C23", "mt8127", MTK_EINT_FUNCTION(0, 128), MTK_FUNCTION(0, "GPIO127"), MTK_FUNCTION(1, "MSDC0_DAT7"), MTK_FUNCTION(4, "NLD7") ), MTK_PIN( PINCTRL_PIN(128, "MSDC0_DAT6"), "C24", "mt8127", MTK_EINT_FUNCTION(0, 129), MTK_FUNCTION(0, "GPIO128"), MTK_FUNCTION(1, "MSDC0_DAT6"), MTK_FUNCTION(4, "NLD6") ), MTK_PIN( PINCTRL_PIN(129, "MSDC0_DAT5"), "D22", "mt8127", MTK_EINT_FUNCTION(0, 130), MTK_FUNCTION(0, "GPIO129"), MTK_FUNCTION(1, "MSDC0_DAT5"), MTK_FUNCTION(4, "NLD4") ), MTK_PIN( PINCTRL_PIN(130, "MSDC0_DAT4"), "D24", "mt8127", MTK_EINT_FUNCTION(0, 131), MTK_FUNCTION(0, "GPIO130"), MTK_FUNCTION(1, "MSDC0_DAT4"), MTK_FUNCTION(4, "NLD3") ), MTK_PIN( PINCTRL_PIN(131, "MSDC0_RSTB"), "F24", "mt8127", MTK_EINT_FUNCTION(0, 132), MTK_FUNCTION(0, "GPIO131"), MTK_FUNCTION(1, "MSDC0_RSTB"), MTK_FUNCTION(4, "NLD0") ), MTK_PIN( PINCTRL_PIN(132, "MSDC0_CMD"), "G20", "mt8127", MTK_EINT_FUNCTION(0, 133), MTK_FUNCTION(0, "GPIO132"), MTK_FUNCTION(1, "MSDC0_CMD"), MTK_FUNCTION(4, "NALE") ), MTK_PIN( PINCTRL_PIN(133, "MSDC0_CLK"), "G21", "mt8127", MTK_EINT_FUNCTION(0, 134), MTK_FUNCTION(0, "GPIO133"), MTK_FUNCTION(1, "MSDC0_CLK"), MTK_FUNCTION(4, "NWEB") ), MTK_PIN( PINCTRL_PIN(134, "MSDC0_DAT3"), "D23", "mt8127", MTK_EINT_FUNCTION(0, 135), MTK_FUNCTION(0, "GPIO134"), MTK_FUNCTION(1, "MSDC0_DAT3"), MTK_FUNCTION(4, "NLD1") ), MTK_PIN( PINCTRL_PIN(135, "MSDC0_DAT2"), "E22", "mt8127", MTK_EINT_FUNCTION(0, 136), MTK_FUNCTION(0, "GPIO135"), MTK_FUNCTION(1, "MSDC0_DAT2"), MTK_FUNCTION(4, "NLD5") ), MTK_PIN( PINCTRL_PIN(136, "MSDC0_DAT1"), "E23", "mt8127", MTK_EINT_FUNCTION(0, 137), MTK_FUNCTION(0, "GPIO136"), MTK_FUNCTION(1, "MSDC0_DAT1"), MTK_FUNCTION(4, "NLD8") ), MTK_PIN( PINCTRL_PIN(137, "MSDC0_DAT0"), "F22", "mt8127", MTK_EINT_FUNCTION(NO_EINT_SUPPORT, NO_EINT_SUPPORT), MTK_FUNCTION(0, "GPIO137"), MTK_FUNCTION(1, "MSDC0_DAT0"), MTK_FUNCTION(4, "WATCHDOG"), MTK_FUNCTION(5, "NLD2") ), MTK_PIN( PINCTRL_PIN(138, "CEC"), "AE21", "mt8127", MTK_EINT_FUNCTION(NO_EINT_SUPPORT, NO_EINT_SUPPORT), MTK_FUNCTION(0, "GPIO138"), MTK_FUNCTION(1, "CEC") ), MTK_PIN( PINCTRL_PIN(139, "HTPLG"), "AD21", "mt8127", MTK_EINT_FUNCTION(NO_EINT_SUPPORT, NO_EINT_SUPPORT), MTK_FUNCTION(0, "GPIO139"), MTK_FUNCTION(1, "HTPLG") ), MTK_PIN( PINCTRL_PIN(140, "HDMISCK"), "AE22", "mt8127", MTK_EINT_FUNCTION(NO_EINT_SUPPORT, NO_EINT_SUPPORT), MTK_FUNCTION(0, "GPIO140"), MTK_FUNCTION(1, "HDMISCK") ), MTK_PIN( PINCTRL_PIN(141, "HDMISD"), "AD22", "mt8127", MTK_EINT_FUNCTION(NO_EINT_SUPPORT, NO_EINT_SUPPORT), MTK_FUNCTION(0, "GPIO141"), MTK_FUNCTION(1, "HDMISD") ), MTK_PIN( PINCTRL_PIN(142, "EINT21"), "J23", "mt8127", MTK_EINT_FUNCTION(0, 21), MTK_FUNCTION(0, "GPIO142"), MTK_FUNCTION(1, "NRNB"), MTK_FUNCTION(2, "ANT_SEL0"), MTK_FUNCTION(7, "DBG_MON_B[32]") ), }; #endif /* __PINCTRL_MTK_MT8127_H */
{ "pile_set_name": "Github" }
// SPDX-License-Identifier: GPL-2.0-or-later /* * Airplane mode button for HP & Xiaomi laptops * * Copyright (C) 2014-2017 Alex Hung <alex.hung@canonical.com> */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> #include <linux/input.h> #include <linux/platform_device.h> #include <linux/acpi.h> #include <acpi/acpi_bus.h> MODULE_LICENSE("GPL"); MODULE_AUTHOR("Alex Hung"); MODULE_ALIAS("acpi*:HPQ6001:*"); MODULE_ALIAS("acpi*:WSTADEF:*"); static struct input_dev *hpwl_input_dev; static const struct acpi_device_id hpwl_ids[] = { {"HPQ6001", 0}, {"WSTADEF", 0}, {"", 0}, }; static int hp_wireless_input_setup(void) { int err; hpwl_input_dev = input_allocate_device(); if (!hpwl_input_dev) return -ENOMEM; hpwl_input_dev->name = "HP Wireless hotkeys"; hpwl_input_dev->phys = "hpq6001/input0"; hpwl_input_dev->id.bustype = BUS_HOST; hpwl_input_dev->evbit[0] = BIT(EV_KEY); set_bit(KEY_RFKILL, hpwl_input_dev->keybit); err = input_register_device(hpwl_input_dev); if (err) goto err_free_dev; return 0; err_free_dev: input_free_device(hpwl_input_dev); return err; } static void hp_wireless_input_destroy(void) { input_unregister_device(hpwl_input_dev); } static void hpwl_notify(struct acpi_device *acpi_dev, u32 event) { if (event != 0x80) { pr_info("Received unknown event (0x%x)\n", event); return; } input_report_key(hpwl_input_dev, KEY_RFKILL, 1); input_sync(hpwl_input_dev); input_report_key(hpwl_input_dev, KEY_RFKILL, 0); input_sync(hpwl_input_dev); } static int hpwl_add(struct acpi_device *device) { int err; err = hp_wireless_input_setup(); if (err) pr_err("Failed to setup hp wireless hotkeys\n"); return err; } static int hpwl_remove(struct acpi_device *device) { hp_wireless_input_destroy(); return 0; } static struct acpi_driver hpwl_driver = { .name = "hp-wireless", .owner = THIS_MODULE, .ids = hpwl_ids, .ops = { .add = hpwl_add, .remove = hpwl_remove, .notify = hpwl_notify, }, }; module_acpi_driver(hpwl_driver);
{ "pile_set_name": "Github" }
#!/usr/bin/env bash # # Build tests for STM32F103RC MEEB_3DP (ccrobot-online.com) # # exit on first failure set -e # # Build with the default configurations # restore_configs opt_set MOTHERBOARD BOARD_CCROBOT_MEEB_3DP opt_set SERIAL_PORT 1 opt_set SERIAL_PORT_2 -1 opt_set X_DRIVER_TYPE TMC2208 opt_set Y_DRIVER_TYPE TMC2208 opt_set Z_DRIVER_TYPE TMC2208 opt_set E0_DRIVER_TYPE TMC2208 exec_test $1 $2 "MEEB_3DP - Basic Config with TMC2208 SW Serial" # clean up restore_configs
{ "pile_set_name": "Github" }
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from . import main, pivot
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8" ?> <xsd:schema xmlns="http://symfony.com/schema/dic/doctrine" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://symfony.com/schema/dic/doctrine" elementFormDefault="qualified"> <xsd:element name="config"> <xsd:complexType> <xsd:all> <xsd:element name="all" type="all" minOccurs="0" maxOccurs="1" /> <xsd:element name="js" type="js" minOccurs="0" maxOccurs="1" /> </xsd:all> </xsd:complexType> </xsd:element> <xsd:complexType name="all"> <xsd:attribute name="has_action" type="xsd:string" use="required" default="false" /> </xsd:complexType> </xsd:schema>
{ "pile_set_name": "Github" }
#!/bin/sh . /lib/functions.sh . /lib/functions/uci-defaults.sh . /lib/functions/system.sh ramips_setup_interfaces() { local board="$1" case $board in 7links,px-4885-4m|\ 7links,px-4885-8m|\ allnet,all0256n-4m|\ allnet,all0256n-8m|\ allnet,all5002|\ allnet,all5003|\ belkin,f7c027|\ dlink,dcs-930l-b1|\ dlink,dcs-930|\ edimax,3g-6200nl|\ hame,mpr-a1|\ hame,mpr-a2|\ hauppauge,broadway|\ hootoo,ht-tm02|\ huawei,d105|\ intenso,memory2move|\ netgear,wnce2001|\ tenda,3g150b|\ tenda,3g300m|\ tenda,w150m|\ trendnet,tew-714tru|\ unbranded,a5-v11|\ wansview,ncs601w|\ zorlik,zl5900v2) ucidef_add_switch "switch0" ucidef_add_switch_attr "switch0" "enable" "false" ucidef_set_interface_lan "eth0" ;; 8devices,carambola) ucidef_add_switch "switch0" \ "0:lan" "1:lan" "6@eth0" ;; accton,wr6202|\ alfa-network,w502u|\ argus,atp-52b|\ asiarf,awm002-evb-4m|\ asiarf,awm002-evb-8m|\ asus,rt-n10-plus|\ asus,wl-330n|\ asus,wl-330n3g|\ aztech,hw550-3g|\ engenius,esr-9753|\ jcg,jhr-n805r|\ jcg,jhr-n825r|\ jcg,jhr-n926r|\ petatel,psr-680w|\ planex,mzk-wdpr|\ skyline,sl-r7205|\ teltonika,rut5xx|\ tenda,w306r-v2|\ unbranded,xdx-rn502j|\ upvel,ur-326n4g) ucidef_add_switch "switch0" \ "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0" ;; airlive,air3gii|\ asus,rt-g32-b1|\ asus,rt-n13u|\ aximcom,mr-102n|\ buffalo,whr-g300n|\ dlink,dap-1350|\ dlink,dir-300-b1|\ dlink,dir-300-b7|\ dlink,dir-320-b1|\ dlink,dir-600-b1|\ dlink,dir-610-a1|\ dlink,dir-615-d|\ dlink,dir-620-a1|\ dlink,dir-620-d1|\ dlink,dwr-512-b|\ easyacc,wizard-8800|\ edimax,3g-6200n|\ fon,fonera-20n|\ hilink,hlk-rm04|\ mofinetwork,mofi3500-3gn|\ netcore,nw718|\ nexaira,bc2|\ nixcore,x1-16m|\ nixcore,x1-8m|\ olimex,rt5350f-olinuxino|\ olimex,rt5350f-olinuxino-evb|\ omnima,miniembplug|\ omnima,miniembwifi|\ planex,mzk-w300nh2|\ poray,ip2202|\ poray,m3|\ poray,m4-4m|\ poray,m4-8m|\ poray,x5|\ poray,x8|\ prolink,pwh2004|\ ralink,v22rw-2x2|\ unbranded,wr512-3gn-4m|\ unbranded,wr512-3gn-8m|\ upvel,ur-336un|\ zyxel,keenetic|\ zyxel,nbg-419n|\ zyxel,nbg-419n-v2) ucidef_add_switch "switch0" \ "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0" ;; alphanetworks,asl26555-8m|\ alphanetworks,asl26555-16m) ucidef_add_switch "switch0" \ "1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0" ;; arcwireless,freestation5) # FIXME: Which is the actual wan port? ucidef_add_switch "switch0" \ "0:lan" "1:wan" "2:wan" "3:wan" "4:wan" "6@eth0" ;; asiarf,awapn2403) ucidef_add_switch "switch0" \ "0:lan" "1:wan" "6@eth0" ;; aximcom,mr-102n|\ trendnet,tew-638apb-v2) ucidef_add_switch "switch0" \ "4:lan" "6@eth0" ;; belkin,f5d8235-v2) ucidef_add_switch "switch0" \ "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0" ;; dlink,dir-615-h1) ucidef_add_switch "switch0" \ "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" "6@eth0" ;; huawei,hg255d) ucidef_add_switch "switch0" \ "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "0:wan" "6@eth0" ;; nexx,wt1520-4m|\ nexx,wt1520-8m) ucidef_add_switch "switch0" \ "0:lan" "4:wan" "6@eth0" ;; planex,mzk-dp150n|\ vocore,vocore-8m|\ vocore,vocore-16m) ucidef_add_switch "switch0" \ "0:lan" "4:lan" "6t@eth0" ;; sitecom,wl-351) ucidef_add_switch "switch0" \ "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5@eth0" ;; sparklan,wcr-150gn) ucidef_add_switch "switch0" \ "0:lan" "6t@eth0" ;; wiznet,wizfi630a) ucidef_add_switch "switch0" \ "0:lan" "1:lan" "2:wan" "6@eth0" ;; zyxel,keenetic-lite-b|\ zyxel,keenetic-start) ucidef_add_switch "switch0" \ "0:lan:3" "1:lan:2" "2:lan:1" "3:lan:0" "4:wan" "6@eth0" ;; esac } ramips_setup_macs() { local board="$1" local lan_mac="" local wan_mac="" local label_mac="" case $board in 7links,px-4885-4m|\ 7links,px-4885-8m) wan_mac=$(macaddr_add "$(mtd_get_mac_binary devconf 0x28)" 1) ;; 8devices,carambola|\ alfa-network,w502u|\ arcwireless,freestation5|\ netgear,wnce2001) wan_mac=$(mtd_get_mac_binary factory 0x2e) ;; accton,wr6202|\ asiarf,awm002-evb-4m|\ asiarf,awm002-evb-8m|\ asus,rt-n13u|\ aztech,hw550-3g|\ fon,fonera-20n|\ huawei,hg255d|\ omnima,miniembwifi|\ planex,mzk-wdpr|\ poray,ip2202|\ teltonika,rut5xx|\ unbranded,xdx-rn502j|\ zyxel,keenetic|\ zyxel,nbg-419n|\ zyxel,nbg-419n-v2) wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x28)" 1) ;; airlive,air3gii|\ argus,atp-52b|\ asus,wl-330n3g|\ dlink,dir-620-d1|\ edimax,3g-6200n|\ edimax,3g-6200nl|\ netcore,nw718|\ nexx,wt1520-4m|\ nexx,wt1520-8m|\ nixcore,x1-16m|\ nixcore,x1-8m|\ omnima,miniembplug|\ planex,mzk-w300nh2|\ sitecom,wl-351|\ trendnet,tew-714tru) wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1) ;; asus,rt-g32-b1|\ asus,rt-n10-plus) wan_mac=$(macaddr_add "$(mtd_get_mac_binary devconf 0x4)" 1) ;; belkin,f5d8235-v2) wan_mac=$(macaddr_add "$(mtd_get_mac_binary uboot 0x40004)" 1) ;; dlink,dir-300-b7|\ dlink,dir-320-b1|\ dlink,dir-620-a1|\ engenius,esr-9753|\ hame,mpr-a1|\ hauppauge,broadway|\ huawei,d105|\ hilink,hlk-rm04|\ nexaira,bc2|\ olimex,rt5350f-olinuxino|\ olimex,rt5350f-olinuxino-evb|\ petatel,psr-680w|\ skyline,sl-r7205) lan_mac=$(macaddr_setbit_la "$(cat /sys/class/net/eth0/address)") wan_mac=$(macaddr_add "$lan_mac" 1) ;; dlink,dap-1350) wan_mac=$(macaddr_add "$(mtd_get_mac_binary devdata 0x2e)" 1) ;; dlink,dir-300-b1|\ dlink,dir-600-b1|\ dlink,dir-610-a1) wan_mac=$(macaddr_add "$(mtd_get_mac_binary devdata 0x4004)" 1) ;; dlink,dir-615-d) label_mac=$(mtd_get_mac_binary devdata 0x4004) ;; dlink,dir-615-h1) wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x28)" 1) label_mac=$(mtd_get_mac_binary factory 0x4) ;; dlink,dwr-512-b) wan_mac=$(macaddr_add "$(mtd_get_mac_binary config 0xe07e)" 1) ;; jcg,jhr-n805r|\ jcg,jhr-n825r|\ jcg,jhr-n926r) wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x2e)" 1) ;; poray,m3|\ poray,m4-4m|\ poray,m4-8m|\ poray,x5|\ poray,x8) lan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" -2) ;; sparklan,wcr-150gn|\ wiznet,wizfi630a) wan_mac=$(mtd_get_mac_binary factory 0x28) ;; tenda,w306r-v2) wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x28)" 5) ;; upvel,ur-326n4g|\ upvel,ur-336un) wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4004)" 1) ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac } board_config_update board=$(board_name) ramips_setup_interfaces $board ramips_setup_macs $board board_config_flush exit 0
{ "pile_set_name": "Github" }
// Copyright 2016 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build go1.7 package webdav import ( "context" "net/http" ) func getContext(r *http.Request) context.Context { return r.Context() }
{ "pile_set_name": "Github" }
{% set version = "1.0.1" %} {% set sha256 = "ec7a175d54190c0d0c29212d32e1bb93f9f687b2db26da4fc9f5e555312e879e" %} package: name: krocus version: '{{ version }}' source: url: https://github.com/andrewjpage/krocus/archive/v{{ version }}.tar.gz sha256: '{{ sha256 }}' build: noarch: python number: 1 requirements: host: - python >=3 - setuptools run: - python >=3 - setuptools - biopython >=1.68 - pyfastaq >=3.14.0 test: commands: - krocus --help about: home: https://github.com/andrewjpage/krocus license: GPL-3.0 license_family: GPL summary: krocus performs multi-locus sequence typing from uncorrected long reads. description: | Krocus can predict a sequence type directly from uncorrected long reads, and was designed to consume read data as it is produced, providing results in minutes. extra: skip-lints: - uses_setuptools # krocus uses pkg_resources
{ "pile_set_name": "Github" }
require 'test_helper' class ProjectsHelperTest < ActionView::TestCase end
{ "pile_set_name": "Github" }
/* Copyright (C) 2014 Fredrik Johansson This file is part of Arb. Arb is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See <http://www.gnu.org/licenses/>. */ #include "flint/fmpz_poly.h" #include "acb.h" void rising_difference_polynomial(fmpz * s, fmpz * c, ulong m); void acb_rising_ui_rs(acb_t y, const acb_t x, ulong n, ulong m, slong prec) { acb_ptr xs; acb_t t, u, v; ulong i, k, rem; fmpz_t c, h; fmpz *s, *d; slong wp; if (n == 0) { acb_one(y); return; } if (n == 1) { acb_set_round(y, x, prec); return; } wp = ARF_PREC_ADD(prec, FLINT_BIT_COUNT(n)); acb_init(t); acb_init(u); acb_init(v); fmpz_init(c); fmpz_init(h); if (m == 0) { ulong m1, m2; m1 = 0.2 * pow(2.0 * wp, 0.4); m2 = n_sqrt(n); m = FLINT_MIN(m1, m2); } m = FLINT_MIN(m, n); m = FLINT_MAX(m, 1); xs = _acb_vec_init(m + 1); d = _fmpz_vec_init(m * m); s = _fmpz_vec_init(m + 1); _acb_vec_set_powers(xs, x, m + 1, wp); rising_difference_polynomial(s, d, m); /* tail */ rem = m; while (rem + m <= n) rem += m; acb_one(y); for (k = rem; k < n; k++) { acb_add_ui(t, xs + 1, k, wp); acb_mul(y, y, t, wp); } /* initial rising factorial */ acb_zero(t); for (i = 1; i <= m; i++) acb_addmul_fmpz(t, xs + i, s + i, wp); acb_mul(y, y, t, wp); /* the leading coefficient is always the same */ acb_mul_fmpz(xs + m - 1, xs + m - 1, d + m - 1 + 0, wp); for (k = 0; k + 2 * m <= n; k += m) { for (i = 0; i < m - 1; i++) { fmpz_set_ui(h, k); _fmpz_poly_evaluate_horner_fmpz(c, d + i * m, m - i, h); if (i == 0) acb_add_fmpz(t, t, c, wp); else acb_addmul_fmpz(t, xs + i, c, wp); } acb_add(t, t, xs + m - 1, wp); acb_mul(y, y, t, wp); } acb_set_round(y, y, prec); acb_clear(t); acb_clear(u); acb_clear(v); _acb_vec_clear(xs, m + 1); _fmpz_vec_clear(d, m * m); _fmpz_vec_clear(s, m + 1); fmpz_clear(c); fmpz_clear(h); }
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: 91256185ea36e674187aaaa008e303d6 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
/* * Copyright 2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gradle.api.internal.provider; import com.google.common.collect.ImmutableCollection; import com.google.common.collect.ImmutableSet; import org.gradle.api.provider.Provider; import org.gradle.api.provider.SetProperty; import org.gradle.internal.Cast; import javax.annotation.Nullable; import java.util.Set; import java.util.function.Supplier; public class DefaultSetProperty<T> extends AbstractCollectionProperty<T, Set<T>> implements SetProperty<T> { private static final Supplier<ImmutableCollection.Builder<Object>> FACTORY = new Supplier<ImmutableCollection.Builder<Object>>() { @Override public ImmutableCollection.Builder<Object> get() { return ImmutableSet.builder(); } }; public DefaultSetProperty(PropertyHost host, Class<T> elementType) { super(host, Set.class, elementType, Cast.uncheckedNonnullCast(FACTORY)); } @Override protected Set<T> emptyCollection() { return ImmutableSet.of(); } @Override public Class<?> publicType() { return SetProperty.class; } @Override public int getFactoryId() { return ManagedFactories.SetPropertyManagedFactory.FACTORY_ID; } @Override public SetProperty<T> empty() { super.empty(); return this; } @Override public SetProperty<T> value(@Nullable Iterable<? extends T> elements) { super.value(elements); return this; } @Override public SetProperty<T> value(Provider<? extends Iterable<? extends T>> provider) { super.value(provider); return this; } @Override public SetProperty<T> convention(Iterable<? extends T> elements) { super.convention(elements); return this; } @Override public SetProperty<T> convention(Provider<? extends Iterable<? extends T>> provider) { super.convention(provider); return this; } }
{ "pile_set_name": "Github" }
<?xml version="1.0"?> <t:config id="f7472d0e4697b56e13e1f4baf438d50675d860e0" name="Rpcproxy" version="1.0.1" configversion="1.0.1.0" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:t='tc0'> <t:consolemode value="new"/> </t:config>
{ "pile_set_name": "Github" }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ namespace Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.PowerShell { using System.Management.Automation; using System.Management.Automation.Host; using System.Threading; using System.Linq; internal interface IAsyncCommandRuntimeExtensions { Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SendAsyncStep Wrap(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SendAsyncStep func); System.Collections.Generic.IEnumerable<Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SendAsyncStep> Wrap(System.Collections.Generic.IEnumerable<Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SendAsyncStep> funcs); T ExecuteSync<T>(System.Func<T> step); } public class AsyncCommandRuntime : System.Management.Automation.ICommandRuntime2, IAsyncCommandRuntimeExtensions, System.IDisposable { private ICommandRuntime2 originalCommandRuntime; private System.Threading.Thread originalThread; public bool AllowInteractive { get; set; } = false; public CancellationToken cancellationToken; SemaphoreSlim semaphore = new SemaphoreSlim(1, 1); ManualResetEventSlim readyToRun = new ManualResetEventSlim(false); ManualResetEventSlim completed = new ManualResetEventSlim(false); System.Action runOnMainThread; private System.Management.Automation.PSCmdlet cmdlet; internal AsyncCommandRuntime(System.Management.Automation.PSCmdlet cmdlet, CancellationToken cancellationToken) { this.originalCommandRuntime = cmdlet.CommandRuntime as ICommandRuntime2; this.originalThread = System.Threading.Thread.CurrentThread; this.cancellationToken = cancellationToken; this.cmdlet = cmdlet; cmdlet.CommandRuntime = this; } public PSHost Host => this.originalCommandRuntime.Host; public PSTransactionContext CurrentPSTransaction => this.originalCommandRuntime.CurrentPSTransaction; private void CheckForInteractive() { // This is an interactive call -- if we are not on the original thread, this will only work if this was done at ACR creation time; if (!AllowInteractive) { throw new System.Exception("AsyncCommandRuntime is not configured for interactive calls"); } } private void WaitOurTurn() { // wait for our turn to play semaphore?.Wait(cancellationToken); // ensure that completed is not set completed.Reset(); } private void WaitForCompletion() { // wait for the result (or cancellation!) WaitHandle.WaitAny(new[] { cancellationToken.WaitHandle, completed?.WaitHandle }); // let go of the semaphore semaphore?.Release(); } public bool ShouldContinue(string query, string caption, bool hasSecurityImpact, ref bool yesToAll, ref bool noToAll) { // if we are on the original thread, just call straight thru. if (this.originalThread == System.Threading.Thread.CurrentThread) { return originalCommandRuntime.ShouldContinue(query, caption, hasSecurityImpact, ref yesToAll, ref noToAll); } CheckForInteractive(); // otherwise, queue up the request and wait for the main thread to do the right thing. try { // wait for our turn to talk to the main thread WaitOurTurn(); bool yta = yesToAll; bool nta = noToAll; bool result = false; // set the function to run runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption, hasSecurityImpact, ref yta, ref nta); // tell the main thread to go ahead readyToRun.Set(); // wait for the result (or cancellation!) WaitForCompletion(); // set the output variables yesToAll = yta; noToAll = nta; return result; } catch (System.OperationCanceledException exception) { // maybe don't even worry? throw exception; } } public bool ShouldContinue(string query, string caption) { // if we are on the original thread, just call straight thru. if (this.originalThread == System.Threading.Thread.CurrentThread) { return originalCommandRuntime.ShouldContinue(query, caption); } CheckForInteractive(); // otherwise, queue up the request and wait for the main thread to do the right thing. try { // wait for our turn to talk to the main thread WaitOurTurn(); bool result = false; // set the function to run runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption); // tell the main thread to go ahead readyToRun.Set(); // wait for the result (or cancellation!) WaitForCompletion(); // set the output variables return result; } catch (System.OperationCanceledException exception) { // maybe don't even worry? throw exception; } } public bool ShouldContinue(string query, string caption, ref bool yesToAll, ref bool noToAll) { // if we are on the original thread, just call straight thru. if (this.originalThread == System.Threading.Thread.CurrentThread) { return originalCommandRuntime.ShouldContinue(query, caption, ref yesToAll, ref noToAll); } CheckForInteractive(); // otherwise, queue up the request and wait for the main thread to do the right thing. try { // wait for our turn to talk to the main thread WaitOurTurn(); bool yta = yesToAll; bool nta = noToAll; bool result = false; // set the function to run runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption, ref yta, ref nta); // tell the main thread to go ahead readyToRun.Set(); // wait for the result (or cancellation!) WaitForCompletion(); // set the output variables yesToAll = yta; noToAll = nta; return result; } catch (System.OperationCanceledException exception) { // maybe don't even worry? throw exception; } } public bool ShouldProcess(string target) { // if we are on the original thread, just call straight thru. if (this.originalThread == System.Threading.Thread.CurrentThread) { return originalCommandRuntime.ShouldProcess(target); } CheckForInteractive(); // otherwise, queue up the request and wait for the main thread to do the right thing. try { // wait for our turn to talk to the main thread WaitOurTurn(); bool result = false; // set the function to run runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(target); // tell the main thread to go ahead readyToRun.Set(); // wait for the result (or cancellation!) WaitForCompletion(); // set the output variables return result; } catch (System.OperationCanceledException exception) { // maybe don't even worry? throw exception; } } public bool ShouldProcess(string target, string action) { // if we are on the original thread, just call straight thru. if (this.originalThread == System.Threading.Thread.CurrentThread) { return originalCommandRuntime.ShouldProcess(target, action); } CheckForInteractive(); // otherwise, queue up the request and wait for the main thread to do the right thing. try { // wait for our turn to talk to the main thread WaitOurTurn(); bool result = false; // set the function to run runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(target, action); // tell the main thread to go ahead readyToRun.Set(); // wait for the result (or cancellation!) WaitForCompletion(); // set the output variables return result; } catch (System.OperationCanceledException exception) { // maybe don't even worry? throw exception; } } public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption) { // if we are on the original thread, just call straight thru. if (this.originalThread == System.Threading.Thread.CurrentThread) { return originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption); } CheckForInteractive(); // otherwise, queue up the request and wait for the main thread to do the right thing. try { // wait for our turn to talk to the main thread WaitOurTurn(); bool result = false; // set the function to run runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption); // tell the main thread to go ahead readyToRun.Set(); // wait for the result (or cancellation!) WaitForCompletion(); // set the output variables return result; } catch (System.OperationCanceledException exception) { // maybe don't even worry? throw exception; } } public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption, out ShouldProcessReason shouldProcessReason) { // if we are on the original thread, just call straight thru. if (this.originalThread == System.Threading.Thread.CurrentThread) { return originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption, out shouldProcessReason); } CheckForInteractive(); // otherwise, queue up the request and wait for the main thread to do the right thing. try { // wait for our turn to talk to the main thread WaitOurTurn(); bool result = false; ShouldProcessReason reason = ShouldProcessReason.None; // set the function to run runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption, out reason); // tell the main thread to go ahead readyToRun.Set(); // wait for the result (or cancellation!) WaitForCompletion(); // set the output variables shouldProcessReason = reason; return result; } catch (System.OperationCanceledException exception) { // maybe don't even worry? throw exception; } } public void ThrowTerminatingError(ErrorRecord errorRecord) { // if we are on the original thread, just call straight thru. if (this.originalThread == System.Threading.Thread.CurrentThread) { originalCommandRuntime.ThrowTerminatingError(errorRecord); return; } // otherwise, queue up the request and wait for the main thread to do the right thing. try { // wait for our turn to talk to the main thread WaitOurTurn(); // set the function to run runOnMainThread = () => originalCommandRuntime.ThrowTerminatingError(errorRecord); // tell the main thread to go ahead readyToRun.Set(); // wait for the result (or cancellation!) WaitForCompletion(); // return return; } catch (System.OperationCanceledException exception) { // maybe don't even worry? throw exception; } } public bool TransactionAvailable() { // if we are on the original thread, just call straight thru. if (this.originalThread == System.Threading.Thread.CurrentThread) { return originalCommandRuntime.TransactionAvailable(); } // otherwise, queue up the request and wait for the main thread to do the right thing. try { // wait for our turn to talk to the main thread WaitOurTurn(); bool result = false; // set the function to run runOnMainThread = () => result = originalCommandRuntime.TransactionAvailable(); // tell the main thread to go ahead readyToRun.Set(); // wait for the result (or cancellation!) WaitForCompletion(); // set the output variables return result; } catch (System.OperationCanceledException exception) { // maybe don't even worry? throw exception; } } public void WriteCommandDetail(string text) { // if we are on the original thread, just call straight thru. if (this.originalThread == System.Threading.Thread.CurrentThread) { originalCommandRuntime.WriteCommandDetail(text); return; } // otherwise, queue up the request and wait for the main thread to do the right thing. try { // wait for our turn to talk to the main thread WaitOurTurn(); // set the function to run runOnMainThread = () => originalCommandRuntime.WriteCommandDetail(text); // tell the main thread to go ahead readyToRun.Set(); // wait for the result (or cancellation!) WaitForCompletion(); // return return; } catch (System.OperationCanceledException exception) { // maybe don't even worry? throw exception; } } public void WriteDebug(string text) { // if we are on the original thread, just call straight thru. if (this.originalThread == System.Threading.Thread.CurrentThread) { originalCommandRuntime.WriteDebug(text); return; } // otherwise, queue up the request and wait for the main thread to do the right thing. try { // wait for our turn to talk to the main thread WaitOurTurn(); // set the function to run runOnMainThread = () => originalCommandRuntime.WriteDebug(text); // tell the main thread to go ahead readyToRun.Set(); // wait for the result (or cancellation!) WaitForCompletion(); // return return; } catch (System.OperationCanceledException exception) { // maybe don't even worry? throw exception; } } public void WriteError(ErrorRecord errorRecord) { // if we are on the original thread, just call straight thru. if (this.originalThread == System.Threading.Thread.CurrentThread) { originalCommandRuntime.WriteError(errorRecord); return; } // otherwise, queue up the request and wait for the main thread to do the right thing. try { // wait for our turn to talk to the main thread WaitOurTurn(); // set the function to run runOnMainThread = () => originalCommandRuntime.WriteError(errorRecord); // tell the main thread to go ahead readyToRun.Set(); // wait for the result (or cancellation!) WaitForCompletion(); // return return; } catch (System.OperationCanceledException exception) { // maybe don't even worry? throw exception; } } public void WriteInformation(InformationRecord informationRecord) { // if we are on the original thread, just call straight thru. if (this.originalThread == System.Threading.Thread.CurrentThread) { originalCommandRuntime.WriteInformation(informationRecord); return; } // otherwise, queue up the request and wait for the main thread to do the right thing. try { // wait for our turn to talk to the main thread WaitOurTurn(); // set the function to run runOnMainThread = () => originalCommandRuntime.WriteInformation(informationRecord); // tell the main thread to go ahead readyToRun.Set(); // wait for the result (or cancellation!) WaitForCompletion(); // return return; } catch (System.OperationCanceledException exception) { // maybe don't even worry? throw exception; } } public void WriteObject(object sendToPipeline) { // if we are on the original thread, just call straight thru. if (this.originalThread == System.Threading.Thread.CurrentThread) { originalCommandRuntime.WriteObject(sendToPipeline); return; } // otherwise, queue up the request and wait for the main thread to do the right thing. try { // wait for our turn to talk to the main thread WaitOurTurn(); // set the function to run runOnMainThread = () => originalCommandRuntime.WriteObject(sendToPipeline); // tell the main thread to go ahead readyToRun.Set(); // wait for the result (or cancellation!) WaitForCompletion(); // return return; } catch (System.OperationCanceledException exception) { // maybe don't even worry? throw exception; } } public void WriteObject(object sendToPipeline, bool enumerateCollection) { // if we are on the original thread, just call straight thru. if (this.originalThread == System.Threading.Thread.CurrentThread) { originalCommandRuntime.WriteObject(sendToPipeline, enumerateCollection); return; } // otherwise, queue up the request and wait for the main thread to do the right thing. try { // wait for our turn to talk to the main thread WaitOurTurn(); // set the function to run runOnMainThread = () => originalCommandRuntime.WriteObject(sendToPipeline, enumerateCollection); // tell the main thread to go ahead readyToRun.Set(); // wait for the result (or cancellation!) WaitForCompletion(); // return return; } catch (System.OperationCanceledException exception) { // maybe don't even worry? throw exception; } } public void WriteProgress(ProgressRecord progressRecord) { // if we are on the original thread, just call straight thru. if (this.originalThread == System.Threading.Thread.CurrentThread) { originalCommandRuntime.WriteProgress(progressRecord); return; } // otherwise, queue up the request and wait for the main thread to do the right thing. try { // wait for our turn to talk to the main thread WaitOurTurn(); // set the function to run runOnMainThread = () => originalCommandRuntime.WriteProgress(progressRecord); // tell the main thread to go ahead readyToRun.Set(); // wait for the result (or cancellation!) WaitForCompletion(); // return return; } catch (System.OperationCanceledException exception) { // maybe don't even worry? throw exception; } } public void WriteProgress(long sourceId, ProgressRecord progressRecord) { // if we are on the original thread, just call straight thru. if (this.originalThread == System.Threading.Thread.CurrentThread) { originalCommandRuntime.WriteProgress(sourceId, progressRecord); return; } // otherwise, queue up the request and wait for the main thread to do the right thing. try { // wait for our turn to talk to the main thread WaitOurTurn(); // set the function to run runOnMainThread = () => originalCommandRuntime.WriteProgress(sourceId, progressRecord); // tell the main thread to go ahead readyToRun.Set(); // wait for the result (or cancellation!) WaitForCompletion(); // return return; } catch (System.OperationCanceledException exception) { // maybe don't even worry? throw exception; } } public void WriteVerbose(string text) { // if we are on the original thread, just call straight thru. if (this.originalThread == System.Threading.Thread.CurrentThread) { originalCommandRuntime.WriteVerbose(text); return; } // otherwise, queue up the request and wait for the main thread to do the right thing. try { // wait for our turn to talk to the main thread WaitOurTurn(); // set the function to run runOnMainThread = () => originalCommandRuntime.WriteVerbose(text); // tell the main thread to go ahead readyToRun.Set(); // wait for the result (or cancellation!) WaitForCompletion(); // return return; } catch (System.OperationCanceledException exception) { // maybe don't even worry? throw exception; } } public void WriteWarning(string text) { // if we are on the original thread, just call straight thru. if (this.originalThread == System.Threading.Thread.CurrentThread) { originalCommandRuntime.WriteWarning(text); return; } // otherwise, queue up the request and wait for the main thread to do the right thing. try { // wait for our turn to talk to the main thread WaitOurTurn(); // set the function to run runOnMainThread = () => originalCommandRuntime.WriteWarning(text); // tell the main thread to go ahead readyToRun.Set(); // wait for the result (or cancellation!) WaitForCompletion(); // return return; } catch (System.OperationCanceledException exception) { // maybe don't even worry? throw exception; } } public void Wait(System.Threading.Tasks.Task ProcessRecordAsyncTask, System.Threading.CancellationToken cancellationToken) { do { WaitHandle.WaitAny(new[] { readyToRun.WaitHandle, ((System.IAsyncResult)ProcessRecordAsyncTask).AsyncWaitHandle }); if (readyToRun.IsSet) { // reset the request for the next time readyToRun.Reset(); // run the delegate on this thread runOnMainThread(); // tell the originator everything is complete completed.Set(); } } while (!ProcessRecordAsyncTask.IsCompleted); if (ProcessRecordAsyncTask.IsFaulted) { // don't unwrap a Aggregate Exception -- we'll lose the stack trace of the actual exception. // if( ProcessRecordAsyncTask.Exception is System.AggregateException aggregate ) { // throw aggregate.InnerException; // } throw ProcessRecordAsyncTask.Exception; } } public Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SendAsyncStep Wrap(Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SendAsyncStep func) => func.Target.GetType().Name != "Closure" ? func : (p1, p2, p3) => ExecuteSync<System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>>(() => func(p1, p2, p3)); public System.Collections.Generic.IEnumerable<Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SendAsyncStep> Wrap(System.Collections.Generic.IEnumerable<Microsoft.Azure.PowerShell.Cmdlets.DedicatedHsm.Runtime.SendAsyncStep> funcs) => funcs?.Select(Wrap); public T ExecuteSync<T>(System.Func<T> step) { // if we are on the original thread, just call straight thru. if (this.originalThread == System.Threading.Thread.CurrentThread) { return step(); } T result = default(T); try { // wait for our turn to talk to the main thread WaitOurTurn(); // set the function to run runOnMainThread = () => { result = step(); }; // tell the main thread to go ahead readyToRun.Set(); // wait for the result (or cancellation!) WaitForCompletion(); // return return result; } catch (System.OperationCanceledException exception) { // maybe don't even worry? throw exception; } } public void Dispose() { if (cmdlet != null) { cmdlet.CommandRuntime = this.originalCommandRuntime; cmdlet = null; } semaphore?.Dispose(); semaphore = null; readyToRun?.Dispose(); readyToRun = null; completed?.Dispose(); completed = null; } } }
{ "pile_set_name": "Github" }
let s = "\\ \/ \b \f \n \r \t \" " in s
{ "pile_set_name": "Github" }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Diagnostics; namespace System.Xaml { public enum XamlNodeType:byte { None, // need something to return when un-inited. (and past Eof) StartObject, GetObject, EndObject, StartMember, EndMember, Value, NamespaceDeclaration, }; internal delegate void XamlNodeAddDelegate(XamlNodeType nodeType, object data); internal delegate void XamlLineInfoAddDelegate(int lineNumber, int linePosition); internal delegate XamlNode XamlNodeNextDelegate(); internal delegate XamlNode XamlNodeIndexDelegate(int idx); [DebuggerDisplay("{ToString()}")] internal struct XamlNode { internal enum InternalNodeType:byte { None, StartOfStream, EndOfStream, EndOfAttributes, LineInfo } XamlNodeType _nodeType; InternalNodeType _internalNodeType; private object _data; public XamlNodeType NodeType { get { return _nodeType; } } public XamlNode(XamlNodeType nodeType) { #if DEBUG switch (nodeType) { case XamlNodeType.EndObject: case XamlNodeType.EndMember: case XamlNodeType.GetObject: break; default: Debug.Assert(false, "XamlNode Ctor missing data argument"); break; } #endif _nodeType = nodeType; _internalNodeType = InternalNodeType.None; _data = null; } public XamlNode(XamlNodeType nodeType, object data) { #if DEBUG switch(nodeType) { case XamlNodeType.StartObject: Debug.Assert(data is XamlType, "XamlNode ctor, StartObject data is not a XamlType"); break; case XamlNodeType.StartMember: Debug.Assert(data is XamlMember, "XamlNode ctor, StartMember data is not a XamlMember"); break; case XamlNodeType.NamespaceDeclaration: Debug.Assert(data is NamespaceDeclaration, "XamlNode ctor, NamespaceDeclaration data is not a NamespaceDeclaration"); break; case XamlNodeType.Value: // can be anything; break; case XamlNodeType.EndObject: case XamlNodeType.EndMember: case XamlNodeType.GetObject: Debug.Assert(data == null, "XamlNode ctor, Internal XamlNode data must be null for this Node type"); break; default: Debug.Assert(false, "XamlNode ctor, incorrect ctor called."); break; } #endif _nodeType = nodeType; _internalNodeType = InternalNodeType.None; _data = data; } public XamlNode(InternalNodeType internalNodeType) { Debug.Assert(internalNodeType == InternalNodeType.EndOfAttributes || internalNodeType == InternalNodeType.StartOfStream || internalNodeType == InternalNodeType.EndOfStream, "XamlNode ctor: Illegal Internal node type"); _nodeType = XamlNodeType.None; _internalNodeType = internalNodeType; _data = null; } public XamlNode(LineInfo lineInfo) { _nodeType = XamlNodeType.None; _internalNodeType = InternalNodeType.LineInfo; _data = lineInfo; } public override string ToString() { string str = String.Format(TypeConverterHelper.InvariantEnglishUS, "{0}: ", NodeType); switch(NodeType) { case XamlNodeType.StartObject: str += XamlType.Name; break; case XamlNodeType.StartMember: str += Member.Name; break; case XamlNodeType.Value: str += Value.ToString(); break; case XamlNodeType.NamespaceDeclaration: str += NamespaceDeclaration.ToString(); break; case XamlNodeType.None: switch(_internalNodeType) { case InternalNodeType.EndOfAttributes: str += "End Of Attributes"; break; case InternalNodeType.StartOfStream: str += "Start Of Stream"; break; case InternalNodeType.EndOfStream: str += "End Of Stream"; break; case InternalNodeType.LineInfo: str += "LineInfo: " + LineInfo.ToString(); break; } break; } return str; } public NamespaceDeclaration NamespaceDeclaration { get { if (NodeType == XamlNodeType.NamespaceDeclaration) { return (NamespaceDeclaration)_data; } return null; } } public XamlType XamlType { get { if (NodeType == XamlNodeType.StartObject) { return (XamlType)_data; } return null; } } public object Value { get { if (NodeType == XamlNodeType.Value) { return _data; } return null; } } public XamlMember Member { get { if (NodeType == XamlNodeType.StartMember) { return (XamlMember)_data; } return null; } } public LineInfo LineInfo { get { if (NodeType == XamlNodeType.None) { return _data as LineInfo; // might be null for EOF and EOA. } return null; } } internal bool IsEof { get { if (NodeType == XamlNodeType.None && _internalNodeType == InternalNodeType.EndOfStream) { return true; } return false; } } internal bool IsEndOfAttributes { get { if (NodeType == XamlNodeType.None && _internalNodeType == InternalNodeType.EndOfAttributes) { return true; } return false; } } internal bool IsLineInfo { get { if (NodeType == XamlNodeType.None && _internalNodeType == InternalNodeType.LineInfo) { return true; } return false; } } internal static bool IsEof_Helper(XamlNodeType nodeType, object data) { if (nodeType != XamlNodeType.None) { return false; } if (data is InternalNodeType) { InternalNodeType internalNodeType = (InternalNodeType)data; if (internalNodeType == InternalNodeType.EndOfStream) { return true; } } return false; } } }
{ "pile_set_name": "Github" }
//////////////////////////////////////////////////////////////////////////////// // The Loki Library // Copyright (c) 2009 by Fedor Pikus & Rich Sposato // The copyright on this file is protected under the terms of the MIT license. // // Permission to use, copy, modify, distribute and sell this software for any // purpose is hereby granted without fee, provided that the above copyright // notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. // // The author makes no claims about the suitability of this software for any // purpose. It is provided "as is" without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// // $Id$ #ifndef LOKI_INCLUDED_SAFE_BIT_FIELDS_H #define LOKI_INCLUDED_SAFE_BIT_FIELDS_H #include <cstdlib> #include <assert.h> #include <loki/static_check.h> namespace Loki { /* ========================================================================================================================================== SafeBitField - type-safe class for bit fields. SafeBitConst - type-safe class for bit constants. SafeBitField is designed to be a [almost] drop-in replacement for integer flags and bit fields where individual bits are set and checked using symbolic names for flags: typedef unsigned long Labels_t; Labels_t labels; const Labels_t Label_A = 0x00000001; const Labels_t Label_B = 0x00000002; ... labels |= Label_B; if ( labels & Label_A ) { ... } Such code offers no protection against mismatching bit constants and bit fields: typedef unsigned long Kinds_t; Kinds_t kinds; const Kinds_t Kind_A = 0x00000004; ... if ( kinds & Label_A ) { ... } // Error but compiles SafeBitField is a drop-in replacement which generates a unique type for each bit field. Bit fields of different types cannot be applied to each other: LOKI_BIT_FIELD( unsigned long ) Labels_t; Labels_t labels; LOKI_BIT_CONST( Labels_t, Label_A, 1 ); // 0x0001 - 1st bit is set LOKI_BIT_CONST( Labels_t, Label_B, 2 ); // 0x0002 - 1st bit is set ... LOKI_BIT_FIELD( unsigned long ) Kinds_t; Kinds_t kinds; LOKI_BIT_CONST( Kinds_t, Kind_A, 3 ); // 0x0004 - 1st bit is set ... if ( kinds & Label_A ) { ... } // Does not compile Several other kinds of bit field misuse are caught by safe bit fields: if ( kinds & Kind_A == 0 ) { ... } if ( kinds && Kind_A ) { ... } There are few cases where drop-in replacement does not work: 1. Operations involving bit fields and unnamed integers. Usually the integer in question is 0: Labels_t labels = 0; // No longer compiles if ( ( labels & Label_A ) == 0 ) { ... } // Also does not compile The solution is to use named bit constants, including the one for 0: LOKI_BIT_CONST( Labels_t, Label_None, 0 ); // 0x0000 - No bit is set Labels_t labels = Label_None; // Or just Labels_t labels; - constructor initializes to 0 if ( ( labels & Label_A ) == Label_None ) { ... } // // Or just if ( labels & Label_A ) { ... } 2. I/O and other operations which require integer variables and cannot be modified: void write_to_db( unsigned int word ); Labels_t labels; write_to_db( labels ); // No longer compiles This problem is solved by reinterpreting the bit fields as an integer, the user is responsible for using the right type of integer: write_to_db( *((Labels_t::bit_word_t*)(&labels)) ); ========================================================================================================================================== */ /// @par Non-Templated Initialization. /// Not all compilers support template member functions where the template /// arguments are not deduced but explicitly specified. For these broken /// compilers, a non-template make_bit_const() function is provided instead of /// the template one. The only downside is that instead of compile-time checking /// of the index argument, it does runtime checking. #if defined(__SUNPRO_CC) || ( defined(__GNUC__) && (__GNUC__ < 3) ) #define LOKI_BIT_FIELD_NONTEMPLATE_INIT #endif /// @par Forbidding Conversions. /// This incomplete type prevents compilers from instantiating templates for /// type conversions which should not happen. This incomplete type must be a /// template: if the type is incomplete at the point of template definition, /// the template is illegal (although the standard allows compilers to accept /// or reject such code, §14.6/, so some compilers will not issue diagnostics /// unless template is instantiated). The standard-compliant way is to defer /// binding to the point of instantiation by making the incomplete type itself /// a template. template < typename > struct Forbidden_conversion; // This struct must not be defined! /// Forward declaration of the field type. template < unsigned int unique_index, typename word_t = unsigned long > class SafeBitField; //////////////////////////////////////////////////////////////////////////////// /// \class SafeBitConst Bit constants. /// This class defines a bit-field constant - a collection of unchanging bits /// used to compare to bit-fields. Instances of this class are intended to act /// as labels for bit-fields. /// /// \par Safety /// - This class provides operations used for comparisons and conversions, but /// no operations which may modify the value. /// - As a templated class, it provides type-safety so bit values and constants /// used for different reasons may not be unknowingly compared to each other. /// - The unique_index template parameter insures the unique type of each bit /// bit-field. It shares the unique_index with a similar SafeBitField. /// - Its operations only allow comparisons to other bit-constants and /// bit-fields of the same type. //////////////////////////////////////////////////////////////////////////////// template < unsigned int unique_index, typename word_t = unsigned long > class SafeBitConst { public: /// Type of the bit field is available if needed. typedef word_t bit_word_t; /// Corresponding field type. typedef SafeBitField< unique_index, word_t > field_t; /// Typedef is not allowed in friendship declaration. friend class SafeBitField< unique_index, word_t >; // Static factory constructor, creates a bit constant with one bit set. The position of the bit is given by the template parameter, // bit 1 is the junior bit, i.e. make_bit_const<1>() returns 1. Bit index 0 is a special case and returns 0. // This function should be used only to initialize the static bit constant objects. // This function will not compile if the bit index is outside the vaild range. // There is also a compile-time assert to make sure the size of the class is the same as the size of the underlaying integer type. // This assert could go into the constructor, but aCC does not seem to understand sizeof(SafeBitConst) in the constructor. // #ifndef LOKI_BIT_FIELD_NONTEMPLATE_INIT template < unsigned int i > static SafeBitConst make_bit_const() { LOKI_STATIC_CHECK( i <= ( 8 * sizeof(word_t) ), Index_is_beyond_size_of_data ); LOKI_STATIC_CHECK( sizeof(SafeBitConst) == sizeof(word_t), Object_size_does_not_match_data_size ); // Why check for ( i > 0 ) again inside the shift if the shift // can never be evaluated for i == 0? Some compilers see shift by ( i - 1 ) // and complain that for i == 0 the number is invalid, without // checking that shift needs evaluating. return SafeBitConst( ( i > 0 ) ? ( word_t(1) << ( ( i > 0 ) ? ( i - 1 ) : 0 ) ) : 0 ); } #else static SafeBitConst make_bit_const( unsigned int i ) { LOKI_STATIC_CHECK( sizeof(SafeBitConst) == sizeof(word_t), Object_size_does_not_match_data_size ); assert( i <= ( 8 * sizeof(word_t) ) ); // Index is beyond size of data. // Why check for ( i > 0 ) again inside the shift if the shift // can never be evaluated for i == 0? Some compilers see shift by ( i - 1 ) // and complain that for i == 0 the number is invalid, without // checking that shift needs evaluating. return SafeBitConst( ( i > 0 ) ? ( word_t(1) << ( ( i > 0 ) ? ( i - 1 ) : 0 ) ) : 0 ); } #endif /// Default constructor allows client code to construct bit fields on the stack. SafeBitConst() : word( 0 ) {} /// Copy constructor. SafeBitConst( const SafeBitConst& rhs ) : word( rhs.word ) {} /// Comparison operators which take a constant bit value. bool operator == ( const SafeBitConst & rhs ) const { return word == rhs.word; } bool operator != ( const SafeBitConst & rhs ) const { return word != rhs.word; } bool operator < ( const SafeBitConst & rhs ) const { return word < rhs.word; } bool operator > ( const SafeBitConst & rhs ) const { return word > rhs.word; } bool operator <= ( const SafeBitConst & rhs ) const { return word <= rhs.word; } bool operator >= ( const SafeBitConst & rhs ) const { return word >= rhs.word; } /// Comparision operators for mutable bit fields. bool operator == ( const field_t & rhs ) const { return word == rhs.word; } bool operator != ( const field_t & rhs ) const { return word != rhs.word; } bool operator < ( const field_t & rhs ) const { return word < rhs.word; } bool operator > ( const field_t & rhs ) const { return word > rhs.word; } bool operator <= ( const field_t & rhs ) const { return word <= rhs.word; } bool operator >= ( const field_t & rhs ) const { return word >= rhs.word; } /// Bitwise operations. Operation-assignment operators are not needed, /// since bit constants cannot be changed after they are initialized. const SafeBitConst operator | ( const SafeBitConst & rhs ) const { return SafeBitConst( word | rhs.word ); } const SafeBitConst operator & ( const SafeBitConst & rhs ) const { return SafeBitConst( word & rhs.word ); } const SafeBitConst operator ^ ( const SafeBitConst & rhs ) const { return SafeBitConst( word ^ rhs.word ); } const SafeBitConst operator ~ ( void ) const { return SafeBitConst( ~word ); } /// These bitwise operators return a bit-field instead of a bit-const. field_t operator | ( const field_t & rhs ) const { return field_t( word | rhs.word ); } field_t operator & ( const field_t & rhs ) const { return field_t( word & rhs.word ); } field_t operator ^ ( const field_t & rhs ) const { return field_t( word ^ rhs.word ); } /// The shift operators move bits inside the bit field. These are useful in /// loops which act over bit fields and increment them. const SafeBitConst operator << ( unsigned int s ) const { return SafeBitConst( word << s ); } const SafeBitConst operator >> ( unsigned int s ) const { return SafeBitConst( word >> s ); } /// Word size is also the maximum number of different bit fields for a given word type. static size_t size() { return ( 8 * sizeof( word_t ) ); } private: /// Copy-assignment operator is not implemented since it does not make sense /// for a constant object. SafeBitConst operator = ( const SafeBitConst & rhs ); // Private constructor from an integer type. explicit SafeBitConst( word_t init ) : word( init ) {} /// This data stores a single bit value. It is declared const to enforce // constness for all functions of this class. const word_t word; // Here comes the interesting stuff: all the operators designed to // trap unintended conversions and make them not compile. // Operators below handle code like this: // SafeBitField<1> label1; // SafeBitField<2> label2; // if ( label1 & label2 ) { ... } // These operators are private, and will not instantiate in any // event because of the incomplete Forbidden_conversion struct. template < typename T > SafeBitConst operator|( T ) const { Forbidden_conversion< T > wrong; return *this; } template < typename T > SafeBitConst operator&( T ) const { Forbidden_conversion< T > wrong; return *this; } template < typename T > SafeBitConst operator^( T ) const { Forbidden_conversion< T > wrong; return *this; } template < typename T > SafeBitConst operator|=( T ) const { Forbidden_conversion< T > wrong; return *this; } template < typename T > SafeBitConst operator&=( T ) const { Forbidden_conversion< T > wrong; return *this; } template < typename T > SafeBitConst operator^=( T ) const { Forbidden_conversion< T > wrong; return *this; } // And the same thing for comparisons: private and unusable. // if ( label1 == label2 ) { ... } template < typename T > bool operator==( const T ) const { Forbidden_conversion< T > wrong; return true; } template < typename T > bool operator!=( const T ) const { Forbidden_conversion< T > wrong; return true; } template < typename T > bool operator<( const T ) const { Forbidden_conversion< T > wrong; return true; } template < typename T > bool operator>( const T ) const { Forbidden_conversion< T > wrong; return true; } template < typename T > bool operator<=( const T ) const { Forbidden_conversion< T > wrong; return true; } template < typename T > bool operator>=( const T ) const { Forbidden_conversion< T > wrong; return true; } }; //////////////////////////////////////////////////////////////////////////////// /// \class SafeBitConst Bit constants. /// This class defines a bit-field constant - a collection of unchanging bits /// used to compare to bit-fields. Instances of this class are intended to /// store bit values. /// /// \par Safety /// - This class provides operations used for comparisons and conversions, and /// also operations which may safely modify the value. /// - As a templated class, it provides type-safety so bit values and constants /// used for different reasons may not be unknowingly compared to each other. /// - The unique_index template parameter insures the unique type of each bit /// bit-field. It shares the unique_index with a similar SafeBitConst. /// - Its operations only allow comparisons to other bit-constants and /// bit-fields of the same type. //////////////////////////////////////////////////////////////////////////////// template < unsigned int unique_index, typename word_t > class SafeBitField { public: /// Type of the bit field is available if needed. typedef word_t bit_word_t; /// Corresponding field type. typedef SafeBitConst< unique_index, word_t > const_t; /// Typedef is not allowed in friendship declaration. friend class SafeBitConst<unique_index, word_t>; /// Default constructor allows client code to construct bit fields on the stack. SafeBitField() : word( 0 ) {} /// Copy constructor and assignment operators. SafeBitField( const SafeBitField & rhs ) : word( rhs.word ) {} SafeBitField & operator = ( const SafeBitField & rhs ) { word = rhs.word; return *this; } /// Copy constructor and assignment operators from constant bit fields. SafeBitField( const const_t & rhs ) : word( rhs.word ) {} SafeBitField & operator = ( const const_t & rhs ) { word = rhs.word; return *this; } /// These comparison operators act on bit-fields of the same type. bool operator == ( const SafeBitField & rhs ) const { return word == rhs.word; } bool operator != ( const SafeBitField & rhs ) const { return word != rhs.word; } bool operator < ( const SafeBitField & rhs ) const { return word < rhs.word; } bool operator > ( const SafeBitField & rhs ) const { return word > rhs.word; } bool operator <= ( const SafeBitField & rhs ) const { return word <= rhs.word; } bool operator >= ( const SafeBitField & rhs ) const { return word >= rhs.word; } /// These comparison operators act on bit-constants of a similar type. bool operator == ( const const_t & rhs ) const { return word == rhs.word; } bool operator != ( const const_t & rhs ) const { return word != rhs.word; } bool operator < ( const const_t & rhs ) const { return word < rhs.word; } bool operator > ( const const_t & rhs ) const { return word > rhs.word; } bool operator <= ( const const_t & rhs ) const { return word <= rhs.word; } bool operator >= ( const const_t & rhs ) const { return word >= rhs.word; } /// Bitwise operations that use bit-fields. SafeBitField operator | ( const SafeBitField & rhs ) const { return SafeBitField( word | rhs.word ); } SafeBitField operator & ( const SafeBitField & rhs ) const { return SafeBitField( word & rhs.word ); } SafeBitField operator ^ ( const SafeBitField & rhs ) const { return SafeBitField( word ^ rhs.word ); } SafeBitField operator ~ ( void ) const { return SafeBitField( ~word ); } SafeBitField operator |= ( const SafeBitField & rhs ) { word |= rhs.word; return SafeBitField( *this ); } SafeBitField operator &= ( const SafeBitField & rhs ) { word &= rhs.word; return SafeBitField( *this ); } SafeBitField operator ^= ( const SafeBitField & rhs ) { word ^= rhs.word; return SafeBitField( *this ); } /// Bitwise operators that use bit-constants. SafeBitField operator | ( const_t rhs ) const { return SafeBitField( word | rhs.word ); } SafeBitField operator & ( const_t rhs ) const { return SafeBitField( word & rhs.word ); } SafeBitField operator ^ ( const_t rhs ) const { return SafeBitField( word ^ rhs.word ); } SafeBitField operator |= ( const_t rhs ) { word |= rhs.word; return SafeBitField( *this ); } SafeBitField operator &= ( const_t rhs ) { word &= rhs.word; return SafeBitField( *this ); } SafeBitField operator ^= ( const_t rhs ) { word ^= rhs.word; return SafeBitField( *this ); } // Conversion to bool. // This is a major source of headaches, but it's required to support code like this: // const static SafeBitConst<1> Label_value = SafeBitConst<1>::make_bit_const<1>(); // SafeBitField<1> label; // if ( label & Label_value ) { ... } // Nice... // // The downside is that this allows all sorts of nasty conversions. Without additional precautions, bit fields of different types // can be converted to bool and then compared or operated on: // SafeBitField<1> label1; // SafeBitField<2> label2; // if ( label1 == label2 ) { ... } // Yuck! // if ( label1 & label2 ) { ... } // Blech! // // It is somewhat safer to convert to a pointer, at least pointers to different types cannot be readilly compared, and there are no // bitwise operations on pointers, but the conversion from word_t to a pointer can have run-time cost if they are of different size. // operator const bool() const { return ( 0 != word ); } // Shift operators shift bits inside the bit field. Does not make // sense, most of the time, except perhaps to loop over labels and // increment them. SafeBitField operator << ( unsigned int s ) { return SafeBitField( word << s ); } SafeBitField operator >> ( unsigned int s ) { return SafeBitField( word >> s ); } SafeBitField operator <<= ( unsigned int s ) { word <<= s; return *this; } SafeBitField operator >>= ( unsigned int s ) { word >>= s; return *this; } // Word size is also the maximum number of different bit fields for // a given word type. static size_t size( void ) { return ( 8 * sizeof( word_t ) ); } private: /// Private constructor from an integer type. Don't put too much stock into /// explicit declaration, it's better than nothing but does not solve all /// problems with undesired conversions because SafeBitField coverts to bool. explicit SafeBitField( word_t init ) : word( init ) {} /// This stores the bits. word_t word; // Here comes the interesting stuff: all the operators designed to // trap unintended conversions and make them not compile. // Operators below handle code like this: // SafeBitField<1> label1; // SafeBitField<2> label2; // if ( label1 & label2 ) { ... } // These operators are private, and will not instantiate in any // event because of the incomplete Forbidden_conversion struct. template < typename T > SafeBitField operator | ( T ) const { Forbidden_conversion< T > wrong; return *this; } template < typename T > SafeBitField operator & ( T ) const { Forbidden_conversion< T > wrong; return *this; } template < typename T > SafeBitField operator ^ ( T ) const { Forbidden_conversion< T > wrong; return *this; } template < typename T > SafeBitField operator |= ( T ) const { Forbidden_conversion< T > wrong; return *this; } template < typename T > SafeBitField operator &= ( T ) const { Forbidden_conversion< T > wrong; return *this; } template < typename T > SafeBitField operator ^= ( T ) const { Forbidden_conversion< T > wrong; return *this; } // And the same thing for comparisons: // if ( label1 == label2 ) { ... } template < typename T > bool operator == ( const T ) const { Forbidden_conversion< T > wrong; return true; } template < typename T > bool operator != ( const T ) const { Forbidden_conversion< T > wrong; return true; } template < typename T > bool operator < ( const T ) const { Forbidden_conversion< T > wrong; return true; } template < typename T > bool operator > ( const T ) const { Forbidden_conversion< T > wrong; return true; } template < typename T > bool operator <= ( const T ) const { Forbidden_conversion< T > wrong; return true; } template < typename T > bool operator >= ( const T ) const { Forbidden_conversion< T > wrong; return true; } }; // The above template member operators catch errors when the first // argument to a binary operator is a label, but they don't work when // the first argument is an integer and the second one is a label: the // label converts to bool and the operator is performed on two integers. // These operators catch errors like this: // SafeBitField<1> label1; // SafeBitField<2> label2; // if ( !label1 & label2 ) { ... } // where the first label is converted to bool (these errors cannot be // caught by member operators of SafeBitField class because the first // argument is not SafeBitField but bool. // // If used, these operators will not instantiate because of the // incomplete Forbidden_conversion struct. template < unsigned int unique_index, typename word_t > inline SafeBitField< unique_index, word_t > operator & ( bool, SafeBitField< unique_index, word_t > rhs ) { Forbidden_conversion<word_t> wrong; return rhs; } template < unsigned int unique_index, typename word_t > inline SafeBitField< unique_index, word_t > operator | ( bool, SafeBitField< unique_index, word_t > rhs ) { Forbidden_conversion< word_t > wrong; return rhs; } template < unsigned int unique_index, typename word_t > inline SafeBitField< unique_index, word_t > operator ^ ( bool, SafeBitField< unique_index, word_t > rhs ) { Forbidden_conversion< word_t > wrong; return rhs; } template < unsigned int unique_index, typename word_t > inline SafeBitField< unique_index, word_t > operator == ( bool, SafeBitField< unique_index, word_t > rhs ) { Forbidden_conversion< word_t > wrong; return rhs; } template < unsigned int unique_index, typename word_t > inline SafeBitField< unique_index, word_t > operator != ( bool, SafeBitField< unique_index, word_t > rhs ) { Forbidden_conversion< word_t > wrong; return rhs; } // Finally, few macros. All macros are conditionally defined to use the SafeBitField classes if LOKI_SAFE_BIT_FIELD is defined. Otherwise, // the macros fall back on the use of typedefs and integer constants. This provides no addititonal safety but allows the code to support the // mixture of compilers which are broken to different degrees. #define LOKI_SAFE_BIT_FIELD // The first macro helps to declare new bit field types: // LOKI_BIT_FIELD( ulong ) field_t; // This creates a typedef field_t for SafeBitField<unique_index, ulong> where index is the current line number. Since line numbers __LINE__ are counted // separately for all header files, this ends up being the same type in all files using the header which defines field_t. #ifdef LOKI_SAFE_BIT_FIELD #define LOKI_BIT_FIELD( word_t ) typedef SafeBitField<__LINE__, word_t> #else #define LOKI_BIT_FIELD( word_t ) typedef word_t #endif // LOKI_SAFE_BIT_FIELD // The second macro helps to declare static bit constants: // LOKI_BIT_CONST( field_t, Label_1, 1 ); // creates new bit field object named Label_1 of type field_t which represents the field with the 1st (junior) bit set. #ifdef LOKI_SAFE_BIT_FIELD #ifndef LOKI_BIT_FIELD_NONTEMPLATE_INIT #define LOKI_BIT_CONST( field_t, label, bit_index ) \ static const field_t::const_t label = field_t::const_t::make_bit_const<bit_index>() #else #define LOKI_BIT_CONST( field_t, label, bit_index ) \ static const field_t::const_t label = field_t::const_t::make_bit_const( bit_index ) #endif // LOKI_BIT_FIELD_NONTEMPLATE_INIT #else inline size_t make_bit_const( size_t i ) { return ( i > 0 ) ? ( size_t(1) << ( ( i > 0 ) ? ( i - 1 ) : 0 ) ) : 0; } #define LOKI_BIT_CONST( field_t, label, bit_index ) static const field_t label = make_bit_const( bit_index ) #endif // LOKI_SAFE_BIT_FIELD // The third macro helps to declare complex bit constants which are combination of several bits: // LOKI_BIT_CONSTS( field_t, Label12 ) = Label_1 | Label_2; #ifdef LOKI_SAFE_BIT_FIELD #define LOKI_BIT_CONSTS( field_t, label ) static const field_t::const_t label #else #define LOKI_BIT_CONSTS( field_t, label ) static const field_t label #endif // LOKI_SAFE_BIT_FIELD // The fourth macro helps to declare the maximum number of bit constants for a given type: // static const size_t count = LOKI_BIT_FIELD_COUNT( field_t ); // declared a variable "count" initialized to field_t::size() #ifdef LOKI_SAFE_BIT_FIELD #define LOKI_BIT_FIELD_COUNT( field_t ) field_t::size() #else #define LOKI_BIT_FIELD_COUNT( field_t ) ( 8 * sizeof(field_t) ) #endif // LOKI_SAFE_BIT_FIELD } // namespace Loki #endif // LOKI_INCLUDED_SAFE_BIT_FIELDS_H
{ "pile_set_name": "Github" }
#version 120 uniform float top; uniform float bottom; uniform float left; uniform float right; uniform float mask; uniform float edge_gamma; uniform vec3 color; uniform sampler2D input_tex; uniform float input_opacity; uniform bool gray_output; /// Color Correction parameters uniform vec4 cc_gamma; uniform vec4 cc_brightness; uniform vec4 cc_contrast; uniform vec4 cc_multiplier; #include ":/shaders/colorcorrection.h" #include ":/shaders/grayscale.h" float edgeblend_border(in vec2 coord) { float edgeValue = 1.0; if (coord.x <= left) { edgeValue *= min(coord.x / left, 1.0); } else if (coord.x >= 1.0 - right) { edgeValue *= min((1.0 - coord.x) / right, 1.0); } if (1.0 - coord.y <= top) { edgeValue *= min((1.0 - coord.y) / top, 1.0); } if (coord.y <= bottom) { edgeValue *= min(coord.y / bottom, 1.0); } return 1.0 - pow(clamp(edgeValue,0.0,1.0),edge_gamma); } vec4 edgeblend_color(in float value) { float v = clamp(value,0.0,1.0); float mv = 1.0 - v * mask; return vec4(mv,mv,mv,1.0); } void main() { cc_red = ChannelCorrection(cc_gamma.r, cc_brightness.r, cc_contrast.r, cc_multiplier.r); cc_green = ChannelCorrection(cc_gamma.g, cc_brightness.g, cc_contrast.g, cc_multiplier.g); cc_blue = ChannelCorrection(cc_gamma.b, cc_brightness.b, cc_contrast.b, cc_multiplier.b); cc_all = ChannelCorrection(cc_gamma.a, cc_brightness.a, cc_contrast.a, cc_multiplier.a); vec2 texCoords = gl_TexCoord[0].st; vec3 output_color = mix( color, color_correction(texture2D(input_tex,texCoords).rgb), input_opacity); if (gray_output) { output_color = grayscale(output_color); } gl_FragColor = vec4(output_color,1.0)*edgeblend_color(edgeblend_border(texCoords)); }
{ "pile_set_name": "Github" }
### Parser Training Instructions First, we need to pre-generate some templated data to train the model on. 500K examples should be a good start: ``` $ cd ~/minecraft/python/craftassist/ttad/generation_dialogues $ python generate_dialogue.py -n 500000 > ../data/ttad_model/generated_dialogues.txt ``` This generates a text file. We next pre-process the data into the json format required by the training script ``` $ cd ../ttad_model/ $ python make_dataset.py ../data/ttad_model/generated_dialogues.txt ../data/ttad_model/dialogue_test_data.json ``` Now we run a script to build the grammar automatically from the generated examples: ``` $ python make_action_grammar.py ../data/ttad_model/dialogue_test_data.json ../data/ttad_model/dialogue_test_grammar.json ``` We are now ready to train the model with: ``` $ python train_model.py -cuda -rp 0 -rsm none -rst templated -df ../data/ttad_model/dialogue_test_data.json -atf ../data/ttad_model/dialogue_test_grammar.json -mn ../data/ttad_model/models/dialogue_test_model ``` The -rp, -rsm and -rst options are required to train on only templated data, but feel free to experiment with the model parameters. Once you're done, choose which epoch you want the parameters for, e.g. if 58 had the best validation accuracy: ``` $ cp ../data/ttad_model/models/dialogue_test_model_58.pth ../data/ttad_model/models/dialogue_test_model.pth ``` You can now use that model. In a Python terminal from the ttad_models directory, run: ``` from pprint import pprint from ttad_model_wrapper import * from random import choice ttad = ActionDictBuilder('../data/ttad_model/models/dialogue_test_model', action_tree_path='../data/ttad_model/dialogue_test_grammar.json') data = json.load(open('../data/ttad_model/dialogue_test_data.json')) exple = choice(data['test']['templated']) pprint((exple, ttad.parse(exple[0]))) ```
{ "pile_set_name": "Github" }
.float-menu-cover { position: fixed; right: 0; bottom: 200rpx; display: flex; align-items: center; padding: 16rpx; background:rgba(0,0,0,0.7); border-radius: 16rpx 0 0 16rpx; z-index: 999; } .float-menu-cover-open { right: 440rpx; } .float-menu-cover .arrows { width: 34rpx; height: 34rpx; } .float-menu-cover .r { color: #fff; display: flex; flex-direction: column; font-size: 10pt; margin-left: 16rpx; } .float-menu-items { width: 440rpx; background: #fff; position: fixed; right: 0; bottom: 180rpx; border-radius: 16rpx 0 0 16rpx; display: flex; flex-wrap: wrap; padding-bottom: 32rpx; z-index: 999; } .float-menu-items .item { display: flex; flex-direction: column; align-items: center; margin-left: 32rpx; margin-right: 16rpx; margin-top: 32rpx; } .float-menu-items .item image { width: 43rpx; height: 43rpx; } .float-menu-items .item text { margin-top: 8rpx; color: #333; font-size: 10pt; }
{ "pile_set_name": "Github" }
//===--- UnusedAliasDeclsCheck.h - clang-tidy--------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSED_ALIAS_DECLS_H #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSED_ALIAS_DECLS_H #include "../ClangTidyCheck.h" #include "llvm/ADT/DenseMap.h" namespace clang { namespace tidy { namespace misc { /// Finds unused namespace alias declarations. class UnusedAliasDeclsCheck : public ClangTidyCheck { public: UnusedAliasDeclsCheck(StringRef Name, ClangTidyContext *Context) : ClangTidyCheck(Name, Context) {} bool isLanguageVersionSupported(const LangOptions &LangOpts) const override { return LangOpts.CPlusPlus11; } void registerMatchers(ast_matchers::MatchFinder *Finder) override; void check(const ast_matchers::MatchFinder::MatchResult &Result) override; void onEndOfTranslationUnit() override; private: llvm::DenseMap<const NamedDecl *, CharSourceRange> FoundDecls; }; } // namespace misc } // namespace tidy } // namespace clang #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSED_ALIAS_DECLS_H
{ "pile_set_name": "Github" }
// // PictureCollection.h // PicDownloader // // Created by Rob Napier on 8/23/13. // Copyright (c) 2013 Rob Napier. All rights reserved. // #import <Foundation/Foundation.h> @class Picture; @interface PictureCollection : NSObject @property (nonatomic, readonly) NSUInteger count; - (instancetype)initWithURL:(NSURL *)URL; - (Picture *)pictureAtIndex:(NSUInteger)index; - (void)reset; @end
{ "pile_set_name": "Github" }
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ har hämtats och är klar att använda! Vill du installera det och starta om %1$@ nu?"; "%1$@ can't be updated, because it was opened from a read-only or a temporary location. Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again." = "%1$@ kan inte uppdateras när det körs från en skrivskyddad volym som en skivavbild eller en optisk enhet. Flytta %1$@ till mappen Program, starta om det därifrån, och försök igen."; "%@ %@ is currently the newest version available." = "%1$@ %2$@ är för närvarande den senaste tillgängliga versionen."; /* Description text for SUUpdateAlert when the update is downloadable. */ "%@ %@ is now available--you have %@. Would you like to download it now?" = "%1$@ %2$@ finns nu tillgänglig—du har %3$@. Vill hämta uppdateringen nu?"; /* Description text for SUUpdateAlert when the update informational with no download. */ "%@ %@ is now available--you have %@. Would you like to learn more about this update on the web?" = "%1$@ %2$@ is now available--you have %3$@. Would you like to learn more about this update on the web?"; "%@ downloaded" = "%@ hämtat"; "%@ of %@" = "%1$@ av %2$@"; "A new version of %@ is available!" = "En ny version av %@ finns tillgänglig!"; "A new version of %@ is ready to install!" = "En ny version av %@ är redo att installeras!"; "An error occurred in retrieving update information. Please try again later." = "Ett fel uppstod vid hämtning av information om uppdateringar. Försök igen senare."; "An error occurred while downloading the update. Please try again later." = "Ett fel uppstod vid hämtning av uppdateringen. Försök igen senare."; "An error occurred while extracting the archive. Please try again later." = "Ett fel uppstod vid extrahering av arkivet. Försök igen senare."; "An error occurred while installing the update. Please try again later." = "Ett fel uppstod vid installationen av uppdateringen. Försök igen senare."; "An error occurred while parsing the update feed." = "Ett fel uppstod vid tolkning av uppdateringslänken."; "An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@." = "Ett fel uppstod när %1$@ skulle startas om, men den nya versionen kommer att finnas tillgänglig nästa gång du kör %1$@."; /* the unit for bytes */ "B" = "B"; "Cancel" = "Avbryt"; "Cancel Update" = "Avbryt uppdatering"; "Checking for updates..." = "Letar efter uppdateringar…"; /* Take care not to overflow the status window. */ "Downloading update..." = "Hämtar uppdatering…"; /* Take care not to overflow the status window. */ "Extracting update..." = "Extraherar uppdatering…"; /* the unit for gigabytes */ "GB" = "GB"; "Install and Relaunch" = "Installera och starta om"; /* Take care not to overflow the status window. */ "Installing update..." = "Installerar uppdatering…"; /* the unit for kilobytes */ "KB" = "KB"; /* the unit for megabytes */ "MB" = "MB"; "OK" = "OK"; "Ready to Install" = "Redo att installera"; "Should %1$@ automatically check for updates? You can always check for updates manually from the %1$@ menu." = "Ska %1$@ leta efter uppdateringar automatiskt? Du kan alltid leta efter uppdateringar manuellt från %1$@-menyn."; "Update Error!" = "Uppdateringsfel!"; "Updating %@" = "Uppdaterar %@"; "You already have the newest version of %@." = "Du har redan den senaste versionen av %@."; "You're up-to-date!" = "Du är uppdaterad!"; /* Alternative name for "Install" button if we have a paid update or other update without a download but with a URL. */ "Learn More..." = "Mer info…";
{ "pile_set_name": "Github" }
/*==LICENSE==* CyanWorlds.com Engine - MMOG client, server and tools Copyright (C) 2011 Cyan Worlds, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. Additional permissions under GNU GPL version 3 section 7 If you modify this Program, or any covered work, by linking or combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK (or a modified version of those libraries), containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the licensors of this Program grant you additional permission to convey the resulting work. Corresponding Source for a non-source form of such a combination shall include the source code for the parts of OpenSSL and IJG JPEG Library used as well as that of the covered work. You can contact Cyan Worlds, Inc. by email legal@cyan.com or by snail mail at: Cyan Worlds, Inc. 14617 N Newport Hwy Mead, WA 99021 *==LICENSE==*/ #include <Python.h> #pragma hdrstop #include "pyVaultSDLNode.h" #include "pySDL.h" #include "plVault/plVault.h" // glue functions PYTHON_CLASS_DEFINITION(ptVaultSDLNode, pyVaultSDLNode); PYTHON_DEFAULT_NEW_DEFINITION(ptVaultSDLNode, pyVaultSDLNode) PYTHON_DEFAULT_DEALLOC_DEFINITION(ptVaultSDLNode) PYTHON_INIT_DEFINITION(ptVaultSDLNode, args, keywords) { PYTHON_RETURN_INIT_OK; } PYTHON_METHOD_DEFINITION_NOARGS(ptVaultSDLNode, getIdent) { return PyLong_FromLong(self->fThis->GetIdent()); } PYTHON_METHOD_DEFINITION(ptVaultSDLNode, setIdent, args) { int v; if (!PyArg_ParseTuple(args, "i", &v)) { PyErr_SetString(PyExc_TypeError, "setIdent expects an integer"); PYTHON_RETURN_ERROR; } self->fThis->SetIdent(v); PYTHON_RETURN_NONE; } PYTHON_METHOD_DEFINITION(ptVaultSDLNode, initStateDataRecord, args) { char* fileName; int flags; if (!PyArg_ParseTuple(args, "si", &fileName, &flags)) { PyErr_SetString(PyExc_TypeError, "initStateDataRecord expects a string and an int"); PYTHON_RETURN_ERROR; } self->fThis->InitStateDataRecord(fileName, flags); PYTHON_RETURN_NONE; } PYTHON_METHOD_DEFINITION_NOARGS(ptVaultSDLNode, getStateDataRecord) { return self->fThis->GetStateDataRecord(); } PYTHON_METHOD_DEFINITION(ptVaultSDLNode, setStateDataRecord, args) { PyObject* recObj = NULL; int writeOptions = 0; if (!PyArg_ParseTuple(args, "O|i", &recObj, &writeOptions)) { PyErr_SetString(PyExc_TypeError, "setStateDataRecord expects a ptSDLStateDataRecord and an optional int"); PYTHON_RETURN_ERROR; } if (!pySDLStateDataRecord::Check(recObj)) { PyErr_SetString(PyExc_TypeError, "setStateDataRecord expects a ptSDLStateDataRecord and an optional int"); PYTHON_RETURN_ERROR; } pySDLStateDataRecord* rec = pySDLStateDataRecord::ConvertFrom(recObj); self->fThis->SetStateDataRecord(*rec, writeOptions); PYTHON_RETURN_NONE; } PYTHON_START_METHODS_TABLE(ptVaultSDLNode) PYTHON_METHOD_NOARGS(ptVaultSDLNode, getIdent, "UNKNOWN"), PYTHON_METHOD(ptVaultSDLNode, setIdent, "Params: v\nUNKNOWN"), PYTHON_METHOD(ptVaultSDLNode, initStateDataRecord, "Params: filename,flags\nRead the SDL Rec from File if needed"), PYTHON_METHOD_NOARGS(ptVaultSDLNode, getStateDataRecord, "Returns the ptSDLStateDataRecord associated with this node"), PYTHON_METHOD(ptVaultSDLNode, setStateDataRecord, "Params: rec,writeOptions=0\nSets the ptSDLStateDataRecord"), PYTHON_END_METHODS_TABLE; // Type structure definition PLASMA_DEFAULT_TYPE_WBASE(ptVaultSDLNode, pyVaultNode, "Plasma vault SDL node"); // required functions for PyObject interoperability PYTHON_CLASS_NEW_IMPL(ptVaultSDLNode, pyVaultSDLNode) PyObject *pyVaultSDLNode::New(RelVaultNode* nfsNode) { ptVaultSDLNode *newObj = (ptVaultSDLNode*)ptVaultSDLNode_type.tp_new(&ptVaultSDLNode_type, NULL, NULL); newObj->fThis->fNode = nfsNode; return (PyObject*)newObj; } PYTHON_CLASS_CHECK_IMPL(ptVaultSDLNode, pyVaultSDLNode) PYTHON_CLASS_CONVERT_FROM_IMPL(ptVaultSDLNode, pyVaultSDLNode) /////////////////////////////////////////////////////////////////////////// // // AddPlasmaClasses - the python module definitions // void pyVaultSDLNode::AddPlasmaClasses(PyObject *m) { PYTHON_CLASS_IMPORT_START(m); PYTHON_CLASS_IMPORT(m, ptVaultSDLNode); PYTHON_CLASS_IMPORT_END(m); }
{ "pile_set_name": "Github" }
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/ce/model/GetReservationUtilizationRequest.h> #include <aws/core/utils/json/JsonSerializer.h> #include <utility> using namespace Aws::CostExplorer::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; GetReservationUtilizationRequest::GetReservationUtilizationRequest() : m_timePeriodHasBeenSet(false), m_groupByHasBeenSet(false), m_granularity(Granularity::NOT_SET), m_granularityHasBeenSet(false), m_filterHasBeenSet(false), m_nextPageTokenHasBeenSet(false) { } Aws::String GetReservationUtilizationRequest::SerializePayload() const { JsonValue payload; if(m_timePeriodHasBeenSet) { payload.WithObject("TimePeriod", m_timePeriod.Jsonize()); } if(m_groupByHasBeenSet) { Array<JsonValue> groupByJsonList(m_groupBy.size()); for(unsigned groupByIndex = 0; groupByIndex < groupByJsonList.GetLength(); ++groupByIndex) { groupByJsonList[groupByIndex].AsObject(m_groupBy[groupByIndex].Jsonize()); } payload.WithArray("GroupBy", std::move(groupByJsonList)); } if(m_granularityHasBeenSet) { payload.WithString("Granularity", GranularityMapper::GetNameForGranularity(m_granularity)); } if(m_filterHasBeenSet) { payload.WithObject("Filter", m_filter.Jsonize()); } if(m_nextPageTokenHasBeenSet) { payload.WithString("NextPageToken", m_nextPageToken); } return payload.View().WriteReadable(); } Aws::Http::HeaderValueCollection GetReservationUtilizationRequest::GetRequestSpecificHeaders() const { Aws::Http::HeaderValueCollection headers; headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "AWSInsightsIndexService.GetReservationUtilization")); return headers; }
{ "pile_set_name": "Github" }
eclipse.preferences.version=1 org.eclipse.jdt.core.codeComplete.argumentPrefixes= org.eclipse.jdt.core.codeComplete.argumentSuffixes= org.eclipse.jdt.core.codeComplete.fieldPrefixes= org.eclipse.jdt.core.codeComplete.fieldSuffixes= org.eclipse.jdt.core.codeComplete.localPrefixes= org.eclipse.jdt.core.codeComplete.localSuffixes= org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=0 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.format_block_comments=true org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=false org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true org.eclipse.jdt.core.formatter.comment.format_line_comments=false org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert org.eclipse.jdt.core.formatter.comment.line_length=180 org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=4 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=8 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.join_lines_in_comments=false org.eclipse.jdt.core.formatter.join_wrapped_lines=false org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.lineSplit=180 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false org.eclipse.jdt.core.formatter.tabulation.char=space org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
{ "pile_set_name": "Github" }
var constant = require('./constant'), defineProperty = require('./_defineProperty'), identity = require('./identity'); /** * The base implementation of `setToString` without support for hot loop shorting. * * @private * @param {Function} func The function to modify. * @param {Function} string The `toString` result. * @returns {Function} Returns `func`. */ var baseSetToString = !defineProperty ? identity : function(func, string) { return defineProperty(func, 'toString', { 'configurable': true, 'enumerable': false, 'value': constant(string), 'writable': true }); }; module.exports = baseSetToString;
{ "pile_set_name": "Github" }
/* * This message is auto generated by ROS#. Please DO NOT modify. * Note: * - Comments from the original code will be written in their own line * - Variable sized arrays will be initialized to array of size 0 * Please report any issues at * <https://github.com/siemens/ros-sharp> */ namespace RosSharp.RosBridgeClient.MessageTypes.Std { public class Int16 : Message { public const string RosMessageName = "std_msgs/Int16"; public short data { get; set; } public Int16() { this.data = 0; } public Int16(short data) { this.data = data; } } }
{ "pile_set_name": "Github" }
/* Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ CKEDITOR.plugins.setLang( 'liststyle', 'el', { bulletedTitle: 'Ιδιότητες Λίστας Σημείων', circle: 'Κύκλος', decimal: 'Δεκαδική (1, 2, 3, κτλ)', disc: 'Δίσκος', lowerAlpha: 'Μικρά Λατινικά (a, b, c, d, e, κτλ.)', lowerRoman: 'Μικρά Ρωμαϊκά (i, ii, iii, iv, v, κτλ)', none: 'Καμία', notset: '<δεν έχει οριστεί>', numberedTitle: 'Ιδιότητες Αριθμημένης Λίστας ', square: 'Τετράγωνο', start: 'Εκκίνηση', type: 'Τύπος', upperAlpha: 'Κεφαλαία Λατινικά (A, B, C, D, E, κτλ)', upperRoman: 'Κεφαλαία Ρωμαϊκά (I, II, III, IV, V, κτλ)', validateStartNumber: 'Ο αριθμός εκκίνησης της αρίθμησης πρέπει να είναι ακέραιος αριθμός.' } );
{ "pile_set_name": "Github" }
/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is STEnum. * * The Initial Developer of the Original Code is * James Tuley. * Portions created by the Initial Developer are Copyright (C) 2004-2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): * James Tuley <jbtule@mac.com> (Original Author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ // // NSArray-STEnumAdditions.m // STEnum // // Created by James Tuley on Tue Jun 15 2004. // Copyright (c) 2004 James Tuley. All rights reserved. // #import "NSArray-STEnumAdditions.h" @implementation NSArray (STNonSharedCollectionAdditions) +(id)arrayWithNumbersForRange:(NSRange)aRange{ return [[[self alloc] initWithNumbersForRange:aRange] autorelease]; } +(id)arrayWithNumbersForRange:(NSRange)aRange overInterval:(double)anInterval{ return [[[self alloc] initWithNumbersForRange:aRange overInterval:anInterval] autorelease]; } -(id)initWithNumbersForRange:(NSRange)aRange{ return [self initWithNumbersForRange:aRange overInterval:1.0]; } -(id)initWithNumbersForRange:(NSRange)aRange overInterval:(double)anInterval{ double i; NSMutableArray* tempArray = [NSMutableArray array]; for(i = aRange.location; i < aRange.location+aRange.length; i=i+anInterval) [tempArray addObject:[NSNumber numberWithDouble:i]]; return [self initWithArray:tempArray]; } -(id)firstObject{ if([self count] > 0) return [self objectAtIndex:0]; else return nil; } -(id)secondObject{ if([self count] > 1) return [self objectAtIndex:1]; else return nil; } @end @interface NSArray(STPrivateAdditions) -(id)_STEmptyMutableCollection; -(id)_STObjectForObject:(id)anObject; -(void)_STAdd:(id)anObject toCollection:(id)aCollection originalObject:anOriginalObject; -(id)_STReturnMeFromCollection:(id)aCollection; -(NSEnumerator*)_STEnumerator; @end @implementation NSArray(STPrivateAdditions) -(NSEnumerator*)_STEnumerator{ return [self objectEnumerator]; } -(id)_STEmptyMutableCollection{ return [NSMutableArray arrayWithCapacity:[self count]]; } -(id)_STObjectForObject:(id)anObject{ return anObject; } -(void)_STAdd:(id)anObject toCollection:(id)aCollection originalObject:anOriginalObject{ [aCollection addObject:anObject]; } -(id)_STReturnMeFromCollection:(id)aCollection{ return [[self classForCoder] arrayWithArray: aCollection]; } @end @implementation NSArray(STSharedCollectionAdditions) #include "STSharedEnum.m" @end
{ "pile_set_name": "Github" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head> <title>CURLOPT_CAINFO man page</title> <meta name="generator" content="roffit"> <STYLE type="text/css"> pre { overflow: auto; margin: 0; } P.level0, pre.level0 { padding-left: 2em; } P.level1, pre.level1 { padding-left: 4em; } P.level2, pre.level2 { padding-left: 6em; } span.emphasis { font-style: italic; } span.bold { font-weight: bold; } span.manpage { font-weight: bold; } h2.nroffsh { background-color: #e0e0e0; } span.nroffip { font-weight: bold; font-size: 120%; font-family: monospace; } p.roffit { text-align: center; font-size: 80%; } </STYLE> </head><body> <p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> <p class="level0">CURLOPT_CAINFO - path to Certificate Authority (CA) bundle <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> <p class="level0">&#35;include &lt;curl/curl.h&gt; <p class="level0">CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CAINFO, char *path); <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> <p class="level0">Pass a char * to a zero terminated string naming a file holding one or more certificates to verify the peer with. <p class="level0">If <a Class="emphasis" href="./CURLOPT_SSL_VERIFYPEER.html">CURLOPT_SSL_VERIFYPEER</a> is zero and you avoid verifying the server's certificate, <a Class="emphasis" href="./CURLOPT_CAINFO.html">CURLOPT_CAINFO</a> need not even indicate an accessible file. <p class="level0">This option is by default set to the system path where libcurl's cacert bundle is assumed to be stored, as established at build time. <p class="level0">If curl is built against the NSS SSL library, the NSS PEM PKCS&#35;11 module (libnsspem.so) needs to be available for this option to work properly. <a name="DEFAULT"></a><h2 class="nroffsh">DEFAULT</h2> <p class="level0">Built-in system specific <a name="PROTOCOLS"></a><h2 class="nroffsh">PROTOCOLS</h2> <p class="level0">All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. <a name="EXAMPLE"></a><h2 class="nroffsh">EXAMPLE</h2> <p class="level0">TODO <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2> <p class="level0">For SSL engines that don't support certificate files the CURLOPT_CAINFO option is ignored. Refer to <a href="https://curl.haxx.se/docs/ssl-compared.html">https://curl.haxx.se/docs/ssl-compared.html</a> <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> <p class="level0">Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> <p class="level0"><a Class="manpage" href="./CURLOPT_CAPATH.html">CURLOPT_CAPATH</a>, <a Class="manpage" href="./CURLOPT_SSL_VERIFYPEER.html">CURLOPT_SSL_VERIFYPEER</a>, <a Class="manpage" href="./CURLOPT_SSL_VERIFYHOST.html">CURLOPT_SSL_VERIFYHOST</a><p class="roffit"> This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. </body></html>
{ "pile_set_name": "Github" }
# Grammar Stmt <- SPACE Expr EOL { printf("%d\n", pop()); } / (!EOL .)* EOL { printf("error\n"); } Expr <- ID { var= yytext[0] } ASSIGN Sum { vars[var - 'a']= top(); } / Sum Sum <- Product ( PLUS Product { int r= pop(), l= pop(); push(l + r); } / MINUS Product { int r= pop(), l= pop(); push(l - r); } )* Product <- Value ( TIMES Value { int r= pop(), l= pop(); push(l * r); } / DIVIDE Value { int r= pop(), l= pop(); push(l / r); } )* Value <- NUMBER { push(atoi(yytext)); } / < ID > !ASSIGN { push(vars[yytext[0] - 'a']); } / OPEN Expr CLOSE # Lexemes NUMBER <- < [0-9]+ > SPACE ID <- < [a-z] > SPACE ASSIGN <- '=' SPACE PLUS <- '+' SPACE MINUS <- '-' SPACE TIMES <- '*' SPACE DIVIDE <- '/' SPACE OPEN <- '(' SPACE CLOSE <- ')' SPACE SPACE <- [ \t]* EOL <- '\n' / '\r\n' / '\r' / ';'
{ "pile_set_name": "Github" }
local ClassNLLCriterion, parent = torch.class('nn.ClassNLLCriterion', 'nn.Criterion') function ClassNLLCriterion:__init() parent.__init(self) self.sizeAverage = true end function ClassNLLCriterion:updateOutput(input, target) if input:dim() == 1 then self.output = -input[target] elseif input:dim() == 2 then local output = 0 for i=1,target:size(1) do output = output - input[i][target[i]] end if self.sizeAverage then output = output / target:size(1) end self.output = output else error('matrix or vector expected') end return self.output end function ClassNLLCriterion:updateGradInput(input, target) self.gradInput:resizeAs(input) self.gradInput:zero() if input:dim() == 1 then self.gradInput[target] = -1 else local z = -1 if self.sizeAverage then z = z / target:size(1) end local gradInput = self.gradInput for i=1,target:size(1) do gradInput[i][target[i]] = z end end return self.gradInput end
{ "pile_set_name": "Github" }
/* $NetBSD: fs.h,v 1.1 2003/05/14 00:30:26 dbj Exp $ */ #include "../../../../sys/ufs/ffs/fs.h"
{ "pile_set_name": "Github" }
.card-outer { @include context-menu-button; background: var(--newtab-card-background-color); border-radius: $border-radius; display: inline-block; height: $card-height; margin-inline-end: $base-gutter; position: relative; width: 100%; &.placeholder { background: transparent; .card { box-shadow: inset $inner-box-shadow; } .card-preview-image-outer, .card-context { display: none; } } .card { border-radius: $border-radius; box-shadow: var(--newtab-card-shadow); height: 100%; } > a { color: inherit; display: block; height: 100%; outline: none; position: absolute; width: 100%; &:-moz-any(.active, :focus) { .card { @include fade-in-card; } .card-title { color: var(--newtab-link-primary-color); } } } &:-moz-any(:hover, :focus, .active):not(.placeholder) { @include fade-in-card; @include context-menu-button-hover; outline: none; .card-title { color: var(--newtab-link-primary-color); } .alternate ~ .card-host-name { display: none; } .card-host-name.alternate { display: block; } } .card-preview-image-outer { background-color: $grey-30; border-radius: $border-radius $border-radius 0 0; height: $card-preview-image-height; overflow: hidden; position: relative; [lwt-newtab-brighttext] & { background-color: $grey-60; } &::after { border-bottom: 1px solid var(--newtab-card-hairline-color); bottom: 0; content: ''; position: absolute; width: 100%; } .card-preview-image { background-position: center; background-repeat: no-repeat; background-size: cover; height: 100%; opacity: 0; transition: opacity 1s $photon-easing; width: 100%; &.loaded { opacity: 1; } } } .card-details { padding: 15px 16px 12px; } .card-text { max-height: 4 * $card-text-line-height + $card-title-margin; overflow: hidden; &.no-host-name, &.no-context { max-height: 5 * $card-text-line-height + $card-title-margin; } &.no-host-name.no-context { max-height: 6 * $card-text-line-height + $card-title-margin; } &:not(.no-description) .card-title { max-height: 3 * $card-text-line-height; overflow: hidden; } } .card-host-name { color: var(--newtab-text-secondary-color); font-size: 10px; overflow: hidden; padding-bottom: 4px; text-overflow: ellipsis; text-transform: uppercase; // sass-lint:disable-line no-disallowed-properties white-space: nowrap; } .card-host-name.alternate { display: none; } .card-title { font-size: 14px; font-weight: 600; line-height: $card-text-line-height; margin: 0 0 $card-title-margin; word-wrap: break-word; } .card-description { font-size: 12px; line-height: $card-text-line-height; margin: 0; overflow: hidden; word-wrap: break-word; } .card-context { bottom: 0; color: var(--newtab-text-secondary-color); display: flex; font-size: 11px; inset-inline-start: 0; padding: 9px 16px 9px 14px; position: absolute; } .card-context-icon { fill: var(--newtab-text-secondary-color); height: 22px; margin-inline-end: 6px; } .card-context-label { flex-grow: 1; line-height: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } } .normal-cards { .card-outer { // Wide layout styles @media (min-width: $break-point-widest) { $line-height: 23px; height: $card-height-large; .card-preview-image-outer { height: $card-preview-image-height-large; } .card-details { padding: 13px 16px 12px; } .card-text { max-height: 6 * $line-height + $card-title-margin; } .card-host-name { font-size: 12px; padding-bottom: 5px; } .card-title { font-size: 17px; line-height: $line-height; margin-bottom: 0; } .card-text:not(.no-description) { .card-title { max-height: 3 * $line-height; } } .card-description { font-size: 15px; line-height: $line-height; } .card-context { bottom: 4px; font-size: 14px; } } } } .compact-cards { $card-detail-vertical-spacing: 12px; $card-title-font-size: 12px; .card-outer { height: $card-height-compact; .card-preview-image-outer { height: $card-preview-image-height-compact; } .card-details { padding: $card-detail-vertical-spacing 16px; } .card-host-name { line-height: 10px; } .card-text { .card-title, &:not(.no-description) .card-title { font-size: $card-title-font-size; line-height: $card-title-font-size + 1; max-height: $card-title-font-size + 5; overflow: hidden; padding: 0 0 4px; text-overflow: ellipsis; white-space: nowrap; } } .card-description { display: none; } .card-context { $icon-size: 16px; $container-size: 32px; background-color: var(--newtab-card-background-color); border-radius: $container-size / 2; clip-path: inset(-1px -1px $container-size - ($card-height-compact - $card-preview-image-height-compact - 2 * $card-detail-vertical-spacing)); height: $container-size; width: $container-size; padding: ($container-size - $icon-size) / 2; top: $card-preview-image-height-compact - $icon-size; inset-inline-end: 12px; inset-inline-start: auto; &::after { border: 1px solid var(--newtab-card-hairline-color); border-bottom: 0; border-radius: ($container-size / 2) + 1 ($container-size / 2) + 1 0 0; content: ''; position: absolute; height: ($container-size + 2) / 2; width: $container-size + 2; top: -1px; left: -1px; } .card-context-icon { margin-inline-end: 0; height: $icon-size; width: $icon-size; &.icon-bookmark-added { fill: $bookmark-icon-fill; } &.icon-download { fill: $download-icon-fill; } &.icon-pocket { fill: $pocket-icon-fill; } } .card-context-label { display: none; } } } @media not all and (min-width: $break-point-widest) { .hide-for-narrow { display: none; } } }
{ "pile_set_name": "Github" }
// ============================================================================= // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab // Copyright (C) 2010 - DIGITEO - Vincent COUVERT <vincent.couvert@scilab.org> // // This file is distributed under the same license as the Scilab package. // ============================================================================= // <-- CLI SHELL MODE --> // <-- ENGLISH IMPOSED --> // <-- LONG TIME EXECUTION --> // Unitary test for conversion of Matlab function: ASECH exec("SCI/modules/m2sci/tests/unit_tests/utils/m2sciTestConversion.sci", -1); if ~m2sciTestConversion("ASECH") then pause;end
{ "pile_set_name": "Github" }
<?php require_once __DIR__.'/../Base.php'; use Kanboard\ExternalLink\WebLinkProvider; class WebLinkProviderTest extends Base { public function testGetName() { $webLinkProvider = new WebLinkProvider($this->container); $this->assertEquals('Web Link', $webLinkProvider->getName()); } public function testGetType() { $webLinkProvider = new WebLinkProvider($this->container); $this->assertEquals('weblink', $webLinkProvider->getType()); } public function testGetDependencies() { $webLinkProvider = new WebLinkProvider($this->container); $this->assertEquals(array('related' => 'Related'), $webLinkProvider->getDependencies()); } public function testMatch() { $webLinkProvider = new WebLinkProvider($this->container); $webLinkProvider->setUserTextInput('https://kanboard.org/'); $this->assertTrue($webLinkProvider->match()); $webLinkProvider->setUserTextInput('https://kanboard.org/mypage'); $this->assertTrue($webLinkProvider->match()); $webLinkProvider->setUserTextInput(' https://kanboard.org/ '); $this->assertTrue($webLinkProvider->match()); $webLinkProvider->setUserTextInput('http:// invalid url'); $this->assertFalse($webLinkProvider->match()); $webLinkProvider->setUserTextInput(''); $this->assertFalse($webLinkProvider->match()); } public function testGetLink() { $webLinkProvider = new WebLinkProvider($this->container); $this->assertInstanceOf('\Kanboard\ExternalLink\WebLink', $webLinkProvider->getLink()); } }
{ "pile_set_name": "Github" }
//===--- utils/unittest/UnitTestMain/TestMain.cpp - unittest driver -------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "llvm/Support/CommandLine.h" #include "llvm/Support/Signals.h" #include "gmock/gmock.h" #include "gtest/gtest.h" #if defined(_WIN32) # include <windows.h> # if defined(_MSC_VER) # include <crtdbg.h> # endif #endif const char *TestMainArgv0; int main(int argc, char **argv) { llvm::sys::PrintStackTraceOnErrorSignal(argv[0], true /* Disable crash reporting */); // Initialize both gmock and gtest. testing::InitGoogleMock(&argc, argv); llvm::cl::ParseCommandLineOptions(argc, argv); // Make it easy for a test to re-execute itself by saving argv[0]. TestMainArgv0 = argv[0]; # if defined(_WIN32) // Disable all of the possible ways Windows conspires to make automated // testing impossible. ::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX); # if defined(_MSC_VER) ::_set_error_mode(_OUT_TO_STDERR); _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); # endif # endif return RUN_ALL_TESTS(); }
{ "pile_set_name": "Github" }
/* Copyright 2014 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package rest import ( "crypto/tls" "net/http" "k8s.io/client-go/plugin/pkg/client/auth/exec" "k8s.io/client-go/transport" ) // TLSConfigFor returns a tls.Config that will provide the transport level security defined // by the provided Config. Will return nil if no transport level security is requested. func TLSConfigFor(config *Config) (*tls.Config, error) { cfg, err := config.TransportConfig() if err != nil { return nil, err } return transport.TLSConfigFor(cfg) } // TransportFor returns an http.RoundTripper that will provide the authentication // or transport level security defined by the provided Config. Will return the // default http.DefaultTransport if no special case behavior is needed. func TransportFor(config *Config) (http.RoundTripper, error) { cfg, err := config.TransportConfig() if err != nil { return nil, err } return transport.New(cfg) } // HTTPWrappersForConfig wraps a round tripper with any relevant layered behavior from the // config. Exposed to allow more clients that need HTTP-like behavior but then must hijack // the underlying connection (like WebSocket or HTTP2 clients). Pure HTTP clients should use // the higher level TransportFor or RESTClientFor methods. func HTTPWrappersForConfig(config *Config, rt http.RoundTripper) (http.RoundTripper, error) { cfg, err := config.TransportConfig() if err != nil { return nil, err } return transport.HTTPWrappersForConfig(cfg, rt) } // TransportConfig converts a client config to an appropriate transport config. func (c *Config) TransportConfig() (*transport.Config, error) { wt := c.WrapTransport if c.ExecProvider != nil { provider, err := exec.GetAuthenticator(c.ExecProvider) if err != nil { return nil, err } if wt != nil { previousWT := wt wt = func(rt http.RoundTripper) http.RoundTripper { return provider.WrapTransport(previousWT(rt)) } } else { wt = provider.WrapTransport } } if c.AuthProvider != nil { provider, err := GetAuthProvider(c.Host, c.AuthProvider, c.AuthConfigPersister) if err != nil { return nil, err } if wt != nil { previousWT := wt wt = func(rt http.RoundTripper) http.RoundTripper { return provider.WrapTransport(previousWT(rt)) } } else { wt = provider.WrapTransport } } return &transport.Config{ UserAgent: c.UserAgent, Transport: c.Transport, WrapTransport: wt, TLS: transport.TLSConfig{ Insecure: c.Insecure, ServerName: c.ServerName, CAFile: c.CAFile, CAData: c.CAData, CertFile: c.CertFile, CertData: c.CertData, KeyFile: c.KeyFile, KeyData: c.KeyData, }, Username: c.Username, Password: c.Password, BearerToken: c.BearerToken, Impersonate: transport.ImpersonationConfig{ UserName: c.Impersonate.UserName, Groups: c.Impersonate.Groups, Extra: c.Impersonate.Extra, }, Dial: c.Dial, }, nil }
{ "pile_set_name": "Github" }
# frozen_string_literal: true describe ::AwsPublicIps::Checks::Redshift do it 'should return redshift ips for classic public clusters' do stub_request(:post, 'https://redshift.us-east-1.amazonaws.com') .to_return(body: ::IO.read('spec/fixtures/redshift-classic-public.xml')) expect(subject.run).to eq([ { id: 'classic', hostname: 'classic.csorkyt5dk7h.us-east-1.redshift.amazonaws.com', ip_addresses: %w[54.167.97.240 54.91.252.196 54.242.227.110] } ]) end it 'should return redshift ips for vpc public clusters' do stub_request(:post, 'https://redshift.us-east-1.amazonaws.com') .to_return(body: ::IO.read('spec/fixtures/redshift-vpc-public.xml')) stub_dns( 'vpc-public-2.csorkyt5dk7h.us-east-1.redshift.amazonaws.com' => %w[54.156.7.130] ) expect(subject.run).to eq([ { id: 'vpc-public-2', hostname: 'vpc-public-2.csorkyt5dk7h.us-east-1.redshift.amazonaws.com', ip_addresses: %w[52.44.170.10 54.209.53.206 54.208.75.129 54.156.7.130] } ]) end it 'should return nothing for vpc private clusters' do stub_request(:post, 'https://redshift.us-east-1.amazonaws.com') .to_return(body: ::IO.read('spec/fixtures/redshift-vpc-private.xml')) expect(subject.run).to eq([]) end it 'should handle clusters with a nil endpoint' do stub_request(:post, 'https://redshift.us-east-1.amazonaws.com') .to_return(body: ::IO.read('spec/fixtures/redshift-empty-endpoint.xml')) expect { subject.run }.to raise_error(StandardError, /has a nil endpoint/) end end
{ "pile_set_name": "Github" }
/* @flow */ function filterItems(items: Array<string|number>): Array<string|number> { return items.map(item => { if (typeof item === 'string') { return item.length > 2 ? item : null; } else { return item*10; } }).filter(Boolean); } const filteredItems = filterItems(['foo', 'b', 1, 2]); console.log(filteredItems);
{ "pile_set_name": "Github" }
package vt100 import ( "strconv" "time" "unicode" "github.com/pkg/term" ) var ( defaultTimeout = 2 * time.Millisecond lastKey int ) type TTY struct { t *term.Term timeout time.Duration } // NewTTY opens /dev/tty in raw and cbreak mode as a term.Term func NewTTY() (*TTY, error) { t, err := term.Open("/dev/tty", term.RawMode, term.CBreakMode, term.ReadTimeout(defaultTimeout)) if err != nil { return nil, err } return &TTY{t, defaultTimeout}, nil } // Term will return the underlying term.Term func (tty *TTY) Term() *term.Term { return tty.t } // RawMode will switch the terminal to raw mode func (tty *TTY) RawMode() { term.RawMode(tty.t) } // NoBlock leaves "cooked" mode and enters "cbreak" mode func (tty *TTY) NoBlock() { tty.t.SetCbreak() } // SetTimeout sets a timeout for reading a key func (tty *TTY) SetTimeout(d time.Duration) { tty.timeout = d tty.t.SetReadTimeout(tty.timeout) } // Restore will restore the terminal func (tty *TTY) Restore() { tty.t.Restore() } // Close will Restore and close the raw terminal func (tty *TTY) Close() { t := tty.Term() t.Restore() t.Close() } // Thanks https://stackoverflow.com/a/32018700/131264 // Returns either an ascii code, or (if input is an arrow) a Javascript key code. func asciiAndKeyCode(tty *TTY) (ascii, keyCode int, err error) { bytes := make([]byte, 3) var numRead int tty.RawMode() tty.NoBlock() tty.SetTimeout(tty.timeout) numRead, err = tty.t.Read(bytes) tty.Restore() tty.t.Flush() if err != nil { return } if numRead == 3 && bytes[0] == 27 && bytes[1] == 91 { // Three-character control sequence, beginning with "ESC-[". // Since there are no ASCII codes for arrow keys, we use // Javascript key codes. if bytes[2] == 65 { // Up keyCode = 38 } else if bytes[2] == 66 { // Down keyCode = 40 } else if bytes[2] == 67 { // Right keyCode = 39 } else if bytes[2] == 68 { // Left keyCode = 37 } } else if numRead == 1 { ascii = int(bytes[0]) //} else { // TWo characters read?? } return } // Don't use the "JavaScript key codes" for the arrow keys func asciiAndKeyCodeNoJavascript(tty *TTY) (ascii, keyCode int, err error) { bytes := make([]byte, 3) var numRead int tty.RawMode() tty.NoBlock() tty.SetTimeout(tty.timeout) numRead, err = tty.t.Read(bytes) tty.Restore() tty.t.Flush() if err != nil { return } if numRead == 3 && bytes[0] == 27 && bytes[1] == 91 { // Three-character control sequence, beginning with "ESC-[". // Since there are no ASCII codes for arrow keys, we use // the last 4 values of a byte if bytes[2] == 65 { // Up keyCode = 253 } else if bytes[2] == 66 { // Down keyCode = 255 } else if bytes[2] == 67 { // Right keyCode = 254 } else if bytes[2] == 68 { // Left keyCode = 252 } } else if numRead == 1 { ascii = int(bytes[0]) //} else { // Two characters read?? } return } // Returns either an ascii code, or (if input is an arrow) a Javascript key code. func asciiAndKeyCodeOnce() (ascii, keyCode int, err error) { t, err := NewTTY() if err != nil { return 0, 0, err } a, kc, err := asciiAndKeyCode(t) t.Close() return a, kc, err } func (tty *TTY) ASCII() int { ascii, _, err := asciiAndKeyCode(tty) if err != nil { return 0 } return ascii } func ASCIIOnce() int { ascii, _, err := asciiAndKeyCodeOnce() if err != nil { return 0 } return ascii } func (tty *TTY) KeyCode() int { _, keyCode, err := asciiAndKeyCode(tty) if err != nil { return 0 } return keyCode } func KeyCodeOnce() int { _, keyCode, err := asciiAndKeyCodeOnce() if err != nil { return 0 } return keyCode } // Return the keyCode or ascii, but ignore repeated keys func (tty *TTY) Key() int { ascii, keyCode, err := asciiAndKeyCodeNoJavascript(tty) if err != nil { lastKey = 0 return 0 } if keyCode != 0 { if keyCode == lastKey { lastKey = 0 return 0 } lastKey = keyCode return keyCode } if ascii == lastKey { lastKey = 0 return 0 } lastKey = ascii return ascii } func KeyOnce() int { ascii, keyCode, err := asciiAndKeyCodeOnce() if err != nil { return 0 } if keyCode != 0 { return keyCode } return ascii } // Wait for Esc, Enter or Space to be pressed func WaitForKey() { // Get a new TTY and start reading keypresses in a loop r, err := NewTTY() if err != nil { r.Close() panic(err) } //r.SetTimeout(10 * time.Millisecond) for { switch r.Key() { case 27, 13, 32: r.Close() return } } } // String will block and then return a string // Arrow keys are returned as ←, →, ↑ or ↓ // returns an empty string if the pressed key could not be interpreted func (tty *TTY) String() string { bytes := make([]byte, 3) tty.RawMode() //tty.NoBlock() tty.SetTimeout(0) numRead, err := tty.t.Read(bytes) if err != nil { return "" } tty.Restore() tty.t.Flush() if numRead == 3 && bytes[0] == 27 && bytes[1] == 91 { // Three-character control sequence, beginning with "ESC-[". // Since there are no ASCII codes for arrow keys, we use // the last 4 values of a byte if bytes[2] == 65 { // Up return "↑" } else if bytes[2] == 66 { // Down return "↓" } else if bytes[2] == 67 { // Right return "→" } else if bytes[2] == 68 { // Left return "←" } } else if numRead == 1 { r := rune(bytes[0]) if unicode.IsPrint(r) { return string(r) } return "c:" + strconv.Itoa(int(r)) } else { // Two or more bytes, a unicode character (or mashing several keys) return string([]rune(string(bytes))[0]) } return "" } // Rune will block and then return a rune. // Arrow keys are returned as ←, →, ↑ or ↓ // returns a rune(0) if the pressed key could not be interpreted func (tty *TTY) Rune() rune { bytes := make([]byte, 3) tty.RawMode() //tty.NoBlock() tty.SetTimeout(0) numRead, err := tty.t.Read(bytes) if err != nil { return rune(0) } tty.Restore() tty.t.Flush() if numRead == 3 && bytes[0] == 27 && bytes[1] == 91 { // Three-character control sequence, beginning with "ESC-[". // Since there are no ASCII codes for arrow keys, we use // the last 4 values of a byte if bytes[2] == 65 { // Up return '↑' } else if bytes[2] == 66 { // Down return '↓' } else if bytes[2] == 67 { // Right return '→' } else if bytes[2] == 68 { // Left return '←' } } else if numRead == 1 { return rune(bytes[0]) } else { // Two or more bytes, a unicode character (or mashing several keys) return []rune(string(bytes))[0] } return rune(0) }
{ "pile_set_name": "Github" }
crlf crlf lf crlf crlf
{ "pile_set_name": "Github" }
using System.Collections.Generic; using System.Net.Http; namespace Apress.Recipes.WebApi { public static class HttpRequestMessageExtensions { private const string HttpContext = "MS_HttpContext"; private const string RemoteEndpointMessage = "System.ServiceModel.Channels.RemoteEndpointMessageProperty"; private const string OwinContext = "MS_OwinContext"; private const string OwinIp = "server.LocalIpAddress"; public static string GetClientIpAddress(this HttpRequestMessage request) { if (request.Properties.ContainsKey(HttpContext)) { dynamic ctx = request.Properties[HttpContext]; if (ctx != null) { return ctx.Request.UserHostAddress; } } if (request.Properties.ContainsKey(OwinContext)) { dynamic ctx = request.Properties[OwinContext]; if (ctx != null) { var env = ctx.Environment as IDictionary<string, object>; if (env != null) { return env[OwinIp] as string; } } } if (request.Properties.ContainsKey(RemoteEndpointMessage)) { dynamic remoteEndpoint = request.Properties[RemoteEndpointMessage]; if (remoteEndpoint != null) { return remoteEndpoint.Address; } } return null; } } }
{ "pile_set_name": "Github" }
DIST deepin-mutter-3.20.38.tar.gz 2421805 SHA256 bd955b569d939cb6b5dc66743d34314ab4c0c3e47552e387e352afad86c29fe6
{ "pile_set_name": "Github" }
lf lf lf lf lf
{ "pile_set_name": "Github" }
# coding=utf-8 from __future__ import unicode_literals from .. import Provider as PhoneNumberProvider class Provider(PhoneNumberProvider): formats = ( '+359(0)#########', '+359(0)### ######', '+359(0)### ### ###', '+359#########', '0#########', '0### ######', '0### ### ###', '0### ###-###', '(0###) ######', '(0###) ### ###', '(0###) ###-###', )
{ "pile_set_name": "Github" }
// Copyright (c) 2012 The LevelDB Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. #include "leveldb/filter_policy.h" #include "leveldb/slice.h" #include "util/hash.h" namespace leveldb { namespace { static uint32_t BloomHash(const Slice& key) { return Hash(key.data(), key.size(), 0xbc9f1d34); } class BloomFilterPolicy : public FilterPolicy { private: size_t bits_per_key_; size_t k_; public: explicit BloomFilterPolicy(int bits_per_key) : bits_per_key_(bits_per_key) { // We intentionally round down to reduce probing cost a little bit k_ = static_cast<size_t>(bits_per_key * 0.69); // 0.69 =~ ln(2) if (k_ < 1) k_ = 1; if (k_ > 30) k_ = 30; } virtual const char* Name() const { return "leveldb.BuiltinBloomFilter2"; } virtual void CreateFilter(const Slice* keys, int n, std::string* dst) const { // Compute bloom filter size (in both bits and bytes) size_t bits = n * bits_per_key_; // For small n, we can see a very high false positive rate. Fix it // by enforcing a minimum bloom filter length. if (bits < 64) bits = 64; size_t bytes = (bits + 7) / 8; bits = bytes * 8; const size_t init_size = dst->size(); dst->resize(init_size + bytes, 0); dst->push_back(static_cast<char>(k_)); // Remember # of probes in filter char* array = &(*dst)[init_size]; for (int i = 0; i < n; i++) { // Use double-hashing to generate a sequence of hash values. // See analysis in [Kirsch,Mitzenmacher 2006]. uint32_t h = BloomHash(keys[i]); const uint32_t delta = (h >> 17) | (h << 15); // Rotate right 17 bits for (size_t j = 0; j < k_; j++) { const uint32_t bitpos = h % bits; array[bitpos/8] |= (1 << (bitpos % 8)); h += delta; } } } virtual bool KeyMayMatch(const Slice& key, const Slice& bloom_filter) const { const size_t len = bloom_filter.size(); if (len < 2) return false; const char* array = bloom_filter.data(); const size_t bits = (len - 1) * 8; // Use the encoded k so that we can read filters generated by // bloom filters created using different parameters. const size_t k = array[len-1]; if (k > 30) { // Reserved for potentially new encodings for short bloom filters. // Consider it a match. return true; } uint32_t h = BloomHash(key); const uint32_t delta = (h >> 17) | (h << 15); // Rotate right 17 bits for (size_t j = 0; j < k; j++) { const uint32_t bitpos = h % bits; if ((array[bitpos/8] & (1 << (bitpos % 8))) == 0) return false; h += delta; } return true; } }; } const FilterPolicy* NewBloomFilterPolicy(int bits_per_key) { return new BloomFilterPolicy(bits_per_key); } } // namespace leveldb
{ "pile_set_name": "Github" }
<!DOCTYPE HTML> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc --> <title>Uses of Class squidpony.squidmath.WhirlingNoise (squidlib-util 3.0.1)</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="description" content="use: package: squidpony.squidmath, class: WhirlingNoise"> <meta name="generator" content="javadoc/ClassUseWriter"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> <link rel="stylesheet" type="text/css" href="../../../script-dir/jquery-ui.css" title="Style"> <script type="text/javascript" src="../../../script.js"></script> <script type="text/javascript" src="../../../script-dir/jszip/dist/jszip.min.js"></script> <script type="text/javascript" src="../../../script-dir/jszip-utils/dist/jszip-utils.min.js"></script> <!--[if IE]> <script type="text/javascript" src="../../../script-dir/jszip-utils/dist/jszip-utils-ie.min.js"></script> <![endif]--> <script type="text/javascript" src="../../../script-dir/jquery-3.4.1.js"></script> <script type="text/javascript" src="../../../script-dir/jquery-ui.js"></script> </head> <body class="class-use"> <script type="text/javascript">var pathtoroot = "../../../"; loadScripts(document, 'script');</script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <div class="flexBox"> <header role="banner" class="flexHeader"> <nav role="navigation"> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a id="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a id="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../index.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../WhirlingNoise.html" title="class in squidpony.squidmath">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-files/index-1.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <div class="navListSearch"><label for="search">SEARCH:</label> <input type="text" id="search" value="search" disabled="disabled"> <input type="reset" id="reset" value="reset" disabled="disabled"> </div> </div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="skipNav"><a id="skip.navbar.top"> <!-- --> </a></div> </nav> </header> <div class="flexContent"> <main role="main"> <div class="header"> <h1 title="Uses of Class squidpony.squidmath.WhirlingNoise" class="title">Uses of Class<br>squidpony.squidmath.WhirlingNoise</h1> </div> <div class="classUseContainer"> <div class="useSummary"> <table> <caption><span>Packages that use <a href="../WhirlingNoise.html" title="class in squidpony.squidmath">WhirlingNoise</a></span><span class="tabEnd">&nbsp;</span></caption> <thead> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> </thead> <tbody> <tr class="altColor"> <th class="colFirst" scope="row"><a href="#squidpony.squidmath">squidpony.squidmath</a></th> <td class="colLast"> <div class="block">A very broad package containing random number generators, geometry tools, data structures, and noise functions.</div> </td> </tr> </tbody> </table> </div> <section class="classUses"> <ul class="blockList"> <li class="blockList"> <section class="detail"><a id="squidpony.squidmath"> <!-- --> </a> <h2>Uses of <a href="../WhirlingNoise.html" title="class in squidpony.squidmath">WhirlingNoise</a> in <a href="../package-summary.html">squidpony.squidmath</a></h2> <div class="useSummary"> <table> <caption><span>Fields in <a href="../package-summary.html">squidpony.squidmath</a> declared as <a href="../WhirlingNoise.html" title="class in squidpony.squidmath">WhirlingNoise</a></span><span class="tabEnd">&nbsp;</span></caption> <thead> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colSecond" scope="col">Field</th> <th class="colLast" scope="col">Description</th> </tr> </thead> <tbody> <tr class="altColor"> <td class="colFirst"><code>static <a href="../WhirlingNoise.html" title="class in squidpony.squidmath">WhirlingNoise</a></code></td> <th class="colSecond" scope="row"><span class="typeNameLabel">WhirlingNoise.</span><code><span class="memberNameLink"><a href="../WhirlingNoise.html#instance">instance</a></span></code></th> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </div> </section> </li> </ul> </section> </div> </main> <footer role="contentinfo"> <nav role="navigation"> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a id="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a id="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../index.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../WhirlingNoise.html" title="class in squidpony.squidmath">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-files/index-1.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> </div> <a id="skip.navbar.bottom"> <!-- --> </a> <!-- ======== END OF BOTTOM NAVBAR ======= --> </nav> <p class="legalCopy"><small>Copyright &#169; 2012&#x2013;2020. All rights reserved.</small></p> </footer> </div> </div> </body> </html>
{ "pile_set_name": "Github" }
/* * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include "webrtc/modules/audio_coding/codecs/isac/main/interface/audio_encoder_isac.h" #include "webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h" namespace webrtc { // Explicit instantiation of AudioEncoderDecoderIsacT<IsacFloat>, a.k.a. // AudioEncoderDecoderIsac. template class AudioEncoderDecoderIsacT<IsacFloat>; // Explicit instantiation of AudioEncoderDecoderIsacT<IsacRed>, a.k.a. // AudioEncoderDecoderIsacRed. template class AudioEncoderDecoderIsacT<IsacRed>; } // namespace webrtc
{ "pile_set_name": "Github" }
/*! iScroll v5.1.3 ~ (c) 2008-2014 Matteo Spinelli ~ http://cubiq.org/license */ (function (window, document, Math) { var rAF = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (callback) { window.setTimeout(callback, 1000 / 60); }; var utils = (function () { var me = {}; var _elementStyle = document.createElement('div').style; var _vendor = (function () { var vendors = ['t', 'webkitT', 'MozT', 'msT', 'OT'], transform, i = 0, l = vendors.length; for ( ; i < l; i++ ) { transform = vendors[i] + 'ransform'; if ( transform in _elementStyle ) return vendors[i].substr(0, vendors[i].length-1); } return false; })(); function _prefixStyle (style) { if ( _vendor === false ) return false; if ( _vendor === '' ) return style; return _vendor + style.charAt(0).toUpperCase() + style.substr(1); } me.getTime = Date.now || function getTime () { return new Date().getTime(); }; me.extend = function (target, obj) { for ( var i in obj ) { target[i] = obj[i]; } }; me.addEvent = function (el, type, fn, capture) { el.addEventListener(type, fn, !!capture); }; me.removeEvent = function (el, type, fn, capture) { el.removeEventListener(type, fn, !!capture); }; me.prefixPointerEvent = function (pointerEvent) { return window.MSPointerEvent ? 'MSPointer' + pointerEvent.charAt(9).toUpperCase() + pointerEvent.substr(10): pointerEvent; }; me.momentum = function (current, start, time, lowerMargin, wrapperSize, deceleration) { var distance = current - start, speed = Math.abs(distance) / time, destination, duration; deceleration = deceleration === undefined ? 0.0006 : deceleration; destination = current + ( speed * speed ) / ( 2 * deceleration ) * ( distance < 0 ? -1 : 1 ); duration = speed / deceleration; if ( destination < lowerMargin ) { destination = wrapperSize ? lowerMargin - ( wrapperSize / 2.5 * ( speed / 8 ) ) : lowerMargin; distance = Math.abs(destination - current); duration = distance / speed; } else if ( destination > 0 ) { destination = wrapperSize ? wrapperSize / 2.5 * ( speed / 8 ) : 0; distance = Math.abs(current) + destination; duration = distance / speed; } return { destination: Math.round(destination), duration: duration }; }; var _transform = _prefixStyle('transform'); me.extend(me, { hasTransform: _transform !== false, hasPerspective: _prefixStyle('perspective') in _elementStyle, hasTouch: 'ontouchstart' in window, hasPointer: window.PointerEvent || window.MSPointerEvent, // IE10 is prefixed hasTransition: _prefixStyle('transition') in _elementStyle }); // This should find all Android browsers lower than build 535.19 (both stock browser and webview) me.isBadAndroid = /Android /.test(window.navigator.appVersion) && !(/Chrome\/\d/.test(window.navigator.appVersion)); me.extend(me.style = {}, { transform: _transform, transitionTimingFunction: _prefixStyle('transitionTimingFunction'), transitionDuration: _prefixStyle('transitionDuration'), transitionDelay: _prefixStyle('transitionDelay'), transformOrigin: _prefixStyle('transformOrigin') }); me.hasClass = function (e, c) { var re = new RegExp("(^|\\s)" + c + "(\\s|$)"); return re.test(e.className); }; me.addClass = function (e, c) { if ( me.hasClass(e, c) ) { return; } var newclass = e.className.split(' '); newclass.push(c); e.className = newclass.join(' '); }; me.removeClass = function (e, c) { if ( !me.hasClass(e, c) ) { return; } var re = new RegExp("(^|\\s)" + c + "(\\s|$)", 'g'); e.className = e.className.replace(re, ' '); }; me.offset = function (el) { var left = -el.offsetLeft, top = -el.offsetTop; // jshint -W084 while (el = el.offsetParent) { left -= el.offsetLeft; top -= el.offsetTop; } // jshint +W084 return { left: left, top: top }; }; me.preventDefaultException = function (el, exceptions) { for ( var i in exceptions ) { if ( exceptions[i].test(el[i]) ) { return true; } } return false; }; me.extend(me.eventType = {}, { touchstart: 1, touchmove: 1, touchend: 1, mousedown: 2, mousemove: 2, mouseup: 2, pointerdown: 3, pointermove: 3, pointerup: 3, MSPointerDown: 3, MSPointerMove: 3, MSPointerUp: 3 }); me.extend(me.ease = {}, { quadratic: { style: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)', fn: function (k) { return k * ( 2 - k ); } }, circular: { style: 'cubic-bezier(0.1, 0.57, 0.1, 1)', // Not properly "circular" but this looks better, it should be (0.075, 0.82, 0.165, 1) fn: function (k) { return Math.sqrt( 1 - ( --k * k ) ); } }, back: { style: 'cubic-bezier(0.175, 0.885, 0.32, 1.275)', fn: function (k) { var b = 4; return ( k = k - 1 ) * k * ( ( b + 1 ) * k + b ) + 1; } }, bounce: { style: '', fn: function (k) { if ( ( k /= 1 ) < ( 1 / 2.75 ) ) { return 7.5625 * k * k; } else if ( k < ( 2 / 2.75 ) ) { return 7.5625 * ( k -= ( 1.5 / 2.75 ) ) * k + 0.75; } else if ( k < ( 2.5 / 2.75 ) ) { return 7.5625 * ( k -= ( 2.25 / 2.75 ) ) * k + 0.9375; } else { return 7.5625 * ( k -= ( 2.625 / 2.75 ) ) * k + 0.984375; } } }, elastic: { style: '', fn: function (k) { var f = 0.22, e = 0.4; if ( k === 0 ) { return 0; } if ( k == 1 ) { return 1; } return ( e * Math.pow( 2, - 10 * k ) * Math.sin( ( k - f / 4 ) * ( 2 * Math.PI ) / f ) + 1 ); } } }); me.tap = function (e, eventName) { var ev = document.createEvent('Event'); ev.initEvent(eventName, true, true); ev.pageX = e.pageX; ev.pageY = e.pageY; e.target.dispatchEvent(ev); }; me.click = function (e) { var target = e.target, ev; if ( !(/(SELECT|INPUT|TEXTAREA)/i).test(target.tagName) ) { ev = document.createEvent('MouseEvents'); ev.initMouseEvent('click', true, true, e.view, 1, target.screenX, target.screenY, target.clientX, target.clientY, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, 0, null); ev._constructed = true; target.dispatchEvent(ev); } }; return me; })(); function IScroll (el, options) { this.wrapper = typeof el == 'string' ? document.querySelector(el) : el; this.scroller = this.wrapper.children[0]; this.scrollerStyle = this.scroller.style; // cache style for better performance this.options = { resizeScrollbars: true, mouseWheelSpeed: 20, snapThreshold: 0.334, // INSERT POINT: OPTIONS startX: 0, startY: 0, scrollY: true, directionLockThreshold: 5, momentum: true, bounce: true, bounceTime: 600, bounceEasing: '', preventDefault: true, preventDefaultException: { tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/ }, HWCompositing: true, useTransition: true, useTransform: true }; for ( var i in options ) { this.options[i] = options[i]; } // Normalize options this.translateZ = this.options.HWCompositing && utils.hasPerspective ? ' translateZ(0)' : ''; this.options.useTransition = utils.hasTransition && this.options.useTransition; this.options.useTransform = utils.hasTransform && this.options.useTransform; this.options.eventPassthrough = this.options.eventPassthrough === true ? 'vertical' : this.options.eventPassthrough; this.options.preventDefault = !this.options.eventPassthrough && this.options.preventDefault; // If you want eventPassthrough I have to lock one of the axes this.options.scrollY = this.options.eventPassthrough == 'vertical' ? false : this.options.scrollY; this.options.scrollX = this.options.eventPassthrough == 'horizontal' ? false : this.options.scrollX; // With eventPassthrough we also need lockDirection mechanism this.options.freeScroll = this.options.freeScroll && !this.options.eventPassthrough; this.options.directionLockThreshold = this.options.eventPassthrough ? 0 : this.options.directionLockThreshold; this.options.bounceEasing = typeof this.options.bounceEasing == 'string' ? utils.ease[this.options.bounceEasing] || utils.ease.circular : this.options.bounceEasing; this.options.resizePolling = this.options.resizePolling === undefined ? 60 : this.options.resizePolling; if ( this.options.tap === true ) { this.options.tap = 'tap'; } if ( this.options.shrinkScrollbars == 'scale' ) { this.options.useTransition = false; } this.options.invertWheelDirection = this.options.invertWheelDirection ? -1 : 1; if ( this.options.probeType == 3 ) { this.options.useTransition = false; } // INSERT POINT: NORMALIZATION // Some defaults this.x = 0; this.y = 0; this.directionX = 0; this.directionY = 0; this._events = {}; // INSERT POINT: DEFAULTS this._init(); this.refresh(); this.scrollTo(this.options.startX, this.options.startY); this.enable(); } IScroll.prototype = { version: '5.1.3', _init: function () { this._initEvents(); if ( this.options.scrollbars || this.options.indicators ) { this._initIndicators(); } if ( this.options.mouseWheel ) { this._initWheel(); } if ( this.options.snap ) { this._initSnap(); } if ( this.options.keyBindings ) { this._initKeys(); } // INSERT POINT: _init }, destroy: function () { this._initEvents(true); this._execEvent('destroy'); }, _transitionEnd: function (e) { if ( e.target != this.scroller || !this.isInTransition ) { return; } this._transitionTime(); if ( !this.resetPosition(this.options.bounceTime) ) { this.isInTransition = false; this._execEvent('scrollEnd'); } }, _start: function (e) { // React to left mouse button only if ( utils.eventType[e.type] != 1 ) { if ( e.button !== 0 ) { return; } } if ( !this.enabled || (this.initiated && utils.eventType[e.type] !== this.initiated) ) { return; } if ( this.options.preventDefault && !utils.isBadAndroid && !utils.preventDefaultException(e.target, this.options.preventDefaultException) ) { e.preventDefault(); } var point = e.touches ? e.touches[0] : e, pos; this.initiated = utils.eventType[e.type]; this.moved = false; this.distX = 0; this.distY = 0; this.directionX = 0; this.directionY = 0; this.directionLocked = 0; this._transitionTime(); this.startTime = utils.getTime(); if ( this.options.useTransition && this.isInTransition ) { this.isInTransition = false; pos = this.getComputedPosition(); this._translate(Math.round(pos.x), Math.round(pos.y)); this._execEvent('scrollEnd'); } else if ( !this.options.useTransition && this.isAnimating ) { this.isAnimating = false; this._execEvent('scrollEnd'); } this.startX = this.x; this.startY = this.y; this.absStartX = this.x; this.absStartY = this.y; this.pointX = point.pageX; this.pointY = point.pageY; this._execEvent('beforeScrollStart'); }, _move: function (e) { if ( !this.enabled || utils.eventType[e.type] !== this.initiated ) { return; } if ( this.options.preventDefault ) { // increases performance on Android? TODO: check! e.preventDefault(); } var point = e.touches ? e.touches[0] : e, deltaX = point.pageX - this.pointX, deltaY = point.pageY - this.pointY, timestamp = utils.getTime(), newX, newY, absDistX, absDistY; this.pointX = point.pageX; this.pointY = point.pageY; this.distX += deltaX; this.distY += deltaY; absDistX = Math.abs(this.distX); absDistY = Math.abs(this.distY); // We need to move at least 10 pixels for the scrolling to initiate if ( timestamp - this.endTime > 300 && (absDistX < 10 && absDistY < 10) ) { return; } // If you are scrolling in one direction lock the other if ( !this.directionLocked && !this.options.freeScroll ) { if ( absDistX > absDistY + this.options.directionLockThreshold ) { this.directionLocked = 'h'; // lock horizontally } else if ( absDistY >= absDistX + this.options.directionLockThreshold ) { this.directionLocked = 'v'; // lock vertically } else { this.directionLocked = 'n'; // no lock } } if ( this.directionLocked == 'h' ) { if ( this.options.eventPassthrough == 'vertical' ) { e.preventDefault(); } else if ( this.options.eventPassthrough == 'horizontal' ) { this.initiated = false; return; } deltaY = 0; } else if ( this.directionLocked == 'v' ) { if ( this.options.eventPassthrough == 'horizontal' ) { e.preventDefault(); } else if ( this.options.eventPassthrough == 'vertical' ) { this.initiated = false; return; } deltaX = 0; } deltaX = this.hasHorizontalScroll ? deltaX : 0; deltaY = this.hasVerticalScroll ? deltaY : 0; newX = this.x + deltaX; newY = this.y + deltaY; // Slow down if outside of the boundaries if ( newX > 0 || newX < this.maxScrollX ) { newX = this.options.bounce ? this.x + deltaX / 3 : newX > 0 ? 0 : this.maxScrollX; } if ( newY > 0 || newY < this.maxScrollY ) { newY = this.options.bounce ? this.y + deltaY / 3 : newY > 0 ? 0 : this.maxScrollY; } this.directionX = deltaX > 0 ? -1 : deltaX < 0 ? 1 : 0; this.directionY = deltaY > 0 ? -1 : deltaY < 0 ? 1 : 0; if ( !this.moved ) { this._execEvent('scrollStart'); } this.moved = true; this._translate(newX, newY); /* REPLACE START: _move */ if ( timestamp - this.startTime > 300 ) { this.startTime = timestamp; this.startX = this.x; this.startY = this.y; if ( this.options.probeType == 1 ) { this._execEvent('scroll'); } } if ( this.options.probeType > 1 ) { this._execEvent('scroll'); } /* REPLACE END: _move */ }, _end: function (e) { if ( !this.enabled || utils.eventType[e.type] !== this.initiated ) { return; } if ( this.options.preventDefault && !utils.preventDefaultException(e.target, this.options.preventDefaultException) ) { e.preventDefault(); } var point = e.changedTouches ? e.changedTouches[0] : e, momentumX, momentumY, duration = utils.getTime() - this.startTime, newX = Math.round(this.x), newY = Math.round(this.y), distanceX = Math.abs(newX - this.startX), distanceY = Math.abs(newY - this.startY), time = 0, easing = ''; this.isInTransition = 0; this.initiated = 0; this.endTime = utils.getTime(); // reset if we are outside of the boundaries if ( this.resetPosition(this.options.bounceTime) ) { return; } this.scrollTo(newX, newY); // ensures that the last position is rounded // we scrolled less than 10 pixels if ( !this.moved ) { if ( this.options.tap ) { utils.tap(e, this.options.tap); } if ( this.options.click ) { utils.click(e); } this._execEvent('scrollCancel'); return; } if ( this._events.flick && duration < 200 && distanceX < 100 && distanceY < 100 ) { this._execEvent('flick'); return; } // start momentum animation if needed if ( this.options.momentum && duration < 300 ) { momentumX = this.hasHorizontalScroll ? utils.momentum(this.x, this.startX, duration, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0, this.options.deceleration) : { destination: newX, duration: 0 }; momentumY = this.hasVerticalScroll ? utils.momentum(this.y, this.startY, duration, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0, this.options.deceleration) : { destination: newY, duration: 0 }; newX = momentumX.destination; newY = momentumY.destination; time = Math.max(momentumX.duration, momentumY.duration); this.isInTransition = 1; } if ( this.options.snap ) { var snap = this._nearestSnap(newX, newY); this.currentPage = snap; time = this.options.snapSpeed || Math.max( Math.max( Math.min(Math.abs(newX - snap.x), 1000), Math.min(Math.abs(newY - snap.y), 1000) ), 300); newX = snap.x; newY = snap.y; this.directionX = 0; this.directionY = 0; easing = this.options.bounceEasing; } // INSERT POINT: _end if ( newX != this.x || newY != this.y ) { // change easing function when scroller goes out of the boundaries if ( newX > 0 || newX < this.maxScrollX || newY > 0 || newY < this.maxScrollY ) { easing = utils.ease.quadratic; } this.scrollTo(newX, newY, time, easing); return; } this._execEvent('scrollEnd'); }, _resize: function () { var that = this; clearTimeout(this.resizeTimeout); this.resizeTimeout = setTimeout(function () { that.refresh(); }, this.options.resizePolling); }, resetPosition: function (time) { var x = this.x, y = this.y; time = time || 0; if ( !this.hasHorizontalScroll || this.x > 0 ) { x = 0; } else if ( this.x < this.maxScrollX ) { x = this.maxScrollX; } if ( !this.hasVerticalScroll || this.y > 0 ) { y = 0; } else if ( this.y < this.maxScrollY ) { y = this.maxScrollY; } if ( x == this.x && y == this.y ) { return false; } this.scrollTo(x, y, time, this.options.bounceEasing); return true; }, disable: function () { this.enabled = false; }, enable: function () { this.enabled = true; }, refresh: function () { var rf = this.wrapper.offsetHeight; // Force reflow this.wrapperWidth = this.wrapper.clientWidth; this.wrapperHeight = this.wrapper.clientHeight; /* REPLACE START: refresh */ this.scrollerWidth = this.scroller.offsetWidth; this.scrollerHeight = this.scroller.offsetHeight; this.maxScrollX = this.wrapperWidth - this.scrollerWidth; this.maxScrollY = this.wrapperHeight - this.scrollerHeight; /* REPLACE END: refresh */ this.hasHorizontalScroll = this.options.scrollX && this.maxScrollX < 0; this.hasVerticalScroll = this.options.scrollY && this.maxScrollY < 0; if ( !this.hasHorizontalScroll ) { this.maxScrollX = 0; this.scrollerWidth = this.wrapperWidth; } if ( !this.hasVerticalScroll ) { this.maxScrollY = 0; this.scrollerHeight = this.wrapperHeight; } this.endTime = 0; this.directionX = 0; this.directionY = 0; this.wrapperOffset = utils.offset(this.wrapper); this._execEvent('refresh'); this.resetPosition(); // INSERT POINT: _refresh }, on: function (type, fn) { if ( !this._events[type] ) { this._events[type] = []; } this._events[type].push(fn); }, off: function (type, fn) { if ( !this._events[type] ) { return; } var index = this._events[type].indexOf(fn); if ( index > -1 ) { this._events[type].splice(index, 1); } }, _execEvent: function (type) { if ( !this._events[type] ) { return; } var i = 0, l = this._events[type].length; if ( !l ) { return; } for ( ; i < l; i++ ) { this._events[type][i].apply(this, [].slice.call(arguments, 1)); } }, scrollBy: function (x, y, time, easing) { x = this.x + x; y = this.y + y; time = time || 0; this.scrollTo(x, y, time, easing); }, scrollTo: function (x, y, time, easing) { easing = easing || utils.ease.circular; this.isInTransition = this.options.useTransition && time > 0; if ( !time || (this.options.useTransition && easing.style) ) { this._transitionTimingFunction(easing.style); this._transitionTime(time); this._translate(x, y); } else { this._animate(x, y, time, easing.fn); } }, scrollToElement: function (el, time, offsetX, offsetY, easing) { el = el.nodeType ? el : this.scroller.querySelector(el); if ( !el ) { return; } var pos = utils.offset(el); pos.left -= this.wrapperOffset.left; pos.top -= this.wrapperOffset.top; // if offsetX/Y are true we center the element to the screen if ( offsetX === true ) { offsetX = Math.round(el.offsetWidth / 2 - this.wrapper.offsetWidth / 2); } if ( offsetY === true ) { offsetY = Math.round(el.offsetHeight / 2 - this.wrapper.offsetHeight / 2); } pos.left -= offsetX || 0; pos.top -= offsetY || 0; pos.left = pos.left > 0 ? 0 : pos.left < this.maxScrollX ? this.maxScrollX : pos.left; pos.top = pos.top > 0 ? 0 : pos.top < this.maxScrollY ? this.maxScrollY : pos.top; time = time === undefined || time === null || time === 'auto' ? Math.max(Math.abs(this.x-pos.left), Math.abs(this.y-pos.top)) : time; this.scrollTo(pos.left, pos.top, time, easing); }, _transitionTime: function (time) { time = time || 0; this.scrollerStyle[utils.style.transitionDuration] = time + 'ms'; if ( !time && utils.isBadAndroid ) { this.scrollerStyle[utils.style.transitionDuration] = '0.001s'; } if ( this.indicators ) { for ( var i = this.indicators.length; i--; ) { this.indicators[i].transitionTime(time); } } // INSERT POINT: _transitionTime }, _transitionTimingFunction: function (easing) { this.scrollerStyle[utils.style.transitionTimingFunction] = easing; if ( this.indicators ) { for ( var i = this.indicators.length; i--; ) { this.indicators[i].transitionTimingFunction(easing); } } // INSERT POINT: _transitionTimingFunction }, _translate: function (x, y) { if ( this.options.useTransform ) { /* REPLACE START: _translate */ this.scrollerStyle[utils.style.transform] = 'translate(' + x + 'px,' + y + 'px)' + this.translateZ; /* REPLACE END: _translate */ } else { x = Math.round(x); y = Math.round(y); this.scrollerStyle.left = x + 'px'; this.scrollerStyle.top = y + 'px'; } this.x = x; this.y = y; if ( this.indicators ) { for ( var i = this.indicators.length; i--; ) { this.indicators[i].updatePosition(); } } // INSERT POINT: _translate }, _initEvents: function (remove) { var eventType = remove ? utils.removeEvent : utils.addEvent, target = this.options.bindToWrapper ? this.wrapper : window; eventType(window, 'orientationchange', this); eventType(window, 'resize', this); if ( this.options.click ) { eventType(this.wrapper, 'click', this, true); } if ( !this.options.disableMouse ) { eventType(this.wrapper, 'mousedown', this); eventType(target, 'mousemove', this); eventType(target, 'mousecancel', this); eventType(target, 'mouseup', this); } if ( utils.hasPointer && !this.options.disablePointer ) { eventType(this.wrapper, utils.prefixPointerEvent('pointerdown'), this); eventType(target, utils.prefixPointerEvent('pointermove'), this); eventType(target, utils.prefixPointerEvent('pointercancel'), this); eventType(target, utils.prefixPointerEvent('pointerup'), this); } if ( utils.hasTouch && !this.options.disableTouch ) { eventType(this.wrapper, 'touchstart', this); eventType(target, 'touchmove', this); eventType(target, 'touchcancel', this); eventType(target, 'touchend', this); } eventType(this.scroller, 'transitionend', this); eventType(this.scroller, 'webkitTransitionEnd', this); eventType(this.scroller, 'oTransitionEnd', this); eventType(this.scroller, 'MSTransitionEnd', this); }, getComputedPosition: function () { var matrix = window.getComputedStyle(this.scroller, null), x, y; if ( this.options.useTransform ) { matrix = matrix[utils.style.transform].split(')')[0].split(', '); x = +(matrix[12] || matrix[4]); y = +(matrix[13] || matrix[5]); } else { x = +matrix.left.replace(/[^-\d.]/g, ''); y = +matrix.top.replace(/[^-\d.]/g, ''); } return { x: x, y: y }; }, _initIndicators: function () { var interactive = this.options.interactiveScrollbars, customStyle = typeof this.options.scrollbars != 'string', indicators = [], indicator; var that = this; this.indicators = []; if ( this.options.scrollbars ) { // Vertical scrollbar if ( this.options.scrollY ) { indicator = { el: createDefaultScrollbar('v', interactive, this.options.scrollbars), interactive: interactive, defaultScrollbars: true, customStyle: customStyle, resize: this.options.resizeScrollbars, shrink: this.options.shrinkScrollbars, fade: this.options.fadeScrollbars, listenX: false }; this.wrapper.appendChild(indicator.el); indicators.push(indicator); } // Horizontal scrollbar if ( this.options.scrollX ) { indicator = { el: createDefaultScrollbar('h', interactive, this.options.scrollbars), interactive: interactive, defaultScrollbars: true, customStyle: customStyle, resize: this.options.resizeScrollbars, shrink: this.options.shrinkScrollbars, fade: this.options.fadeScrollbars, listenY: false }; this.wrapper.appendChild(indicator.el); indicators.push(indicator); } } if ( this.options.indicators ) { // TODO: check concat compatibility indicators = indicators.concat(this.options.indicators); } for ( var i = indicators.length; i--; ) { this.indicators.push( new Indicator(this, indicators[i]) ); } // TODO: check if we can use array.map (wide compatibility and performance issues) function _indicatorsMap (fn) { for ( var i = that.indicators.length; i--; ) { fn.call(that.indicators[i]); } } if ( this.options.fadeScrollbars ) { this.on('scrollEnd', function () { _indicatorsMap(function () { this.fade(); }); }); this.on('scrollCancel', function () { _indicatorsMap(function () { this.fade(); }); }); this.on('scrollStart', function () { _indicatorsMap(function () { this.fade(1); }); }); this.on('beforeScrollStart', function () { _indicatorsMap(function () { this.fade(1, true); }); }); } this.on('refresh', function () { _indicatorsMap(function () { this.refresh(); }); }); this.on('destroy', function () { _indicatorsMap(function () { this.destroy(); }); delete this.indicators; }); }, _initWheel: function () { utils.addEvent(this.wrapper, 'wheel', this); utils.addEvent(this.wrapper, 'mousewheel', this); utils.addEvent(this.wrapper, 'DOMMouseScroll', this); this.on('destroy', function () { utils.removeEvent(this.wrapper, 'wheel', this); utils.removeEvent(this.wrapper, 'mousewheel', this); utils.removeEvent(this.wrapper, 'DOMMouseScroll', this); }); }, _wheel: function (e) { if ( !this.enabled ) { return; } e.preventDefault(); e.stopPropagation(); var wheelDeltaX, wheelDeltaY, newX, newY, that = this; if ( this.wheelTimeout === undefined ) { that._execEvent('scrollStart'); } // Execute the scrollEnd event after 400ms the wheel stopped scrolling clearTimeout(this.wheelTimeout); this.wheelTimeout = setTimeout(function () { that._execEvent('scrollEnd'); that.wheelTimeout = undefined; }, 400); if ( 'deltaX' in e ) { if (e.deltaMode === 1) { wheelDeltaX = -e.deltaX * this.options.mouseWheelSpeed; wheelDeltaY = -e.deltaY * this.options.mouseWheelSpeed; } else { wheelDeltaX = -e.deltaX; wheelDeltaY = -e.deltaY; } } else if ( 'wheelDeltaX' in e ) { wheelDeltaX = e.wheelDeltaX / 120 * this.options.mouseWheelSpeed; wheelDeltaY = e.wheelDeltaY / 120 * this.options.mouseWheelSpeed; } else if ( 'wheelDelta' in e ) { wheelDeltaX = wheelDeltaY = e.wheelDelta / 120 * this.options.mouseWheelSpeed; } else if ( 'detail' in e ) { wheelDeltaX = wheelDeltaY = -e.detail / 3 * this.options.mouseWheelSpeed; } else { return; } wheelDeltaX *= this.options.invertWheelDirection; wheelDeltaY *= this.options.invertWheelDirection; if ( !this.hasVerticalScroll ) { wheelDeltaX = wheelDeltaY; wheelDeltaY = 0; } if ( this.options.snap ) { newX = this.currentPage.pageX; newY = this.currentPage.pageY; if ( wheelDeltaX > 0 ) { newX--; } else if ( wheelDeltaX < 0 ) { newX++; } if ( wheelDeltaY > 0 ) { newY--; } else if ( wheelDeltaY < 0 ) { newY++; } this.goToPage(newX, newY); return; } newX = this.x + Math.round(this.hasHorizontalScroll ? wheelDeltaX : 0); newY = this.y + Math.round(this.hasVerticalScroll ? wheelDeltaY : 0); if ( newX > 0 ) { newX = 0; } else if ( newX < this.maxScrollX ) { newX = this.maxScrollX; } if ( newY > 0 ) { newY = 0; } else if ( newY < this.maxScrollY ) { newY = this.maxScrollY; } this.scrollTo(newX, newY, 0); if ( this.options.probeType > 1 ) { this._execEvent('scroll'); } // INSERT POINT: _wheel }, _initSnap: function () { this.currentPage = {}; if ( typeof this.options.snap == 'string' ) { this.options.snap = this.scroller.querySelectorAll(this.options.snap); } this.on('refresh', function () { var i = 0, l, m = 0, n, cx, cy, x = 0, y, stepX = this.options.snapStepX || this.wrapperWidth, stepY = this.options.snapStepY || this.wrapperHeight, el; this.pages = []; if ( !this.wrapperWidth || !this.wrapperHeight || !this.scrollerWidth || !this.scrollerHeight ) { return; } if ( this.options.snap === true ) { cx = Math.round( stepX / 2 ); cy = Math.round( stepY / 2 ); while ( x > -this.scrollerWidth ) { this.pages[i] = []; l = 0; y = 0; while ( y > -this.scrollerHeight ) { this.pages[i][l] = { x: Math.max(x, this.maxScrollX), y: Math.max(y, this.maxScrollY), width: stepX, height: stepY, cx: x - cx, cy: y - cy }; y -= stepY; l++; } x -= stepX; i++; } } else { el = this.options.snap; l = el.length; n = -1; for ( ; i < l; i++ ) { if ( i === 0 || el[i].offsetLeft <= el[i-1].offsetLeft ) { m = 0; n++; } if ( !this.pages[m] ) { this.pages[m] = []; } x = Math.max(-el[i].offsetLeft, this.maxScrollX); y = Math.max(-el[i].offsetTop, this.maxScrollY); cx = x - Math.round(el[i].offsetWidth / 2); cy = y - Math.round(el[i].offsetHeight / 2); this.pages[m][n] = { x: x, y: y, width: el[i].offsetWidth, height: el[i].offsetHeight, cx: cx, cy: cy }; if ( x > this.maxScrollX ) { m++; } } } this.goToPage(this.currentPage.pageX || 0, this.currentPage.pageY || 0, 0); // Update snap threshold if needed if ( this.options.snapThreshold % 1 === 0 ) { this.snapThresholdX = this.options.snapThreshold; this.snapThresholdY = this.options.snapThreshold; } else { this.snapThresholdX = Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].width * this.options.snapThreshold); this.snapThresholdY = Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].height * this.options.snapThreshold); } }); this.on('flick', function () { var time = this.options.snapSpeed || Math.max( Math.max( Math.min(Math.abs(this.x - this.startX), 1000), Math.min(Math.abs(this.y - this.startY), 1000) ), 300); this.goToPage( this.currentPage.pageX + this.directionX, this.currentPage.pageY + this.directionY, time ); }); }, _nearestSnap: function (x, y) { if ( !this.pages.length ) { return { x: 0, y: 0, pageX: 0, pageY: 0 }; } var i = 0, l = this.pages.length, m = 0; // Check if we exceeded the snap threshold if ( Math.abs(x - this.absStartX) < this.snapThresholdX && Math.abs(y - this.absStartY) < this.snapThresholdY ) { return this.currentPage; } if ( x > 0 ) { x = 0; } else if ( x < this.maxScrollX ) { x = this.maxScrollX; } if ( y > 0 ) { y = 0; } else if ( y < this.maxScrollY ) { y = this.maxScrollY; } for ( ; i < l; i++ ) { if ( x >= this.pages[i][0].cx ) { x = this.pages[i][0].x; break; } } l = this.pages[i].length; for ( ; m < l; m++ ) { if ( y >= this.pages[0][m].cy ) { y = this.pages[0][m].y; break; } } if ( i == this.currentPage.pageX ) { i += this.directionX; if ( i < 0 ) { i = 0; } else if ( i >= this.pages.length ) { i = this.pages.length - 1; } x = this.pages[i][0].x; } if ( m == this.currentPage.pageY ) { m += this.directionY; if ( m < 0 ) { m = 0; } else if ( m >= this.pages[0].length ) { m = this.pages[0].length - 1; } y = this.pages[0][m].y; } return { x: x, y: y, pageX: i, pageY: m }; }, goToPage: function (x, y, time, easing) { easing = easing || this.options.bounceEasing; if ( x >= this.pages.length ) { x = this.pages.length - 1; } else if ( x < 0 ) { x = 0; } if ( y >= this.pages[x].length ) { y = this.pages[x].length - 1; } else if ( y < 0 ) { y = 0; } var posX = this.pages[x][y].x, posY = this.pages[x][y].y; time = time === undefined ? this.options.snapSpeed || Math.max( Math.max( Math.min(Math.abs(posX - this.x), 1000), Math.min(Math.abs(posY - this.y), 1000) ), 300) : time; this.currentPage = { x: posX, y: posY, pageX: x, pageY: y }; this.scrollTo(posX, posY, time, easing); }, next: function (time, easing) { var x = this.currentPage.pageX, y = this.currentPage.pageY; x++; if ( x >= this.pages.length && this.hasVerticalScroll ) { x = 0; y++; } this.goToPage(x, y, time, easing); }, prev: function (time, easing) { var x = this.currentPage.pageX, y = this.currentPage.pageY; x--; if ( x < 0 && this.hasVerticalScroll ) { x = 0; y--; } this.goToPage(x, y, time, easing); }, _initKeys: function (e) { // default key bindings var keys = { pageUp: 33, pageDown: 34, end: 35, home: 36, left: 37, up: 38, right: 39, down: 40 }; var i; // if you give me characters I give you keycode if ( typeof this.options.keyBindings == 'object' ) { for ( i in this.options.keyBindings ) { if ( typeof this.options.keyBindings[i] == 'string' ) { this.options.keyBindings[i] = this.options.keyBindings[i].toUpperCase().charCodeAt(0); } } } else { this.options.keyBindings = {}; } for ( i in keys ) { this.options.keyBindings[i] = this.options.keyBindings[i] || keys[i]; } utils.addEvent(window, 'keydown', this); this.on('destroy', function () { utils.removeEvent(window, 'keydown', this); }); }, _key: function (e) { if ( !this.enabled ) { return; } var snap = this.options.snap, // we are using this alot, better to cache it newX = snap ? this.currentPage.pageX : this.x, newY = snap ? this.currentPage.pageY : this.y, now = utils.getTime(), prevTime = this.keyTime || 0, acceleration = 0.250, pos; if ( this.options.useTransition && this.isInTransition ) { pos = this.getComputedPosition(); this._translate(Math.round(pos.x), Math.round(pos.y)); this.isInTransition = false; } this.keyAcceleration = now - prevTime < 200 ? Math.min(this.keyAcceleration + acceleration, 50) : 0; switch ( e.keyCode ) { case this.options.keyBindings.pageUp: if ( this.hasHorizontalScroll && !this.hasVerticalScroll ) { newX += snap ? 1 : this.wrapperWidth; } else { newY += snap ? 1 : this.wrapperHeight; } break; case this.options.keyBindings.pageDown: if ( this.hasHorizontalScroll && !this.hasVerticalScroll ) { newX -= snap ? 1 : this.wrapperWidth; } else { newY -= snap ? 1 : this.wrapperHeight; } break; case this.options.keyBindings.end: newX = snap ? this.pages.length-1 : this.maxScrollX; newY = snap ? this.pages[0].length-1 : this.maxScrollY; break; case this.options.keyBindings.home: newX = 0; newY = 0; break; case this.options.keyBindings.left: newX += snap ? -1 : 5 + this.keyAcceleration>>0; break; case this.options.keyBindings.up: newY += snap ? 1 : 5 + this.keyAcceleration>>0; break; case this.options.keyBindings.right: newX -= snap ? -1 : 5 + this.keyAcceleration>>0; break; case this.options.keyBindings.down: newY -= snap ? 1 : 5 + this.keyAcceleration>>0; break; default: return; } if ( snap ) { this.goToPage(newX, newY); return; } if ( newX > 0 ) { newX = 0; this.keyAcceleration = 0; } else if ( newX < this.maxScrollX ) { newX = this.maxScrollX; this.keyAcceleration = 0; } if ( newY > 0 ) { newY = 0; this.keyAcceleration = 0; } else if ( newY < this.maxScrollY ) { newY = this.maxScrollY; this.keyAcceleration = 0; } this.scrollTo(newX, newY, 0); this.keyTime = now; }, _animate: function (destX, destY, duration, easingFn) { var that = this, startX = this.x, startY = this.y, startTime = utils.getTime(), destTime = startTime + duration; function step () { var now = utils.getTime(), newX, newY, easing; if ( now >= destTime ) { that.isAnimating = false; that._translate(destX, destY); if ( !that.resetPosition(that.options.bounceTime) ) { that._execEvent('scrollEnd'); } return; } now = ( now - startTime ) / duration; easing = easingFn(now); newX = ( destX - startX ) * easing + startX; newY = ( destY - startY ) * easing + startY; that._translate(newX, newY); if ( that.isAnimating ) { rAF(step); } if ( that.options.probeType == 3 ) { that._execEvent('scroll'); } } this.isAnimating = true; step(); }, handleEvent: function (e) { switch ( e.type ) { case 'touchstart': case 'pointerdown': case 'MSPointerDown': case 'mousedown': this._start(e); break; case 'touchmove': case 'pointermove': case 'MSPointerMove': case 'mousemove': this._move(e); break; case 'touchend': case 'pointerup': case 'MSPointerUp': case 'mouseup': case 'touchcancel': case 'pointercancel': case 'MSPointerCancel': case 'mousecancel': this._end(e); break; case 'orientationchange': case 'resize': this._resize(); break; case 'transitionend': case 'webkitTransitionEnd': case 'oTransitionEnd': case 'MSTransitionEnd': this._transitionEnd(e); break; case 'wheel': case 'DOMMouseScroll': case 'mousewheel': this._wheel(e); break; case 'keydown': this._key(e); break; case 'click': if ( !e._constructed ) { e.preventDefault(); e.stopPropagation(); } break; } } }; function createDefaultScrollbar (direction, interactive, type) { var scrollbar = document.createElement('div'), indicator = document.createElement('div'); if ( type === true ) { scrollbar.style.cssText = 'position:absolute;z-index:9999'; indicator.style.cssText = '-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px'; } indicator.className = 'iScrollIndicator'; if ( direction == 'h' ) { if ( type === true ) { scrollbar.style.cssText += ';height:7px;left:2px;right:2px;bottom:0'; indicator.style.height = '100%'; } scrollbar.className = 'iScrollHorizontalScrollbar'; } else { if ( type === true ) { scrollbar.style.cssText += ';width:7px;bottom:2px;top:2px;right:1px'; indicator.style.width = '100%'; } scrollbar.className = 'iScrollVerticalScrollbar'; } scrollbar.style.cssText += ';overflow:hidden'; if ( !interactive ) { scrollbar.style.pointerEvents = 'none'; } scrollbar.appendChild(indicator); return scrollbar; } function Indicator (scroller, options) { this.wrapper = typeof options.el == 'string' ? document.querySelector(options.el) : options.el; this.wrapperStyle = this.wrapper.style; this.indicator = this.wrapper.children[0]; this.indicatorStyle = this.indicator.style; this.scroller = scroller; this.options = { listenX: true, listenY: true, interactive: false, resize: true, defaultScrollbars: false, shrink: false, fade: false, speedRatioX: 0, speedRatioY: 0 }; for ( var i in options ) { this.options[i] = options[i]; } this.sizeRatioX = 1; this.sizeRatioY = 1; this.maxPosX = 0; this.maxPosY = 0; if ( this.options.interactive ) { if ( !this.options.disableTouch ) { utils.addEvent(this.indicator, 'touchstart', this); utils.addEvent(window, 'touchend', this); } if ( !this.options.disablePointer ) { utils.addEvent(this.indicator, utils.prefixPointerEvent('pointerdown'), this); utils.addEvent(window, utils.prefixPointerEvent('pointerup'), this); } if ( !this.options.disableMouse ) { utils.addEvent(this.indicator, 'mousedown', this); utils.addEvent(window, 'mouseup', this); } } if ( this.options.fade ) { this.wrapperStyle[utils.style.transform] = this.scroller.translateZ; this.wrapperStyle[utils.style.transitionDuration] = utils.isBadAndroid ? '0.001s' : '0ms'; this.wrapperStyle.opacity = '0'; } } Indicator.prototype = { handleEvent: function (e) { switch ( e.type ) { case 'touchstart': case 'pointerdown': case 'MSPointerDown': case 'mousedown': this._start(e); break; case 'touchmove': case 'pointermove': case 'MSPointerMove': case 'mousemove': this._move(e); break; case 'touchend': case 'pointerup': case 'MSPointerUp': case 'mouseup': case 'touchcancel': case 'pointercancel': case 'MSPointerCancel': case 'mousecancel': this._end(e); break; } }, destroy: function () { if ( this.options.interactive ) { utils.removeEvent(this.indicator, 'touchstart', this); utils.removeEvent(this.indicator, utils.prefixPointerEvent('pointerdown'), this); utils.removeEvent(this.indicator, 'mousedown', this); utils.removeEvent(window, 'touchmove', this); utils.removeEvent(window, utils.prefixPointerEvent('pointermove'), this); utils.removeEvent(window, 'mousemove', this); utils.removeEvent(window, 'touchend', this); utils.removeEvent(window, utils.prefixPointerEvent('pointerup'), this); utils.removeEvent(window, 'mouseup', this); } if ( this.options.defaultScrollbars ) { this.wrapper.parentNode.removeChild(this.wrapper); } }, _start: function (e) { var point = e.touches ? e.touches[0] : e; e.preventDefault(); e.stopPropagation(); this.transitionTime(); this.initiated = true; this.moved = false; this.lastPointX = point.pageX; this.lastPointY = point.pageY; this.startTime = utils.getTime(); if ( !this.options.disableTouch ) { utils.addEvent(window, 'touchmove', this); } if ( !this.options.disablePointer ) { utils.addEvent(window, utils.prefixPointerEvent('pointermove'), this); } if ( !this.options.disableMouse ) { utils.addEvent(window, 'mousemove', this); } this.scroller._execEvent('beforeScrollStart'); }, _move: function (e) { var point = e.touches ? e.touches[0] : e, deltaX, deltaY, newX, newY, timestamp = utils.getTime(); if ( !this.moved ) { this.scroller._execEvent('scrollStart'); } this.moved = true; deltaX = point.pageX - this.lastPointX; this.lastPointX = point.pageX; deltaY = point.pageY - this.lastPointY; this.lastPointY = point.pageY; newX = this.x + deltaX; newY = this.y + deltaY; this._pos(newX, newY); if ( this.scroller.options.probeType == 1 && timestamp - this.startTime > 300 ) { this.startTime = timestamp; this.scroller._execEvent('scroll'); } else if ( this.scroller.options.probeType > 1 ) { this.scroller._execEvent('scroll'); } // INSERT POINT: indicator._move e.preventDefault(); e.stopPropagation(); }, _end: function (e) { if ( !this.initiated ) { return; } this.initiated = false; e.preventDefault(); e.stopPropagation(); utils.removeEvent(window, 'touchmove', this); utils.removeEvent(window, utils.prefixPointerEvent('pointermove'), this); utils.removeEvent(window, 'mousemove', this); if ( this.scroller.options.snap ) { var snap = this.scroller._nearestSnap(this.scroller.x, this.scroller.y); var time = this.options.snapSpeed || Math.max( Math.max( Math.min(Math.abs(this.scroller.x - snap.x), 1000), Math.min(Math.abs(this.scroller.y - snap.y), 1000) ), 300); if ( this.scroller.x != snap.x || this.scroller.y != snap.y ) { this.scroller.directionX = 0; this.scroller.directionY = 0; this.scroller.currentPage = snap; this.scroller.scrollTo(snap.x, snap.y, time, this.scroller.options.bounceEasing); } } if ( this.moved ) { this.scroller._execEvent('scrollEnd'); } }, transitionTime: function (time) { time = time || 0; this.indicatorStyle[utils.style.transitionDuration] = time + 'ms'; if ( !time && utils.isBadAndroid ) { this.indicatorStyle[utils.style.transitionDuration] = '0.001s'; } }, transitionTimingFunction: function (easing) { this.indicatorStyle[utils.style.transitionTimingFunction] = easing; }, refresh: function () { this.transitionTime(); if ( this.options.listenX && !this.options.listenY ) { this.indicatorStyle.display = this.scroller.hasHorizontalScroll ? 'block' : 'none'; } else if ( this.options.listenY && !this.options.listenX ) { this.indicatorStyle.display = this.scroller.hasVerticalScroll ? 'block' : 'none'; } else { this.indicatorStyle.display = this.scroller.hasHorizontalScroll || this.scroller.hasVerticalScroll ? 'block' : 'none'; } if ( this.scroller.hasHorizontalScroll && this.scroller.hasVerticalScroll ) { utils.addClass(this.wrapper, 'iScrollBothScrollbars'); utils.removeClass(this.wrapper, 'iScrollLoneScrollbar'); if ( this.options.defaultScrollbars && this.options.customStyle ) { if ( this.options.listenX ) { this.wrapper.style.right = '8px'; } else { this.wrapper.style.bottom = '8px'; } } } else { utils.removeClass(this.wrapper, 'iScrollBothScrollbars'); utils.addClass(this.wrapper, 'iScrollLoneScrollbar'); if ( this.options.defaultScrollbars && this.options.customStyle ) { if ( this.options.listenX ) { this.wrapper.style.right = '2px'; } else { this.wrapper.style.bottom = '2px'; } } } var r = this.wrapper.offsetHeight; // force refresh if ( this.options.listenX ) { this.wrapperWidth = this.wrapper.clientWidth; if ( this.options.resize ) { this.indicatorWidth = Math.max(Math.round(this.wrapperWidth * this.wrapperWidth / (this.scroller.scrollerWidth || this.wrapperWidth || 1)), 8); this.indicatorStyle.width = this.indicatorWidth + 'px'; } else { this.indicatorWidth = this.indicator.clientWidth; } this.maxPosX = this.wrapperWidth - this.indicatorWidth; if ( this.options.shrink == 'clip' ) { this.minBoundaryX = -this.indicatorWidth + 8; this.maxBoundaryX = this.wrapperWidth - 8; } else { this.minBoundaryX = 0; this.maxBoundaryX = this.maxPosX; } this.sizeRatioX = this.options.speedRatioX || (this.scroller.maxScrollX && (this.maxPosX / this.scroller.maxScrollX)); } if ( this.options.listenY ) { this.wrapperHeight = this.wrapper.clientHeight; if ( this.options.resize ) { this.indicatorHeight = Math.max(Math.round(this.wrapperHeight * this.wrapperHeight / (this.scroller.scrollerHeight || this.wrapperHeight || 1)), 8); this.indicatorStyle.height = this.indicatorHeight + 'px'; } else { this.indicatorHeight = this.indicator.clientHeight; } this.maxPosY = this.wrapperHeight - this.indicatorHeight; if ( this.options.shrink == 'clip' ) { this.minBoundaryY = -this.indicatorHeight + 8; this.maxBoundaryY = this.wrapperHeight - 8; } else { this.minBoundaryY = 0; this.maxBoundaryY = this.maxPosY; } this.maxPosY = this.wrapperHeight - this.indicatorHeight; this.sizeRatioY = this.options.speedRatioY || (this.scroller.maxScrollY && (this.maxPosY / this.scroller.maxScrollY)); } this.updatePosition(); }, updatePosition: function () { var x = this.options.listenX && Math.round(this.sizeRatioX * this.scroller.x) || 0, y = this.options.listenY && Math.round(this.sizeRatioY * this.scroller.y) || 0; if ( !this.options.ignoreBoundaries ) { if ( x < this.minBoundaryX ) { if ( this.options.shrink == 'scale' ) { this.width = Math.max(this.indicatorWidth + x, 8); this.indicatorStyle.width = this.width + 'px'; } x = this.minBoundaryX; } else if ( x > this.maxBoundaryX ) { if ( this.options.shrink == 'scale' ) { this.width = Math.max(this.indicatorWidth - (x - this.maxPosX), 8); this.indicatorStyle.width = this.width + 'px'; x = this.maxPosX + this.indicatorWidth - this.width; } else { x = this.maxBoundaryX; } } else if ( this.options.shrink == 'scale' && this.width != this.indicatorWidth ) { this.width = this.indicatorWidth; this.indicatorStyle.width = this.width + 'px'; } if ( y < this.minBoundaryY ) { if ( this.options.shrink == 'scale' ) { this.height = Math.max(this.indicatorHeight + y * 3, 8); this.indicatorStyle.height = this.height + 'px'; } y = this.minBoundaryY; } else if ( y > this.maxBoundaryY ) { if ( this.options.shrink == 'scale' ) { this.height = Math.max(this.indicatorHeight - (y - this.maxPosY) * 3, 8); this.indicatorStyle.height = this.height + 'px'; y = this.maxPosY + this.indicatorHeight - this.height; } else { y = this.maxBoundaryY; } } else if ( this.options.shrink == 'scale' && this.height != this.indicatorHeight ) { this.height = this.indicatorHeight; this.indicatorStyle.height = this.height + 'px'; } } this.x = x; this.y = y; if ( this.scroller.options.useTransform ) { this.indicatorStyle[utils.style.transform] = 'translate(' + x + 'px,' + y + 'px)' + this.scroller.translateZ; } else { this.indicatorStyle.left = x + 'px'; this.indicatorStyle.top = y + 'px'; } }, _pos: function (x, y) { if ( x < 0 ) { x = 0; } else if ( x > this.maxPosX ) { x = this.maxPosX; } if ( y < 0 ) { y = 0; } else if ( y > this.maxPosY ) { y = this.maxPosY; } x = this.options.listenX ? Math.round(x / this.sizeRatioX) : this.scroller.x; y = this.options.listenY ? Math.round(y / this.sizeRatioY) : this.scroller.y; this.scroller.scrollTo(x, y); }, fade: function (val, hold) { if ( hold && !this.visible ) { return; } clearTimeout(this.fadeTimeout); this.fadeTimeout = null; var time = val ? 250 : 500, delay = val ? 0 : 300; val = val ? '1' : '0'; this.wrapperStyle[utils.style.transitionDuration] = time + 'ms'; this.fadeTimeout = setTimeout((function (val) { this.wrapperStyle.opacity = val; this.visible = +val; }).bind(this, val), delay); } }; IScroll.utils = utils; if ( typeof module != 'undefined' && module.exports ) { module.exports = IScroll; } else { window.IScroll = IScroll; } })(window, document, Math);
{ "pile_set_name": "Github" }
#ifndef BOOST_MPL_VECTOR_VECTOR20_HPP_INCLUDED #define BOOST_MPL_VECTOR_VECTOR20_HPP_INCLUDED // Copyright Aleksey Gurtovoy 2000-2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/mpl for documentation. // $Id$ // $Date$ // $Revision$ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/vector/vector10.hpp> #endif #include <boost/mpl/aux_/config/use_preprocessed.hpp> #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ && !defined(BOOST_MPL_PREPROCESSING_MODE) # define BOOST_MPL_PREPROCESSED_HEADER vector20.hpp # include <boost/mpl/vector/aux_/include_preprocessed.hpp> #else # include <boost/mpl/aux_/config/typeof.hpp> # include <boost/mpl/aux_/config/ctps.hpp> # include <boost/preprocessor/iterate.hpp> namespace boost { namespace mpl { # define BOOST_PP_ITERATION_PARAMS_1 \ (3,(11, 20, <boost/mpl/vector/aux_/numbered.hpp>)) # include BOOST_PP_ITERATE() }} #endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS #endif // BOOST_MPL_VECTOR_VECTOR20_HPP_INCLUDED
{ "pile_set_name": "Github" }
// Copyright 2008 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. var x; // Converts a number to string respecting -0. function stringify(n) { if ((1 / n) === -Infinity) return "-0"; return String(n); } function f(expected, y) { function testEval(string, x, y) { var mulFunction = Function("x, y", "return " + string); return mulFunction(x, y); } function mulTest(expected, x, y) { assertEquals(expected, x * y); assertEquals(expected, testEval(stringify(x) + " * y", x, y)); assertEquals(expected, testEval("x * " + stringify(y), x, y)); assertEquals(expected, testEval(stringify(x) + " * " + stringify(y), x, y)); } mulTest(expected, x, y); mulTest(-expected, -x, y); mulTest(-expected, x, -y); mulTest(expected, -x, -y); if (x === y) return; // Symmetric cases not necessary. mulTest(expected, y, x); mulTest(-expected, -y, x); mulTest(-expected, y, -x); mulTest(expected, -y, -x); } x = 134217728; f(0, 0); f(134217728, 1); f(268435456, 2); f(402653184, 3); f(536870912, 4); f(671088640, 5); f(939524096, 7); f(1073741824, 8); f(1207959552, 9); f(2013265920, 15); f(2147483648, 16); f(2281701376, 17); f(4160749568, 31); f(4294967296, 32); f(4429185024, 33); f(8455716864, 63); f(8589934592, 64); f(8724152320, 65); f(17045651456, 127); f(17179869184, 128); f(17314086912, 129); f(34225520640, 255); f(34359738368, 256); f(34493956096, 257); f(68585259008, 511); f(68719476736, 512); f(68853694464, 513); f(137304735744, 1023); f(137438953472, 1024); f(137573171200, 1025); f(274743689216, 2047); f(274877906944, 2048); f(275012124672, 2049); f(549621596160, 4095); f(549755813888, 4096); f(549890031616, 4097); f(1099377410048, 8191); f(1099511627776, 8192); f(1099645845504, 8193); f(2198889037824, 16383); f(2199023255552, 16384); f(2199157473280, 16385); f(4397912293376, 32767); f(4398046511104, 32768); f(4398180728832, 32769); f(8795958804480, 65535); f(8796093022208, 65536); f(8796227239936, 65537); f(17592051826688, 131071); f(17592186044416, 131072); f(17592320262144, 131073); f(35184237871104, 262143); f(35184372088832, 262144); f(35184506306560, 262145); f(70368609959936, 524287); f(70368744177664, 524288); f(70368878395392, 524289); f(140737354137600, 1048575); f(140737488355328, 1048576); f(140737622573056, 1048577); f(281474842492928, 2097151); f(281474976710656, 2097152); f(281475110928384, 2097153); f(562949819203584, 4194303); f(562949953421312, 4194304); f(562950087639040, 4194305); f(1125899772624896, 8388607); f(1125899906842624, 8388608); f(1125900041060352, 8388609); x = 134217729; f(0, 0); f(134217729, 1); f(268435458, 2); f(402653187, 3); f(536870916, 4); f(671088645, 5); f(939524103, 7); f(1073741832, 8); f(1207959561, 9); f(2013265935, 15); f(2147483664, 16); f(2281701393, 17); f(4160749599, 31); f(4294967328, 32); f(4429185057, 33); f(8455716927, 63); f(8589934656, 64); f(8724152385, 65); f(17045651583, 127); f(17179869312, 128); f(17314087041, 129); f(34225520895, 255); f(34359738624, 256); f(34493956353, 257); f(68585259519, 511); f(68719477248, 512); f(68853694977, 513); f(137304736767, 1023); f(137438954496, 1024); f(137573172225, 1025); f(274743691263, 2047); f(274877908992, 2048); f(275012126721, 2049); f(549621600255, 4095); f(549755817984, 4096); f(549890035713, 4097); f(1099377418239, 8191); f(1099511635968, 8192); f(1099645853697, 8193); f(2198889054207, 16383); f(2199023271936, 16384); f(2199157489665, 16385); f(4397912326143, 32767); f(4398046543872, 32768); f(4398180761601, 32769); f(8795958870015, 65535); f(8796093087744, 65536); f(8796227305473, 65537); f(17592051957759, 131071); f(17592186175488, 131072); f(17592320393217, 131073); f(35184238133247, 262143); f(35184372350976, 262144); f(35184506568705, 262145); f(70368610484223, 524287); f(70368744701952, 524288); f(70368878919681, 524289); f(140737355186175, 1048575); f(140737489403904, 1048576); f(140737623621633, 1048577); f(281474844590079, 2097151); f(281474978807808, 2097152); f(281475113025537, 2097153); f(562949823397887, 4194303); f(562949957615616, 4194304); f(562950091833345, 4194305); f(1125899781013503, 8388607); f(1125899915231232, 8388608); f(1125900049448961, 8388609); x = 268435455; f(0, 0); f(268435455, 1); f(536870910, 2); f(805306365, 3); f(1073741820, 4); f(1342177275, 5); f(1879048185, 7); f(2147483640, 8); f(2415919095, 9); f(4026531825, 15); f(4294967280, 16); f(4563402735, 17); f(8321499105, 31); f(8589934560, 32); f(8858370015, 33); f(16911433665, 63); f(17179869120, 64); f(17448304575, 65); f(34091302785, 127); f(34359738240, 128); f(34628173695, 129); f(68451041025, 255); f(68719476480, 256); f(68987911935, 257); f(137170517505, 511); f(137438952960, 512); f(137707388415, 513); f(274609470465, 1023); f(274877905920, 1024); f(275146341375, 1025); f(549487376385, 2047); f(549755811840, 2048); f(550024247295, 2049); f(1099243188225, 4095); f(1099511623680, 4096); f(1099780059135, 4097); f(2198754811905, 8191); f(2199023247360, 8192); f(2199291682815, 8193); f(4397778059265, 16383); f(4398046494720, 16384); f(4398314930175, 16385); f(8795824553985, 32767); f(8796092989440, 32768); f(8796361424895, 32769); f(17591917543425, 65535); f(17592185978880, 65536); f(17592454414335, 65537); f(35184103522305, 131071); f(35184371957760, 131072); f(35184640393215, 131073); f(70368475480065, 262143); f(70368743915520, 262144); f(70369012350975, 262145); f(140737219395585, 524287); f(140737487831040, 524288); f(140737756266495, 524289); f(281474707226625, 1048575); f(281474975662080, 1048576); f(281475244097535, 1048577); f(562949682888705, 2097151); f(562949951324160, 2097152); f(562950219759615, 2097153); f(1125899634212865, 4194303); f(1125899902648320, 4194304); f(1125900171083775, 4194305); x = 268435456; f(0, 0); f(268435456, 1); f(536870912, 2); f(805306368, 3); f(1073741824, 4); f(1342177280, 5); f(1879048192, 7); f(2147483648, 8); f(2415919104, 9); f(4026531840, 15); f(4294967296, 16); f(4563402752, 17); f(8321499136, 31); f(8589934592, 32); f(8858370048, 33); f(16911433728, 63); f(17179869184, 64); f(17448304640, 65); f(34091302912, 127); f(34359738368, 128); f(34628173824, 129); f(68451041280, 255); f(68719476736, 256); f(68987912192, 257); f(137170518016, 511); f(137438953472, 512); f(137707388928, 513); f(274609471488, 1023); f(274877906944, 1024); f(275146342400, 1025); f(549487378432, 2047); f(549755813888, 2048); f(550024249344, 2049); f(1099243192320, 4095); f(1099511627776, 4096); f(1099780063232, 4097); f(2198754820096, 8191); f(2199023255552, 8192); f(2199291691008, 8193); f(4397778075648, 16383); f(4398046511104, 16384); f(4398314946560, 16385); f(8795824586752, 32767); f(8796093022208, 32768); f(8796361457664, 32769); f(17591917608960, 65535); f(17592186044416, 65536); f(17592454479872, 65537); f(35184103653376, 131071); f(35184372088832, 131072); f(35184640524288, 131073); f(70368475742208, 262143); f(70368744177664, 262144); f(70369012613120, 262145); f(140737219919872, 524287); f(140737488355328, 524288); f(140737756790784, 524289); f(281474708275200, 1048575); f(281474976710656, 1048576); f(281475245146112, 1048577); f(562949684985856, 2097151); f(562949953421312, 2097152); f(562950221856768, 2097153); f(1125899638407168, 4194303); f(1125899906842624, 4194304); f(1125900175278080, 4194305); x = 268435457; f(0, 0); f(268435457, 1); f(536870914, 2); f(805306371, 3); f(1073741828, 4); f(1342177285, 5); f(1879048199, 7); f(2147483656, 8); f(2415919113, 9); f(4026531855, 15); f(4294967312, 16); f(4563402769, 17); f(8321499167, 31); f(8589934624, 32); f(8858370081, 33); f(16911433791, 63); f(17179869248, 64); f(17448304705, 65); f(34091303039, 127); f(34359738496, 128); f(34628173953, 129); f(68451041535, 255); f(68719476992, 256); f(68987912449, 257); f(137170518527, 511); f(137438953984, 512); f(137707389441, 513); f(274609472511, 1023); f(274877907968, 1024); f(275146343425, 1025); f(549487380479, 2047); f(549755815936, 2048); f(550024251393, 2049); f(1099243196415, 4095); f(1099511631872, 4096); f(1099780067329, 4097); f(2198754828287, 8191); f(2199023263744, 8192); f(2199291699201, 8193); f(4397778092031, 16383); f(4398046527488, 16384); f(4398314962945, 16385); f(8795824619519, 32767); f(8796093054976, 32768); f(8796361490433, 32769); f(17591917674495, 65535); f(17592186109952, 65536); f(17592454545409, 65537); f(35184103784447, 131071); f(35184372219904, 131072); f(35184640655361, 131073); f(70368476004351, 262143); f(70368744439808, 262144); f(70369012875265, 262145); f(140737220444159, 524287); f(140737488879616, 524288); f(140737757315073, 524289); f(281474709323775, 1048575); f(281474977759232, 1048576); f(281475246194689, 1048577); f(562949687083007, 2097151); f(562949955518464, 2097152); f(562950223953921, 2097153); f(1125899642601471, 4194303); f(1125899911036928, 4194304); f(1125900179472385, 4194305); x = 536870911; f(0, 0); f(536870911, 1); f(1073741822, 2); f(1610612733, 3); f(2147483644, 4); f(2684354555, 5); f(3758096377, 7); f(4294967288, 8); f(4831838199, 9); f(8053063665, 15); f(8589934576, 16); f(9126805487, 17); f(16642998241, 31); f(17179869152, 32); f(17716740063, 33); f(33822867393, 63); f(34359738304, 64); f(34896609215, 65); f(68182605697, 127); f(68719476608, 128); f(69256347519, 129); f(136902082305, 255); f(137438953216, 256); f(137975824127, 257); f(274341035521, 511); f(274877906432, 512); f(275414777343, 513); f(549218941953, 1023); f(549755812864, 1024); f(550292683775, 1025); f(1098974754817, 2047); f(1099511625728, 2048); f(1100048496639, 2049); f(2198486380545, 4095); f(2199023251456, 4096); f(2199560122367, 4097); f(4397509632001, 8191); f(4398046502912, 8192); f(4398583373823, 8193); f(8795556134913, 16383); f(8796093005824, 16384); f(8796629876735, 16385); f(17591649140737, 32767); f(17592186011648, 32768); f(17592722882559, 32769); f(35183835152385, 65535); f(35184372023296, 65536); f(35184908894207, 65537); f(70368207175681, 131071); f(70368744046592, 131072); f(70369280917503, 131073); f(140736951222273, 262143); f(140737488093184, 262144); f(140738024964095, 262145); f(281474439315457, 524287); f(281474976186368, 524288); f(281475513057279, 524289); f(562949415501825, 1048575); f(562949952372736, 1048576); f(562950489243647, 1048577); f(1125899367874561, 2097151); f(1125899904745472, 2097152); f(1125900441616383, 2097153); x = 536870912; f(0, 0); f(536870912, 1); f(1073741824, 2); f(1610612736, 3); f(2147483648, 4); f(2684354560, 5); f(3758096384, 7); f(4294967296, 8); f(4831838208, 9); f(8053063680, 15); f(8589934592, 16); f(9126805504, 17); f(16642998272, 31); f(17179869184, 32); f(17716740096, 33); f(33822867456, 63); f(34359738368, 64); f(34896609280, 65); f(68182605824, 127); f(68719476736, 128); f(69256347648, 129); f(136902082560, 255); f(137438953472, 256); f(137975824384, 257); f(274341036032, 511); f(274877906944, 512); f(275414777856, 513); f(549218942976, 1023); f(549755813888, 1024); f(550292684800, 1025); f(1098974756864, 2047); f(1099511627776, 2048); f(1100048498688, 2049); f(2198486384640, 4095); f(2199023255552, 4096); f(2199560126464, 4097); f(4397509640192, 8191); f(4398046511104, 8192); f(4398583382016, 8193); f(8795556151296, 16383); f(8796093022208, 16384); f(8796629893120, 16385); f(17591649173504, 32767); f(17592186044416, 32768); f(17592722915328, 32769); f(35183835217920, 65535); f(35184372088832, 65536); f(35184908959744, 65537); f(70368207306752, 131071); f(70368744177664, 131072); f(70369281048576, 131073); f(140736951484416, 262143); f(140737488355328, 262144); f(140738025226240, 262145); f(281474439839744, 524287); f(281474976710656, 524288); f(281475513581568, 524289); f(562949416550400, 1048575); f(562949953421312, 1048576); f(562950490292224, 1048577); f(1125899369971712, 2097151); f(1125899906842624, 2097152); f(1125900443713536, 2097153);
{ "pile_set_name": "Github" }
<?php /* * Copyright 2014 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ class Google_Service_Books_VolumeSaleInfoOffersRetailPrice extends Google_Model { public $amountInMicros; public $currencyCode; public function setAmountInMicros($amountInMicros) { $this->amountInMicros = $amountInMicros; } public function getAmountInMicros() { return $this->amountInMicros; } public function setCurrencyCode($currencyCode) { $this->currencyCode = $currencyCode; } public function getCurrencyCode() { return $this->currencyCode; } }
{ "pile_set_name": "Github" }
#include "gpsim_assert.h" // Shift ints left and right unsigned char failures=0; unsigned int aint0 = 0; unsigned int aint1 = 0; unsigned char achar0 = 0; unsigned char achar1 = 0; unsigned char achar2 = 0; unsigned char achar3 = 0; void done() { ASSERT(MANGLE(failures) == 0); PASSED(); } void shift_int_left_1(void) { aint0 <<= 1; } void shift_int_left_2(void) { aint0 <<= 2; } void shift_int_left_3(void) { aint0 <<= 3; } void shift_int_left_4(void) { aint0 <<= 4; } void shift_int_left_5(void) { aint0 <<= 5; } void shift_int_left_6(void) { aint0 <<= 6; } void shift_int_left_7(void) { aint0 <<= 7; } void shift_int_left_8(void) { aint0 <<= 8; } void shift_int_left_9(void) { aint0 <<= 9; } void shift_int_left_10(void) { aint0 <<= 10; } void shift_int_left_11(void) { aint0 <<= 11; } void shift_int_left_12(void) { aint0 <<= 12; } void shift_int_left_13(void) { aint0 <<= 13; } void shift_int_left_14(void) { aint0 <<= 14; } void shift_int_left_15(void) { aint0 <<= 15; } /*****************************************************/ void shift_int_right_1(void) { aint0 >>= 1; } void shift_int_right_2(void) { aint0 >>= 2; } void shift_int_right_3(void) { aint0 >>= 3; } void shift_int_right_4(void) { aint0 >>= 4; } void shift_int_right_5(void) { aint0 >>= 5; } void shift_int_right_6(void) { aint0 >>= 6; } void shift_int_right_7(void) { aint0 >>= 7; } void shift_int_right_8(void) { aint0 >>= 8; } void shift_int_right_9(void) { aint0 >>= 9; } void shift_int_right_10(void) { aint0 >>= 10; } void shift_int_right_11(void) { aint0 >>= 11; } void shift_int_right_12(void) { aint0 >>= 12; } void shift_int_right_13(void) { aint0 >>= 13; } void shift_int_right_14(void) { aint0 >>= 14; } void shift_int_right_15(void) { aint0 >>= 15; } /*****************************************************/ void main(void) { //char i; aint0 = 0xabcd; shift_int_left_1(); if(aint0 != 0x579a) failures++; aint0 = 0xabcd; shift_int_left_2(); if(aint0 != 0xaf34) failures++; aint0 = 0xabcd; shift_int_left_3(); if(aint0 != 0x5e68) failures++; aint0 = 0xabcd; shift_int_left_4(); if(aint0 != 0xbcd0) failures++; aint0 = 0xabcd; shift_int_left_5(); if(aint0 != 0x79a0) failures++; aint0 = 0xabcd; shift_int_left_6(); if(aint0 != 0xf340) failures++; aint0 = 0xabcd; shift_int_left_7(); if(aint0 != 0xe680) failures++; aint0 = 0xabcd; shift_int_left_8(); if(aint0 != 0xcd00) failures++; aint0 = 0xabcd; shift_int_left_9(); if(aint0 != 0x9a00) failures++; aint0 = 0xabcd; shift_int_left_10(); if(aint0 != 0x3400) failures++; aint0 = 0xabcd; shift_int_left_11(); if(aint0 != 0x6800) failures++; aint0 = 0xabcd; shift_int_left_12(); if(aint0 != 0xd000) failures++; aint0 = 0xabcd; shift_int_left_13(); if(aint0 != 0xa000) failures++; aint0 = 0xabcd; shift_int_left_14(); if(aint0 != 0x4000) failures++; aint0 = 0xabcd; shift_int_left_15(); if(aint0 != 0x8000) failures++; /***********************/ aint0 = 0xabcd; shift_int_right_1(); if(aint0 != 0x55e6) failures++; aint0 = 0xabcd; shift_int_right_2(); if(aint0 != 0x2af3) failures++; aint0 = 0xabcd; shift_int_right_3(); if(aint0 != 0x1579) failures++; aint0 = 0xabcd; shift_int_right_4(); if(aint0 != 0x0abc) failures++; aint0 = 0xabcd; shift_int_right_5(); if(aint0 != 0x055e) failures++; aint0 = 0xabcd; shift_int_right_6(); if(aint0 != 0x02af) failures++; aint0 = 0xabcd; shift_int_right_7(); if(aint0 != 0x0157) failures++; aint0 = 0xabcd; shift_int_right_8(); if(aint0 != 0x00ab) failures++; aint0 = 0xabcd; shift_int_right_9(); if(aint0 != 0x0055) failures++; aint0 = 0xabcd; shift_int_right_10(); if(aint0 != 0x002a) failures++; aint0 = 0xabcd; shift_int_right_11(); if(aint0 != 0x0015) failures++; aint0 = 0xabcd; shift_int_right_12(); if(aint0 != 0x000a) failures++; aint0 = 0xabcd; shift_int_right_13(); if(aint0 != 0x0005) failures++; aint0 = 0xabcd; shift_int_right_14(); if(aint0 != 0x0002) failures++; aint0 = 0xabcd; shift_int_right_15(); if(aint0 != 0x0001) failures++; done(); }
{ "pile_set_name": "Github" }
FUNCTION NEVN(NODE,LUN,INV1,INV2,I1,I2,I3,USR) C$$$ SUBPROGRAM DOCUMENTATION BLOCK C C SUBPROGRAM: NEVN C PRGMMR: WOOLLEN ORG: NP20 DATE: 2003-11-04 C C ABSTRACT: THIS FUNCTION LOOKS FOR ALL STACKED DATA EVENTS FOR A C SPECIFIED DATA VALUE AND LEVEL WITHIN THE PORTION OF THE CURRENT C SUBSET BUFFER BOUNDED BY THE INDICES INV1 AND INV2. ALL SUCH C EVENTS ARE ACCUMULATED AND RETURNED TO THE CALLING PROGRAM WITHIN C ARRAY USR. THE VALUE OF THE FUNCTION ITSELF IS THE TOTAL NUMBER C OF EVENTS FOUND. C C PROGRAM HISTORY LOG: C 2003-11-04 J. WOOLLEN -- ORIGINAL AUTHOR (WAS IN VERIFICATION C VERSION) C 2003-11-04 D. KEYSER -- UNIFIED/PORTABLE FOR WRF; ADDED C DOCUMENTATION (INCLUDING HISTORY); OUTPUTS C MORE COMPLETE DIAGNOSTIC INFO WHEN ROUTINE C TERMINATES ABNORMALLY C 2009-03-31 J. WOOLLEN -- ADDED ADDITIONAL DOCUMENTATION C C USAGE: NEVN (NODE, LUN, INV1, INV2, I1, I2, I3, USR) C INPUT ARGUMENT LIST: C NODE - INTEGER: JUMP/LINK TABLE INDEX OF NODE TO RETURN C STACKED VALUES FOR C LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS C INV1 - INTEGER: STARTING INDEX OF THE PORTION OF THE SUBSET C BUFFER IN WHICH TO LOOK FOR STACK VALUES C INV2 - INTEGER: ENDING INDEX OF THE PORTION OF THE SUBSET C BUFFER IN WHICH TO LOOK FOR STACK VALUES C I1 - INTEGER: LENGTH OF FIRST DIMENSION OF USR C I2 - INTEGER: LENGTH OF SECOND DIMENSION OF USR C I3 - INTEGER: LENGTH OF THIRD DIMENSION OF USR C C OUTPUT ARGUMENT LIST: C USR - REAL*8:(I1,I2,I3) STARTING ADDRESS OF DATA VALUES READ C FROM DATA SUBSET, EVENTS ARE RETURNED IN THE THIRD C DIMENSION FOR A PARTICULAR DATA VALUE AND LEVEL IN THE C FIRST AND SECOND DIMENSIONS C NEVN - INTEGER: NUMBER OF EVENTS IN STACK (MUST BE LESS THAN C OR EQUAL TO I3) C C REMARKS: C IMPORTANT: THIS ROUTINE SHOULD ONLY BE CALLED BY ROUTINE UFBIN3, C WHICH, ITSELF, IS CALLED ONLY BY VERIFICATION C APPLICATION PROGRAM GRIDTOBS, WHERE IT WAS PREVIOUSLY C AN IN-LINE SUBROUTINE. IN GENERAL, NEVN DOES NOT WORK C PROPERLY IN OTHER APPLICATION PROGRAMS AT THIS TIME. C C THIS ROUTINE CALLS: BORT INVWIN LSTJPB C THIS ROUTINE IS CALLED BY: UFBIN3 C Should NOT be called by any C application programs!!! C C ATTRIBUTES: C LANGUAGE: FORTRAN 77 C MACHINE: PORTABLE TO ALL PLATFORMS C C$$$ INCLUDE 'bufrlib.prm' COMMON /USRINT/ NVAL(NFILES),INV(MAXSS,NFILES),VAL(MAXSS,NFILES) CHARACTER*128 BORT_STR DIMENSION USR(I1,I2,I3) REAL*8 VAL,USR C---------------------------------------------------------------------- C---------------------------------------------------------------------- NEVN = 0 C FIND THE ENCLOSING EVENT STACK DESCRIPTOR C ----------------------------------------- NDRS = LSTJPB(NODE,LUN,'DRS') IF(NDRS.LE.0) GOTO 100 INVN = INVWIN(NDRS,LUN,INV1,INV2) IF(INVN.EQ.0) GOTO 900 NEVN = VAL(INVN,LUN) IF(NEVN.GT.I3) GOTO 901 C SEARCH EACH STACK LEVEL FOR THE REQUESTED NODE AND COPY THE VALUE C ----------------------------------------------------------------- N2 = INVN + 1 DO L=1,NEVN N1 = N2 N2 = N2 + VAL(N1,LUN) DO N=N1,N2 IF(INV(N,LUN).EQ.NODE) USR(1,1,L) = VAL(N,LUN) ENDDO ENDDO C EXITS C ----- 100 RETURN 900 CALL BORT('BUFRLIB: NEVN - CAN''T FIND THE EVENT STACK!!!!!!') 901 WRITE(BORT_STR,'("BUFRLIB: NEVN - THE NO. OF EVENTS FOR THE '// . 'REQUESTED STACK (",I3,") EXCEEDS THE VALUE OF THE 3RD DIM. OF'// . ' THE USR ARRAY (",I3,")")') NEVN,I3 CALL BORT(BORT_STR) END
{ "pile_set_name": "Github" }
TEMPLATE = subdirs SUBDIRS = text
{ "pile_set_name": "Github" }
# Microsoft Developer Studio Project File - Name="blitz3d" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Static Library" 0x0104 CFG=blitz3d - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "blitz3d.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "blitz3d.mak" CFG="blitz3d - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "blitz3d - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "blitz3d - Win32 Debug" (based on "Win32 (x86) Static Library") !MESSAGE "blitz3d - Win32 Blitz3DRelease" (based on "Win32 (x86) Static Library") !MESSAGE "blitz3d - Win32 Blitz2DRelease" (based on "Win32 (x86) Static Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "blitz3d - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /Ob2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /Yu"std.h" /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo !ELSEIF "$(CFG)" == "blitz3d - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo !ELSEIF "$(CFG)" == "blitz3d - Win32 Blitz3DRelease" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "blitz3d___Win32_Blitz3DRelease" # PROP BASE Intermediate_Dir "blitz3d___Win32_Blitz3DRelease" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "blitz3d___Win32_Blitz3DRelease" # PROP Intermediate_Dir "blitz3d___Win32_Blitz3DRelease" # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /Ob2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /Yu"std.h" /FD /c # ADD CPP /nologo /G6 /Gz /MT /W3 /GX /O2 /Ob2 /D "_LIB" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "PRO" /FD /c # SUBTRACT CPP /YX /Yc /Yu # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo !ELSEIF "$(CFG)" == "blitz3d - Win32 Blitz2DRelease" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "blitz3d___Win32_Blitz2DRelease" # PROP BASE Intermediate_Dir "blitz3d___Win32_Blitz2DRelease" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "blitz3d___Win32_Blitz2DRelease" # PROP Intermediate_Dir "blitz3d___Win32_Blitz2DRelease" # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /Ob2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /Yu"std.h" /FD /c # ADD CPP /nologo /G6 /MT /W3 /GX /O2 /Ob2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /Yu"std.h" /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo !ENDIF # Begin Target # Name "blitz3d - Win32 Release" # Name "blitz3d - Win32 Debug" # Name "blitz3d - Win32 Blitz3DRelease" # Name "blitz3d - Win32 Blitz2DRelease" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=.\animation.cpp # End Source File # Begin Source File SOURCE=.\animator.cpp # End Source File # Begin Source File SOURCE=.\brush.cpp # End Source File # Begin Source File SOURCE=.\cachedtexture.cpp # End Source File # Begin Source File SOURCE=.\camera.cpp # End Source File # Begin Source File SOURCE=.\collision.cpp # End Source File # Begin Source File SOURCE=.\entity.cpp # End Source File # Begin Source File SOURCE=.\frustum.cpp # End Source File # Begin Source File SOURCE=.\geom.cpp # End Source File # Begin Source File SOURCE=.\light.cpp # End Source File # Begin Source File SOURCE=.\listener.cpp # End Source File # Begin Source File SOURCE=.\loader_3ds.cpp # End Source File # Begin Source File SOURCE=.\loader_b3d.cpp # End Source File # Begin Source File SOURCE=.\loader_x.cpp # End Source File # Begin Source File SOURCE=.\md2model.cpp # End Source File # Begin Source File SOURCE=.\md2norms.cpp # End Source File # Begin Source File SOURCE=.\md2rep.cpp # End Source File # Begin Source File SOURCE=.\meshcollider.cpp # End Source File # Begin Source File SOURCE=.\meshloader.cpp # End Source File # Begin Source File SOURCE=.\meshmodel.cpp # End Source File # Begin Source File SOURCE=.\meshutil.cpp # End Source File # Begin Source File SOURCE=.\mirror.cpp # End Source File # Begin Source File SOURCE=.\model.cpp # End Source File # Begin Source File SOURCE=.\object.cpp # End Source File # Begin Source File SOURCE=.\pivot.cpp # End Source File # Begin Source File SOURCE=.\planemodel.cpp # End Source File # Begin Source File SOURCE=.\q3bspmodel.cpp # End Source File # Begin Source File SOURCE=.\q3bsprep.cpp # End Source File # Begin Source File SOURCE=.\sprite.cpp # End Source File # Begin Source File SOURCE=.\std.cpp !IF "$(CFG)" == "blitz3d - Win32 Release" # ADD CPP /Yc"std.h" !ELSEIF "$(CFG)" == "blitz3d - Win32 Debug" !ELSEIF "$(CFG)" == "blitz3d - Win32 Blitz3DRelease" # ADD BASE CPP /Yc"std.h" # ADD CPP /Yc"std.h" !ELSEIF "$(CFG)" == "blitz3d - Win32 Blitz2DRelease" # ADD BASE CPP /Yc"std.h" # ADD CPP /Yc"std.h" !ENDIF # End Source File # Begin Source File SOURCE=.\surface.cpp # End Source File # Begin Source File SOURCE=.\terrain.cpp # End Source File # Begin Source File SOURCE=.\terrainrep.cpp # End Source File # Begin Source File SOURCE=.\texture.cpp # End Source File # Begin Source File SOURCE=.\world.cpp # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=.\animation.h # End Source File # Begin Source File SOURCE=.\animator.h # End Source File # Begin Source File SOURCE=.\blitz3d.h # End Source File # Begin Source File SOURCE=.\brush.h # End Source File # Begin Source File SOURCE=.\cachedtexture.h # End Source File # Begin Source File SOURCE=.\camera.h # End Source File # Begin Source File SOURCE=.\collision.h # End Source File # Begin Source File SOURCE=.\entity.h # End Source File # Begin Source File SOURCE=.\frustum.h # End Source File # Begin Source File SOURCE=.\geom.h # End Source File # Begin Source File SOURCE=.\light.h # End Source File # Begin Source File SOURCE=.\listener.h # End Source File # Begin Source File SOURCE=.\loader_3ds.h # End Source File # Begin Source File SOURCE=.\loader_b3d.h # End Source File # Begin Source File SOURCE=.\loader_x.h # End Source File # Begin Source File SOURCE=.\md2model.h # End Source File # Begin Source File SOURCE=.\md2norms.h # End Source File # Begin Source File SOURCE=.\md2rep.h # End Source File # Begin Source File SOURCE=.\meshcollider.h # End Source File # Begin Source File SOURCE=.\meshloader.h # End Source File # Begin Source File SOURCE=.\meshmodel.h # End Source File # Begin Source File SOURCE=.\meshutil.h # End Source File # Begin Source File SOURCE=.\mirror.h # End Source File # Begin Source File SOURCE=.\model.h # End Source File # Begin Source File SOURCE=.\object.h # End Source File # Begin Source File SOURCE=.\pivot.h # End Source File # Begin Source File SOURCE=.\planemodel.h # End Source File # Begin Source File SOURCE=.\q3bspmodel.h # End Source File # Begin Source File SOURCE=.\q3bsprep.h # End Source File # Begin Source File SOURCE=.\rendercontext.h # End Source File # Begin Source File SOURCE=.\sprite.h # End Source File # Begin Source File SOURCE=.\std.h # End Source File # Begin Source File SOURCE=.\surface.h # End Source File # Begin Source File SOURCE=.\terrain.h # End Source File # Begin Source File SOURCE=.\terrainrep.h # End Source File # Begin Source File SOURCE=.\texture.h # End Source File # Begin Source File SOURCE=.\world.h # End Source File # End Group # End Target # End Project
{ "pile_set_name": "Github" }
setwd(normalizePath(dirname(R.utils::commandArgs(asValues=TRUE)$"f"))) source("../../../scripts/h2o-r-test-setup.R") test.glm.interactions2 <- function() { h2o.glm(x=1:4,y=5,training_frame=as.h2o(iris[,c(5,1,2,3,4)]), interactions=c(1,2), lambda=0, standardize=FALSE) lm(Petal.Width ~ Petal.Length*Sepal.Width, data=iris) h2o.glm(y="Petal.Width", x=c("Petal.Length","Sepal.Width"), interactions=c("Petal.Length","Sepal.Width"), training_frame=as.h2o(iris), lambda=0, standardize=FALSE) h2o.glm(x=1:4,y=5,training_frame=as.h2o(iris[,c(5,1,2,3,4)]), interactions=c(1,2), lambda=0, standardize=FALSE) lm(Petal.Width ~ Species*Sepal.Length + Sepal.Width + Petal.Length, data=iris) h2o.glm(y="Petal.Width", x=c("Species","Sepal.Length","Sepal.Width", "Petal.Length"), interactions=c("Species", "Sepal.Length"), lambda=0, standardize=FALSE, training_frame=as.h2o(iris)) lm(Petal.Width ~ Species*Sepal.Length + Sepal.Width + Petal.Length, data=iris) } doTest("Testing model accessors for GLM", test.glm.interactions2)
{ "pile_set_name": "Github" }
/* * SPDX-License-Identifier: MIT * * Copyright © 2017-2018 Intel Corporation */ #include "../intel_timeline.h" #include "mock_timeline.h" void mock_timeline_init(struct intel_timeline *timeline, u64 context) { timeline->gt = NULL; timeline->fence_context = context; mutex_init(&timeline->mutex); INIT_ACTIVE_REQUEST(&timeline->last_request, &timeline->mutex); INIT_LIST_HEAD(&timeline->requests); i915_syncmap_init(&timeline->sync); INIT_LIST_HEAD(&timeline->link); } void mock_timeline_fini(struct intel_timeline *timeline) { i915_syncmap_free(&timeline->sync); }
{ "pile_set_name": "Github" }
##Package: Custom ##Status: Generated ---------------------------------------------------------------------------------------------------- @@JvDiagramShape.pas Summary Contains the TJvDiagramShape component. ---------------------------------------------------------------------------------------------------- @@TJvStandardShape Summary Write here a summary (1 line) Description Write here a description ---------------------------------------------------------------------------------------------------- @@TJvStandardShape.LineColor Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvStandardShape.ShapeType Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvSizingMode.smBottom Description for smBottom ---------------------------------------------------------------------------------------------------- @@TJvSizingMode.smBottomRight Description for smBottomRight ---------------------------------------------------------------------------------------------------- @@TJvSizingMode.smNone Description for smNone ---------------------------------------------------------------------------------------------------- @@TJvSizingMode.smBottomLeft Description for smBottomLeft ---------------------------------------------------------------------------------------------------- @@TJvSizingMode.smRight Description for smRight ---------------------------------------------------------------------------------------------------- @@TJvSizingMode.smTop Description for smTop ---------------------------------------------------------------------------------------------------- @@TJvSizingMode.smTopRight Description for smTopRight ---------------------------------------------------------------------------------------------------- @@TJvSizingMode.smLeft Description for smLeft ---------------------------------------------------------------------------------------------------- @@TJvSizingMode.smTopLeft Description for smTopLeft ---------------------------------------------------------------------------------------------------- @@TJvSizingMode <TITLE TJvSizingMode type> Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvSizeableShape.SizingMode Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvSizeableShape.SizeRectWidth Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvSizeableShape.SizeRectHeight Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvSizeableShape.SetBounds Summary Write here a summary (1 line) Description This is an overridden method, you don't have to describe these if it does the same as the inherited method Parameters ALeft - Description for this parameter ATop - Description for this parameter AWidth - Description for this parameter AHeight - Description for this parameter See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvSizeableShape.MinWidth Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvSizeableShape.MinHeight Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvSingleHeadArrow Summary Write here a summary (1 line) Description Write here a description ---------------------------------------------------------------------------------------------------- @@TJvSingleHeadOpenDashArrow Summary Write here a summary (1 line) Description Write here a description ---------------------------------------------------------------------------------------------------- @@TJvSizeableShape Summary Write here a summary (1 line) Description Write here a description ---------------------------------------------------------------------------------------------------- @@TJvMoveableShape.Moving Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvMoveableShape Summary Write here a summary (1 line) Description Write here a description ---------------------------------------------------------------------------------------------------- @@TJvDoubleHeadArrow Summary Write here a summary (1 line) Description Write here a description ---------------------------------------------------------------------------------------------------- @@TJvCustomDiagramShape.UnselectAllShapes Summary Write here a summary (1 line) Description Write here a description Parameters ParentControl - Description for this parameter See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvCustomDiagramShape.SetMultiSelected Summary Write here a summary (1 line) Description Write here a description Parameters ParentControl - Description for this parameter Value - Description for this parameter See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvCustomDiagramShape.SetBounds Summary Write here a summary (1 line) Description This is an overridden method, you don't have to describe these if it does the same as the inherited method Parameters ALeft - Description for this parameter ATop - Description for this parameter AWidth - Description for this parameter AHeight - Description for this parameter See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvCustomDiagramShape.Selected Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvCustomDiagramShape.RightClickSelect Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvCustomDiagramShape.SaveToFile Summary Write here a summary (1 line) Description Write here a description Parameters FileName - Description for this parameter ParentControl - Description for this parameter See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvCustomDiagramShape.MultiSelect Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvCustomDiagramShape.LoadFromFile Summary Write here a summary (1 line) Description Write here a description Parameters FileName - Description for this parameter ParentControl - Description for this parameter See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvCustomDiagramShape.DeleteSelectedShapes Summary Write here a summary (1 line) Description Write here a description Parameters ParentControl - Description for this parameter See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvCustomDiagramShape.DeleteAllShapes Summary Write here a summary (1 line) Description Write here a description Parameters ParentControl - Description for this parameter See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvCustomDiagramShape.Caption Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvCustomDiagramShape.CanProcessMouseMsg Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvCustomDiagramShape.AlignCaption Summary Write here a summary (1 line) Description Write here a description Parameters Alignment - Description for this parameter See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvCustomDiagramShape Summary Write here a summary (1 line) Description Write here a description ---------------------------------------------------------------------------------------------------- @@TJvConnector.StartTermRect Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvConnector.StartConn Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvConnector.SetConnections Summary Write here a summary (1 line) Description Write here a description Parameters TheStartConn - Description for this parameter TheEndConn - Description for this parameter See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvConnector.SetBoundingRect Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvConnector.SetBounds Summary Write here a summary (1 line) Description This is an overridden method, you don't have to describe these if it does the same as the inherited method Parameters ALeft - Description for this parameter ATop - Description for this parameter AWidth - Description for this parameter AHeight - Description for this parameter See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvConnector.MidPoint Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvConnector.LineWidth Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvConnector.LineColor Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvConnector.EndTermRect Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvConnector.EndConn Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvConnectionSide.csBottom Description for csBottom ---------------------------------------------------------------------------------------------------- @@TJvConnector Summary Write here a summary (1 line) Description Write here a description ---------------------------------------------------------------------------------------------------- @@TJvConnectionSide.csTop Description for csTop ---------------------------------------------------------------------------------------------------- @@TJvConnectionSide.csRight Description for csRight ---------------------------------------------------------------------------------------------------- @@TJvConnectionSide.csLeft Description for csLeft ---------------------------------------------------------------------------------------------------- @@TJvConnectionSide <TITLE TJvConnectionSide type> Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvConnection.TopMost Summary Write here a summary (1 line) Description Write here a description Parameters TerminatorRect - Description for this parameter Return value Describe here what the function returns See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvConnection.TermPoint Summary Write here a summary (1 line) Description Write here a description Parameters TerminatorRect - Description for this parameter Return value Describe here what the function returns See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvConnection.Side Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvConnection.Shape Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvConnection.RightMost Summary Write here a summary (1 line) Description Write here a description Parameters TerminatorRect - Description for this parameter Return value Describe here what the function returns See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvConnection.Offset Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvConnection.LeftMost Summary Write here a summary (1 line) Description Write here a description Parameters TerminatorRect - Description for this parameter Return value Describe here what the function returns See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvConnection.ConnPoint Summary Write here a summary (1 line) Description Write here a description Parameters TerminatorRect - Description for this parameter Return value Describe here what the function returns See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvConnection.BottomMost Summary Write here a summary (1 line) Description Write here a description Parameters TerminatorRect - Description for this parameter Return value Describe here what the function returns See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvConnection Summary Write here a summary (1 line) Description Write here a description ---------------------------------------------------------------------------------------------------- @@TJvConnection.Assign Summary Write here a summary (1 line) Description This is an overridden method, you don't have to describe these if it does the same as the inherited method Parameters Source - Description for this parameter See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvBluntSingleHeadOpenDashArrow Summary Write here a summary (1 line) Description Write here a description ---------------------------------------------------------------------------------------------------- @@TJvBluntSingleHeadArrow Summary Write here a summary (1 line) Description Write here a description ---------------------------------------------------------------------------------------------------- @@TJvBitmapShape.Images Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvBitmapShape.ImageIndex Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvBitmapShape Summary Write here a summary (1 line) Description Write here a description ---------------------------------------------------------------------------------------------------- @@TJvSubCaseArrow Summary Write here a summary (1 line) Description Write here a description ---------------------------------------------------------------------------------------------------- @@TJvTextShape Summary Write here a summary (1 line) Description Write here a description ---------------------------------------------------------------------------------------------------- @@TJvTextShape.AutoSize Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvTextShape.Font Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvTextShape.SetBounds Summary Write here a summary (1 line) Description This is an overridden method, you don't have to describe these if it does the same as the inherited method Parameters ALeft - Description for this parameter ATop - Description for this parameter AWidth - Description for this parameter AHeight - Description for this parameter See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references ---------------------------------------------------------------------------------------------------- @@TJvTextShape.Text Summary Write here a summary (1 line) Description Write here a description See Also List here other properties, methods (comma seperated) Remove the 'See Also' section if there are no references
{ "pile_set_name": "Github" }
/** * @file * * @ingroup rtems_rfs * * @brief RTEMS File Systems Bitmap Routines * * These functions manage bit maps. A bit map consists of the map of bit * allocated in a block and a search map where a bit represents 32 actual * bits. The search map allows for a faster search for an available bit as 32 * search bits can checked in a test. */ /* * COPYRIGHT (c) 2010 Chris Johns <chrisj@rtems.org> * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.org/license/LICENSE. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /** * Set to 1 to enable warnings when developing. */ #define RTEMS_RFS_BITMAP_WARNINGS 0 #if RTEMS_RFS_BITMAP_WARNINGS #include <stdio.h> #endif #include <stdlib.h> #include <rtems/rfs/rtems-rfs-bitmaps.h> /** * Test a bit in an element. If set return true else return false. * * @param target The target to test the bit in. * @param bit The bit to test. * @retval true The bit is set. * @retval false The bit is clear. */ static bool rtems_rfs_bitmap_test (rtems_rfs_bitmap_element target, rtems_rfs_bitmap_bit bit) { return RTEMS_RFS_BITMAP_TEST_BIT (target, bit); } /** * Set the bits in the element. Bits not set in the bit argument are left * unchanged. * * @param target The target element bits are set. * @param bits The bits in the target to set. A 1 in the bits will set the * same bit in the target. */ static rtems_rfs_bitmap_element rtems_rfs_bitmap_set (rtems_rfs_bitmap_element target, rtems_rfs_bitmap_element bits) { return RTEMS_RFS_BITMAP_SET_BITS (target, bits); } /** * Clear the bits in the element. Bits not set in the bit argument are left * unchanged. * * @param target The target element to clear the bits in. * @param bits The bits in the target to clear. A 1 in the bits will clear the * bit in the target. */ static rtems_rfs_bitmap_element rtems_rfs_bitmap_clear (rtems_rfs_bitmap_element target, rtems_rfs_bitmap_element bits) { return RTEMS_RFS_BITMAP_CLEAR_BITS (target, bits); } /** * Merge the bits in 2 variables based on the mask. A set bit in the mask will * merge the bits from bits1 and a clear bit will merge the bits from bits2. * The mask is always defined as 1 being set and 0 being clear. */ static rtems_rfs_bitmap_element rtems_rfs_bitmap_merge (rtems_rfs_bitmap_element bits1, rtems_rfs_bitmap_element bits2, rtems_rfs_bitmap_element mask) { /* * Use the normal bit operators because we do not change the bits just merge * the 2 separate parts. */ bits1 &= mask; bits2 &= RTEMS_RFS_BITMAP_INVERT_MASK (mask); return bits1 | bits2; } /** * Match the bits of 2 elements and return true if they match else return * false. * * @param bits1 One set of bits to match. * @param bits2 The second set of bits to match. * @retval true The bits match. * @retval false The bits do not match. */ static bool rtems_rfs_bitmap_match (rtems_rfs_bitmap_element bits1, rtems_rfs_bitmap_element bits2) { return bits1 ^ bits2 ? false : true; } #if RTEMS_NOT_USED_BUT_KEPT /** * Match the bits of 2 elements within the mask and return true if they match * else return false. * * @param mask The mask over which the match occurs. A 1 is a valid mask bit. * @param bits1 One set of bits to match. * @param bits2 The second set of bits to match. * @retval true The bits match. * @retval false The bits do not match. */ static bool rtems_rfs_bitmap_match_masked (rtems_rfs_bitmap_element mask, rtems_rfs_bitmap_element bits1, rtems_rfs_bitmap_element bits2) { return (bits1 ^ bits2) & mask ? false : true; } #endif /** * Return the map after loading from disk if not already loaded. * * @param control The bitmap control. * @param rtems_rfs_bitmap_map* Pointer to the bitmap map data if no error. * @return int The error number (errno). No error if 0. */ static int rtems_rfs_bitmap_load_map (rtems_rfs_bitmap_control* control, rtems_rfs_bitmap_map* map) { int rc; if (!control->buffer) return ENXIO; *map = NULL; rc = rtems_rfs_buffer_handle_request (control->fs, control->buffer, control->block, true); if (rc) return rc; *map = rtems_rfs_buffer_data (control->buffer); return 0; } rtems_rfs_bitmap_element rtems_rfs_bitmap_mask (unsigned int size) { rtems_rfs_bitmap_element mask = RTEMS_RFS_BITMAP_ELEMENT_FULL_MASK; mask >>= (rtems_rfs_bitmap_element_bits () - size); return mask; } rtems_rfs_bitmap_element rtems_rfs_bitmap_mask_section (unsigned int start, unsigned int end) { rtems_rfs_bitmap_element mask = 0; if (end > start) mask = rtems_rfs_bitmap_mask (end - start) << start; return mask; } int rtems_rfs_bitmap_map_set (rtems_rfs_bitmap_control* control, rtems_rfs_bitmap_bit bit) { rtems_rfs_bitmap_map map; rtems_rfs_bitmap_map search_map; int index; int offset; int rc; rtems_rfs_bitmap_element element; rc = rtems_rfs_bitmap_load_map (control, &map); if (rc > 0) return rc; if (bit >= control->size) return EINVAL; search_map = control->search_bits; index = rtems_rfs_bitmap_map_index (bit); offset = rtems_rfs_bitmap_map_offset (bit); element = map[index]; map[index] = rtems_rfs_bitmap_set (element, 1 << offset); /* * If the element does not change, the bit was already set. There will be no * further action to take. */ if (rtems_rfs_bitmap_match(element, map[index])) return 0; control->free--; rtems_rfs_buffer_mark_dirty (control->buffer); if (rtems_rfs_bitmap_match(map[index], RTEMS_RFS_BITMAP_ELEMENT_SET)) { bit = index; index = rtems_rfs_bitmap_map_index (bit); offset = rtems_rfs_bitmap_map_offset (bit); search_map[index] = rtems_rfs_bitmap_set (search_map[index], 1 << offset); } return 0; } int rtems_rfs_bitmap_map_clear (rtems_rfs_bitmap_control* control, rtems_rfs_bitmap_bit bit) { rtems_rfs_bitmap_map map; rtems_rfs_bitmap_map search_map; int index; int offset; int rc; rtems_rfs_bitmap_element element; rc = rtems_rfs_bitmap_load_map (control, &map); if (rc > 0) return rc; if (bit >= control->size) return EINVAL; search_map = control->search_bits; index = rtems_rfs_bitmap_map_index (bit); offset = rtems_rfs_bitmap_map_offset (bit); element = map[index]; map[index] = rtems_rfs_bitmap_clear (element, 1 << offset); /* * If the element does not change, the bit was already clear. There will be * no further action to take. */ if (rtems_rfs_bitmap_match(element, map[index])) return 0; bit = index; index = rtems_rfs_bitmap_map_index (bit); offset = rtems_rfs_bitmap_map_offset(bit); search_map[index] = rtems_rfs_bitmap_clear (search_map[index], 1 << offset); rtems_rfs_buffer_mark_dirty (control->buffer); control->free++; return 0; } int rtems_rfs_bitmap_map_test (rtems_rfs_bitmap_control* control, rtems_rfs_bitmap_bit bit, bool* state) { rtems_rfs_bitmap_map map; int index; int rc; rc = rtems_rfs_bitmap_load_map (control, &map); if (rc > 0) return rc; if (bit >= control->size) return EINVAL; index = rtems_rfs_bitmap_map_index (bit); *state = rtems_rfs_bitmap_test (map[index], bit); return 0; } int rtems_rfs_bitmap_map_set_all (rtems_rfs_bitmap_control* control) { rtems_rfs_bitmap_map map; size_t elements; int e; int rc; rc = rtems_rfs_bitmap_load_map (control, &map); if (rc > 0) return rc; elements = rtems_rfs_bitmap_elements (control->size); control->free = 0; for (e = 0; e < elements; e++) map[e] = RTEMS_RFS_BITMAP_ELEMENT_SET; elements = rtems_rfs_bitmap_elements (elements); for (e = 0; e < elements; e++) control->search_bits[e] = RTEMS_RFS_BITMAP_ELEMENT_SET; rtems_rfs_buffer_mark_dirty (control->buffer); return 0; } int rtems_rfs_bitmap_map_clear_all (rtems_rfs_bitmap_control* control) { rtems_rfs_bitmap_map map; rtems_rfs_bitmap_bit last_search_bit; size_t elements; int e; int rc; rc = rtems_rfs_bitmap_load_map (control, &map); if (rc > 0) return rc; elements = rtems_rfs_bitmap_elements (control->size); control->free = control->size; for (e = 0; e < elements; e++) map[e] = RTEMS_RFS_BITMAP_ELEMENT_CLEAR; /* * Set the un-mapped bits in the last search element so the available logic * works. */ last_search_bit = rtems_rfs_bitmap_map_offset (elements); if (last_search_bit == 0) last_search_bit = rtems_rfs_bitmap_element_bits (); elements = rtems_rfs_bitmap_elements (elements); for (e = 0; e < (elements - 1); e++) control->search_bits[e] = RTEMS_RFS_BITMAP_ELEMENT_CLEAR; control->search_bits[elements - 1] = rtems_rfs_bitmap_merge (RTEMS_RFS_BITMAP_ELEMENT_CLEAR, RTEMS_RFS_BITMAP_ELEMENT_SET, rtems_rfs_bitmap_mask (last_search_bit)); rtems_rfs_buffer_mark_dirty (control->buffer); return 0; } static int rtems_rfs_search_map_for_clear_bit (rtems_rfs_bitmap_control* control, rtems_rfs_bitmap_bit* bit, bool* found, size_t window, int direction) { rtems_rfs_bitmap_map map; rtems_rfs_bitmap_bit test_bit; rtems_rfs_bitmap_bit end_bit; rtems_rfs_bitmap_element* search_bits; int search_index; int search_offset; rtems_rfs_bitmap_element* map_bits; int map_index; int map_offset; int rc; *found = false; /* * Load the bitmap. */ rc = rtems_rfs_bitmap_load_map (control, &map); if (rc > 0) return rc; /* * Calculate the bit we are testing plus the end point we search over. */ test_bit = *bit; end_bit = test_bit + (window * direction); if (end_bit < 0) end_bit = 0; else if (end_bit >= control->size) end_bit = control->size - 1; map_index = rtems_rfs_bitmap_map_index (test_bit); map_offset = rtems_rfs_bitmap_map_offset (test_bit); search_index = rtems_rfs_bitmap_map_index (map_index); search_offset = rtems_rfs_bitmap_map_offset (map_index); search_bits = &control->search_bits[search_index]; map_bits = &map[map_index]; /* * Check each bit from the search map offset for a clear bit. */ do { /* * If any bit is clear find that bit and then search the map element. If * all bits are set there are no map bits so move to the next search * element. */ if (!rtems_rfs_bitmap_match (*search_bits, RTEMS_RFS_BITMAP_ELEMENT_SET)) { while ((search_offset >= 0) && (search_offset < rtems_rfs_bitmap_element_bits ())) { if (!rtems_rfs_bitmap_test (*search_bits, search_offset)) { /* * Find the clear bit in the map. Update the search map and map if * found. We may find none are spare if searching up from the seed. */ while ((map_offset >= 0) && (map_offset < rtems_rfs_bitmap_element_bits ())) { if (!rtems_rfs_bitmap_test (*map_bits, map_offset)) { *map_bits = rtems_rfs_bitmap_set (*map_bits, 1 << map_offset); if (rtems_rfs_bitmap_match(*map_bits, RTEMS_RFS_BITMAP_ELEMENT_SET)) *search_bits = rtems_rfs_bitmap_set (*search_bits, 1 << search_offset); control->free--; *bit = test_bit; *found = true; rtems_rfs_buffer_mark_dirty (control->buffer); return 0; } if (test_bit == end_bit) break; map_offset += direction; test_bit += direction; } } map_bits += direction; map_index += direction; map_offset = direction > 0 ? 0 : rtems_rfs_bitmap_element_bits () - 1; test_bit = (map_index * rtems_rfs_bitmap_element_bits ()) + map_offset; search_offset += direction; if (((direction < 0) && (test_bit <= end_bit)) || ((direction > 0) && (test_bit >= end_bit))) break; } } else { /* * Move to the next search element. We need to determine the number of * bits in the search offset that are being skipped so the map bits * pointer can be updated. If we are moving down and we have a search * offset of 0 then the search map adjustment is to the top bit of the * pervious search bit's value. * * Align test_bit either up or down depending on the direction to next 32 * bit boundary. */ rtems_rfs_bitmap_bit bits_skipped; test_bit &= ~((1 << RTEMS_RFS_ELEMENT_BITS_POWER_2) - 1); if (direction > 0) { bits_skipped = rtems_rfs_bitmap_element_bits () - search_offset; test_bit += bits_skipped * rtems_rfs_bitmap_element_bits (); map_offset = 0; } else { bits_skipped = search_offset + 1; /* * Need to remove 1 for the rounding up. The above rounds down and * adds 1. Remember the logic is for subtraction. */ test_bit -= ((bits_skipped - 1) * rtems_rfs_bitmap_element_bits ()) + 1; map_offset = rtems_rfs_bitmap_element_bits () - 1; } map_bits += direction * bits_skipped; map_index += direction * bits_skipped; } search_bits += direction; search_offset = direction > 0 ? 0 : rtems_rfs_bitmap_element_bits () - 1; } while (((direction < 0) && (test_bit >= end_bit)) || ((direction > 0) && (test_bit <= end_bit))); return 0; } int rtems_rfs_bitmap_map_alloc (rtems_rfs_bitmap_control* control, rtems_rfs_bitmap_bit seed, bool* allocated, rtems_rfs_bitmap_bit* bit) { rtems_rfs_bitmap_bit upper_seed; rtems_rfs_bitmap_bit lower_seed; rtems_rfs_bitmap_bit window; /* may become a parameter */ int rc = 0; /* * By default we assume the allocation failed. */ *allocated = false; /* * The window is the number of bits we search over in either direction each * time. */ window = RTEMS_RFS_BITMAP_SEARCH_WINDOW; /* * Start from the seed and move in either direction. Search in window amounts * of bits from the original seed above then below. That is search from the * seed up then from the seed down a window number of bits, then repeat the * process from the window distance from the seed, again above then * below. Keep moving out until all bits have been searched. */ upper_seed = seed; lower_seed = seed; /* * If the upper and lower seed values have reached the limits of the bitmap * we have searched all of the map. The seed may not be aligned to a window * boundary so we may need to search a partial window and this may also not * be balanced for the upper or lower seeds. We move to the limits, search * then return false if no clear bits are found. */ while (((upper_seed >= 0) && (upper_seed < control->size)) || ((lower_seed >= 0) && (lower_seed < control->size))) { /* * Search up first so bits allocated in succession are grouped together. */ if (upper_seed < control->size) { *bit = upper_seed; rc = rtems_rfs_search_map_for_clear_bit (control, bit, allocated, window, 1); if ((rc > 0) || *allocated) break; } if (lower_seed >= 0) { *bit = lower_seed; rc = rtems_rfs_search_map_for_clear_bit (control, bit, allocated, window, -1); if ((rc > 0) || *allocated) break; } /* * Do not bound the limits at the edges of the map. Do not update if an * edge has been passed. */ if (upper_seed < control->size) upper_seed += window; if (lower_seed >= 0) lower_seed -= window; } return 0; } int rtems_rfs_bitmap_create_search (rtems_rfs_bitmap_control* control) { rtems_rfs_bitmap_map search_map; rtems_rfs_bitmap_map map; size_t size; rtems_rfs_bitmap_bit bit; int rc; rc = rtems_rfs_bitmap_load_map (control, &map); if (rc > 0) return rc; control->free = 0; search_map = control->search_bits; size = control->size; bit = 0; *search_map = RTEMS_RFS_BITMAP_ELEMENT_CLEAR; while (size) { rtems_rfs_bitmap_element bits; int available; if (size < rtems_rfs_bitmap_element_bits ()) { bits = rtems_rfs_bitmap_merge (*map, RTEMS_RFS_BITMAP_ELEMENT_SET, rtems_rfs_bitmap_mask_section (0, size)); available = size; } else { bits = *map; available = rtems_rfs_bitmap_element_bits (); } if (rtems_rfs_bitmap_match (bits, RTEMS_RFS_BITMAP_ELEMENT_SET)) rtems_rfs_bitmap_set (*search_map, bit); else { int b; for (b = 0; b < available; b++) if (!rtems_rfs_bitmap_test (bits, b)) control->free++; } size -= available; /* Iterate from 0 to 1 less than the number of bits in an element */ if (bit == (rtems_rfs_bitmap_element_bits () - 1)) { bit = 0; search_map++; *search_map = RTEMS_RFS_BITMAP_ELEMENT_CLEAR; } else bit++; map++; } return 0; } int rtems_rfs_bitmap_open (rtems_rfs_bitmap_control* control, rtems_rfs_file_system* fs, rtems_rfs_buffer_handle* buffer, size_t size, rtems_rfs_buffer_block block) { size_t elements = rtems_rfs_bitmap_elements (size); control->buffer = buffer; control->fs = fs; control->block = block; control->size = size; elements = rtems_rfs_bitmap_elements (elements); control->search_bits = malloc (elements * sizeof (rtems_rfs_bitmap_element)); if (!control->search_bits) return ENOMEM; return rtems_rfs_bitmap_create_search (control); } int rtems_rfs_bitmap_close (rtems_rfs_bitmap_control* control) { free (control->search_bits); return 0; }
{ "pile_set_name": "Github" }
/* * This file is part of the Computer Vision Toolkit (cvkit). * * Author: Heiko Hirschmueller * * Copyright (c) 2014, Institute of Robotics and Mechatronics, German Aerospace Center * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors * may be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #include "basewindow.h" #include <gutil/exception.h> #include <gutil/misc.h> #include <windows.h> #include <windowsx.h> #include <commctrl.h> #include <cstdlib> #include <string> #include <algorithm> #undef min #undef max /* NOTE: In contrast to the X11 implementation of this classe, the event loop of the WIN32 implementation is not executed in a separate thread but in the method waitForClose(). This means that only one window can be open at a time. However, this is sufficient for the tool sv. */ namespace bgui { struct BaseWindowData { BaseWindow *base; HINSTANCE hinstance; HWND hwnd; // pointer to window int xb, yb; // size of borders in x and y direction int th; // height of text in pixel HBITMAP bitmap; // bitmap as background buffer unsigned char *bpixel; // BGR pixel array of bitmap int bw, bh; // width and height of bitmap int bytes_per_line; // size of row in bytes, including padding std::string info, text; // optional info line and multi line text bool top, left; // location of info line }; namespace { struct BaseWindowData *bp; class WindowsException : public gutil::Exception { public: WindowsException(const std::string &message): gutil::Exception("Windows", message) { } }; void drawInfoText(HWND hwnd, HDC hdc, BaseWindowData *p) { HFONT fixed_font=static_cast<HFONT>(GetStockObject(ANSI_FIXED_FONT)); HFONT old_font=static_cast<HFONT>(SelectObject(hdc, fixed_font)); SetBkColor(hdc, 0x000000); SetTextColor(hdc, 0xffffff); if (p->text.size() > 0) { SetTextAlign(hdc, TA_TOP | TA_LEFT); RECT rect; GetClientRect(p->hwnd, &rect); std::vector<std::string> list; // get total size of text and calculate position gutil::split(list, p->text, '\n', false); int w=0; int h=0; for (size_t i=0; i<list.size(); i++) { if (list[i].size() > 0) { SIZE size; GetTextExtentPoint32(hdc, TEXT(list[i].c_str()), static_cast<int>(list[i].size()), &size); w=std::max(w, static_cast<int>(size.cx)); } h+=p->th; } if (rect.right-rect.left > w) { rect.left+=(rect.right-rect.left-w)/2; rect.right=rect.left+w; } if (rect.bottom-rect.top > h) { rect.top+=(rect.bottom-rect.top-h)/2; rect.bottom=rect.top+h; } HBRUSH brush=CreateSolidBrush(GetBkColor(hdc)); FillRect(hdc, &rect, brush); DeleteObject(brush); // draw multi line text for (size_t i=0; i<list.size(); i++) { if (list[i].size() > 0) { TextOut(hdc, rect.left, static_cast<int>(rect.top+i*p->th), TEXT(list[i].c_str()), static_cast<int>(list[i].size())); } } } else if (p->info.size() > 0) { SetTextAlign(hdc, TA_TOP | TA_LEFT); RECT rect; GetClientRect(p->hwnd, &rect); SIZE size; GetTextExtentPoint32(hdc, TEXT(p->info.c_str()), static_cast<int>(p->info.size()), &size); // alternatively, draw one line of text at specified position if (p->top) { if (p->left) { TextOut(hdc, rect.left, rect.top, TEXT(p->info.c_str()), static_cast<int>(p->info.size())); } else { TextOut(hdc, rect.right-size.cx, rect.top, TEXT(p->info.c_str()), static_cast<int>(p->info.size())); } } else { if (p->left) { TextOut(hdc, rect.left, rect.bottom-size.cy, TEXT(p->info.c_str()), static_cast<int>(p->info.size())); } else { TextOut(hdc, rect.right-size.cy, rect.bottom-size.cy, TEXT(p->info.c_str()), static_cast<int>(p->info.size())); } } } if (old_font != 0) { SelectObject(hdc, old_font); } } int getState(WPARAM wparam) { int state=0; if ((wparam & MK_CONTROL) != 0) { state|=BaseWindow::ctrlmask; } if ((wparam & MK_SHIFT) != 0) { state|=BaseWindow::shiftmask; } if ((wparam & MK_LBUTTON) != 0) { state|=BaseWindow::button1mask; } if ((wparam & MK_MBUTTON) != 0) { state|=BaseWindow::button2mask; } if ((wparam & MK_RBUTTON) != 0) { state|=BaseWindow::button3mask; } return state; } BaseWindow::SpecialKey getSpecialKey(WPARAM wparam) { BaseWindow::SpecialKey sk=BaseWindow::k_none; switch (wparam) { case VK_ESCAPE: sk=BaseWindow::k_esc; break; case VK_LEFT: sk=BaseWindow::k_left; break; case VK_RIGHT: sk=BaseWindow::k_right; break; case VK_UP: sk=BaseWindow::k_up; break; case VK_DOWN: sk=BaseWindow::k_down; break; case VK_HOME: sk=BaseWindow::k_home; break; case VK_END: sk=BaseWindow::k_end; break; default: sk=BaseWindow::k_none; break; } return sk; } LRESULT CALLBACK mainProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { try { switch (msg) { case WM_GETMINMAXINFO: { MINMAXINFO *minmax=(MINMAXINFO *) lparam; minmax->ptMinTrackSize.x=200; minmax->ptMinTrackSize.y=100; return 0; } case WM_CREATE: { return 0; } case WM_PAINT: { PAINTSTRUCT ps; HDC hdc=BeginPaint(bp->hwnd, &ps); if (hdc != 0) { HDC hdb=CreateCompatibleDC(NULL); HGDIOBJ old=SelectObject(hdb, static_cast<HGDIOBJ>(bp->bitmap)); BitBlt(hdc, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right-ps.rcPaint.left, ps.rcPaint.bottom-ps.rcPaint.top, hdb, ps.rcPaint.left, ps.rcPaint.top, SRCCOPY); drawInfoText(bp->hwnd, hdc, bp); SelectObject(hdb, old); DeleteDC(hdb); EndPaint(bp->hwnd, &ps); } return 0; } case WM_SIZE: { bp->base->onResize(static_cast<int>(LOWORD(lparam)), static_cast<int>(HIWORD(lparam))); return 0; } case WM_LBUTTONDOWN: { bp->base->onMousePressed(BaseWindow::button1, static_cast<int>(GET_X_LPARAM(lparam)), static_cast<int>(GET_Y_LPARAM(lparam)), getState(wparam)); return 0; } case WM_MBUTTONDOWN: { bp->base->onMousePressed(BaseWindow::button2, static_cast<int>(GET_X_LPARAM(lparam)), static_cast<int>(GET_Y_LPARAM(lparam)), getState(wparam)); return 0; } case WM_RBUTTONDOWN: { bp->base->onMousePressed(BaseWindow::button3, static_cast<int>(GET_X_LPARAM(lparam)), static_cast<int>(GET_Y_LPARAM(lparam)), getState(wparam)); return 0; } case WM_LBUTTONUP: { bp->base->onMouseReleased(BaseWindow::button1, static_cast<int>(GET_X_LPARAM(lparam)), static_cast<int>(GET_Y_LPARAM(lparam)), getState(wparam)); return 0; } case WM_MBUTTONUP: { bp->base->onMouseReleased(BaseWindow::button2, static_cast<int>(GET_X_LPARAM(lparam)), static_cast<int>(GET_Y_LPARAM(lparam)), getState(wparam)); return 0; } case WM_RBUTTONUP: { bp->base->onMouseReleased(BaseWindow::button3, static_cast<int>(GET_X_LPARAM(lparam)), static_cast<int>(GET_Y_LPARAM(lparam)), getState(wparam)); return 0; } case WM_MOUSEWHEEL: { POINT p; p.x=GET_X_LPARAM(lparam); p.y=GET_Y_LPARAM(lparam); ScreenToClient(bp->hwnd, &p); if (GET_WHEEL_DELTA_WPARAM(wparam)/120 > 0) { bp->base->onMousePressed(BaseWindow::button4, static_cast<int>(p.x), static_cast<int>(p.y), getState(wparam&0xffff)); } else if (GET_WHEEL_DELTA_WPARAM(wparam)/120 < 0) { bp->base->onMousePressed(BaseWindow::button5, static_cast<int>(p.x), static_cast<int>(p.y), getState(wparam&0xffff)); } return 0; } case WM_MOUSEMOVE: { if ((wparam & (MK_LBUTTON|MK_MBUTTON|MK_RBUTTON)) != 0) bp->base->onMouseMove(static_cast<int>(GET_X_LPARAM(lparam)), static_cast<int>(GET_Y_LPARAM(lparam)), getState(wparam)); return 0; } case WM_CHAR: { int x=0; int y=0; POINT p; if (GetCursorPos(&p)) { if (ScreenToClient(bp->hwnd, &p)) { x=static_cast<int>(p.x); y=static_cast<int>(p.y); } } bp->base->onKey(static_cast<char>(wparam), BaseWindow::k_none, x, y); return 0; } case WM_KEYDOWN: { BaseWindow::SpecialKey sk=getSpecialKey(wparam); if (sk != BaseWindow::k_none) { int x=0; int y=0; POINT p; if (GetCursorPos(&p)) { if (ScreenToClient(bp->hwnd, &p)) { x=static_cast<int>(p.x); y=static_cast<int>(p.y); } } bp->base->onKey(0, getSpecialKey(wparam), x, y); return 0; } break; } case WM_CLOSE: { if (bp->base->onClose()) { DestroyWindow(bp->hwnd); } return 0; } case WM_DESTROY: { bp->hwnd=0; PostQuitMessage(0); return 0; } } } catch (const gutil::Exception &ex) { ex.print(); exit(10); } catch (...) { gutil::showError("An unknown exception occured"); exit(10); } return DefWindowProc(hwnd, msg, wparam, lparam); } } BaseWindow::BaseWindow(const char *title, int w, int h) { if (bp != 0) { throw WindowsException("There can be only one BaseWindow!"); } bp=p=new BaseWindowData(); p->base=this; p->hinstance=GetModuleHandle(NULL); // initialise common controls INITCOMMONCONTROLSEX icc; icc.dwSize = sizeof(icc); icc.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&icc); // class for window WNDCLASSEX wc; LPCTSTR mainclass=TEXT("sv"); LPCTSTR maintitle=TEXT(title); wc.cbSize=sizeof(wc); wc.style=0; wc.lpfnWndProc=&mainProc; wc.cbClsExtra=0; wc.cbWndExtra=0; wc.hInstance=p->hinstance; wc.hIcon=0; wc.hCursor=(HCURSOR) LoadImage(NULL, IDC_ARROW, IMAGE_CURSOR, 0, 0, LR_SHARED); wc.hbrBackground=0; wc.lpszMenuName=0; wc.lpszClassName=mainclass; wc.hIconSm=0; // register window class if (!RegisterClassEx(&wc)) { MessageBox(NULL, TEXT("Error registering window class"), TEXT("Error"), MB_ICONERROR | MB_OK); throw WindowsException("Error registering window class"); } // create instance of window p->hwnd=CreateWindowEx(0, mainclass, maintitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, w, h, NULL, NULL, p->hinstance, NULL); // error if window creation failed if (p->hwnd == 0) { MessageBox(NULL, TEXT("Error creating main window"), TEXT("Error"), MB_ICONERROR | MB_OK); throw WindowsException("Error creating main window"); } // get size of window borders RECT rect; rect.left=50; rect.top=50; rect.right=350; rect.bottom=250; AdjustWindowRectEx(&rect, WS_OVERLAPPEDWINDOW, FALSE, 0); p->xb=(rect.right-rect.left-300); p->yb=(rect.bottom-rect.top-200); // get height of text GetClientRect(GetDesktopWindow(), &rect); HDC hdc=GetDC(p->hwnd); HFONT fixed_font=static_cast<HFONT>(GetStockObject(ANSI_FIXED_FONT)); HFONT old_font=static_cast<HFONT>(SelectObject(hdc, fixed_font)); SIZE size; GetTextExtentPoint32(hdc, TEXT("ABCDEFG"), 7, &size); p->th=size.cy; if (old_font != 0) { SelectObject(hdc, old_font); } // create memory bitmap as buffer p->bw=rect.right; p->bh=rect.bottom; p->bytes_per_line=(3*p->bw+3)&~3; BITMAPINFO info; info.bmiHeader.biSize=sizeof(BITMAPINFOHEADER); info.bmiHeader.biWidth=p->bw; info.bmiHeader.biHeight=p->bh; info.bmiHeader.biPlanes=1; info.bmiHeader.biBitCount=24; info.bmiHeader.biCompression=BI_RGB; info.bmiHeader.biSizeImage=0; info.bmiHeader.biXPelsPerMeter=1; info.bmiHeader.biYPelsPerMeter=1; info.bmiHeader.biClrUsed=0; info.bmiHeader.biClrImportant=0; p->bitmap=CreateDIBSection(hdc, &info, DIB_RGB_COLORS, reinterpret_cast<void **>(&(p->bpixel)), 0, 0); if (p->bitmap == 0) { MessageBox(NULL, TEXT("Cannot create bitmap"), TEXT("Error"), MB_ICONERROR | MB_OK); throw WindowsException("Cannot create bitmap"); } ReleaseDC(p->hwnd, hdc); } BaseWindow::~BaseWindow() { bp=0; DeleteObject(p->bitmap); if (p->hwnd != 0) { DestroyWindow(p->hwnd); } delete p; } void BaseWindow::setVisible(bool show) { if (p->hwnd != 0) { if (show) { ShowWindow(p->hwnd, SW_SHOW); UpdateWindow(p->hwnd); } else { ShowWindow(p->hwnd, SW_HIDE); } } } int BaseWindow::addFileWatch(const char *path) { // how to check if a file has been modified and the modification // is completed, i.e. writing has finished (!) on windows? return 0; } void BaseWindow::removeFileWatch(int watchid) { } void BaseWindow::sendClose() { if (p->hwnd != 0) { CallWindowProc(mainProc, p->hwnd, WM_CLOSE, 0, 0); } } void BaseWindow::waitForClose() { MSG msg; while (GetMessage(&msg, NULL, 0, 0) > 0) { TranslateMessage(&msg); DispatchMessage(&msg); } } bool BaseWindow::isClosed() { return p->hwnd == 0; } void BaseWindow::getContent(gimage::ImageU8 &image) { int w=0, h=0; getSize(w, h); image.setSize(w, h, 3); for (int k=0; k<h; k++) { unsigned char *line=p->bpixel+(p->bh-k-1)*p->bytes_per_line; for (int i=0; i<w; i++) { image.set(i, k, 2, *line++); image.set(i, k, 1, *line++); image.set(i, k, 0, *line++); } } } void BaseWindow::setTitle(const char *title) { if (p->hwnd != 0) { SetWindowText(p->hwnd, TEXT(title)); } } void BaseWindow::getDisplaySize(int &w, int &h) { RECT rect; // get desktop size GetClientRect(GetDesktopWindow(), &rect); w=rect.right-rect.left-p->xb; h=rect.bottom-rect.top-p->yb; } void BaseWindow::getSize(int &w, int &h) { if (p->hwnd != 0) { RECT rect; // get size of window without borders GetClientRect(p->hwnd, &rect); w=rect.right-rect.left; h=rect.bottom-rect.top; } } void BaseWindow::setSize(int w, int h) { if (p->hwnd != 0) { RECT rect; int x, y; // get current position GetWindowRect(p->hwnd, &rect); x=rect.left; y=rect.top; // add window borders w+=p->xb; h+=p->yb; // get size of desktop, check that the window is not made bigger // than the desktop and also check if the window should be moved GetClientRect(GetDesktopWindow(), &rect); w=std::min(w, static_cast<int>(rect.right-rect.left)); h=std::min(h, static_cast<int>(rect.bottom-rect.top)); if (x+w > rect.right) { x=rect.right-w; if (x < 0) { x=0; } } if (y+h > rect.bottom) { y=rect.bottom-h; if (y < 0) { y=0; } } SetWindowPos(p->hwnd, HWND_TOP, x, y, w, h, SWP_NOZORDER); } } void BaseWindow::setPosition(int x, int y) { if (p->hwnd != 0) { x=std::min(x, 0); y=std::min(y, 0); RECT drect; GetClientRect(GetDesktopWindow(), &drect); RECT wrect; GetWindowRect(GetDesktopWindow(), &wrect); x=std::min(x, static_cast<int>(drect.right-(wrect.right-wrect.left))); y=std::min(y, static_cast<int>(drect.bottom-(wrect.bottom-wrect.top))); if (p->hwnd != 0) { SetWindowPos(p->hwnd, HWND_TOP, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER); } } } int BaseWindow::getTextHeight() { return p->th; } void BaseWindow::setInfoLine(const char *text, bool top, bool left) { if (strlen(text) == 0 && p->info.size() == 0) { return; } if (p->hwnd == 0) { p->info=text; p->top=top; p->left=left; return; } // get context for window and bitmap HDC hdc=GetDC(p->hwnd); HDC hdb=CreateCompatibleDC(NULL); HGDIOBJ old=SelectObject(hdb, static_cast<HGDIOBJ>(p->bitmap)); // get inner size of window RECT rect; GetClientRect(p->hwnd, &rect); // determine size of old info text SIZE size; size.cx=0; size.cy=0; if (p->info.size() > 0) { GetTextExtentPoint32(hdc, TEXT(p->info.c_str()), static_cast<int>(p->info.size()), &size); } // clear old std::string completely, if position has changed if (p->info.size() > 0 && (top != p->top || left != p->left)) { if (p->top) { if (p->left) BitBlt(hdc, rect.left, rect.top, size.cx, size.cy, hdb, rect.left, rect.top, SRCCOPY); else BitBlt(hdc, rect.right-size.cx, rect.top, size.cx, size.cy, hdb, rect.right-size.cx, rect.top, SRCCOPY); } else { if (p->left) BitBlt(hdc, rect.left, rect.bottom-size.cy, size.cx, size.cy, hdb, rect.left, rect.bottom-size.cy, SRCCOPY); else BitBlt(hdc, rect.right-size.cx, rect.bottom-size.cy, size.cx, size.cy, hdb, rect.right-size.cx, rect.bottom-size.cy, SRCCOPY); } size.cx=0; size.cy=0; } // store and draw new info text p->info=text; p->top=top; p->left=left; drawInfoText(p->hwnd, hdc, p); // clear overlapping parts of old info text if (size.cx > 0 && size.cy > 0) { SIZE nsize; GetTextExtentPoint32(hdc, TEXT(p->info.c_str()), static_cast<int>(p->info.size()), &nsize); size.cx-=nsize.cx; if (size.cx > 0) { if (p->top) { if (p->left) BitBlt(hdc, rect.left+nsize.cx, rect.top, size.cx, size.cy, hdb, rect.left+nsize.cx, rect.top, SRCCOPY); else BitBlt(hdc, rect.right-nsize.cx-size.cx, rect.top, size.cx, size.cy, hdb, rect.right-nsize.cx-size.cx, rect.top, SRCCOPY); } else { if (p->left) BitBlt(hdc, rect.left+nsize.cx, rect.bottom-p->th, size.cx, size.cy, hdb, rect.left+nsize.cx, rect.bottom-p->th, SRCCOPY); else BitBlt(hdc, rect.right-nsize.cx-size.cx, rect.bottom-p->th, size.cx, size.cy, hdb, rect.right-nsize.cx-size.cx, rect.bottom-p->th, SRCCOPY); } } } // free resources SelectObject(hdb, old); DeleteDC(hdb); ReleaseDC(p->hwnd, hdc); } void BaseWindow::setInfoText(const char *text) { if (strlen(text) == 0 && p->text.size() == 0) { return; } if (p->hwnd == 0) { p->text=text; return; } // get context for window and bitmap HDC hdc=GetDC(p->hwnd); HDC hdb=CreateCompatibleDC(NULL); HGDIOBJ old=SelectObject(hdb, static_cast<HGDIOBJ>(bp->bitmap)); // get inner size of window RECT rect; GetClientRect(p->hwnd, &rect); // clear completely BitBlt(hdc, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, hdb, rect.left, rect.top, SRCCOPY); // store text and draw p->text=text; drawInfoText(p->hwnd, hdc, p); // free resources SelectObject(hdb, old); DeleteDC(hdb); ReleaseDC(p->hwnd, hdc); } bool BaseWindow::hasInfoText() { return p->text.size() != 0; } void BaseWindow::clearBuffer() { memset(p->bpixel, 0, p->bytes_per_line*p->bh); } void BaseWindow::paintBuffer(const ImageAdapterBase &im, int x, int y) { const int w=std::min(static_cast<long>(p->bw), x+im.getWidth()); const int h=std::min(static_cast<long>(p->bh), y+im.getHeight()); for (int k=std::max(0, y); k<h; k++) { gimage::ImageU8 buffer(w, 1, 3); im.copyInto(buffer, -x , k-y); unsigned char *line=p->bpixel+(p->bh-k-1)*p->bytes_per_line+3*std::max(0, x); for (int i=std::max(0, x); i<w; i++) { *line++=buffer.get(i, 0, 2); *line++=buffer.get(i, 0, 1); *line++=buffer.get(i, 0, 0); } } } void BaseWindow::showBuffer() { if (p->hwnd != 0) { RedrawWindow(p->hwnd, 0, 0, RDW_INVALIDATE | RDW_UPDATENOW); // or RDW_ERASENOW? } } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <StartupConfig> <!-- use -align=top, -align=right, -align=left, -align=bottom to reorganize the tab location in a plugin container. Default is left align --> <Plugin pluginClass="ds.plugin.uber.UberPlugin" pluginName="Terminals" visible="true" align="left"> <InitArgs>-load=terminalStartup.xml</InitArgs> <InitArgs>-align=bottom</InitArgs> <InitArgs>-layout=wrap</InitArgs> <InitArgs>-logo=images/terminal.png</InitArgs> </Plugin> <Plugin pluginClass="ddb.dsz.plugin.notify.NotifyWindow" pluginName="Notify" visible="false" /> <Plugin pluginClass="ddb.dsz.plugin.monitor.MonitorWindow2" pluginName="Monitor" visible="false"> <InitArgs>-MonitorMaximumLines=20000</InitArgs> </Plugin> <Plugin pluginClass="ds.plugin.peer.PeerServer" pluginName="Server" align="right"> <InitArgs>-load=PeerLive.xml</InitArgs> <InitArgs>-layout=wrap</InitArgs> </Plugin> <Macro macroFile="SystemStartup.xml" align="right"/> </StartupConfig>
{ "pile_set_name": "Github" }
eBPF ------- [![](https://godoc.org/github.com/cilium/ebpf?status.svg)](https://godoc.org/github.com/cilium/ebpf) eBPF is a pure Go library that provides utilities for loading, compiling, and debugging eBPF programs. It has minimal external dependencies and is intended to be used in long running processes. [ebpf/asm](https://godoc.org/github.com/cilium/ebpf/asm) contains a basic assembler. The library is maintained by [Cloudflare](https://www.cloudflare.com) and [Cilium](https://www.cilium.io). Feel free to [join](https://cilium.herokuapp.com/) the [libbpf-go](https://cilium.slack.com/messages/libbpf-go) channel on Slack. ## Current status The package is production ready, but **the API is explicitly unstable right now**. Expect to update your code if you want to follow along. ## Requirements * A version of Go that is [supported by upstream](https://golang.org/doc/devel/release.html#policy) * Linux 4.9, 4.19 or 5.4 (versions in-between should work, but are not tested) ## Useful resources * [Cilium eBPF documentation](https://cilium.readthedocs.io/en/latest/bpf/#bpf-guide) (recommended) * [Linux documentation on BPF](http://elixir.free-electrons.com/linux/latest/source/Documentation/networking/filter.txt) * [eBPF features by Linux version](https://github.com/iovisor/bcc/blob/master/docs/kernel-versions.md)
{ "pile_set_name": "Github" }
# RUN: yaml-bench -canonical %s > folded line next line * bullet * list last line # Comment
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>SchemeUserState</key> <dict> <key>Cabbage.xcscheme</key> <dict> <key>orderHint</key> <integer>0</integer> </dict> <key>Cabbage.xcscheme_^#shared#^_</key> <dict> <key>orderHint</key> <integer>0</integer> </dict> </dict> <key>SuppressBuildableAutocreation</key> <dict> <key>5F464570210C713F0013ADC3</key> <dict> <key>primary</key> <true/> </dict> </dict> </dict> </plist>
{ "pile_set_name": "Github" }
<html> <body> <span>This inspection warns about known Javac issues, problems and incompatibilities.</span> </body> </html>
{ "pile_set_name": "Github" }
/* * vim: noexpandtab ts=8 sts=0 sw=8: * * configfs_example_macros.c - This file is a demonstration module * containing a number of configfs subsystems. It uses the helper * macros defined by configfs.h * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 021110-1307, USA. * * Based on sysfs: * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel * * configfs Copyright (C) 2005 Oracle. All rights reserved. */ #include <linux/init.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/configfs.h> /* * 01-childless * * This first example is a childless subsystem. It cannot create * any config_items. It just has attributes. * * Note that we are enclosing the configfs_subsystem inside a container. * This is not necessary if a subsystem has no attributes directly * on the subsystem. See the next example, 02-simple-children, for * such a subsystem. */ struct childless { struct configfs_subsystem subsys; int showme; int storeme; }; static inline struct childless *to_childless(struct config_item *item) { return item ? container_of(to_configfs_subsystem(to_config_group(item)), struct childless, subsys) : NULL; } static ssize_t childless_showme_show(struct config_item *item, char *page) { struct childless *childless = to_childless(item); ssize_t pos; pos = sprintf(page, "%d\n", childless->showme); childless->showme++; return pos; } static ssize_t childless_storeme_show(struct config_item *item, char *page) { return sprintf(page, "%d\n", to_childless(item)->storeme); } static ssize_t childless_storeme_store(struct config_item *item, const char *page, size_t count) { struct childless *childless = to_childless(item); unsigned long tmp; char *p = (char *) page; tmp = simple_strtoul(p, &p, 10); if (!p || (*p && (*p != '\n'))) return -EINVAL; if (tmp > INT_MAX) return -ERANGE; childless->storeme = tmp; return count; } static ssize_t childless_description_show(struct config_item *item, char *page) { return sprintf(page, "[01-childless]\n" "\n" "The childless subsystem is the simplest possible subsystem in\n" "configfs. It does not support the creation of child config_items.\n" "It only has a few attributes. In fact, it isn't much different\n" "than a directory in /proc.\n"); } CONFIGFS_ATTR_RO(childless_, showme); CONFIGFS_ATTR(childless_, storeme); CONFIGFS_ATTR_RO(childless_, description); static struct configfs_attribute *childless_attrs[] = { &childless_attr_showme, &childless_attr_storeme, &childless_attr_description, NULL, }; static struct config_item_type childless_type = { .ct_attrs = childless_attrs, .ct_owner = THIS_MODULE, }; static struct childless childless_subsys = { .subsys = { .su_group = { .cg_item = { .ci_namebuf = "01-childless", .ci_type = &childless_type, }, }, }, }; /* ----------------------------------------------------------------- */ /* * 02-simple-children * * This example merely has a simple one-attribute child. Note that * there is no extra attribute structure, as the child's attribute is * known from the get-go. Also, there is no container for the * subsystem, as it has no attributes of its own. */ struct simple_child { struct config_item item; int storeme; }; static inline struct simple_child *to_simple_child(struct config_item *item) { return item ? container_of(item, struct simple_child, item) : NULL; } static ssize_t simple_child_storeme_show(struct config_item *item, char *page) { return sprintf(page, "%d\n", to_simple_child(item)->storeme); } static ssize_t simple_child_storeme_store(struct config_item *item, const char *page, size_t count) { struct simple_child *simple_child = to_simple_child(item); unsigned long tmp; char *p = (char *) page; tmp = simple_strtoul(p, &p, 10); if (!p || (*p && (*p != '\n'))) return -EINVAL; if (tmp > INT_MAX) return -ERANGE; simple_child->storeme = tmp; return count; } CONFIGFS_ATTR(simple_child_, storeme); static struct configfs_attribute *simple_child_attrs[] = { &simple_child_attr_storeme, NULL, }; static void simple_child_release(struct config_item *item) { kfree(to_simple_child(item)); } static struct configfs_item_operations simple_child_item_ops = { .release = simple_child_release, }; static struct config_item_type simple_child_type = { .ct_item_ops = &simple_child_item_ops, .ct_attrs = simple_child_attrs, .ct_owner = THIS_MODULE, }; struct simple_children { struct config_group group; }; static inline struct simple_children *to_simple_children(struct config_item *item) { return item ? container_of(to_config_group(item), struct simple_children, group) : NULL; } static struct config_item *simple_children_make_item(struct config_group *group, const char *name) { struct simple_child *simple_child; simple_child = kzalloc(sizeof(struct simple_child), GFP_KERNEL); if (!simple_child) return ERR_PTR(-ENOMEM); config_item_init_type_name(&simple_child->item, name, &simple_child_type); simple_child->storeme = 0; return &simple_child->item; } static ssize_t simple_children_description_show(struct config_item *item, char *page) { return sprintf(page, "[02-simple-children]\n" "\n" "This subsystem allows the creation of child config_items. These\n" "items have only one attribute that is readable and writeable.\n"); } CONFIGFS_ATTR_RO(simple_children_, description); static struct configfs_attribute *simple_children_attrs[] = { &simple_children_attr_description, NULL, }; static void simple_children_release(struct config_item *item) { kfree(to_simple_children(item)); } static struct configfs_item_operations simple_children_item_ops = { .release = simple_children_release, }; /* * Note that, since no extra work is required on ->drop_item(), * no ->drop_item() is provided. */ static struct configfs_group_operations simple_children_group_ops = { .make_item = simple_children_make_item, }; static struct config_item_type simple_children_type = { .ct_item_ops = &simple_children_item_ops, .ct_group_ops = &simple_children_group_ops, .ct_attrs = simple_children_attrs, .ct_owner = THIS_MODULE, }; static struct configfs_subsystem simple_children_subsys = { .su_group = { .cg_item = { .ci_namebuf = "02-simple-children", .ci_type = &simple_children_type, }, }, }; /* ----------------------------------------------------------------- */ /* * 03-group-children * * This example reuses the simple_children group from above. However, * the simple_children group is not the subsystem itself, it is a * child of the subsystem. Creation of a group in the subsystem creates * a new simple_children group. That group can then have simple_child * children of its own. */ static struct config_group *group_children_make_group( struct config_group *group, const char *name) { struct simple_children *simple_children; simple_children = kzalloc(sizeof(struct simple_children), GFP_KERNEL); if (!simple_children) return ERR_PTR(-ENOMEM); config_group_init_type_name(&simple_children->group, name, &simple_children_type); return &simple_children->group; } static ssize_t group_children_description_show(struct config_item *item, char *page) { return sprintf(page, "[03-group-children]\n" "\n" "This subsystem allows the creation of child config_groups. These\n" "groups are like the subsystem simple-children.\n"); } CONFIGFS_ATTR_RO(group_children_, description); static struct configfs_attribute *group_children_attrs[] = { &group_children_attr_description, NULL, }; /* * Note that, since no extra work is required on ->drop_item(), * no ->drop_item() is provided. */ static struct configfs_group_operations group_children_group_ops = { .make_group = group_children_make_group, }; static struct config_item_type group_children_type = { .ct_group_ops = &group_children_group_ops, .ct_attrs = group_children_attrs, .ct_owner = THIS_MODULE, }; static struct configfs_subsystem group_children_subsys = { .su_group = { .cg_item = { .ci_namebuf = "03-group-children", .ci_type = &group_children_type, }, }, }; /* ----------------------------------------------------------------- */ /* * We're now done with our subsystem definitions. * For convenience in this module, here's a list of them all. It * allows the init function to easily register them. Most modules * will only have one subsystem, and will only call register_subsystem * on it directly. */ static struct configfs_subsystem *example_subsys[] = { &childless_subsys.subsys, &simple_children_subsys, &group_children_subsys, NULL, }; static int __init configfs_example_init(void) { int ret; int i; struct configfs_subsystem *subsys; for (i = 0; example_subsys[i]; i++) { subsys = example_subsys[i]; config_group_init(&subsys->su_group); mutex_init(&subsys->su_mutex); ret = configfs_register_subsystem(subsys); if (ret) { printk(KERN_ERR "Error %d while registering subsystem %s\n", ret, subsys->su_group.cg_item.ci_namebuf); goto out_unregister; } } return 0; out_unregister: for (i--; i >= 0; i--) configfs_unregister_subsystem(example_subsys[i]); return ret; } static void __exit configfs_example_exit(void) { int i; for (i = 0; example_subsys[i]; i++) configfs_unregister_subsystem(example_subsys[i]); } module_init(configfs_example_init); module_exit(configfs_example_exit); MODULE_LICENSE("GPL");
{ "pile_set_name": "Github" }
#include <Module/Module.h>
{ "pile_set_name": "Github" }
## Python prompt from explorer Originally published: 2004-08-30 01:29:03 Last updated: 2004-08-30 01:29:03 Author: Jason Whitlark If you use the command prompt here powertoy, you might find this useful. Right click on any folder and select Python Shell Here, and an that opens up in the directory you selected.
{ "pile_set_name": "Github" }